From: mistachkin Date: Fri, 15 Jul 2016 00:07:47 +0000 (+0000) Subject: Add tests, including some for the sqlite3_expanded_sql() API. X-Git-Tag: version-3.14.0~57^2~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e2f84b403c982d48ed4e9f49677ab40119c7db4b;p=thirdparty%2Fsqlite.git Add tests, including some for the sqlite3_expanded_sql() API. FossilOrigin-Name: 8b8c0b749a9a1daca49e7ea9351e253443bb1fc2 --- diff --git a/manifest b/manifest index ae6c2d0353..1075a137e4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C More\swork\son\sthe\sTcl\sinterface\sand\stests\sfor\sthe\ssqlite3_trace_v2()\sAPI. -D 2016-07-14T23:17:03.656 +C Add\stests,\sincluding\ssome\sfor\sthe\ssqlite3_expanded_sql()\sAPI. +D 2016-07-15T00:07:47.847 F Makefile.in 6c20d44f72d4564f11652b26291a214c8367e5db F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc d66d0395c38571aab3804f8db0fa20707ae4609a @@ -1285,7 +1285,7 @@ F test/tokenize.test ce430a7aed48fc98301611429595883fdfcab5d7 F test/tpch01.test 04adbf8d8300fa60a222f28d901abd76e7be6dd4 F test/trace.test 6f676313e3ebd2a50585036d2f212a3319dd5836 F test/trace2.test f5cb67ad3bc09e0c58e8cca78dfd0b5639259983 -F test/trace3.test bc598719949e59b8ba5152cc42fea75e99766478 +F test/trace3.test fb9242446aeef4f6e559edb126b3d67185b9a1c0 F test/trans.test 6e1b4c6a42dba31bd65f8fa5e61a2708e08ddde6 F test/trans2.test 62bd045bfc7a1c14c5ba83ba64d21ade31583f76 F test/trans3.test 91a100e5412b488e22a655fe423a14c26403ab94 @@ -1506,7 +1506,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 7b59fa40a01c89cc98414d90a798169c26e04256 -R f3e8ed411550909534d86cfeab7a6746 +P f3c4aa97d8c10fdb69efc6405b5fa45781f45a61 +R 433ed72af7d798e30b744dbac703a881 U mistachkin -Z 5840e23d72dcfac70e0e20acc9abb290 +Z c19e7bc180fcaf3fc05253b5c21f7fa0 diff --git a/manifest.uuid b/manifest.uuid index 0d1c4fc278..d877fc43c8 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f3c4aa97d8c10fdb69efc6405b5fa45781f45a61 \ No newline at end of file +8b8c0b749a9a1daca49e7ea9351e253443bb1fc2 \ No newline at end of file diff --git a/test/trace3.test b/test/trace3.test index b9977178ad..760fd33fe5 100644 --- a/test/trace3.test +++ b/test/trace3.test @@ -8,8 +8,9 @@ # May you share freely, never taking more than you give. # #*********************************************************************** -# This file implements regression tests for SQLite library. The focus -# of this test file is the "sqlite3_trace_v2()" API. +# This file implements regression tests for SQLite library. The focus of +# this test file is the "sqlite3_trace_v2()" and "sqlite3_expanded_sql()" +# APIs. # set testdir [file dirname $argv0] @@ -113,8 +114,67 @@ do_test trace3-6.1 { } set ::stmtlist(record) } "/^[string trim [string repeat {-?\d+ } 16]] \\\{-?\\d+ -?\\d+\\\}\$/" +do_test trace3-6.2 { + set ::stmtlist(record) {} + db trace_v2 trace_v2_record {statement profile row} + execsql { + SELECT a, b FROM t1 ORDER BY a; + } + set ::stmtlist(record) +} "/^\\\{-?\\d+ \\\{SELECT a, b FROM t1 ORDER BY a;\\\}\\\} [string trim \ +[string repeat {-?\d+ } 16]] \\\{-?\\d+ -?\\d+\\\}\$/" do_test trace3-7.1 { + set DB [sqlite3_connection_pointer db] + + set STMT [sqlite3_prepare_v2 $DB \ + "SELECT a, b FROM t1 WHERE b = ? ORDER BY a;" -1 TAIL] +} {/^[0-9A-F]+$/} + +do_test trace3-8.1 { + list [sqlite3_bind_null $STMT 1] [sqlite3_expanded_sql $STMT] +} {{} {SELECT a, b FROM t1 WHERE b = NULL ORDER BY a;}} +do_test trace3-8.2 { + list [sqlite3_bind_int $STMT 1 123] [sqlite3_expanded_sql $STMT] +} {{} {SELECT a, b FROM t1 WHERE b = 123 ORDER BY a;}} +do_test trace3-8.3 { + list [sqlite3_bind_int64 $STMT 1 123] [sqlite3_expanded_sql $STMT] +} {{} {SELECT a, b FROM t1 WHERE b = 123 ORDER BY a;}} +do_test trace3-8.4 { + list [sqlite3_bind_text $STMT 1 "some string" 11] \ + [sqlite3_expanded_sql $STMT] +} {{} {SELECT a, b FROM t1 WHERE b = 'some string' ORDER BY a;}} +do_test trace3-8.5 { + list [sqlite3_bind_text $STMT 1 "some 'bad' string" 17] \ + [sqlite3_expanded_sql $STMT] +} {{} {SELECT a, b FROM t1 WHERE b = 'some ''bad'' string' ORDER BY a;}} +do_test trace3-8.6 { + list [sqlite3_bind_double $STMT 1 123] [sqlite3_expanded_sql $STMT] +} {{} {SELECT a, b FROM t1 WHERE b = 123.0 ORDER BY a;}} +do_test trace3-8.7 { + list [sqlite3_bind_text16 $STMT 1 \ + [encoding convertto unicode hi\000yall\000] 16] \ + [sqlite3_expanded_sql $STMT] +} {{} {SELECT a, b FROM t1 WHERE b = 'hi' ORDER BY a;}} +do_test trace3-8.8 { + list [sqlite3_bind_blob $STMT 1 "\x12\x34\x56" 3] \ + [sqlite3_expanded_sql $STMT] +} {{} {SELECT a, b FROM t1 WHERE b = x'123456' ORDER BY a;}} + +do_test trace3-9.1 { + db trace_v2 "" + db trace_v2 +} {} +do_test trace3-9.2 { + unset -nocomplain ::stmtlist + db trace_v2 "" {statement profile row} + execsql { + SELECT a, b FROM t1 ORDER BY a; + } + array get ::stmtlist +} {} + +do_test trace3-10.1 { set ::stmtlist(record) {} db trace_v2 trace_v2_record close db close