From: drh Date: Sat, 2 Jul 2016 20:51:31 +0000 (+0000) Subject: Merge the alternative table-valued function RHS of IN operator implementation X-Git-Tag: version-3.14.0~83^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2519b2a3e537fb6a1827e2cb3b4358f6419ce13b;p=thirdparty%2Fsqlite.git Merge the alternative table-valued function RHS of IN operator implementation from trunk. FossilOrigin-Name: 507fdbfb54ce377f0d870260b07d71b797843fcf --- 2519b2a3e537fb6a1827e2cb3b4358f6419ce13b diff --cc manifest index 3973bf7b86,67ebe5290b..98382c2ade --- a/manifest +++ b/manifest @@@ -1,6 -1,6 +1,6 @@@ - C Add\sthe\sability\sto\shave\sa\stable-valued\sfunction\son\sthe\sRHS\sof\san\sIN\soperator. - D 2016-06-29T06:19:19.192 -C Fix\sa\sproblem\sin\stable-valued\sfunctions\son\sthe\sRHS\sof\san\sIN\soperator\sthat\noccurs\sfollowing\san\sOOM\serror. -D 2016-07-02T12:33:21.171 -F Makefile.in bc2b4864a23a4a21c3e26d7b4350f51bab324d45 ++C Merge\sthe\salternative\stable-valued\sfunction\sRHS\sof\sIN\soperator\simplementation\nfrom\strunk. ++D 2016-07-02T20:51:31.298 +F Makefile.in 541d493154ec3b0b20b2f1d495ec66f55905191e F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 50149765ef72f4e652b9a0f1f6462c4784bb9423 F README.md 8ecc12493ff9f820cdea6520a9016001cb2e59b7 @@@ -1115,7 -1115,7 +1116,7 @@@ F test/symlink.test c9ebe7330d228249e44 F test/sync.test 2f84bdbc2b2df1fcb0220575b4b9f8cea94b7529 F test/syscall.test f59ba4e25f7ba4a4c031026cc2ef8b6e4b4c639c F test/sysfault.test c9f2b0d8d677558f74de750c75e12a5454719d04 - F test/tabfunc01.test 32e620a19963c50dcf6958dc5bb352de96d948fb -F test/tabfunc01.test bb774639915aaaf30417f8d0faf832c3309a3338 ++F test/tabfunc01.test 96e56e22e5be82818d9673e9e993e9f26f80079a F test/table.test b708f3e5fa2542fa51dfab21fc07b36ea445cb2f F test/tableapi.test 2674633fa95d80da917571ebdd759a14d9819126 F test/tableopts.test dba698ba97251017b7c80d738c198d39ab747930 @@@ -1503,7 -1503,7 +1504,7 @@@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a9 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 - P 06e1fab7527c6b4330a58f8d8873afaf2d67ae86 - R a95030951795f74126be51a632f80a74 -P ac6000f050ff4efcf8a87f0825077dbf4144f073 -R 59b18bb8c847f9af40e3580110542be4 ++P ba1b441b6003808810667d749635fe6b2e8c6165 bead151e72215e6ca2a90eb049cfca414dccea04 ++R ab2f6bd04c16fa8193c86a3894a34997 U drh - Z 5d31abe2efd2f25b296efdbc945337ef -Z 7fb23bc853c489879c3871faac168f56 ++Z f71a4b07caffe5df9d8bd19d720e6958 diff --cc manifest.uuid index 6d65c9b627,b49dcbac4b..2e561b3053 --- a/manifest.uuid +++ b/manifest.uuid @@@ -1,1 -1,1 +1,1 @@@ - ba1b441b6003808810667d749635fe6b2e8c6165 -bead151e72215e6ca2a90eb049cfca414dccea04 ++507fdbfb54ce377f0d870260b07d71b797843fcf diff --cc test/tabfunc01.test index a0aae155bd,7d32f48387..044851705d --- a/test/tabfunc01.test +++ b/test/tabfunc01.test @@@ -136,64 -135,13 +136,73 @@@ do_execsql_test tabfunc01-500 ORDER BY +1; } {1 7 11 17} + # Table-valued functions on the RHS of an IN operator + # + do_execsql_test tabfunc01-600 { + CREATE TABLE t600(a INTEGER PRIMARY KEY, b TEXT); + WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<100) + INSERT INTO t600(a,b) SELECT x, printf('(%03d)',x) FROM c; + SELECT b FROM t600 WHERE a IN generate_series(2,52,10); + } {(002) (012) (022) (032) (042) (052)} + + +do_test tabfunc01-600 { + set TAIL {} + set VM [sqlite3_prepare db {SELECT * FROM intarray(?2,?3)} -1 TAIL] + set TAIL +} {} +do_test tabfunc01-610 { + sqlite3_bind_intarray $VM 2 11 22 33 44 55 + sqlite3_bind_int $VM 3 4 + sqlite3_step $VM +} SQLITE_ROW +do_test tabfunc01-620 { + sqlite3_column_int $VM 0 +} 11 +do_test tabfunc01-621 { + sqlite3_step $VM + sqlite3_column_int $VM 0 +} 22 +sqlite3_finalize $VM + +do_test tabfunc01-650 { + db eval { + DROP TABLE IF EXISTS t6; + CREATE TABLE t6(x INTEGER PRIMARY KEY, y BLOB); + WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<100) + INSERT INTO t6(x,y) SELECT x, randomblob(x) FROM c; + } + set TAIL {} + set VM [sqlite3_prepare db { + SELECT length(y) FROM t6 WHERE x IN (SELECT value FROM intarray(?1,3)); + } -1 TAIL] + string trim $TAIL +} {} +do_test tabfunc01-660 { + sqlite3_bind_intarray $VM 1 11 22 33 44 55 + sqlite3_step $VM +} SQLITE_ROW +do_test tabfunc01-661 { + sqlite3_column_int $VM 0 +} 11 +sqlite3_finalize $VM + +do_test tabfunc01-670 { + set TAIL {} + set VM [sqlite3_prepare db { + SELECT length(y) FROM t6 WHERE x IN intarray(?1,3); + } -1 TAIL] + string trim $TAIL +} {} +do_test tabfunc01-671 { + sqlite3_bind_intarray $VM 1 11 22 33 44 55 + sqlite3_step $VM +} SQLITE_ROW +do_test tabfunc01-672 { + sqlite3_column_int $VM 0 +} 11 +sqlite3_finalize $VM + +catch {sqlite3_bind_intarray} + finish_test