SQLite

Check-in [6ee12221fa]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add a new JSON test case to verify that all control characters are escaped in the json_quote() function.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 6ee12221fa252784c897a24ae8cff64dfe6149cbc9020abe14539df33202d892
User & Date: drh 2017-04-10 12:31:15.817
Context
2017-04-10
20:27
Slightly smaller and faster sqlite3VdbeMemGrow(). (check-in: efd1702ae8 user: drh tags: trunk)
12:31
Add a new JSON test case to verify that all control characters are escaped in the json_quote() function. (check-in: 6ee12221fa user: drh tags: trunk)
12:25
Change the JSON extension so that it disallows control characters inside of strings. Fix for ticket [6c9b5514077fed34551f98e64c09a10dc2fc8e16]. (check-in: 475d8f82ec user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/json102.test.
325
326
327
328
329
330
331







332
333
#
# The JSON spec requires that all control characters be escaped.
#
do_execsql_test json102-1500 {
  WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<0x20)
  SELECT x FROM c WHERE json_valid(printf('{"a":"x%sz"}', char(x))) ORDER BY x;
} {32}








finish_test







>
>
>
>
>
>
>


325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
#
# The JSON spec requires that all control characters be escaped.
#
do_execsql_test json102-1500 {
  WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<0x20)
  SELECT x FROM c WHERE json_valid(printf('{"a":"x%sz"}', char(x))) ORDER BY x;
} {32}

# All control characters are escaped
#
do_execsql_test json102-1501 {
  WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<0x1f)
  SELECT sum(json_valid(json_quote('a'||char(x)||'z'))) FROM c ORDER BY x;
} {31}

finish_test