Merge support for large files on Android from trunk.
FossilOrigin-Name: c2885c6bb24cc55178467e57e77bf71df58b3b13
This commit is contained in:
commit
a4a8a3c22e
122
manifest
122
manifest
@ -1,5 +1,5 @@
|
||||
C Merge\sthe\slatest\strunk\schanges,\sincluding\sthe\smulti-threaded\ssorter,\sinto\nthe\ssessions\sbranch.
|
||||
D 2014-09-02T15:49:47.703
|
||||
C Merge\ssupport\sfor\slarge\sfiles\son\sAndroid\sfrom\strunk.
|
||||
D 2014-09-08T15:04:24.810
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in dd5f245aa8c741bc65845747203c8ce2f3fb6c83
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@ -177,79 +177,79 @@ F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca
|
||||
F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
|
||||
F sqlite3.1 3d8b83c91651f53472ca17599dae3457b8b89494
|
||||
F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
|
||||
F src/alter.c b00900877f766f116f9e16116f1ccacdc21d82f1
|
||||
F src/analyze.c f00f06e6ef66c61b41f154889fe7caf5ed55a0ce
|
||||
F src/alter.c ba266a779bc7ce10e52e59e7d3dc79fa342e8fdb
|
||||
F src/analyze.c 79383a54fee3b7f1fb03dd4c8c8115583f506de5
|
||||
F src/attach.c 3801129015ef59d76bf23c95ef9b0069d18a0c52
|
||||
F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
|
||||
F src/backup.c a31809c65623cc41849b94d368917f8bb66e6a7e
|
||||
F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb
|
||||
F src/btmutex.c ec9d3f1295dafeb278c3830211cc5584132468f4
|
||||
F src/btree.c 2a483a8045118faa99867a8679da42754b532318
|
||||
F src/btmutex.c 49ca66250c7dfa844a4d4cb8272b87420d27d3a5
|
||||
F src/btree.c b1c1cd1cc3ae2e433a23b9a6c9ab53805707d8cd
|
||||
F src/btree.h a79aa6a71e7f1055f01052b7f821bd1c2dce95c8
|
||||
F src/btreeInt.h cf180d86b2e9e418f638d65baa425c4c69c0e0e3
|
||||
F src/build.c c26b233dcdb1e2c8f468d49236c266f9f3de96d8
|
||||
F src/callback.c b97d0695ffcf6a8710ee445ffe56ee387d4d8a6f
|
||||
F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac
|
||||
F src/btreeInt.h e0ecb5dba292722039a7540beb3fc448103273cc
|
||||
F src/build.c 8cb237719c185eec7bd8449b2e747491ded11932
|
||||
F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0
|
||||
F src/complete.c 535183afb3c75628b78ce82612931ac7cdf26f14
|
||||
F src/ctime.c 0231df905e2c4abba4483ee18ffc05adc321df2a
|
||||
F src/date.c 593c744b2623971e45affd0bde347631bdfa4625
|
||||
F src/delete.c cb7a757eb829ebb046c66f6399435c6636fe1314
|
||||
F src/expr.c e1691ab0fe6be7247ef073b0038fb8ecd9944fad
|
||||
F src/date.c 57a7f9ba9f6b4d5268f5e411739066a611f99036
|
||||
F src/delete.c de3d07d6602b90ae6e8bdebeb7b3265bb846377f
|
||||
F src/expr.c 441a7e24e2f7bea9475778fa8acce9e8a69ca8f0
|
||||
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
|
||||
F src/fkey.c 8d81a780ad78d16ec9082585758a8f1d6bf02ca3
|
||||
F src/func.c bbb724b74ed96ca42675a7274646a71dd52bcda7
|
||||
F src/global.c 1e4bd956dc2f608f87d2a929abc4a20db65f30e4
|
||||
F src/fkey.c da985ae673efef2c712caef825a5d2edb087ead7
|
||||
F src/func.c 0517037766e18eff7dce298e6b3a8e6311df75ec
|
||||
F src/global.c 5110fa12e09729b84eee0191c984ec4008e21937
|
||||
F src/hash.c 4263fbc955f26c2e8cdc0cf214bc42435aa4e4f5
|
||||
F src/hash.h c8f3c31722cf3277d03713909761e152a5b81094
|
||||
F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08
|
||||
F src/insert.c 3d41db1398a5863c4a1c064d2082d0dc43274628
|
||||
F src/insert.c 92e955206fadb4d1184161d00894b32c90879e86
|
||||
F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d
|
||||
F src/legacy.c 87c92f4a08e2f70220e3b22a9c3b2482d36a134a
|
||||
F src/lempar.c cdf0a000315332fc9b50b62f3b5e22e080a0952b
|
||||
F src/loadext.c 31c2122b7dd05a179049bbf163fd4839f181cbab
|
||||
F src/main.c 20a0c78f2b9f66766402d2a6563ffe047c64a8be
|
||||
F src/main.c faf3629e61ba31912b474316c02f173878ddd566
|
||||
F src/malloc.c 954de5f998c23237e04474a3f2159bf483bba65a
|
||||
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
|
||||
F src/mem1.c c0c990fcaddff810ea277b4fb5d9138603dd5d4b
|
||||
F src/mem1.c faf615aafd8be74a71494dfa027c113ea5c6615f
|
||||
F src/mem2.c dce31758da87ec2cfa52ba4c5df1aed6e07d8e8f
|
||||
F src/mem3.c 61c9d47b792908c532ca3a62b999cf21795c6534
|
||||
F src/mem5.c 74670012946c4adc8a6ad84d03acc80959c3e529
|
||||
F src/memjournal.c 0683aac6cab6ec2b5374c0db37c0deb2436a3785
|
||||
F src/mem5.c 61eeb90134f9a5be6c2e68d8daae7628b25953fb
|
||||
F src/memjournal.c 3eb2c0b51adbd869cb6a44780323f05fa904dc85
|
||||
F src/mutex.c 84a073c9a23a8d7bdd2ea832522d1730df18812c
|
||||
F src/mutex.h 5bc526e19dccc412b7ff04642f6fdad3fdfdabea
|
||||
F src/mutex.h 779d588e3b7756ec3ecf7d78cde1d84aba414f85
|
||||
F src/mutex_noop.c f3f09fd7a2eb4287cfc799753ffc30380e7b71a1
|
||||
F src/mutex_unix.c 1b10d5413dfc794364a8adf3eb3a192926b43fa3
|
||||
F src/mutex_w32.c 06bfff9a3a83b53389a51a967643db3967032e1e
|
||||
F src/notify.c 9711a7575036f0d3040ba61bc6e217f13a9888e7
|
||||
F src/os.c 1b147e4cf7cc39e618115c14a086aed44bc91ace
|
||||
F src/os.h 60d419395e32a8029fa380a80a3da2e9030f635e
|
||||
F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf
|
||||
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
|
||||
F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa
|
||||
F src/os_unix.c 8525ca79457c5b4673a5fda2774ee39fe155f40f
|
||||
F src/os_win.c 2aa8aa7780d7cf03e912d2088ab2ec5c32f33dc5
|
||||
F src/os_unix.c addd023b26c623fec4dedc110fc4370a65b4768c
|
||||
F src/os_win.c 0a4042ef35f322e86fa01f6c8884c5e645b911e7
|
||||
F src/os_win.h 09e751b20bbc107ffbd46e13555dc73576d88e21
|
||||
F src/pager.c 3e732d2bbdd8d8d95fed0c5ae7e718d73153c4c5
|
||||
F src/pager.c 31da9594ad4c3b5851bb6fe1a95c33835ab7ddce
|
||||
F src/pager.h ffd5607f7b3e4590b415b007a4382f693334d428
|
||||
F src/parse.y 22d6a074e5f5a7258947a1dc55a9bf946b765dd0
|
||||
F src/pcache.c 3b3791297e8977002e56b4a9b8916f2039abad9b
|
||||
F src/pcache.c 2048affdb09a04478b5fc6e64cb1083078d369be
|
||||
F src/pcache.h 9b559127b83f84ff76d735c8262f04853be0c59a
|
||||
F src/pcache1.c c5af6403a55178c9d1c09e4f77b0f9c88822762c
|
||||
F src/pcache1.c dab8ab930d4a73b99768d881185994f34b80ecaa
|
||||
F src/pragma.c 14bcdb504128a476cce5bbc086d5226c5e46c225
|
||||
F src/prepare.c 3842c1dfc0b053458e3adcf9f6efc48e03e3fe3d
|
||||
F src/printf.c 00986c86ddfffefc2fd3c73667ff51b3b9709c74
|
||||
F src/printf.c e74925089a85e3c9f0e315595f41c139d3d118c2
|
||||
F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece
|
||||
F src/resolve.c 0ea356d32a5e884add23d1b9b4e8736681dd5697
|
||||
F src/rowset.c a9c9aae3234b44a6d7c6f5a3cadf90dce1e627be
|
||||
F src/select.c 89e569b263535662f54b537eb9118b2c554ae7aa
|
||||
F src/resolve.c 0d1621e45fffe4b4396477cf46e41a84b0145ffb
|
||||
F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e
|
||||
F src/select.c b4457526cee73c0b69fad42f799f619b1d5a8a8a
|
||||
F src/shell.c ec6d5f630ed617dc80cbc35d9e45fe47f07923db
|
||||
F src/sqlite.h.in 49c501f66e0d6591ebe7588edddf0c4b06c8b9e9
|
||||
F src/sqlite.h.in 70de5c9e5ac117363db78d144c7e6f1f65d007a1
|
||||
F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad
|
||||
F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc
|
||||
F src/sqliteInt.h 465b40ebe68a1a4127e33740550ac53976172652
|
||||
F src/sqlite3ext.h 1f40357fb9b12a80c5a3b2b109fd249b009213d4
|
||||
F src/sqliteInt.h 4d6c5c87324c2b6218c01a0895c0d298fffb5aff
|
||||
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
|
||||
F src/status.c 7ac05a5c7017d0b9f0b4bcd701228b784f987158
|
||||
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
|
||||
F src/tclsqlite.c 30d8f4ba516061832cfe10d7c71d84e17bff1918
|
||||
F src/test1.c 363a5089230a92cf0aaa7a2945da7f2bf3b0a8d3
|
||||
F src/table.c 4e28a53e66bad8d014a510ef0205f5497c712b08
|
||||
F src/tclsqlite.c 9d0073dda76ab2508c8fde50950f4556fe2fdafb
|
||||
F src/test1.c 22bfe1ce9f2f3746d682093a475ec0a33e0e55d8
|
||||
F src/test2.c 98049e51a17dc62606a99a9eb95ee477f9996712
|
||||
F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c
|
||||
F src/test4.c 9b32d22f5f150abe23c1830e2057c4037c45b3df
|
||||
@ -269,11 +269,11 @@ F src/test_fs.c ced436e3d4b8e4681328409b8081051ce614e28f
|
||||
F src/test_func.c d3013ce36f19ac72a99c73864930fd1fa41832f8
|
||||
F src/test_hexio.c abfdecb6fa58c354623978efceb088ca18e379cd
|
||||
F src/test_init.c 66b33120ffe9cd853b5a905ec850d51151337b32
|
||||
F src/test_intarray.c db4614c2262a06abc4409dc048d59c580c38320f
|
||||
F src/test_intarray.c 6c610a21ab8edde85a3a2c7f2b069244ecf4d834
|
||||
F src/test_intarray.h 9dc57417fb65bc7835cc18548852cc08cc062202
|
||||
F src/test_journal.c f5c0a05b7b3d5930db769b5ee6c3766dc2221a64
|
||||
F src/test_loadext.c a5251f956ab6af21e138dc1f9c0399394a510cb4
|
||||
F src/test_malloc.c 5368fb1de77246da1ae0ff59cba0d30cb0e5812f
|
||||
F src/test_malloc.c ba34143f941a9d74b30bbffc8818389bb73a1ca2
|
||||
F src/test_multiplex.c ca90057438b63bf0840ebb84d0ef050624519a76
|
||||
F src/test_multiplex.h c08e4e8f8651f0c5e0509b138ff4d5b43ed1f5d3
|
||||
F src/test_mutex.c 293042d623ebba969160f471a82aa1551626454f
|
||||
@ -283,7 +283,7 @@ F src/test_pcache.c a5cd24730cb43c5b18629043314548c9169abb00
|
||||
F src/test_quota.c 65f6348fec0f2b3020c907247fb47556b214abb9
|
||||
F src/test_quota.h 2a8ad1952d1d2ca9af0ce0465e56e6c023b5e15d
|
||||
F src/test_rtree.c fdd8d29ca5165c7857987a2ba263fac5c69e231f
|
||||
F src/test_schema.c cd12a2223c3a394f4d07bb93bdf6d344c5c121b6
|
||||
F src/test_schema.c 2bdba21b82f601da69793e1f1d11bf481a79b091
|
||||
F src/test_server.c a2615049954cbb9cfb4a62e18e2f0616e4dc38fe
|
||||
F src/test_sqllog.c c1c1bbedbcaf82b93d83e4f9dd990e62476a680e
|
||||
F src/test_stat.c 9898687a6c2beca733b0dd6fe19163d987826d31
|
||||
@ -295,27 +295,27 @@ F src/test_vfs.c f84075a388527892ff184988f43b69ce69b8083c
|
||||
F src/test_vfstrace.c bab9594adc976cbe696ff3970728830b4c5ed698
|
||||
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
|
||||
F src/threads.c 22dded4283dc4b25422f6444cdcb8d6b1ea0b5ff
|
||||
F src/tokenize.c ae45399d6252b4d736af43bee1576ce7bff86aec
|
||||
F src/trigger.c 4bddd12803275aa98f1c7ce0118fceb02b2167f6
|
||||
F src/update.c b0f38fda25d532343d54b7dc49f55ab73e92ca45
|
||||
F src/tokenize.c 722872c816887fd66931333c59570ebd9622a95f
|
||||
F src/trigger.c 25571661fdeae8c7f975ff40ffec205520a3f92f
|
||||
F src/update.c b9e5295d3a78e96b7c2978c4f9d224d06880f031
|
||||
F src/utf.c 77abb5e6d27f3d236e50f7c8fff1d00e15262359
|
||||
F src/util.c 068dcd26354a3898ccc64ad5c4bdb95a7a15d33a
|
||||
F src/vacuum.c 3728d74919d4fb1356f9e9a13e27773db60b7179
|
||||
F src/vdbe.c 591bd4a84f1c37d004f545f8e805b7e597afc87f
|
||||
F src/util.c 4006c01772bd8d8ac4306d523bbcee41d3e392d8
|
||||
F src/vacuum.c 59f03f92bcff57faa6a8ca256eb29ccddfb0614a
|
||||
F src/vdbe.c 16b7d573a683e70a1e502332c5f90dd48fa34736
|
||||
F src/vdbe.h ca3b6df299adce6e2f499c57e42ae54f142ae823
|
||||
F src/vdbeInt.h 872d39f632bfd12897a6ab184ad4c1df5c38eb7a
|
||||
F src/vdbeapi.c 6b14e76648bbd10a95a2f3963ee09a8d06658f5e
|
||||
F src/vdbeaux.c 3118c164becbbf5a017d04826bbd93559ab9e190
|
||||
F src/vdbeInt.h 0dec00acd7e490a456a0ebaa6f478de94da7b52d
|
||||
F src/vdbeapi.c d63985095b5d24b522fc206c547df1683a4e73ee
|
||||
F src/vdbeaux.c 264284931ecd079076ab40a71522570107b8e723
|
||||
F src/vdbeblob.c d65b01f439df63911ac3d7a9a85c15503965f2c3
|
||||
F src/vdbemem.c 921d5468a68ac06f369810992e84ca22cc730a62
|
||||
F src/vdbesort.c 02646a9f86421776ae5d7594f620f9ed669d3698
|
||||
F src/vdbetrace.c 6f52bc0c51e144b7efdcfb2a8f771167a8816767
|
||||
F src/vdbemem.c dc36ea9fe26c25550c50085f388167086ef7d73a
|
||||
F src/vdbesort.c ab39574ec6e0c6213bd2a5c09cca9f9f8ba98450
|
||||
F src/vdbetrace.c 16d39c1ef7d1f4a3a7464bea3b7b4bdd7849c415
|
||||
F src/vtab.c 019dbfd0406a7447c990e1f7bd1dfcdb8895697f
|
||||
F src/wal.c 264df50a1b33124130b23180ded2e2c5663c652a
|
||||
F src/wal.c 10e7de7ce90865a68153f001a61f1d985cd17983
|
||||
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
|
||||
F src/walker.c 11edb74d587bc87b33ca96a5173e3ec1b8389e45
|
||||
F src/where.c d9eae96b2cbbe4842eac3ee156ccd1b933d802c4
|
||||
F src/whereInt.h 923820bee9726033a501a08d2fc69b9c1ee4feb3
|
||||
F src/walker.c c253b95b4ee44b21c406e2a1052636c31ea27804
|
||||
F src/where.c 839b5e1db2507e221ad1c308f148a8519ed750be
|
||||
F src/whereInt.h 124d970450955a6982e174b07c320ae6d62a595c
|
||||
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
||||
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
||||
F test/aggnested.test 45c0201e28045ad38a530b5a144b73cd4aa2cfd6
|
||||
@ -1142,7 +1142,7 @@ F test/whereF.test 5b2ba0dbe8074aa13e416b37c753991f0a2492d7
|
||||
F test/whereG.test 69f5ec4b15760a8c860f80e2d55525669390aab3
|
||||
F test/whereH.test e4b07f7a3c2f5d31195cd33710054c78667573b2
|
||||
F test/whereI.test 1d89199697919d4930be05a71e7fe620f114e622
|
||||
F test/whereJ.test 8880784c211c459595f734a35bcc5f2061fce987
|
||||
F test/whereJ.test 63599653dfefe4e74ebb358db753417fe0aa8a49
|
||||
F test/wherelimit.test 5e9fd41e79bb2b2d588ed999d641d9c965619b31
|
||||
F test/wild001.test bca33f499866f04c24510d74baf1e578d4e44b1c
|
||||
F test/win32heap.test ea19770974795cff26e11575e12d422dbd16893c
|
||||
@ -1210,7 +1210,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P 08ae974ac80fabe53f515bbbd93ccf55de8ee671 9779c7a9eb1e2bd36e9286331a9314f064014d80
|
||||
R 11d01aea9d4869c03771e6bed22886b5
|
||||
P d4cce2c71e64ab7b6a65a81b88b69445ed859351 ad7063aa1a0db32cdbe71815545b2edca57d3bcc
|
||||
R 4a5cc1720b7ac28a8c5dae667ce4d5c3
|
||||
U drh
|
||||
Z 5223b9b83d8a079e78fcc2500add2ce8
|
||||
Z 6dac05eb8bc8db62f0a6dc6a2d623660
|
||||
|
@ -1 +1 @@
|
||||
d4cce2c71e64ab7b6a65a81b88b69445ed859351
|
||||
c2885c6bb24cc55178467e57e77bf71df58b3b13
|
@ -174,8 +174,8 @@ static void renameTriggerFunc(
|
||||
UNUSED_PARAMETER(NotUsed);
|
||||
|
||||
/* The principle used to locate the table name in the CREATE TRIGGER
|
||||
** statement is that the table name is the first token that is immediatedly
|
||||
** preceded by either TK_ON or TK_DOT and immediatedly followed by one
|
||||
** statement is that the table name is the first token that is immediately
|
||||
** preceded by either TK_ON or TK_DOT and immediately followed by one
|
||||
** of TK_WHEN, TK_BEGIN or TK_FOR.
|
||||
*/
|
||||
if( zSql ){
|
||||
|
@ -35,7 +35,7 @@
|
||||
** not possible to enable both STAT3 and STAT4 at the same time. If they
|
||||
** are both enabled, then STAT4 takes precedence.
|
||||
**
|
||||
** For most applications, sqlite_stat1 provides all the statisics required
|
||||
** For most applications, sqlite_stat1 provides all the statistics required
|
||||
** for the query planner to make good choices.
|
||||
**
|
||||
** Format of sqlite_stat1:
|
||||
@ -387,7 +387,7 @@ static void stat4Destructor(void *pOld){
|
||||
** original WITHOUT ROWID table as N==K as a special case.
|
||||
**
|
||||
** This routine allocates the Stat4Accum object in heap memory. The return
|
||||
** value is a pointer to the the Stat4Accum object. The datatype of the
|
||||
** value is a pointer to the Stat4Accum object. The datatype of the
|
||||
** return value is BLOB, but it is really just a pointer to the Stat4Accum
|
||||
** object.
|
||||
*/
|
||||
@ -1583,7 +1583,7 @@ static void initAvgEq(Index *pIdx){
|
||||
/* Set nSum to the number of distinct (iCol+1) field prefixes that
|
||||
** occur in the stat4 table for this index before pFinal. Set
|
||||
** sumEq to the sum of the nEq values for column iCol for the same
|
||||
** set (adding the value only once where there exist dupicate
|
||||
** set (adding the value only once where there exist duplicate
|
||||
** prefixes). */
|
||||
for(i=0; i<(pIdx->nSample-1); i++){
|
||||
if( aSample[i].anDLt[iCol]!=aSample[i+1].anDLt[iCol] ){
|
||||
|
@ -106,7 +106,7 @@ static void SQLITE_NOINLINE btreeLockCarefully(Btree *p){
|
||||
Btree *pLater;
|
||||
|
||||
/* In most cases, we should be able to acquire the lock we
|
||||
** want without having to go throught the ascending lock
|
||||
** want without having to go through the ascending lock
|
||||
** procedure that follows. Just be sure not to block.
|
||||
*/
|
||||
if( sqlite3_mutex_try(p->pBt->mutex)==SQLITE_OK ){
|
||||
|
30
src/btree.c
30
src/btree.c
@ -9,7 +9,7 @@
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
*************************************************************************
|
||||
** This file implements a external (disk-based) database using BTrees.
|
||||
** This file implements an external (disk-based) database using BTrees.
|
||||
** See the header comment on "btreeInt.h" for additional information.
|
||||
** Including a description of file format and an overview of operation.
|
||||
*/
|
||||
@ -1144,7 +1144,7 @@ static void ptrmapPutOvflPtr(MemPage *pPage, u8 *pCell, int *pRC){
|
||||
*/
|
||||
static int defragmentPage(MemPage *pPage){
|
||||
int i; /* Loop counter */
|
||||
int pc; /* Address of a i-th cell */
|
||||
int pc; /* Address of the i-th cell */
|
||||
int hdr; /* Offset to the page header */
|
||||
int size; /* Size of a cell */
|
||||
int usableSize; /* Number of usable bytes on a page */
|
||||
@ -2601,7 +2601,7 @@ page1_init_failed:
|
||||
** false then all cursors are counted.
|
||||
**
|
||||
** For the purposes of this routine, a cursor is any cursor that
|
||||
** is capable of reading or writing to the databse. Cursors that
|
||||
** is capable of reading or writing to the database. Cursors that
|
||||
** have been tripped into the CURSOR_FAULT state are not counted.
|
||||
*/
|
||||
static int countValidCursors(BtShared *pBt, int wrOnly){
|
||||
@ -3065,7 +3065,7 @@ static int allocateBtreePage(BtShared *, MemPage **, Pgno *, Pgno, u8);
|
||||
** calling this function again), return SQLITE_DONE. Or, if an error
|
||||
** occurs, return some other error code.
|
||||
**
|
||||
** More specificly, this function attempts to re-organize the database so
|
||||
** More specifically, this function attempts to re-organize the database so
|
||||
** that the last page of the file currently in use is no longer in use.
|
||||
**
|
||||
** Parameter nFin is the number of pages that this database would contain
|
||||
@ -3073,7 +3073,7 @@ static int allocateBtreePage(BtShared *, MemPage **, Pgno *, Pgno, u8);
|
||||
**
|
||||
** If the bCommit parameter is non-zero, this function assumes that the
|
||||
** caller will keep calling incrVacuumStep() until it returns SQLITE_DONE
|
||||
** or an error. bCommit is passed true for an auto-vacuum-on-commmit
|
||||
** or an error. bCommit is passed true for an auto-vacuum-on-commit
|
||||
** operation, or false for an incremental vacuum.
|
||||
*/
|
||||
static int incrVacuumStep(BtShared *pBt, Pgno nFin, Pgno iLastPg, int bCommit){
|
||||
@ -3540,7 +3540,7 @@ int sqlite3BtreeRollback(Btree *p, int tripCode){
|
||||
}
|
||||
|
||||
/*
|
||||
** Start a statement subtransaction. The subtransaction can can be rolled
|
||||
** Start a statement subtransaction. The subtransaction can be rolled
|
||||
** back independently of the main transaction. You must start a transaction
|
||||
** before starting a subtransaction. The subtransaction is ended automatically
|
||||
** if the main transaction commits or rolls back.
|
||||
@ -3774,7 +3774,7 @@ int sqlite3BtreeCloseCursor(BtCursor *pCur){
|
||||
** compiler to crash when getCellInfo() is implemented as a macro.
|
||||
** But there is a measureable speed advantage to using the macro on gcc
|
||||
** (when less compiler optimizations like -Os or -O0 are used and the
|
||||
** compiler is not doing agressive inlining.) So we use a real function
|
||||
** compiler is not doing aggressive inlining.) So we use a real function
|
||||
** for MSVC and a macro for everything else. Ticket #2457.
|
||||
*/
|
||||
#ifndef NDEBUG
|
||||
@ -3991,7 +3991,7 @@ static int copyPayload(
|
||||
**
|
||||
** If the current cursor entry uses one or more overflow pages and the
|
||||
** eOp argument is not 2, this function may allocate space for and lazily
|
||||
** popluates the overflow page-list cache array (BtCursor.aOverflow).
|
||||
** populates the overflow page-list cache array (BtCursor.aOverflow).
|
||||
** Subsequent calls use this cache to make seeking to the supplied offset
|
||||
** more efficient.
|
||||
**
|
||||
@ -4193,7 +4193,7 @@ static int accessPayload(
|
||||
|
||||
/*
|
||||
** Read part of the key associated with cursor pCur. Exactly
|
||||
** "amt" bytes will be transfered into pBuf[]. The transfer
|
||||
** "amt" bytes will be transferred into pBuf[]. The transfer
|
||||
** begins at "offset".
|
||||
**
|
||||
** The caller must ensure that pCur is pointing to a valid row
|
||||
@ -5889,7 +5889,7 @@ static void insertCell(
|
||||
** The cells are guaranteed to fit on the page.
|
||||
*/
|
||||
static void assemblePage(
|
||||
MemPage *pPage, /* The page to be assemblied */
|
||||
MemPage *pPage, /* The page to be assembled */
|
||||
int nCell, /* The number of cells to add to this page */
|
||||
u8 **apCell, /* Pointers to cell bodies */
|
||||
u16 *aSize /* Sizes of the cells */
|
||||
@ -6555,7 +6555,7 @@ static int balance_nonroot(
|
||||
}
|
||||
|
||||
/*
|
||||
** Put the new pages in accending order. This helps to
|
||||
** Put the new pages in ascending order. This helps to
|
||||
** keep entries in the disk file in order so that a scan
|
||||
** of the table is a linear scan through the file. That
|
||||
** in turn helps the operating system to deliver pages
|
||||
@ -6950,7 +6950,7 @@ static int balance(BtCursor *pCur){
|
||||
/* Call balance_quick() to create a new sibling of pPage on which
|
||||
** to store the overflow cell. balance_quick() inserts a new cell
|
||||
** into pParent, which may cause pParent overflow. If this
|
||||
** happens, the next interation of the do-loop will balance pParent
|
||||
** happens, the next iteration of the do-loop will balance pParent
|
||||
** use either balance_nonroot() or balance_deeper(). Until this
|
||||
** happens, the overflow cell is stored in the aBalanceQuickSpace[]
|
||||
** buffer.
|
||||
@ -7027,7 +7027,7 @@ static int balance(BtCursor *pCur){
|
||||
** MovetoUnpacked() to seek cursor pCur to (pKey, nKey) has already
|
||||
** been performed. seekResult is the search result returned (a negative
|
||||
** number if pCur points at an entry that is smaller than (pKey, nKey), or
|
||||
** a positive value if pCur points at an etry that is larger than
|
||||
** a positive value if pCur points at an entry that is larger than
|
||||
** (pKey, nKey)).
|
||||
**
|
||||
** If the seekResult parameter is non-zero, then the caller guarantees that
|
||||
@ -7184,7 +7184,7 @@ end_insert:
|
||||
|
||||
/*
|
||||
** Delete the entry that the cursor is pointing to. The cursor
|
||||
** is left pointing at a arbitrary location.
|
||||
** is left pointing at an arbitrary location.
|
||||
*/
|
||||
int sqlite3BtreeDelete(BtCursor *pCur){
|
||||
Btree *p = pCur->pBtree;
|
||||
@ -7882,7 +7882,7 @@ static void setPageReferenced(IntegrityCk *pCheck, Pgno iPg){
|
||||
/*
|
||||
** Add 1 to the reference count for page iPage. If this is the second
|
||||
** reference to the page, add an error message to pCheck->zErrMsg.
|
||||
** Return 1 if there are 2 ore more references to the page and 0 if
|
||||
** Return 1 if there are 2 or more references to the page and 0 if
|
||||
** if this is the first reference to the page.
|
||||
**
|
||||
** Also check that the page number is in bounds.
|
||||
|
@ -9,7 +9,7 @@
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
*************************************************************************
|
||||
** This file implements a external (disk-based) database using BTrees.
|
||||
** This file implements an external (disk-based) database using BTrees.
|
||||
** For a detailed discussion of BTrees, refer to
|
||||
**
|
||||
** Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
|
||||
@ -135,7 +135,7 @@
|
||||
**
|
||||
** The flags define the format of this btree page. The leaf flag means that
|
||||
** this page has no children. The zerodata flag means that this page carries
|
||||
** only keys and no data. The intkey flag means that the key is a integer
|
||||
** only keys and no data. The intkey flag means that the key is an integer
|
||||
** which is stored in the key size entry of the cell header rather than in
|
||||
** the payload area.
|
||||
**
|
||||
@ -544,7 +544,7 @@ struct BtCursor {
|
||||
** seek the cursor to the saved position.
|
||||
**
|
||||
** CURSOR_FAULT:
|
||||
** A unrecoverable error (an I/O error or a malloc failure) has occurred
|
||||
** An unrecoverable error (an I/O error or a malloc failure) has occurred
|
||||
** on a different connection that shares the BtShared cache with this
|
||||
** cursor. The error has left the cache in an inconsistent state.
|
||||
** Do nothing else with this cursor. Any attempt to use the cursor
|
||||
|
10
src/build.c
10
src/build.c
@ -1619,7 +1619,7 @@ static int hasColumn(const i16 *aiCol, int nCol, int x){
|
||||
** no rowid btree for a WITHOUT ROWID. Instead, the canonical
|
||||
** data storage is a covering index btree.
|
||||
** (2) Bypass the creation of the sqlite_master table entry
|
||||
** for the PRIMARY KEY as the the primary key index is now
|
||||
** for the PRIMARY KEY as the primary key index is now
|
||||
** identified by the sqlite_master table entry of the table itself.
|
||||
** (3) Set the Index.tnum of the PRIMARY KEY Index object in the
|
||||
** schema to the rootpage from the main table.
|
||||
@ -1640,7 +1640,7 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){
|
||||
Vdbe *v = pParse->pVdbe;
|
||||
|
||||
/* Convert the OP_CreateTable opcode that would normally create the
|
||||
** root-page for the table into a OP_CreateIndex opcode. The index
|
||||
** root-page for the table into an OP_CreateIndex opcode. The index
|
||||
** created will become the PRIMARY KEY index.
|
||||
*/
|
||||
if( pParse->addrCrTab ){
|
||||
@ -2654,7 +2654,7 @@ static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){
|
||||
int iPartIdxLabel; /* Jump to this label to skip a row */
|
||||
Vdbe *v; /* Generate code into this virtual machine */
|
||||
KeyInfo *pKey; /* KeyInfo for index */
|
||||
int regRecord; /* Register holding assemblied index record */
|
||||
int regRecord; /* Register holding assembled index record */
|
||||
sqlite3 *db = pParse->db; /* The database connection */
|
||||
int iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);
|
||||
|
||||
@ -3254,7 +3254,7 @@ exit_create_index:
|
||||
** Fill the Index.aiRowEst[] array with default information - information
|
||||
** to be used when we have not run the ANALYZE command.
|
||||
**
|
||||
** aiRowEst[0] is suppose to contain the number of elements in the index.
|
||||
** aiRowEst[0] is supposed to contain the number of elements in the index.
|
||||
** Since we do not know, guess 1 million. aiRowEst[1] is an estimate of the
|
||||
** number of rows in the table that match any particular value of the
|
||||
** first column of the index. aiRowEst[2] is an estimate of the number
|
||||
@ -3633,7 +3633,7 @@ void sqlite3SrcListDelete(sqlite3 *db, SrcList *pList){
|
||||
** if this is the first term of the FROM clause. pTable and pDatabase
|
||||
** are the name of the table and database named in the FROM clause term.
|
||||
** pDatabase is NULL if the database name qualifier is missing - the
|
||||
** usual case. If the term has a alias, then pAlias points to the
|
||||
** usual case. If the term has an alias, then pAlias points to the
|
||||
** alias token. If the term is a subquery, then pSubquery is the
|
||||
** SELECT statement that the subquery encodes. The pTable and
|
||||
** pDatabase parameters are NULL for subqueries. The pOn and pUsing
|
||||
|
@ -142,7 +142,7 @@ int sqlite3CheckCollSeq(Parse *pParse, CollSeq *pColl){
|
||||
**
|
||||
** Each pointer stored in the sqlite3.aCollSeq hash table contains an
|
||||
** array of three CollSeq structures. The first is the collation sequence
|
||||
** prefferred for UTF-8, the second UTF-16le, and the third UTF-16be.
|
||||
** preferred for UTF-8, the second UTF-16le, and the third UTF-16be.
|
||||
**
|
||||
** Stored immediately after the three collation sequences is a copy of
|
||||
** the collation sequence name. A pointer to this string is stored in
|
||||
|
@ -70,7 +70,7 @@ extern const char sqlite3IsEbcdicIdChar[];
|
||||
** a statement.
|
||||
**
|
||||
** (4) CREATE The keyword CREATE has been seen at the beginning of a
|
||||
** statement, possibly preceeded by EXPLAIN and/or followed by
|
||||
** statement, possibly preceded by EXPLAIN and/or followed by
|
||||
** TEMP or TEMPORARY
|
||||
**
|
||||
** (5) TRIGGER We are in the middle of a trigger definition that must be
|
||||
@ -80,7 +80,7 @@ extern const char sqlite3IsEbcdicIdChar[];
|
||||
** the end of a trigger definition.
|
||||
**
|
||||
** (7) END We've seen the ";END" of the ";END;" that occurs at the end
|
||||
** of a trigger difinition.
|
||||
** of a trigger definition.
|
||||
**
|
||||
** Transitions between states above are determined by tokens extracted
|
||||
** from the input. The following tokens are significant:
|
||||
@ -123,7 +123,7 @@ int sqlite3_complete(const char *zSql){
|
||||
};
|
||||
#else
|
||||
/* If triggers are not supported by this compile then the statement machine
|
||||
** used to detect the end of a statement is much simplier
|
||||
** used to detect the end of a statement is much simpler
|
||||
*/
|
||||
static const u8 trans[3][3] = {
|
||||
/* Token: */
|
||||
|
@ -24,7 +24,7 @@
|
||||
** 1970-01-01 00:00:00 is JD 2440587.5
|
||||
** 2000-01-01 00:00:00 is JD 2451544.5
|
||||
**
|
||||
** This implemention requires years to be expressed as a 4-digit number
|
||||
** This implementation requires years to be expressed as a 4-digit number
|
||||
** which means that only dates between 0000-01-01 and 9999-12-31 can
|
||||
** be represented, even though julian day numbers allow a much wider
|
||||
** range of dates.
|
||||
|
10
src/delete.c
10
src/delete.c
@ -90,7 +90,7 @@ void sqlite3MaterializeView(
|
||||
Parse *pParse, /* Parsing context */
|
||||
Table *pView, /* View definition */
|
||||
Expr *pWhere, /* Optional WHERE clause to be added */
|
||||
int iCur /* Cursor number for ephemerial table */
|
||||
int iCur /* Cursor number for ephemeral table */
|
||||
){
|
||||
SelectDest dest;
|
||||
Select *pSel;
|
||||
@ -248,7 +248,7 @@ void sqlite3DeleteFrom(
|
||||
int addrBypass = 0; /* Address of jump over the delete logic */
|
||||
int addrLoop = 0; /* Top of the delete loop */
|
||||
int addrDelete = 0; /* Jump directly to the delete logic */
|
||||
int addrEphOpen = 0; /* Instruction to open the Ephermeral table */
|
||||
int addrEphOpen = 0; /* Instruction to open the Ephemeral table */
|
||||
|
||||
#ifndef SQLITE_OMIT_TRIGGER
|
||||
int isView; /* True if attempting to delete from a view */
|
||||
@ -328,7 +328,7 @@ void sqlite3DeleteFrom(
|
||||
sqlite3BeginWriteOperation(pParse, 1, iDb);
|
||||
|
||||
/* If we are trying to delete from a view, realize that view into
|
||||
** a ephemeral table.
|
||||
** an ephemeral table.
|
||||
*/
|
||||
#if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER)
|
||||
if( isView ){
|
||||
@ -389,7 +389,7 @@ void sqlite3DeleteFrom(
|
||||
iRowSet = ++pParse->nMem;
|
||||
sqlite3VdbeAddOp2(v, OP_Null, 0, iRowSet);
|
||||
}else{
|
||||
/* For a WITHOUT ROWID table, create an ephermeral table used to
|
||||
/* For a WITHOUT ROWID table, create an ephemeral table used to
|
||||
** hold all primary keys for rows to be deleted. */
|
||||
pPk = sqlite3PrimaryKeyIndex(pTab);
|
||||
assert( pPk!=0 );
|
||||
@ -564,7 +564,7 @@ delete_from_cleanup:
|
||||
return;
|
||||
}
|
||||
/* Make sure "isView" and other macros defined above are undefined. Otherwise
|
||||
** thely may interfere with compilation of other functions in this file
|
||||
** they may interfere with compilation of other functions in this file
|
||||
** (or in another file, if this file becomes part of the amalgamation). */
|
||||
#ifdef isView
|
||||
#undef isView
|
||||
|
22
src/expr.c
22
src/expr.c
@ -22,7 +22,7 @@
|
||||
** affinity of that column is returned. Otherwise, 0x00 is returned,
|
||||
** indicating no affinity for the expression.
|
||||
**
|
||||
** i.e. the WHERE clause expresssions in the following statements all
|
||||
** i.e. the WHERE clause expressions in the following statements all
|
||||
** have an affinity:
|
||||
**
|
||||
** CREATE TABLE t1(a);
|
||||
@ -501,7 +501,7 @@ void sqlite3ExprAttachSubtrees(
|
||||
}
|
||||
|
||||
/*
|
||||
** Allocate a Expr node which joins as many as two subtrees.
|
||||
** Allocate an Expr node which joins as many as two subtrees.
|
||||
**
|
||||
** One or both of the subtrees can be NULL. Return a pointer to the new
|
||||
** Expr node. Or, if an OOM error occurs, set pParse->db->mallocFailed,
|
||||
@ -611,7 +611,7 @@ Expr *sqlite3ExprFunction(Parse *pParse, ExprList *pList, Token *pToken){
|
||||
**
|
||||
** Wildcards of the form ":aaa", "@aaa", or "$aaa" are assigned the same number
|
||||
** as the previous instance of the same wildcard. Or if this is the first
|
||||
** instance of the wildcard, the next sequenial variable number is
|
||||
** instance of the wildcard, the next sequential variable number is
|
||||
** assigned.
|
||||
*/
|
||||
void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr){
|
||||
@ -746,7 +746,7 @@ static int exprStructSize(Expr *p){
|
||||
** During expression analysis, extra information is computed and moved into
|
||||
** later parts of teh Expr object and that extra information might get chopped
|
||||
** off if the expression is reduced. Note also that it does not work to
|
||||
** make a EXPRDUP_REDUCE copy of a reduced expression. It is only legal
|
||||
** make an EXPRDUP_REDUCE copy of a reduced expression. It is only legal
|
||||
** to reduce a pristine expression tree from the parser. The implementation
|
||||
** of dupedExprStructSize() contain multiple assert() statements that attempt
|
||||
** to enforce this constraint.
|
||||
@ -815,7 +815,7 @@ static int dupedExprSize(Expr *p, int flags){
|
||||
** is not NULL then *pzBuffer is assumed to point to a buffer large enough
|
||||
** to store the copy of expression p, the copies of p->u.zToken
|
||||
** (if applicable), and the copies of the p->pLeft and p->pRight expressions,
|
||||
** if any. Before returning, *pzBuffer is set to the first byte passed the
|
||||
** if any. Before returning, *pzBuffer is set to the first byte past the
|
||||
** portion of the buffer copied into by this function.
|
||||
*/
|
||||
static Expr *exprDup(sqlite3 *db, Expr *p, int flags, u8 **pzBuffer){
|
||||
@ -1541,7 +1541,7 @@ static int sqlite3InRhsIsConstant(Expr *pIn){
|
||||
**
|
||||
** If the RHS of the IN operator is a list or a more complex subquery, then
|
||||
** an ephemeral table might need to be generated from the RHS and then
|
||||
** pX->iTable made to point to the ephermeral table instead of an
|
||||
** pX->iTable made to point to the ephemeral table instead of an
|
||||
** existing table.
|
||||
**
|
||||
** The inFlags parameter must contain exactly one of the bits
|
||||
@ -1671,7 +1671,7 @@ int sqlite3FindInIndex(Parse *pParse, Expr *pX, u32 inFlags, int *prRhsHasNull){
|
||||
** and IN_INDEX_NOOP is an allowed reply
|
||||
** and the RHS of the IN operator is a list, not a subquery
|
||||
** and the RHS is not contant or has two or fewer terms,
|
||||
** then it is not worth creating an ephermeral table to evaluate
|
||||
** then it is not worth creating an ephemeral table to evaluate
|
||||
** the IN operator so return IN_INDEX_NOOP.
|
||||
*/
|
||||
if( eType==0
|
||||
@ -2758,7 +2758,7 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){
|
||||
}
|
||||
|
||||
/* Attempt a direct implementation of the built-in COALESCE() and
|
||||
** IFNULL() functions. This avoids unnecessary evalation of
|
||||
** IFNULL() functions. This avoids unnecessary evaluation of
|
||||
** arguments past the first non-NULL argument.
|
||||
*/
|
||||
if( pDef->funcFlags & SQLITE_FUNC_COALESCE ){
|
||||
@ -3197,7 +3197,7 @@ void sqlite3ExprCodeFactorable(Parse *pParse, Expr *pExpr, int target){
|
||||
}
|
||||
|
||||
/*
|
||||
** Generate code that evalutes the given expression and puts the result
|
||||
** Generate code that evaluates the given expression and puts the result
|
||||
** in register target.
|
||||
**
|
||||
** Also make a copy of the expression results into another "cache" register
|
||||
@ -3552,7 +3552,7 @@ int sqlite3ExprCodeExprList(
|
||||
** x>=y AND x<=z
|
||||
**
|
||||
** Code it as such, taking care to do the common subexpression
|
||||
** elementation of x.
|
||||
** elimination of x.
|
||||
*/
|
||||
static void exprCodeBetween(
|
||||
Parse *pParse, /* Parsing and code generating context */
|
||||
@ -4289,7 +4289,7 @@ int sqlite3GetTempReg(Parse *pParse){
|
||||
** purpose.
|
||||
**
|
||||
** If a register is currently being used by the column cache, then
|
||||
** the dallocation is deferred until the column cache line that uses
|
||||
** the deallocation is deferred until the column cache line that uses
|
||||
** the register becomes stale.
|
||||
*/
|
||||
void sqlite3ReleaseTempReg(Parse *pParse, int iReg){
|
||||
|
@ -173,7 +173,7 @@
|
||||
**
|
||||
** 4) No parent key columns were provided explicitly as part of the
|
||||
** foreign key definition, and the PRIMARY KEY of the parent table
|
||||
** consists of a a different number of columns to the child key in
|
||||
** consists of a different number of columns to the child key in
|
||||
** the child table.
|
||||
**
|
||||
** then non-zero is returned, and a "foreign key mismatch" error loaded
|
||||
|
@ -9,7 +9,7 @@
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
*************************************************************************
|
||||
** This file contains the C-language implementions for many of the SQL
|
||||
** This file contains the C-language implementations for many of the SQL
|
||||
** functions of SQLite. (Some function, and in particular the date and
|
||||
** time functions, are implemented separately.)
|
||||
*/
|
||||
@ -1638,7 +1638,7 @@ int sqlite3IsLikeFunction(sqlite3 *db, Expr *pExpr, int *pIsNocase, char *aWc){
|
||||
}
|
||||
|
||||
/*
|
||||
** All all of the FuncDef structures in the aBuiltinFunc[] array above
|
||||
** All of the FuncDef structures in the aBuiltinFunc[] array above
|
||||
** to the global function hash table. This occurs at start-time (as
|
||||
** a consequence of calling sqlite3_initialize()).
|
||||
**
|
||||
|
@ -10,7 +10,7 @@
|
||||
**
|
||||
*************************************************************************
|
||||
**
|
||||
** This file contains definitions of global variables and contants.
|
||||
** This file contains definitions of global variables and constants.
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
|
14
src/insert.c
14
src/insert.c
@ -410,7 +410,7 @@ static int xferOptimization(
|
||||
** The 4th template is used if the insert statement takes its
|
||||
** values from a SELECT but the data is being inserted into a table
|
||||
** that is also read as part of the SELECT. In the third form,
|
||||
** we have to use a intermediate table to store the results of
|
||||
** we have to use an intermediate table to store the results of
|
||||
** the select. The template is like this:
|
||||
**
|
||||
** X <- A
|
||||
@ -575,7 +575,7 @@ void sqlite3Insert(
|
||||
regAutoinc = autoIncBegin(pParse, iDb, pTab);
|
||||
|
||||
/* Allocate registers for holding the rowid of the new row,
|
||||
** the content of the new row, and the assemblied row record.
|
||||
** the content of the new row, and the assembled row record.
|
||||
*/
|
||||
regRowid = regIns = pParse->nMem+1;
|
||||
pParse->nMem += pTab->nCol + 1;
|
||||
@ -1027,7 +1027,7 @@ insert_cleanup:
|
||||
}
|
||||
|
||||
/* Make sure "isView" and other macros defined above are undefined. Otherwise
|
||||
** thely may interfere with compilation of other functions in this file
|
||||
** they may interfere with compilation of other functions in this file
|
||||
** (or in another file, if this file becomes part of the amalgamation). */
|
||||
#ifdef isView
|
||||
#undef isView
|
||||
@ -1143,7 +1143,7 @@ void sqlite3GenerateConstraintChecks(
|
||||
int ix; /* Index loop counter */
|
||||
int nCol; /* Number of columns */
|
||||
int onError; /* Conflict resolution strategy */
|
||||
int j1; /* Addresss of jump instruction */
|
||||
int j1; /* Address of jump instruction */
|
||||
int seenReplace = 0; /* True if REPLACE is used to resolve INT PK conflict */
|
||||
int nPkField; /* Number of fields in PRIMARY KEY. 1 for ROWID tables */
|
||||
int ipkTop = 0; /* Top of the rowid change constraint check */
|
||||
@ -1559,7 +1559,7 @@ void sqlite3CompleteInsertion(
|
||||
Index *pIdx; /* An index being inserted or updated */
|
||||
u8 pik_flags; /* flag values passed to the btree insert */
|
||||
int regData; /* Content registers (after the rowid) */
|
||||
int regRec; /* Register holding assemblied record for the table */
|
||||
int regRec; /* Register holding assembled record for the table */
|
||||
int i; /* Loop counter */
|
||||
u8 bAffinityDone = 0; /* True if OP_Affinity has been run already */
|
||||
|
||||
@ -1684,7 +1684,7 @@ int sqlite3OpenTableAndIndices(
|
||||
** The following global variable is incremented whenever the
|
||||
** transfer optimization is used. This is used for testing
|
||||
** purposes only - to make sure the transfer optimization really
|
||||
** is happening when it is suppose to.
|
||||
** is happening when it is supposed to.
|
||||
*/
|
||||
int sqlite3_xferopt_count;
|
||||
#endif /* SQLITE_TEST */
|
||||
@ -1751,7 +1751,7 @@ static int xferCompatibleIndex(Index *pDest, Index *pSrc){
|
||||
** INSERT INTO tab1 SELECT * FROM tab2;
|
||||
**
|
||||
** The xfer optimization transfers raw records from tab2 over to tab1.
|
||||
** Columns are not decoded and reassemblied, which greatly improves
|
||||
** Columns are not decoded and reassembled, which greatly improves
|
||||
** performance. Raw index records are transferred in the same way.
|
||||
**
|
||||
** The xfer optimization is only attempted if tab1 and tab2 are compatible.
|
||||
|
@ -2874,9 +2874,9 @@ int sqlite3_get_autocommit(sqlite3 *db){
|
||||
}
|
||||
|
||||
/*
|
||||
** The following routines are subtitutes for constants SQLITE_CORRUPT,
|
||||
** The following routines are substitutes for constants SQLITE_CORRUPT,
|
||||
** SQLITE_MISUSE, SQLITE_CANTOPEN, SQLITE_IOERR and possibly other error
|
||||
** constants. They server two purposes:
|
||||
** constants. They serve two purposes:
|
||||
**
|
||||
** 1. Serve as a convenient place to set a breakpoint in a debugger
|
||||
** to detect when version error conditions occurs.
|
||||
@ -3190,7 +3190,7 @@ int sqlite3_test_control(int op, ...){
|
||||
** IMPORTANT: Changing the PENDING byte from 0x40000000 results in
|
||||
** an incompatible database file format. Changing the PENDING byte
|
||||
** while any database connection is open results in undefined and
|
||||
** dileterious behavior.
|
||||
** deleterious behavior.
|
||||
*/
|
||||
case SQLITE_TESTCTRL_PENDING_BYTE: {
|
||||
rc = PENDING_BYTE;
|
||||
|
@ -188,7 +188,7 @@ static int sqlite3MemSize(void *pPrior){
|
||||
**
|
||||
** For this low-level interface, we know that pPrior!=0. Cases where
|
||||
** pPrior==0 while have been intercepted by higher-level routine and
|
||||
** redirected to xMalloc. Similarly, we know that nByte>0 becauses
|
||||
** redirected to xMalloc. Similarly, we know that nByte>0 because
|
||||
** cases where nByte<=0 will have been intercepted by higher-level
|
||||
** routines and redirected to xFree.
|
||||
*/
|
||||
|
@ -28,7 +28,7 @@
|
||||
** 1. All memory allocations sizes are rounded up to a power of 2.
|
||||
**
|
||||
** 2. If two adjacent free blocks are the halves of a larger block,
|
||||
** then the two blocks are coalesed into the single larger block.
|
||||
** then the two blocks are coalesced into the single larger block.
|
||||
**
|
||||
** 3. New memory is allocated from the first available free block.
|
||||
**
|
||||
|
@ -26,7 +26,7 @@ typedef struct FileChunk FileChunk;
|
||||
**
|
||||
** The size chosen is a little less than a power of two. That way,
|
||||
** the FileChunk object will have a size that almost exactly fills
|
||||
** a power-of-two allocation. This mimimizes wasted space in power-of-two
|
||||
** a power-of-two allocation. This minimizes wasted space in power-of-two
|
||||
** memory allocators.
|
||||
*/
|
||||
#define JOURNAL_CHUNKSIZE ((int)(1024-sizeof(FileChunk*)))
|
||||
|
@ -25,7 +25,7 @@
|
||||
** Figure out what version of the code to use. The choices are
|
||||
**
|
||||
** SQLITE_MUTEX_OMIT No mutex logic. Not even stubs. The
|
||||
** mutexes implemention cannot be overridden
|
||||
** mutexes implementation cannot be overridden
|
||||
** at start-time.
|
||||
**
|
||||
** SQLITE_MUTEX_NOOP For single-threaded applications. No
|
||||
|
2
src/os.h
2
src/os.h
@ -120,7 +120,7 @@
|
||||
** shared locks begins at SHARED_FIRST.
|
||||
**
|
||||
** The same locking strategy and
|
||||
** byte ranges are used for Unix. This leaves open the possiblity of having
|
||||
** byte ranges are used for Unix. This leaves open the possibility of having
|
||||
** clients on win95, winNT, and unix all talking to the same shared file
|
||||
** and all locking correctly. To do so would require that samba (or whatever
|
||||
** tool is being used for file sharing) implements locks correctly between
|
||||
|
@ -299,6 +299,14 @@ static int randomnessPid = 0;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Explicitly call the 64-bit version of lseek() on Android. Otherwise, lseek()
|
||||
** is the 32-bit version, even if _FILE_OFFSET_BITS=64 is defined.
|
||||
*/
|
||||
#ifdef __ANDROID__
|
||||
# define lseek lseek64
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Different Unix systems declare open() in different ways. Same use
|
||||
** open(const char*,int,mode_t). Others use open(const char*,int,...).
|
||||
@ -631,7 +639,7 @@ static int unixMutexHeld(void) {
|
||||
#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG)
|
||||
/*
|
||||
** Helper function for printing out trace information from debugging
|
||||
** binaries. This returns the string represetation of the supplied
|
||||
** binaries. This returns the string representation of the supplied
|
||||
** integer lock-type.
|
||||
*/
|
||||
static const char *azFileLock(int eFileLock){
|
||||
@ -708,9 +716,22 @@ static int lockTrace(int fd, int op, struct flock *p){
|
||||
|
||||
/*
|
||||
** Retry ftruncate() calls that fail due to EINTR
|
||||
**
|
||||
** All calls to ftruncate() within this file should be made through this wrapper.
|
||||
** On the Android platform, bypassing the logic below could lead to a corrupt
|
||||
** database.
|
||||
*/
|
||||
static int robust_ftruncate(int h, sqlite3_int64 sz){
|
||||
int rc;
|
||||
#ifdef __ANDROID__
|
||||
/* On Android, ftruncate() always uses 32-bit offsets, even if
|
||||
** _FILE_OFFSET_BITS=64 is defined. This means it is unsafe to attempt to
|
||||
** truncate a file to any size larger than 2GiB. Silently ignore any
|
||||
** such attempts. */
|
||||
if( sz>(sqlite3_int64)0x7FFFFFFF ){
|
||||
rc = SQLITE_OK;
|
||||
}else
|
||||
#endif
|
||||
do{ rc = osFtruncate(h,sz); }while( rc<0 && errno==EINTR );
|
||||
return rc;
|
||||
}
|
||||
@ -3098,7 +3119,7 @@ static int nfsUnlock(sqlite3_file *id, int eFileLock){
|
||||
** NB: If you define USE_PREAD or USE_PREAD64, then it might also
|
||||
** be necessary to define _XOPEN_SOURCE to be 500. This varies from
|
||||
** one system to another. Since SQLite does not define USE_PREAD
|
||||
** any any form by default, we will not attempt to define _XOPEN_SOURCE.
|
||||
** in any form by default, we will not attempt to define _XOPEN_SOURCE.
|
||||
** See tickets #2741 and #2681.
|
||||
**
|
||||
** To avoid stomping the errno value on a failed read the lastErrno value
|
||||
@ -3595,7 +3616,7 @@ static int unixTruncate(sqlite3_file *id, i64 nByte){
|
||||
nByte = ((nByte + pFile->szChunk - 1)/pFile->szChunk) * pFile->szChunk;
|
||||
}
|
||||
|
||||
rc = robust_ftruncate(pFile->h, (off_t)nByte);
|
||||
rc = robust_ftruncate(pFile->h, nByte);
|
||||
if( rc ){
|
||||
pFile->lastErrno = errno;
|
||||
return unixLogError(SQLITE_IOERR_TRUNCATE, "ftruncate", pFile->zPath);
|
||||
@ -3730,7 +3751,7 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){
|
||||
}
|
||||
|
||||
/*
|
||||
** If *pArg is inititially negative then this is a query. Set *pArg to
|
||||
** If *pArg is initially negative then this is a query. Set *pArg to
|
||||
** 1 or 0 depending on whether or not bit mask of pFile->ctrlFlags is set.
|
||||
**
|
||||
** If *pArg is 0 or 1, then clear or set the mask bit of pFile->ctrlFlags.
|
||||
@ -3937,7 +3958,7 @@ static int unixSectorSize(sqlite3_file *id){
|
||||
** Return the device characteristics for the file.
|
||||
**
|
||||
** This VFS is set up to return SQLITE_IOCAP_POWERSAFE_OVERWRITE by default.
|
||||
** However, that choice is contraversial since technically the underlying
|
||||
** However, that choice is controversial since technically the underlying
|
||||
** file system does not always provide powersafe overwrites. (In other
|
||||
** words, after a power-loss event, parts of the file that were never
|
||||
** written might end up being altered.) However, non-PSOW behavior is very,
|
||||
@ -4909,7 +4930,7 @@ static int unixUnfetch(sqlite3_file *fd, i64 iOff, void *p){
|
||||
** looks at the filesystem type and tries to guess the best locking
|
||||
** strategy from that.
|
||||
**
|
||||
** For finder-funtion F, two objects are created:
|
||||
** For finder-function F, two objects are created:
|
||||
**
|
||||
** (1) The real finder-function named "FImpt()".
|
||||
**
|
||||
@ -5171,7 +5192,7 @@ static const sqlite3_io_methods
|
||||
#endif /* OS_VXWORKS && SQLITE_ENABLE_LOCKING_STYLE */
|
||||
|
||||
/*
|
||||
** An abstract type for a pointer to a IO method finder function:
|
||||
** An abstract type for a pointer to an IO method finder function:
|
||||
*/
|
||||
typedef const sqlite3_io_methods *(*finder_type)(const char*,unixFile*);
|
||||
|
||||
@ -5485,7 +5506,7 @@ static UnixUnusedFd *findReusableFd(const char *zPath, int flags){
|
||||
** descriptor on the same path, fail, and return an error to SQLite.
|
||||
**
|
||||
** Even if a subsequent open() call does succeed, the consequences of
|
||||
** not searching for a resusable file descriptor are not dire. */
|
||||
** not searching for a reusable file descriptor are not dire. */
|
||||
if( 0==osStat(zPath, &sStat) ){
|
||||
unixInodeInfo *pInode;
|
||||
|
||||
@ -5516,7 +5537,7 @@ static UnixUnusedFd *findReusableFd(const char *zPath, int flags){
|
||||
** written to *pMode. If an IO error occurs, an SQLite error code is
|
||||
** returned and the value of *pMode is not modified.
|
||||
**
|
||||
** In most cases cases, this routine sets *pMode to 0, which will become
|
||||
** In most cases, this routine sets *pMode to 0, which will become
|
||||
** an indication to robust_open() to create the file using
|
||||
** SQLITE_DEFAULT_FILE_PERMISSIONS adjusted by the umask.
|
||||
** But if the file being opened is a WAL or regular journal file, then
|
||||
@ -6308,7 +6329,7 @@ static int unixGetLastError(sqlite3_vfs *NotUsed, int NotUsed2, char *NotUsed3){
|
||||
** proxy path against the values stored in the conch. The conch file is
|
||||
** stored in the same directory as the database file and the file name
|
||||
** is patterned after the database file name as ".<databasename>-conch".
|
||||
** If the conch file does not exist, or it's contents do not match the
|
||||
** If the conch file does not exist, or its contents do not match the
|
||||
** host ID and/or proxy path, then the lock is escalated to an exclusive
|
||||
** lock and the conch file contents is updated with the host ID and proxy
|
||||
** path and the lock is downgraded to a shared lock again. If the conch
|
||||
@ -6360,7 +6381,7 @@ static int unixGetLastError(sqlite3_vfs *NotUsed, int NotUsed2, char *NotUsed3){
|
||||
** setting the environment variable SQLITE_FORCE_PROXY_LOCKING to 1 will
|
||||
** force proxy locking to be used for every database file opened, and 0
|
||||
** will force automatic proxy locking to be disabled for all database
|
||||
** files (explicity calling the SQLITE_SET_LOCKPROXYFILE pragma or
|
||||
** files (explicitly calling the SQLITE_SET_LOCKPROXYFILE pragma or
|
||||
** sqlite_file_control API is not affected by SQLITE_FORCE_PROXY_LOCKING).
|
||||
*/
|
||||
|
||||
|
@ -1286,12 +1286,14 @@ void sqlite3_win32_sleep(DWORD milliseconds){
|
||||
#endif
|
||||
}
|
||||
|
||||
#if SQLITE_MAX_WORKER_THREADS>0 && !SQLITE_OS_WINRT && SQLITE_THREADSAFE>0
|
||||
DWORD sqlite3Win32Wait(HANDLE hObject){
|
||||
DWORD rc;
|
||||
while( (rc = osWaitForSingleObjectEx(hObject, INFINITE,
|
||||
TRUE))==WAIT_IO_COMPLETION ){}
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Return true (non-zero) if we are running under WinNT, Win2K, WinXP,
|
||||
@ -3126,7 +3128,7 @@ static int winUnlock(sqlite3_file *id, int locktype){
|
||||
}
|
||||
|
||||
/*
|
||||
** If *pArg is inititially negative then this is a query. Set *pArg to
|
||||
** If *pArg is initially negative then this is a query. Set *pArg to
|
||||
** 1 or 0 depending on whether or not bit mask of pFile->ctrlFlags is set.
|
||||
**
|
||||
** If *pArg is 0 or 1, then clear or set the mask bit of pFile->ctrlFlags.
|
||||
@ -4140,7 +4142,7 @@ static int winUnfetch(sqlite3_file *fd, i64 iOff, void *p){
|
||||
}else{
|
||||
/* FIXME: If Windows truly always prevents truncating or deleting a
|
||||
** file while a mapping is held, then the following winUnmapfile() call
|
||||
** is unnecessary can can be omitted - potentially improving
|
||||
** is unnecessary can be omitted - potentially improving
|
||||
** performance. */
|
||||
winUnmapfile(pFd);
|
||||
}
|
||||
|
26
src/pager.c
26
src/pager.c
@ -76,12 +76,12 @@
|
||||
** Definition: Two databases (or the same database at two points it time)
|
||||
** are said to be "logically equivalent" if they give the same answer to
|
||||
** all queries. Note in particular the content of freelist leaf
|
||||
** pages can be changed arbitarily without effecting the logical equivalence
|
||||
** pages can be changed arbitrarily without affecting the logical equivalence
|
||||
** of the database.
|
||||
**
|
||||
** (7) At any time, if any subset, including the empty set and the total set,
|
||||
** of the unsynced changes to a rollback journal are removed and the
|
||||
** journal is rolled back, the resulting database file will be logical
|
||||
** journal is rolled back, the resulting database file will be logically
|
||||
** equivalent to the database file at the beginning of the transaction.
|
||||
**
|
||||
** (8) When a transaction is rolled back, the xTruncate method of the VFS
|
||||
@ -378,7 +378,7 @@ int sqlite3PagerTrace=1; /* True to enable tracing */
|
||||
**
|
||||
** The exception is when the database file is unlocked as the pager moves
|
||||
** from ERROR to OPEN state. At this point there may be a hot-journal file
|
||||
** in the file-system that needs to be rolled back (as part of a OPEN->SHARED
|
||||
** in the file-system that needs to be rolled back (as part of an OPEN->SHARED
|
||||
** transition, by the same pager or any other). If the call to xUnlock()
|
||||
** fails at this point and the pager is left holding an EXCLUSIVE lock, this
|
||||
** can confuse the call to xCheckReservedLock() call made later as part
|
||||
@ -461,7 +461,7 @@ struct PagerSavepoint {
|
||||
#define SPILLFLAG_NOSYNC 0x04 /* Spill is ok, but do not sync */
|
||||
|
||||
/*
|
||||
** A open page cache is an instance of struct Pager. A description of
|
||||
** An open page cache is an instance of struct Pager. A description of
|
||||
** some of the more important member variables follows:
|
||||
**
|
||||
** eState
|
||||
@ -633,7 +633,7 @@ struct Pager {
|
||||
|
||||
/**************************************************************************
|
||||
** The following block contains those class members that change during
|
||||
** routine opertion. Class members not in this block are either fixed
|
||||
** routine operation. Class members not in this block are either fixed
|
||||
** when the pager is first created or else only change when there is a
|
||||
** significant mode change (such as changing the page_size, locking_mode,
|
||||
** or the journal_mode). From another view, these class members describe
|
||||
@ -2497,7 +2497,7 @@ delmaster_out:
|
||||
** If the file on disk is currently larger than nPage pages, then use the VFS
|
||||
** xTruncate() method to truncate it.
|
||||
**
|
||||
** Or, it might might be the case that the file on disk is smaller than
|
||||
** Or, it might be the case that the file on disk is smaller than
|
||||
** nPage pages. Some operating system implementations can get confused if
|
||||
** you try to truncate a file to some size that is larger than it
|
||||
** currently is, so detect this case and write a single zero byte to
|
||||
@ -2556,7 +2556,7 @@ int sqlite3SectorSize(sqlite3_file *pFile){
|
||||
/*
|
||||
** Set the value of the Pager.sectorSize variable for the given
|
||||
** pager based on the value returned by the xSectorSize method
|
||||
** of the open database file. The sector size will be used used
|
||||
** of the open database file. The sector size will be used
|
||||
** to determine the size and alignment of journal header and
|
||||
** master journal pointers within created journal files.
|
||||
**
|
||||
@ -3618,12 +3618,14 @@ int sqlite3PagerSetPagesize(Pager *pPager, u32 *pPageSize, int nReserve){
|
||||
|
||||
if( rc==SQLITE_OK ){
|
||||
pager_reset(pPager);
|
||||
pPager->dbSize = (Pgno)((nByte+pageSize-1)/pageSize);
|
||||
pPager->pageSize = pageSize;
|
||||
sqlite3PageFree(pPager->pTmpSpace);
|
||||
pPager->pTmpSpace = pNew;
|
||||
rc = sqlite3PcacheSetPageSize(pPager->pPCache, pageSize);
|
||||
}
|
||||
if( rc==SQLITE_OK ){
|
||||
pPager->dbSize = (Pgno)((nByte+pageSize-1)/pageSize);
|
||||
pPager->pageSize = pageSize;
|
||||
}
|
||||
}
|
||||
|
||||
*pPageSize = pPager->pageSize;
|
||||
@ -3756,7 +3758,7 @@ static int pager_wait_on_lock(Pager *pPager, int locktype){
|
||||
int rc; /* Return code */
|
||||
|
||||
/* Check that this is either a no-op (because the requested lock is
|
||||
** already held, or one of the transistions that the busy-handler
|
||||
** already held), or one of the transitions that the busy-handler
|
||||
** may be invoked during, according to the comment above
|
||||
** sqlite3PagerSetBusyhandler().
|
||||
*/
|
||||
@ -4384,7 +4386,7 @@ static int pagerStress(void *p, PgHdr *pPg){
|
||||
** a rollback or by user request, respectively.
|
||||
**
|
||||
** Spilling is also prohibited when in an error state since that could
|
||||
** lead to database corruption. In the current implementaton it
|
||||
** lead to database corruption. In the current implementation it
|
||||
** is impossible for sqlite3PcacheFetch() to be called with createFlag==3
|
||||
** while in the error state, hence it is impossible for this routine to
|
||||
** be called in the error state. Nevertheless, we include a NEVER()
|
||||
@ -4924,7 +4926,7 @@ static int hasHotJournal(Pager *pPager, int *pExists){
|
||||
*pExists = (first!=0);
|
||||
}else if( rc==SQLITE_CANTOPEN ){
|
||||
/* If we cannot open the rollback journal file in order to see if
|
||||
** its has a zero header, that might be due to an I/O error, or
|
||||
** it has a zero header, that might be due to an I/O error, or
|
||||
** it might be due to the race condition described above and in
|
||||
** ticket #3883. Either way, assume that the journal is hot.
|
||||
** This might be a false positive. But if it is, then the
|
||||
|
@ -390,7 +390,7 @@ PgHdr *sqlite3PcacheFetchFinish(
|
||||
|
||||
/*
|
||||
** Decrement the reference count on a page. If the page is clean and the
|
||||
** reference count drops to 0, then it is made elible for recycling.
|
||||
** reference count drops to 0, then it is made eligible for recycling.
|
||||
*/
|
||||
void SQLITE_NOINLINE sqlite3PcacheRelease(PgHdr *p){
|
||||
assert( p->nRef>0 );
|
||||
|
@ -13,7 +13,7 @@
|
||||
** This file implements the default page cache implementation (the
|
||||
** sqlite3_pcache interface). It also contains part of the implementation
|
||||
** of the SQLITE_CONFIG_PAGECACHE and sqlite3_release_memory() features.
|
||||
** If the default page cache implementation is overriden, then neither of
|
||||
** If the default page cache implementation is overridden, then neither of
|
||||
** these two features are available.
|
||||
*/
|
||||
|
||||
@ -25,7 +25,7 @@ typedef struct PgFreeslot PgFreeslot;
|
||||
typedef struct PGroup PGroup;
|
||||
|
||||
/* Each page cache (or PCache) belongs to a PGroup. A PGroup is a set
|
||||
** of one or more PCaches that are able to recycle each others unpinned
|
||||
** of one or more PCaches that are able to recycle each other's unpinned
|
||||
** pages when they are under memory pressure. A PGroup is an instance of
|
||||
** the following object.
|
||||
**
|
||||
|
@ -904,7 +904,7 @@ char *sqlite3MPrintf(sqlite3 *db, const char *zFormat, ...){
|
||||
|
||||
/*
|
||||
** Like sqlite3MPrintf(), but call sqlite3DbFree() on zStr after formatting
|
||||
** the string and before returnning. This routine is intended to be used
|
||||
** the string and before returning. This routine is intended to be used
|
||||
** to modify an existing string. For example:
|
||||
**
|
||||
** x = sqlite3MPrintf(db, x, "prefix %s suffix", x);
|
||||
|
@ -1118,7 +1118,7 @@ static int resolveOrderGroupBy(
|
||||
}
|
||||
|
||||
/*
|
||||
** Resolve names in the SELECT statement p and all of its descendents.
|
||||
** Resolve names in the SELECT statement p and all of its descendants.
|
||||
*/
|
||||
static int resolveSelectStep(Walker *pWalker, Select *p){
|
||||
NameContext *pOuterNC; /* Context that contains this SELECT */
|
||||
|
@ -50,7 +50,7 @@
|
||||
** No INSERTs may occurs after a SMALLEST. An assertion will fail if
|
||||
** that is attempted.
|
||||
**
|
||||
** The cost of an INSERT is roughly constant. (Sometime new memory
|
||||
** The cost of an INSERT is roughly constant. (Sometimes new memory
|
||||
** has to be allocated on an INSERT.) The cost of a TEST with a new
|
||||
** batch number is O(NlogN) where N is the number of elements in the RowSet.
|
||||
** The cost of a TEST using the same batch number is O(logN). The cost
|
||||
@ -443,8 +443,8 @@ int sqlite3RowSetNext(RowSet *p, i64 *pRowid){
|
||||
** Check to see if element iRowid was inserted into the rowset as
|
||||
** part of any insert batch prior to iBatch. Return 1 or 0.
|
||||
**
|
||||
** If this is the first test of a new batch and if there exist entires
|
||||
** on pRowSet->pEntry, then sort those entires into the forest at
|
||||
** If this is the first test of a new batch and if there exist entries
|
||||
** on pRowSet->pEntry, then sort those entries into the forest at
|
||||
** pRowSet->pForest so that they can be tested.
|
||||
*/
|
||||
int sqlite3RowSetTest(RowSet *pRowSet, int iBatch, sqlite3_int64 iRowid){
|
||||
|
16
src/select.c
16
src/select.c
@ -1010,7 +1010,7 @@ int sqlite3KeyInfoIsWriteable(KeyInfo *p){ return p->nRef==1; }
|
||||
** then the KeyInfo structure is appropriate for initializing a virtual
|
||||
** index to implement a DISTINCT test.
|
||||
**
|
||||
** Space to hold the KeyInfo structure is obtain from malloc. The calling
|
||||
** Space to hold the KeyInfo structure is obtained from malloc. The calling
|
||||
** function is responsible for seeing that this structure is eventually
|
||||
** freed.
|
||||
*/
|
||||
@ -1541,7 +1541,7 @@ static void generateColumnNames(
|
||||
}
|
||||
|
||||
/*
|
||||
** Given a an expression list (which is really the list of expressions
|
||||
** Given an expression list (which is really the list of expressions
|
||||
** that form the result set of a SELECT statement) compute appropriate
|
||||
** column names for a table that would hold the expression list.
|
||||
**
|
||||
@ -1614,7 +1614,7 @@ static int selectColumnsFromExprList(
|
||||
}
|
||||
|
||||
/* Make sure the column name is unique. If the name is not unique,
|
||||
** append a integer to the name so that it becomes unique.
|
||||
** append an integer to the name so that it becomes unique.
|
||||
*/
|
||||
nName = sqlite3Strlen30(zName);
|
||||
for(j=cnt=0; j<i; j++){
|
||||
@ -3098,7 +3098,7 @@ static void substSelect(
|
||||
**
|
||||
** SELECT x+y AS a FROM t1 WHERE z<100 AND a>5
|
||||
**
|
||||
** The code generated for this simpification gives the same result
|
||||
** The code generated for this simplification gives the same result
|
||||
** but only has to scan the data once. And because indices might
|
||||
** exist on the table t1, a complete scan of the data might be
|
||||
** avoided.
|
||||
@ -3242,7 +3242,7 @@ static int flattenSubquery(
|
||||
pSubSrc = pSub->pSrc;
|
||||
assert( pSubSrc );
|
||||
/* Prior to version 3.1.2, when LIMIT and OFFSET had to be simple constants,
|
||||
** not arbitrary expresssions, we allowed some combining of LIMIT and OFFSET
|
||||
** not arbitrary expressions, we allowed some combining of LIMIT and OFFSET
|
||||
** because they could be computed at compile-time. But when LIMIT and OFFSET
|
||||
** became arbitrary expressions, we were forced to add restrictions (13)
|
||||
** and (14). */
|
||||
@ -3628,7 +3628,7 @@ static u8 minMaxQuery(AggInfo *pAggInfo, ExprList **ppMinMax){
|
||||
|
||||
/*
|
||||
** The select statement passed as the first argument is an aggregate query.
|
||||
** The second argment is the associated aggregate-info object. This
|
||||
** The second argument is the associated aggregate-info object. This
|
||||
** function tests if the SELECT is of the form:
|
||||
**
|
||||
** SELECT count(*) FROM <tbl>
|
||||
@ -3958,10 +3958,10 @@ static void selectPopWith(Walker *pWalker, Select *p){
|
||||
** fill pTabList->a[].pSelect with a copy of the SELECT statement
|
||||
** that implements the view. A copy is made of the view's SELECT
|
||||
** statement so that we can freely modify or delete that statement
|
||||
** without worrying about messing up the presistent representation
|
||||
** without worrying about messing up the persistent representation
|
||||
** of the view.
|
||||
**
|
||||
** (3) Add terms to the WHERE clause to accomodate the NATURAL keyword
|
||||
** (3) Add terms to the WHERE clause to accommodate the NATURAL keyword
|
||||
** on joins and the ON and USING clause of joins.
|
||||
**
|
||||
** (4) Scan the list of columns in the result set (pEList) looking
|
||||
|
@ -2094,7 +2094,7 @@ int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*);
|
||||
** turns off all busy handlers.
|
||||
**
|
||||
** ^(There can only be a single busy handler for a particular
|
||||
** [database connection] any any given moment. If another busy handler
|
||||
** [database connection] at any given moment. If another busy handler
|
||||
** was defined (using [sqlite3_busy_handler()]) prior to calling
|
||||
** this routine, that other busy handler is cleared.)^
|
||||
**
|
||||
@ -4164,7 +4164,7 @@ SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),
|
||||
** object results in undefined behavior.
|
||||
**
|
||||
** ^These routines work just like the corresponding [column access functions]
|
||||
** except that these routines take a single [protected sqlite3_value] object
|
||||
** except that these routines take a single [protected sqlite3_value] object
|
||||
** pointer instead of a [sqlite3_stmt*] pointer and an integer column number.
|
||||
**
|
||||
** ^The sqlite3_value_text16() interface extracts a UTF-16 string
|
||||
@ -6357,12 +6357,12 @@ int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
|
||||
** the current value is always zero.)^
|
||||
**
|
||||
** [[SQLITE_DBSTATUS_CACHE_USED]] ^(<dt>SQLITE_DBSTATUS_CACHE_USED</dt>
|
||||
** <dd>This parameter returns the approximate number of of bytes of heap
|
||||
** <dd>This parameter returns the approximate number of bytes of heap
|
||||
** memory used by all pager caches associated with the database connection.)^
|
||||
** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0.
|
||||
**
|
||||
** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(<dt>SQLITE_DBSTATUS_SCHEMA_USED</dt>
|
||||
** <dd>This parameter returns the approximate number of of bytes of heap
|
||||
** <dd>This parameter returns the approximate number of bytes of heap
|
||||
** memory used to store the schema for all databases associated
|
||||
** with the connection - main, temp, and any [ATTACH]-ed databases.)^
|
||||
** ^The full amount of memory used by the schemas is reported, even if the
|
||||
@ -6371,7 +6371,7 @@ int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
|
||||
** ^The highwater mark associated with SQLITE_DBSTATUS_SCHEMA_USED is always 0.
|
||||
**
|
||||
** [[SQLITE_DBSTATUS_STMT_USED]] ^(<dt>SQLITE_DBSTATUS_STMT_USED</dt>
|
||||
** <dd>This parameter returns the approximate number of of bytes of heap
|
||||
** <dd>This parameter returns the approximate number of bytes of heap
|
||||
** and lookaside memory used by all prepared statements associated with
|
||||
** the database connection.)^
|
||||
** ^The highwater mark associated with SQLITE_DBSTATUS_STMT_USED is always 0.
|
||||
|
@ -28,7 +28,7 @@ typedef struct sqlite3_api_routines sqlite3_api_routines;
|
||||
** WARNING: In order to maintain backwards compatibility, add new
|
||||
** interfaces to the end of this structure only. If you insert new
|
||||
** interfaces in the middle of this structure, then older different
|
||||
** versions of SQLite will not be able to load each others' shared
|
||||
** versions of SQLite will not be able to load each other's shared
|
||||
** libraries!
|
||||
*/
|
||||
struct sqlite3_api_routines {
|
||||
@ -254,7 +254,7 @@ struct sqlite3_api_routines {
|
||||
|
||||
/*
|
||||
** The following macros redefine the API routines so that they are
|
||||
** redirected throught the global sqlite3_api structure.
|
||||
** redirected through the global sqlite3_api structure.
|
||||
**
|
||||
** This header file is also used by the loadext.c source file
|
||||
** (part of the main SQLite library - not an extension) so that
|
||||
|
@ -351,7 +351,7 @@
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Return true (non-zero) if the input is a integer that is too large
|
||||
** Return true (non-zero) if the input is an integer that is too large
|
||||
** to fit in 32-bits. This macro is used inside of various testcase()
|
||||
** macros to verify that we have tested SQLite for large-file support.
|
||||
*/
|
||||
@ -639,7 +639,7 @@ extern const int sqlite3one;
|
||||
** all alignment restrictions correct.
|
||||
**
|
||||
** Except, if SQLITE_4_BYTE_ALIGNED_MALLOC is defined, then the
|
||||
** underlying malloc() implemention might return us 4-byte aligned
|
||||
** underlying malloc() implementation might return us 4-byte aligned
|
||||
** pointers. In that case, only verify 4-byte alignment.
|
||||
*/
|
||||
#ifdef SQLITE_4_BYTE_ALIGNED_MALLOC
|
||||
@ -1167,7 +1167,6 @@ struct sqlite3 {
|
||||
#define SQLITE_Transitive 0x0200 /* Transitive constraints */
|
||||
#define SQLITE_OmitNoopJoin 0x0400 /* Omit unused tables in joins */
|
||||
#define SQLITE_Stat3 0x0800 /* Use the SQLITE_STAT3 table */
|
||||
#define SQLITE_AdjustOutEst 0x1000 /* Adjust output estimates using WHERE */
|
||||
#define SQLITE_AllOpts 0xffff /* All optimizations */
|
||||
|
||||
/*
|
||||
@ -2896,8 +2895,8 @@ int sqlite3CantopenError(int);
|
||||
|
||||
/*
|
||||
** FTS4 is really an extension for FTS3. It is enabled using the
|
||||
** SQLITE_ENABLE_FTS3 macro. But to avoid confusion we also all
|
||||
** the SQLITE_ENABLE_FTS4 macro to serve as an alisse for SQLITE_ENABLE_FTS3.
|
||||
** SQLITE_ENABLE_FTS3 macro. But to avoid confusion we also call
|
||||
** the SQLITE_ENABLE_FTS4 macro to serve as an alias for SQLITE_ENABLE_FTS3.
|
||||
*/
|
||||
#if defined(SQLITE_ENABLE_FTS4) && !defined(SQLITE_ENABLE_FTS3)
|
||||
# define SQLITE_ENABLE_FTS3
|
||||
|
@ -182,7 +182,7 @@ int sqlite3_get_table(
|
||||
** This routine frees the space the sqlite3_get_table() malloced.
|
||||
*/
|
||||
void sqlite3_free_table(
|
||||
char **azResult /* Result returned from from sqlite3_get_table() */
|
||||
char **azResult /* Result returned from sqlite3_get_table() */
|
||||
){
|
||||
if( azResult ){
|
||||
int i, n;
|
||||
|
@ -804,7 +804,7 @@ static void tclSqlFunc(sqlite3_context *context, int argc, sqlite3_value**argv){
|
||||
/* If there are arguments to the function, make a shallow copy of the
|
||||
** script object, lappend the arguments, then evaluate the copy.
|
||||
**
|
||||
** By "shallow" copy, we mean a only the outer list Tcl_Obj is duplicated.
|
||||
** By "shallow" copy, we mean only the outer list Tcl_Obj is duplicated.
|
||||
** The new Tcl_Obj contains pointers to the original list elements.
|
||||
** That way, when Tcl_EvalObjv() is run and shimmers the first element
|
||||
** of the list to tclCmdNameType, that alternate representation will
|
||||
|
@ -2605,7 +2605,7 @@ static int test_bind(
|
||||
** SQLite selected to call. The TCL test script implements the
|
||||
** "test_collate" proc.
|
||||
**
|
||||
** Note that this will only work with one intepreter at a time, as the
|
||||
** Note that this will only work with one interpreter at a time, as the
|
||||
** interp pointer to use when evaluating the TCL script is stored in
|
||||
** pTestCollateInterp.
|
||||
*/
|
||||
@ -3758,7 +3758,7 @@ static int test_prepare_v2(
|
||||
** Usage: sqlite3_prepare_tkt3134 DB
|
||||
**
|
||||
** Generate a prepared statement for a zero-byte string as a test
|
||||
** for ticket #3134. The string should be preceeded by a zero byte.
|
||||
** for ticket #3134. The string should be preceded by a zero byte.
|
||||
*/
|
||||
static int test_prepare_tkt3134(
|
||||
void * clientData,
|
||||
|
@ -37,13 +37,13 @@ struct sqlite3_intarray {
|
||||
typedef struct intarray_vtab intarray_vtab;
|
||||
typedef struct intarray_cursor intarray_cursor;
|
||||
|
||||
/* A intarray table object */
|
||||
/* An intarray table object */
|
||||
struct intarray_vtab {
|
||||
sqlite3_vtab base; /* Base class */
|
||||
sqlite3_intarray *pContent; /* Content of the integer array */
|
||||
};
|
||||
|
||||
/* A intarray cursor object */
|
||||
/* An intarray cursor object */
|
||||
struct intarray_cursor {
|
||||
sqlite3_vtab_cursor base; /* Base class */
|
||||
int i; /* Current cursor position */
|
||||
|
@ -696,6 +696,12 @@ static int test_memdebug_pending(
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** The following global variable keeps track of the number of tests
|
||||
** that have run. This variable is only useful when running in the
|
||||
** debugger.
|
||||
*/
|
||||
static int sqlite3_memdebug_title_count = 0;
|
||||
|
||||
/*
|
||||
** Usage: sqlite3_memdebug_settitle TITLE
|
||||
@ -713,6 +719,7 @@ static int test_memdebug_settitle(
|
||||
int objc,
|
||||
Tcl_Obj *CONST objv[]
|
||||
){
|
||||
sqlite3_memdebug_title_count++;
|
||||
if( objc!=2 ){
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "TITLE");
|
||||
return TCL_ERROR;
|
||||
@ -880,7 +887,7 @@ static int test_memdebug_log(
|
||||
**
|
||||
** Set the scratch memory buffer using SQLITE_CONFIG_SCRATCH.
|
||||
** The buffer is static and is of limited size. N might be
|
||||
** adjusted downward as needed to accomodate the requested size.
|
||||
** adjusted downward as needed to accommodate the requested size.
|
||||
** The revised value of N is returned.
|
||||
**
|
||||
** A negative SIZE causes the buffer pointer to be NULL.
|
||||
@ -920,7 +927,7 @@ static int test_config_scratch(
|
||||
**
|
||||
** Set the page-cache memory buffer using SQLITE_CONFIG_PAGECACHE.
|
||||
** The buffer is static and is of limited size. N might be
|
||||
** adjusted downward as needed to accomodate the requested size.
|
||||
** adjusted downward as needed to accommodate the requested size.
|
||||
** The revised value of N is returned.
|
||||
**
|
||||
** A negative SIZE causes the buffer pointer to be NULL.
|
||||
|
@ -189,7 +189,7 @@ static int schemaNext(sqlite3_vtab_cursor *cur){
|
||||
|
||||
/* Set zSql to the SQL to pull the list of tables from the
|
||||
** sqlite_master (or sqlite_temp_master) table of the database
|
||||
** identfied by the row pointed to by the SQL statement pCur->pDbList
|
||||
** identified by the row pointed to by the SQL statement pCur->pDbList
|
||||
** (iterating through a "PRAGMA database_list;" statement).
|
||||
*/
|
||||
if( sqlite3_column_int(pCur->pDbList, 0)==1 ){
|
||||
|
@ -77,7 +77,7 @@ const unsigned char ebcdicToAscii[] = {
|
||||
** end result.
|
||||
**
|
||||
** Ticket #1066. the SQL standard does not allow '$' in the
|
||||
** middle of identfiers. But many SQL implementations do.
|
||||
** middle of identifiers. But many SQL implementations do.
|
||||
** SQLite will allow '$' in identifiers for compatibility.
|
||||
** But the feature is undocumented.
|
||||
*/
|
||||
|
@ -127,7 +127,7 @@ void sqlite3BeginTrigger(
|
||||
** ^^^^^^^^
|
||||
**
|
||||
** To maintain backwards compatibility, ignore the database
|
||||
** name on pTableName if we are reparsing our of SQLITE_MASTER.
|
||||
** name on pTableName if we are reparsing out of SQLITE_MASTER.
|
||||
*/
|
||||
if( db->init.busy && iDb!=1 ){
|
||||
sqlite3DbFree(db, pTableName->a[0].zDatabase);
|
||||
|
10
src/update.c
10
src/update.c
@ -327,7 +327,7 @@ void sqlite3Update(
|
||||
}
|
||||
|
||||
/* If we are trying to update a view, realize that view into
|
||||
** a ephemeral table.
|
||||
** an ephemeral table.
|
||||
*/
|
||||
#if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER)
|
||||
if( isView ){
|
||||
@ -488,7 +488,7 @@ void sqlite3Update(
|
||||
}
|
||||
|
||||
/* Populate the array of registers beginning at regNew with the new
|
||||
** row data. This array is used to check constaints, create the new
|
||||
** row data. This array is used to check constants, create the new
|
||||
** table and index records, and as the values for any new.* references
|
||||
** made by triggers.
|
||||
**
|
||||
@ -681,7 +681,7 @@ update_cleanup:
|
||||
return;
|
||||
}
|
||||
/* Make sure "isView" and other macros defined above are undefined. Otherwise
|
||||
** thely may interfere with compilation of other functions in this file
|
||||
** they may interfere with compilation of other functions in this file
|
||||
** (or in another file, if this file becomes part of the amalgamation). */
|
||||
#ifdef isView
|
||||
#undef isView
|
||||
@ -694,7 +694,7 @@ update_cleanup:
|
||||
/*
|
||||
** Generate code for an UPDATE of a virtual table.
|
||||
**
|
||||
** The strategy is that we create an ephemerial table that contains
|
||||
** The strategy is that we create an ephemeral table that contains
|
||||
** for each row to be changed:
|
||||
**
|
||||
** (A) The original rowid of that row.
|
||||
@ -702,7 +702,7 @@ update_cleanup:
|
||||
** (C) The content of every column in the row.
|
||||
**
|
||||
** Then we loop over this ephemeral table and for each row in
|
||||
** the ephermeral table call VUpdate.
|
||||
** the ephemeral table call VUpdate.
|
||||
**
|
||||
** When finished, drop the ephemeral table.
|
||||
**
|
||||
|
@ -204,7 +204,7 @@ void sqlite3ErrorMsg(Parse *pParse, const char *zFormat, ...){
|
||||
** occur.
|
||||
**
|
||||
** 2002-Feb-14: This routine is extended to remove MS-Access style
|
||||
** brackets from around identifers. For example: "[a-b-c]" becomes
|
||||
** brackets from around identifiers. For example: "[a-b-c]" becomes
|
||||
** "a-b-c".
|
||||
*/
|
||||
int sqlite3Dequote(char *z){
|
||||
|
@ -87,7 +87,7 @@ static int execExecSql(sqlite3 *db, char **pzErrMsg, const char *zSql){
|
||||
** step (3) requires additional temporary disk space approximately equal
|
||||
** to the size of the original database for the rollback journal.
|
||||
** Hence, temporary disk space that is approximately 2x the size of the
|
||||
** orginal database is required. Every page of the database is written
|
||||
** original database is required. Every page of the database is written
|
||||
** approximately 3 times: Once for step (2) and twice for step (3).
|
||||
** Two writes per page are required in step (3) because the original
|
||||
** database content must be written into the rollback journal prior to
|
||||
|
@ -2570,7 +2570,7 @@ case OP_MakeRecord: {
|
||||
** ------------------------------------------------------------------------
|
||||
**
|
||||
** Data(0) is taken from register P1. Data(1) comes from register P1+1
|
||||
** and so froth.
|
||||
** and so forth.
|
||||
**
|
||||
** Each type field is a varint representing the serial type of the
|
||||
** corresponding data element (see sqlite3VdbeSerialType()). The
|
||||
@ -3557,7 +3557,7 @@ case OP_SeekGT: { /* jump, in3 */
|
||||
if( pC->isTable ){
|
||||
/* The input value in P3 might be of any type: integer, real, string,
|
||||
** blob, or NULL. But it needs to be an integer before we can do
|
||||
** the seek, so covert it. */
|
||||
** the seek, so convert it. */
|
||||
pIn3 = &aMem[pOp->p3];
|
||||
if( (pIn3->flags & (MEM_Int|MEM_Real))==0 ){
|
||||
applyNumericAffinity(pIn3, 0);
|
||||
|
@ -238,7 +238,7 @@ struct Mem {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Each auxilliary data pointer stored by a user defined function
|
||||
** Each auxiliary data pointer stored by a user defined function
|
||||
** implementation calling sqlite3_set_auxdata() is stored in an instance
|
||||
** of this structure. All such structures associated with a single VM
|
||||
** are stored in a linked list headed at Vdbe.pAuxData. All are destroyed
|
||||
@ -253,7 +253,7 @@ struct AuxData {
|
||||
};
|
||||
|
||||
/*
|
||||
** The "context" argument for a installable function. A pointer to an
|
||||
** The "context" argument for an installable function. A pointer to an
|
||||
** instance of this structure is the first argument to the routines used
|
||||
** implement the SQL functions.
|
||||
**
|
||||
|
@ -212,7 +212,7 @@ int sqlite3_value_type(sqlite3_value* pVal){
|
||||
** The following routines are used by user-defined functions to specify
|
||||
** the function result.
|
||||
**
|
||||
** The setStrOrError() funtion calls sqlite3VdbeMemSetStr() to store the
|
||||
** The setStrOrError() function calls sqlite3VdbeMemSetStr() to store the
|
||||
** result as a string or blob but if the string or blob is too large, it
|
||||
** then sets the error code to SQLITE_TOOBIG
|
||||
*/
|
||||
@ -645,7 +645,7 @@ void *sqlite3_aggregate_context(sqlite3_context *p, int nByte){
|
||||
}
|
||||
|
||||
/*
|
||||
** Return the auxilary data pointer, if any, for the iArg'th argument to
|
||||
** Return the auxiliary data pointer, if any, for the iArg'th argument to
|
||||
** the user-function defined by pCtx.
|
||||
*/
|
||||
void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){
|
||||
@ -660,7 +660,7 @@ void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){
|
||||
}
|
||||
|
||||
/*
|
||||
** Set the auxilary data pointer and delete function, for the iArg'th
|
||||
** Set the auxiliary data pointer and delete function, for the iArg'th
|
||||
** argument to the user-function defined by pCtx. Any previous value is
|
||||
** deleted by calling the delete function specified when it was set.
|
||||
*/
|
||||
@ -706,7 +706,7 @@ failed:
|
||||
|
||||
#ifndef SQLITE_OMIT_DEPRECATED
|
||||
/*
|
||||
** Return the number of times the Step function of a aggregate has been
|
||||
** Return the number of times the Step function of an aggregate has been
|
||||
** called.
|
||||
**
|
||||
** This function is deprecated. Do not use it for new code. It is
|
||||
@ -976,7 +976,7 @@ const void *sqlite3_column_decltype16(sqlite3_stmt *pStmt, int N){
|
||||
/*
|
||||
** Return the name of the database from which a result column derives.
|
||||
** NULL is returned if the result column is an expression or constant or
|
||||
** anything else which is not an unabiguous reference to a database column.
|
||||
** anything else which is not an unambiguous reference to a database column.
|
||||
*/
|
||||
const char *sqlite3_column_database_name(sqlite3_stmt *pStmt, int N){
|
||||
return columnName(
|
||||
@ -992,7 +992,7 @@ const void *sqlite3_column_database_name16(sqlite3_stmt *pStmt, int N){
|
||||
/*
|
||||
** Return the name of the table from which a result column derives.
|
||||
** NULL is returned if the result column is an expression or constant or
|
||||
** anything else which is not an unabiguous reference to a database column.
|
||||
** anything else which is not an unambiguous reference to a database column.
|
||||
*/
|
||||
const char *sqlite3_column_table_name(sqlite3_stmt *pStmt, int N){
|
||||
return columnName(
|
||||
@ -1008,7 +1008,7 @@ const void *sqlite3_column_table_name16(sqlite3_stmt *pStmt, int N){
|
||||
/*
|
||||
** Return the name of the table column from which a result column derives.
|
||||
** NULL is returned if the result column is an expression or constant or
|
||||
** anything else which is not an unabiguous reference to a database column.
|
||||
** anything else which is not an unambiguous reference to a database column.
|
||||
*/
|
||||
const char *sqlite3_column_origin_name(sqlite3_stmt *pStmt, int N){
|
||||
return columnName(
|
||||
@ -1288,7 +1288,7 @@ int sqlite3TransferBindings(sqlite3_stmt *pFromStmt, sqlite3_stmt *pToStmt){
|
||||
** Deprecated external interface. Internal/core SQLite code
|
||||
** should call sqlite3TransferBindings.
|
||||
**
|
||||
** Is is misuse to call this routine with statements from different
|
||||
** It is misuse to call this routine with statements from different
|
||||
** database connections. But as this is a deprecated interface, we
|
||||
** will not bother to check for that condition.
|
||||
**
|
||||
|
@ -896,7 +896,7 @@ void sqlite3VdbeSetLineNumber(Vdbe *v, int iLine){
|
||||
** routine, then a pointer to a dummy VdbeOp will be returned. That opcode
|
||||
** is readable but not writable, though it is cast to a writable value.
|
||||
** The return of a dummy opcode allows the call to continue functioning
|
||||
** after a OOM fault without having to check to see if the return from
|
||||
** after an OOM fault without having to check to see if the return from
|
||||
** this routine is a valid pointer. But because the dummy.opcode is 0,
|
||||
** dummy will never be written to. This is verified by code inspection and
|
||||
** by running with Valgrind.
|
||||
@ -1611,9 +1611,9 @@ void sqlite3VdbeRewind(Vdbe *p){
|
||||
** After the VDBE has be prepped, it can be executed by one or more
|
||||
** calls to sqlite3VdbeExec().
|
||||
**
|
||||
** This function may be called exact once on a each virtual machine.
|
||||
** This function may be called exactly once on each virtual machine.
|
||||
** After this routine is called the VM has been "packaged" and is ready
|
||||
** to run. After this routine is called, futher calls to
|
||||
** to run. After this routine is called, further calls to
|
||||
** sqlite3VdbeAddOp() functions are prohibited. This routine disconnects
|
||||
** the Vdbe from the Parse object that helped generate it so that the
|
||||
** the Vdbe becomes an independent entity and the Parse object can be
|
||||
@ -1991,7 +1991,7 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){
|
||||
|
||||
/* The complex case - There is a multi-file write-transaction active.
|
||||
** This requires a master journal file to ensure the transaction is
|
||||
** committed atomicly.
|
||||
** committed atomically.
|
||||
*/
|
||||
#ifndef SQLITE_OMIT_DISKIO
|
||||
else{
|
||||
@ -2639,7 +2639,7 @@ int sqlite3VdbeFinalize(Vdbe *p){
|
||||
** from left to right), or
|
||||
**
|
||||
** * the corresponding bit in argument mask is clear (where the first
|
||||
** function parameter corrsponds to bit 0 etc.).
|
||||
** function parameter corresponds to bit 0 etc.).
|
||||
*/
|
||||
void sqlite3VdbeDeleteAuxData(Vdbe *pVdbe, int iOp, int mask){
|
||||
AuxData **pp = &pVdbe->pAuxData;
|
||||
@ -2743,7 +2743,7 @@ static int SQLITE_NOINLINE handleDeferredMoveto(VdbeCursor *p){
|
||||
** Something has moved cursor "p" out of place. Maybe the row it was
|
||||
** pointed to was deleted out from under it. Or maybe the btree was
|
||||
** rebalanced. Whatever the cause, try to restore "p" to the place it
|
||||
** is suppose to be pointing. If the row was deleted out from under the
|
||||
** is supposed to be pointing. If the row was deleted out from under the
|
||||
** cursor, set the cursor to point to a NULL row.
|
||||
*/
|
||||
static int SQLITE_NOINLINE handleMovedCursor(VdbeCursor *p){
|
||||
@ -3269,7 +3269,7 @@ static int vdbeRecordCompareDebug(
|
||||
assert( mem1.zMalloc==0 );
|
||||
|
||||
/* rc==0 here means that one of the keys ran out of fields and
|
||||
** all the fields up to that point were equal. Return the the default_rc
|
||||
** all the fields up to that point were equal. Return the default_rc
|
||||
** value. */
|
||||
rc = pPKey2->default_rc;
|
||||
|
||||
@ -3460,7 +3460,7 @@ static i64 vdbeRecordDecodeInt(u32 serial_type, const u8 *aKey){
|
||||
** specified by {nKey1, pKey1} and pPKey2. It returns a negative, zero
|
||||
** or positive integer if key1 is less than, equal to or
|
||||
** greater than key2. The {nKey1, pKey1} key must be a blob
|
||||
** created by th OP_MakeRecord opcode of the VDBE. The pPKey2
|
||||
** created by the OP_MakeRecord opcode of the VDBE. The pPKey2
|
||||
** key must be a parsed key such as obtained from
|
||||
** sqlite3VdbeParseRecord.
|
||||
**
|
||||
@ -3650,7 +3650,7 @@ int sqlite3VdbeRecordCompare(
|
||||
assert( mem1.zMalloc==0 );
|
||||
|
||||
/* rc==0 here means that one or both of the keys ran out of fields and
|
||||
** all the fields up to that point were equal. Return the the default_rc
|
||||
** all the fields up to that point were equal. Return the default_rc
|
||||
** value. */
|
||||
assert( CORRUPT_DB
|
||||
|| vdbeRecordCompareDebug(nKey1, pKey1, pPKey2, pPKey2->default_rc)
|
||||
|
@ -37,7 +37,7 @@ int sqlite3VdbeCheckMemInvariants(Mem *p){
|
||||
**
|
||||
** (1) Memory in Mem.zMalloc and managed by the Mem object
|
||||
** (2) Memory to be freed using Mem.xDel
|
||||
** (3) An ephermal string or blob
|
||||
** (3) An ephemeral string or blob
|
||||
** (4) A static string or blob
|
||||
*/
|
||||
if( (p->flags & (MEM_Str|MEM_Blob)) && p->z!=0 ){
|
||||
@ -240,7 +240,7 @@ int sqlite3VdbeMemNulTerminate(Mem *pMem){
|
||||
** used for converting values to text for returning to the user (i.e. via
|
||||
** sqlite3_value_text()), or for ensuring that values to be used as btree
|
||||
** keys are strings. In the former case a NULL pointer is returned the
|
||||
** user and the later is an internal programming error.
|
||||
** user and the latter is an internal programming error.
|
||||
*/
|
||||
int sqlite3VdbeMemStringify(Mem *pMem, u8 enc, u8 bForce){
|
||||
int fg = pMem->flags;
|
||||
@ -405,7 +405,7 @@ static i64 doubleToInt64(double r){
|
||||
** If pMem is an integer, then the value is exact. If pMem is
|
||||
** a floating-point then the value returned is the integer part.
|
||||
** If pMem is a string or blob, then we make an attempt to convert
|
||||
** it into a integer and return that. If pMem represents an
|
||||
** it into an integer and return that. If pMem represents an
|
||||
** an SQL-NULL value, return 0.
|
||||
**
|
||||
** If pMem represents a string value, its encoding might be changed.
|
||||
@ -697,7 +697,7 @@ int sqlite3VdbeMemTooBig(Mem *p){
|
||||
|
||||
#ifdef SQLITE_DEBUG
|
||||
/*
|
||||
** This routine prepares a memory cell for modication by breaking
|
||||
** This routine prepares a memory cell for modification by breaking
|
||||
** its link to a shallow copy and by marking any current shallow
|
||||
** copies of this cell as invalid.
|
||||
**
|
||||
|
@ -2059,7 +2059,7 @@ static void *vdbePmaReaderBgInit(void *pCtx){
|
||||
|
||||
/*
|
||||
** Use a background thread to invoke vdbePmaReaderIncrMergeInit(INCRINIT_TASK)
|
||||
** on the the PmaReader object passed as the first argument.
|
||||
** on the PmaReader object passed as the first argument.
|
||||
**
|
||||
** This call will initialize the various fields of the pReadr->pIncr
|
||||
** structure and, if it is a multi-threaded IncrMerger, launch a
|
||||
|
@ -64,7 +64,7 @@ static int findNextHostParameter(const char *zSql, int *pnToken){
|
||||
** ALGORITHM: Scan the input string looking for host parameters in any of
|
||||
** these forms: ?, ?N, $A, @A, :A. Take care to avoid text within
|
||||
** string literals, quoted identifier names, and comments. For text forms,
|
||||
** the host parameter index is found by scanning the perpared
|
||||
** the host parameter index is found by scanning the prepared
|
||||
** statement for the corresponding OP_Variable opcode. Once the host
|
||||
** parameter index is known, locate the value in p->aVar[]. Then render
|
||||
** the value as a literal in place of the host parameter name.
|
||||
|
12
src/wal.c
12
src/wal.c
@ -574,7 +574,7 @@ static volatile WalIndexHdr *walIndexHdr(Wal *pWal){
|
||||
** The argument to this macro must be of type u32. On a little-endian
|
||||
** architecture, it returns the u32 value that results from interpreting
|
||||
** the 4 bytes as a big-endian value. On a big-endian architecture, it
|
||||
** returns the value that would be produced by intepreting the 4 bytes
|
||||
** returns the value that would be produced by interpreting the 4 bytes
|
||||
** of the input value as a little-endian integer.
|
||||
*/
|
||||
#define BYTESWAP32(x) ( \
|
||||
@ -988,7 +988,7 @@ static int walIndexAppend(Wal *pWal, u32 iFrame, u32 iPage){
|
||||
assert( idx <= HASHTABLE_NSLOT/2 + 1 );
|
||||
|
||||
/* If this is the first entry to be added to this hash-table, zero the
|
||||
** entire hash table and aPgno[] array before proceding.
|
||||
** entire hash table and aPgno[] array before proceeding.
|
||||
*/
|
||||
if( idx==1 ){
|
||||
int nByte = (int)((u8 *)&aHash[HASHTABLE_NSLOT] - (u8 *)&aPgno[1]);
|
||||
@ -1646,7 +1646,7 @@ static int walPagesize(Wal *pWal){
|
||||
** database file.
|
||||
**
|
||||
** This routine uses and updates the nBackfill field of the wal-index header.
|
||||
** This is the only routine tha will increase the value of nBackfill.
|
||||
** This is the only routine that will increase the value of nBackfill.
|
||||
** (A WAL reset or recovery will revert nBackfill to zero, but not increase
|
||||
** its value.)
|
||||
**
|
||||
@ -1950,7 +1950,7 @@ static int walIndexTryHdr(Wal *pWal, int *pChanged){
|
||||
** wal-index from the WAL before returning.
|
||||
**
|
||||
** Set *pChanged to 1 if the wal-index header value in pWal->hdr is
|
||||
** changed by this opertion. If pWal->hdr is unchanged, set *pChanged
|
||||
** changed by this operation. If pWal->hdr is unchanged, set *pChanged
|
||||
** to 0.
|
||||
**
|
||||
** If the wal-index header is successfully read, return SQLITE_OK.
|
||||
@ -2154,7 +2154,7 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int cnt){
|
||||
** may have been appended to the log before READ_LOCK(0) was obtained.
|
||||
** When holding READ_LOCK(0), the reader ignores the entire log file,
|
||||
** which implies that the database file contains a trustworthy
|
||||
** snapshoT. Since holding READ_LOCK(0) prevents a checkpoint from
|
||||
** snapshot. Since holding READ_LOCK(0) prevents a checkpoint from
|
||||
** happening, this is usually correct.
|
||||
**
|
||||
** However, if frames have been appended to the log (or if the log
|
||||
@ -2822,7 +2822,7 @@ int sqlite3WalFrames(
|
||||
**
|
||||
** Padding and syncing only occur if this set of frames complete a
|
||||
** transaction and if PRAGMA synchronous=FULL. If synchronous==NORMAL
|
||||
** or synchonous==OFF, then no padding or syncing are needed.
|
||||
** or synchronous==OFF, then no padding or syncing are needed.
|
||||
**
|
||||
** If SQLITE_IOCAP_POWERSAFE_OVERWRITE is defined, then padding is not
|
||||
** needed and only the sync is done. If padding is needed, then the
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
/*
|
||||
** Walk an expression tree. Invoke the callback once for each node
|
||||
** of the expression, while decending. (In other words, the callback
|
||||
** of the expression, while descending. (In other words, the callback
|
||||
** is invoked before visiting children.)
|
||||
**
|
||||
** The return value from the callback should be one of the WRC_*
|
||||
|
52
src/where.c
52
src/where.c
@ -701,7 +701,7 @@ static int isLikeOrGlob(
|
||||
** value of the variable means there is no need to invoke the LIKE
|
||||
** function, then no OP_Variable will be added to the program.
|
||||
** This causes problems for the sqlite3_bind_parameter_name()
|
||||
** API. To workaround them, add a dummy OP_Variable here.
|
||||
** API. To work around them, add a dummy OP_Variable here.
|
||||
*/
|
||||
int r1 = sqlite3GetTempReg(pParse);
|
||||
sqlite3ExprCodeTarget(pParse, pRight, r1);
|
||||
@ -821,7 +821,7 @@ static void transferJoinMarkings(Expr *pDerived, Expr *pBase){
|
||||
** appropriate for indexing exist.
|
||||
**
|
||||
** All examples A through E above satisfy case 2. But if a term
|
||||
** also statisfies case 1 (such as B) we know that the optimizer will
|
||||
** also satisfies case 1 (such as B) we know that the optimizer will
|
||||
** always prefer case 1, so in that case we pretend that case 2 is not
|
||||
** satisfied.
|
||||
**
|
||||
@ -979,7 +979,7 @@ static void exprAnalyzeOrTerm(
|
||||
}
|
||||
if( (chngToIN & getMask(&pWInfo->sMaskSet, pOrTerm->leftCursor))==0 ){
|
||||
/* This term must be of the form t1.a==t2.b where t2 is in the
|
||||
** chngToIN set but t1 is not. This term will be either preceeded
|
||||
** chngToIN set but t1 is not. This term will be either preceded
|
||||
** or follwed by an inverted copy (t2.b==t1.a). Skip this term
|
||||
** and use its inversion. */
|
||||
testcase( pOrTerm->wtFlags & TERM_COPIED );
|
||||
@ -1390,7 +1390,7 @@ static void exprAnalyze(
|
||||
}
|
||||
|
||||
/*
|
||||
** This function searches pList for a entry that matches the iCol-th column
|
||||
** This function searches pList for an entry that matches the iCol-th column
|
||||
** of index pIdx.
|
||||
**
|
||||
** If such an expression is found, its index in pList->a[] is returned. If
|
||||
@ -2140,7 +2140,7 @@ static int whereRangeSkipScanEst(
|
||||
** number of rows that the index scan is expected to visit without
|
||||
** considering the range constraints. If nEq is 0, this is the number of
|
||||
** rows in the index. Assuming no error occurs, *pnOut is adjusted (reduced)
|
||||
** to account for the range contraints pLower and pUpper.
|
||||
** to account for the range constraints pLower and pUpper.
|
||||
**
|
||||
** In the absence of sqlite_stat4 ANALYZE data, or if such data cannot be
|
||||
** used, a single range inequality reduces the search space by a factor of 4.
|
||||
@ -3417,7 +3417,7 @@ static Bitmask codeOneLoopStart(
|
||||
** B: <after the loop>
|
||||
**
|
||||
** Added 2014-05-26: If the table is a WITHOUT ROWID table, then
|
||||
** use an ephermeral index instead of a RowSet to record the primary
|
||||
** use an ephemeral index instead of a RowSet to record the primary
|
||||
** keys of the rows we have already seen.
|
||||
**
|
||||
*/
|
||||
@ -3468,7 +3468,7 @@ static Bitmask codeOneLoopStart(
|
||||
}
|
||||
|
||||
/* Initialize the rowset register to contain NULL. An SQL NULL is
|
||||
** equivalent to an empty rowset. Or, create an ephermeral index
|
||||
** equivalent to an empty rowset. Or, create an ephemeral index
|
||||
** capable of holding primary keys in the case of a WITHOUT ROWID.
|
||||
**
|
||||
** Also initialize regReturn to contain the address of the instruction
|
||||
@ -4221,14 +4221,16 @@ static int whereLoopInsert(WhereLoopBuilder *pBuilder, WhereLoop *pTemplate){
|
||||
** the number of output rows by a factor of 10 and each additional term
|
||||
** reduces the number of output rows by sqrt(2).
|
||||
*/
|
||||
static void whereLoopOutputAdjust(WhereClause *pWC, WhereLoop *pLoop){
|
||||
static void whereLoopOutputAdjust(
|
||||
WhereClause *pWC, /* The WHERE clause */
|
||||
WhereLoop *pLoop, /* The loop to adjust downward */
|
||||
LogEst nRow /* Number of rows in the entire table */
|
||||
){
|
||||
WhereTerm *pTerm, *pX;
|
||||
Bitmask notAllowed = ~(pLoop->prereq|pLoop->maskSelf);
|
||||
int i, j;
|
||||
int nEq = 0; /* Number of = constraints not within likely()/unlikely() */
|
||||
|
||||
if( !OptimizationEnabled(pWC->pWInfo->pParse->db, SQLITE_AdjustOutEst) ){
|
||||
return;
|
||||
}
|
||||
for(i=pWC->nTerm, pTerm=pWC->a; i>0; i--, pTerm++){
|
||||
if( (pTerm->wtFlags & TERM_VIRTUAL)!=0 ) break;
|
||||
if( (pTerm->prereqAll & pLoop->maskSelf)==0 ) continue;
|
||||
@ -4240,9 +4242,21 @@ static void whereLoopOutputAdjust(WhereClause *pWC, WhereLoop *pLoop){
|
||||
if( pX->iParent>=0 && (&pWC->a[pX->iParent])==pTerm ) break;
|
||||
}
|
||||
if( j<0 ){
|
||||
pLoop->nOut += (pTerm->truthProb<=0 ? pTerm->truthProb : -1);
|
||||
if( pTerm->truthProb<=0 ){
|
||||
pLoop->nOut += pTerm->truthProb;
|
||||
}else{
|
||||
pLoop->nOut--;
|
||||
if( pTerm->eOperator&WO_EQ ) nEq++;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* TUNING: If there is at least one equality constraint in the WHERE
|
||||
** clause that does not have a likelihood() explicitly assigned to it
|
||||
** then do not let the estimated number of output rows exceed half
|
||||
** the number of rows in the table. */
|
||||
if( nEq && pLoop->nOut>nRow-10 ){
|
||||
pLoop->nOut = nRow - 10;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -4288,6 +4302,7 @@ static int whereLoopAddBtreeIndex(
|
||||
LogEst saved_nOut; /* Original value of pNew->nOut */
|
||||
int iCol; /* Index of the column in the table */
|
||||
int rc = SQLITE_OK; /* Return code */
|
||||
LogEst rSize; /* Number of rows in the table */
|
||||
LogEst rLogSize; /* Logarithm of table size */
|
||||
WhereTerm *pTop = 0, *pBtm = 0; /* Top and bottom range constraints */
|
||||
|
||||
@ -4317,7 +4332,8 @@ static int whereLoopAddBtreeIndex(
|
||||
saved_prereq = pNew->prereq;
|
||||
saved_nOut = pNew->nOut;
|
||||
pNew->rSetup = 0;
|
||||
rLogSize = estLog(pProbe->aiRowLogEst[0]);
|
||||
rSize = pProbe->aiRowLogEst[0];
|
||||
rLogSize = estLog(rSize);
|
||||
|
||||
/* Consider using a skip-scan if there are no WHERE clause constraints
|
||||
** available for the left-most terms of the index, and if the average
|
||||
@ -4494,7 +4510,7 @@ static int whereLoopAddBtreeIndex(
|
||||
nOutUnadjusted = pNew->nOut;
|
||||
pNew->rRun += nInMul + nIn;
|
||||
pNew->nOut += nInMul + nIn;
|
||||
whereLoopOutputAdjust(pBuilder->pWC, pNew);
|
||||
whereLoopOutputAdjust(pBuilder->pWC, pNew, rSize);
|
||||
rc = whereLoopInsert(pBuilder, pNew);
|
||||
|
||||
if( pNew->wsFlags & WHERE_COLUMN_RANGE ){
|
||||
@ -4707,7 +4723,7 @@ static int whereLoopAddBtree(
|
||||
ApplyCostMultiplier(pNew->rSetup, pTab->costMult);
|
||||
/* TUNING: Each index lookup yields 20 rows in the table. This
|
||||
** is more than the usual guess of 10 rows, since we have no way
|
||||
** of knowning how selective the index will ultimately be. It would
|
||||
** of knowing how selective the index will ultimately be. It would
|
||||
** not be unreasonable to make this value much larger. */
|
||||
pNew->nOut = 43; assert( 43==sqlite3LogEst(20) );
|
||||
pNew->rRun = sqlite3LogEstAdd(rLogSize,pNew->nOut);
|
||||
@ -4748,7 +4764,7 @@ static int whereLoopAddBtree(
|
||||
/* TUNING: Cost of full table scan is (N*3.0). */
|
||||
pNew->rRun = rSize + 16;
|
||||
ApplyCostMultiplier(pNew->rRun, pTab->costMult);
|
||||
whereLoopOutputAdjust(pWC, pNew);
|
||||
whereLoopOutputAdjust(pWC, pNew, rSize);
|
||||
rc = whereLoopInsert(pBuilder, pNew);
|
||||
pNew->nOut = rSize;
|
||||
if( rc ) break;
|
||||
@ -4784,7 +4800,7 @@ static int whereLoopAddBtree(
|
||||
pNew->rRun = sqlite3LogEstAdd(pNew->rRun, rSize+16);
|
||||
}
|
||||
ApplyCostMultiplier(pNew->rRun, pTab->costMult);
|
||||
whereLoopOutputAdjust(pWC, pNew);
|
||||
whereLoopOutputAdjust(pWC, pNew, rSize);
|
||||
rc = whereLoopInsert(pBuilder, pNew);
|
||||
pNew->nOut = rSize;
|
||||
if( rc ) break;
|
||||
@ -5137,7 +5153,7 @@ static int whereLoopAddAll(WhereLoopBuilder *pBuilder){
|
||||
** strict. With GROUP BY and DISTINCT the only requirement is that
|
||||
** equivalent rows appear immediately adjacent to one another. GROUP BY
|
||||
** and DISTINCT do not require rows to appear in any particular order as long
|
||||
** as equivelent rows are grouped together. Thus for GROUP BY and DISTINCT
|
||||
** as equivalent rows are grouped together. Thus for GROUP BY and DISTINCT
|
||||
** the pOrderBy terms can be matched in any order. With ORDER BY, the
|
||||
** pOrderBy terms must be matched in strict left-to-right order.
|
||||
*/
|
||||
|
@ -176,7 +176,7 @@ static int whereLoopResize(sqlite3*, WhereLoop*, int);
|
||||
** 1. Then using those as a basis to compute the N best WherePath objects
|
||||
** of length 2. And so forth until the length of WherePaths equals the
|
||||
** number of nodes in the FROM clause. The best (lowest cost) WherePath
|
||||
** at the end is the choosen query plan.
|
||||
** at the end is the chosen query plan.
|
||||
*/
|
||||
struct WherePath {
|
||||
Bitmask maskLoop; /* Bitmask of all WhereLoop objects in this path */
|
||||
|
303
test/whereJ.test
303
test/whereJ.test
@ -373,50 +373,271 @@ do_execsql_test whereJ-2.2 {
|
||||
|
||||
############################################################################
|
||||
|
||||
ifcapable stat4 {
|
||||
# Create and populate table.
|
||||
do_execsql_test 3.1 { CREATE TABLE t1(a, b, c) }
|
||||
for {set i 0} {$i < 32} {incr i 2} {
|
||||
for {set x 0} {$x < 100} {incr x} {
|
||||
execsql { INSERT INTO t1 VALUES($i, $x, $c) }
|
||||
incr c
|
||||
}
|
||||
execsql { INSERT INTO t1 VALUES($i+1, 5, $c) }
|
||||
# Create and populate table.
|
||||
do_execsql_test 3.1 { CREATE TABLE t1(a, b, c) }
|
||||
for {set i 0} {$i < 32} {incr i 2} {
|
||||
for {set x 0} {$x < 100} {incr x} {
|
||||
execsql { INSERT INTO t1 VALUES($i, $x, $c) }
|
||||
incr c
|
||||
}
|
||||
|
||||
do_execsql_test 3.2 {
|
||||
SELECT a, count(*) FROM t1 GROUP BY a HAVING a < 8;
|
||||
} {
|
||||
0 100 1 1 2 100 3 1 4 100 5 1 6 100 7 1
|
||||
}
|
||||
|
||||
do_execsql_test 3.3 {
|
||||
CREATE INDEX idx_ab ON t1(a, b);
|
||||
CREATE INDEX idx_c ON t1(c);
|
||||
ANALYZE;
|
||||
} {}
|
||||
|
||||
# This one should use index "idx_c".
|
||||
do_eqp_test 3.4 {
|
||||
SELECT * FROM t1 WHERE
|
||||
a = 4 AND b BETWEEN 20 AND 80 -- Matches 80 rows
|
||||
AND
|
||||
c BETWEEN 150 AND 160 -- Matches 10 rows
|
||||
} {
|
||||
0 0 0 {SEARCH TABLE t1 USING INDEX idx_c (c>? AND c<?)}
|
||||
}
|
||||
|
||||
# This one should use index "idx_ab".
|
||||
do_eqp_test 3.5 {
|
||||
SELECT * FROM t1 WHERE
|
||||
a = 5 AND b BETWEEN 20 AND 80 -- Matches 1 row
|
||||
AND
|
||||
c BETWEEN 150 AND 160 -- Matches 10 rows
|
||||
} {
|
||||
0 0 0 {SEARCH TABLE t1 USING INDEX idx_ab (a=? AND b>? AND b<?)}
|
||||
}
|
||||
execsql { INSERT INTO t1 VALUES($i+1, 5, $c) }
|
||||
incr c
|
||||
}
|
||||
|
||||
do_execsql_test 3.2 {
|
||||
SELECT a, count(*) FROM t1 GROUP BY a HAVING a < 8;
|
||||
} {
|
||||
0 100 1 1 2 100 3 1 4 100 5 1 6 100 7 1
|
||||
}
|
||||
|
||||
do_execsql_test 3.3 {
|
||||
CREATE INDEX idx_ab ON t1(a, b);
|
||||
CREATE INDEX idx_c ON t1(c);
|
||||
ANALYZE;
|
||||
} {}
|
||||
|
||||
# This one should use index "idx_c".
|
||||
do_eqp_test 3.4 {
|
||||
SELECT * FROM t1 WHERE
|
||||
a = 4 AND b BETWEEN 20 AND 80 -- Matches 80 rows
|
||||
AND
|
||||
c BETWEEN 150 AND 160 -- Matches 10 rows
|
||||
} {
|
||||
0 0 0 {SEARCH TABLE t1 USING INDEX idx_c (c>? AND c<?)}
|
||||
}
|
||||
|
||||
# This one should use index "idx_ab".
|
||||
do_eqp_test 3.5 {
|
||||
SELECT * FROM t1 WHERE
|
||||
a = 5 AND b BETWEEN 20 AND 80 -- Matches 1 row
|
||||
AND
|
||||
c BETWEEN 150 AND 160 -- Matches 10 rows
|
||||
} {
|
||||
0 0 0 {SEARCH TABLE t1 USING INDEX idx_ab (a=? AND b>? AND b<?)}
|
||||
}
|
||||
|
||||
###########################################################################################
|
||||
|
||||
# Reset the database and setup for a test case derived from actual SQLite users
|
||||
#
|
||||
db close
|
||||
sqlite3 db test.db
|
||||
do_execsql_test 4.1 {
|
||||
CREATE TABLE le(
|
||||
le_id largeint,
|
||||
xid char(31),
|
||||
type smallint,
|
||||
name char(255) DEFAULT '',
|
||||
mtime largeint DEFAULT 0,
|
||||
muuid int DEFAULT 0
|
||||
);
|
||||
CREATE TABLE cx(
|
||||
cx_id largeint,
|
||||
code char(31),
|
||||
type smallint,
|
||||
name char(31),
|
||||
description varchar,
|
||||
role smallint,
|
||||
mtime largeint DEFAULT 0,
|
||||
muuid int DEFAULT 0,
|
||||
le_id largeint DEFAULT 0,
|
||||
imco smallint DEFAULT 0
|
||||
);
|
||||
CREATE TABLE px(
|
||||
px_id largeint,
|
||||
cx_id largeint,
|
||||
px_tid largeint,
|
||||
name char(31),
|
||||
description varchar DEFAULT '',
|
||||
ia smallint,
|
||||
sl smallint,
|
||||
le_id largeint DEFAULT 0,
|
||||
mtime largeint DEFAULT 0,
|
||||
muuid int DEFAULT 0
|
||||
);
|
||||
CREATE INDEX le_id on le (le_id);
|
||||
CREATE INDEX c_id on cx (cx_id);
|
||||
CREATE INDEX c_leid on cx (le_id);
|
||||
CREATE INDEX p_id on px (px_id);
|
||||
CREATE INDEX p_cid0 on px (cx_id);
|
||||
CREATE INDEX p_pt on px (px_tid);
|
||||
CREATE INDEX p_leid on px (le_id);
|
||||
} {}
|
||||
do_execsql_test 4.2 {
|
||||
ANALYZE sqlite_master;
|
||||
INSERT INTO sqlite_stat1 VALUES('le','le_id','1979 1');
|
||||
INSERT INTO sqlite_stat1 VALUES('cx','c_leid','852 171');
|
||||
INSERT INTO sqlite_stat1 VALUES('cx','c_id','852 1');
|
||||
INSERT INTO sqlite_stat1 VALUES('px','p_leid','114443 63');
|
||||
INSERT INTO sqlite_stat1 VALUES('px','p_pt','114443 22889');
|
||||
INSERT INTO sqlite_stat1 VALUES('px','p_cid0','114443 181');
|
||||
INSERT INTO sqlite_stat1 VALUES('px','p_id','114443 1');
|
||||
INSERT INTO sqlite_stat4 VALUES('le','le_id','1 1','162 162','162 162',X'030202013903fb');
|
||||
INSERT INTO sqlite_stat4 VALUES('le','le_id','1 1','208 208','208 208',X'0302020253012d');
|
||||
INSERT INTO sqlite_stat4 VALUES('le','le_id','1 1','219 219','219 219',X'030202025e0131');
|
||||
INSERT INTO sqlite_stat4 VALUES('le','le_id','1 1','248 248','248 248',X'030202027b014e');
|
||||
INSERT INTO sqlite_stat4 VALUES('le','le_id','1 1','265 265','265 265',X'030202028c015f');
|
||||
INSERT INTO sqlite_stat4 VALUES('le','le_id','1 1','358 358','358 358',X'03020202e901bc');
|
||||
INSERT INTO sqlite_stat4 VALUES('le','le_id','1 1','439 439','439 439',X'030202033a020d');
|
||||
INSERT INTO sqlite_stat4 VALUES('le','le_id','1 1','657 657','657 657',X'030202041402b4');
|
||||
INSERT INTO sqlite_stat4 VALUES('le','le_id','1 1','659 659','659 659',X'030202041602b6');
|
||||
INSERT INTO sqlite_stat4 VALUES('le','le_id','1 1','681 681','681 681',X'030202042c02cc');
|
||||
INSERT INTO sqlite_stat4 VALUES('le','le_id','1 1','831 831','831 831',X'03020204c20482');
|
||||
INSERT INTO sqlite_stat4 VALUES('le','le_id','1 1','852 852','852 852',X'03020204d70497');
|
||||
INSERT INTO sqlite_stat4 VALUES('le','le_id','1 1','870 870','870 870',X'03020204e904a9');
|
||||
INSERT INTO sqlite_stat4 VALUES('le','le_id','1 1','879 879','879 879',X'03020204f204b2');
|
||||
INSERT INTO sqlite_stat4 VALUES('le','le_id','1 1','1099 1099','1099 1099',X'03020205ce058e');
|
||||
INSERT INTO sqlite_stat4 VALUES('le','le_id','1 1','1273 1273','1273 1273',X'030202067c05a9');
|
||||
INSERT INTO sqlite_stat4 VALUES('le','le_id','1 1','1319 1319','1319 1319',X'03020206e30730');
|
||||
INSERT INTO sqlite_stat4 VALUES('le','le_id','1 1','1330 1330','1330 1330',X'0302020700035b');
|
||||
INSERT INTO sqlite_stat4 VALUES('le','le_id','1 1','1539 1539','1539 1539',X'03020207d105d8');
|
||||
INSERT INTO sqlite_stat4 VALUES('le','le_id','1 1','1603 1603','1603 1603',X'03020208390780');
|
||||
INSERT INTO sqlite_stat4 VALUES('le','le_id','1 1','1759 1759','1759 1759',X'030202092f0618');
|
||||
INSERT INTO sqlite_stat4 VALUES('le','le_id','1 1','1843 1843','1843 1843',X'03020209880650');
|
||||
INSERT INTO sqlite_stat4 VALUES('le','le_id','1 1','1915 1915','1915 1915',X'03020209d0068b');
|
||||
INSERT INTO sqlite_stat4 VALUES('le','le_id','1 1','1927 1927','1927 1927',X'03020209dc0697');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_leid','846 1','0 94','0 94',X'0308015f');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_leid','846 1','0 189','0 189',X'03080200be');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_leid','846 1','0 284','0 284',X'0308020120');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_leid','846 1','0 379','0 379',X'030802017f');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_leid','846 1','0 474','0 474',X'03080201de');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_leid','846 1','0 569','0 569',X'030802023d');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_leid','846 1','0 664','0 664',X'030802029f');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_leid','846 1','0 759','0 759',X'03080202fe');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_leid','3 1','846 847','1 847',X'0301024500e6');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_leid','1 1','849 849','2 849',X'03010246027e');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_leid','1 1','850 850','3 850',X'0301024700c9');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_leid','1 1','851 851','4 851',X'03010248027f');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_id','1 1','94 94','94 94',X'03020200b801a8');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_id','1 1','113 113','113 113',X'03020200d101ad');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_id','1 1','171 171','171 171',X'030201011d2a');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_id','1 1','177 177','177 177',X'030202012600f2');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_id','1 1','189 189','189 189',X'030202013501c8');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_id','1 1','206 206','206 206',X'030201014f2d');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_id','1 1','231 231','231 231',X'030202016d00fc');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_id','1 1','284 284','284 284',X'03020201b702d0');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_id','1 1','291 291','291 291',X'03020101c042');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_id','1 1','311 311','311 311',X'03020201d801e7');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_id','1 1','339 339','339 339',X'03020101f74b');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_id','1 1','347 347','347 347',X'03020202030118');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_id','1 1','379 379','379 379',X'030202022f01fa');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_id','1 1','393 393','393 393',X'030201023f55');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_id','1 1','407 407','407 407',X'03020202500201');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_id','1 1','413 413','413 413',X'03020102565a');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_id','1 1','468 468','468 468',X'030201029468');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_id','1 1','474 474','474 474',X'030202029a0211');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_id','1 1','517 517','517 517',X'03020102cc76');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_id','1 1','548 548','548 548',X'03020202f00223');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_id','1 1','569 569','569 569',X'03020203090087');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_id','1 1','664 664','664 664',X'03020203740163');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_id','1 1','759 759','759 759',X'03020203e800b3');
|
||||
INSERT INTO sqlite_stat4 VALUES('cx','c_id','1 1','803 803','803 803',X'030202041b026f');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_leid','110728 1','0 12715','0 12715',X'030802345b');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_leid','110728 1','0 25431','0 25431',X'0308026718');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_leid','110728 1','0 38147','0 38147',X'030803009a5c');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_leid','110728 1','0 50863','0 50863',X'03080300cdbe');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_leid','110728 1','0 63579','0 63579',X'0308030100e8');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_leid','110728 1','0 76295','0 76295',X'03080301351d');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_leid','110728 1','0 89011','0 89011',X'03080301674c');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_leid','110728 1','0 101727','0 101727',X'030803019b99');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_leid','28 1','110824 110843','16 110843',X'0301037a0107f1');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_leid','53 1','110873 110875','25 110875',X'0302020095275a');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_leid','32 1','110927 110936','27 110936',X'030203009b009b4a');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_leid','51 1','110980 111017','30 111017',X'03020300a4016c00');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_leid','67 1','111047 111059','38 111059',X'03020200af2611');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_leid','60 1','111136 111156','43 111156',X'03020300bc009aeb');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_leid','42 1','111222 111239','59 111239',X'03020300d200b17b');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_leid','36 1','111264 111266','60 111266',X'03020200d426d6');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_leid','27 1','111733 111757','159 111757',X'030203014e017e1b');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_leid','36 1','111760 111773','160 111773',X'030203014f00a2b9');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_leid','29 1','111822 111833','167 111833',X'0302030176009c22');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_leid','75 1','113031 113095','1190 113095',X'030203068501912c');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_leid','132 1','113230 113263','1252 113263',X'0302030711009ee6');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_leid','110 1','113851 113918','1572 113918',X'03020308e9011ca2');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_leid','78 1','114212 114217','1791 114217',X'03020209e13b24');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_leid','112 1','114303 114351','1799 114351',X'03020309ea0128f2');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_pt','89824 1','0 12715','0 12715',X'030802477e');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_pt','89824 1','0 25431','0 25431',X'0308027c20');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_pt','89824 1','0 38147','0 38147',X'03080300c211');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_pt','89824 1','0 50863','0 50863',X'03080300fbe5');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_pt','89824 1','0 63579','0 63579',X'0308030140ff');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_pt','89824 1','0 76295','0 76295',X'03080301792d');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_pt','89824 1','0 89011','0 89011',X'03080301bb68');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_pt','24217 1','89824 101727','1 101727',X'03090300da12');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_pt','154 1','114041 114154','2 114154',X'0301030200e5e9');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_pt','198 1','114195 114351','3 114351',X'03010303015cb1');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_pt','50 1','114393 114441','4 114441',X'0301030401b2ef');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_cid0','3867 1','3 3736','2 3736',X'03010337015c6a');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_cid0','4194 1','4177 8209','5 8209',X'0301033b015075');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_cid0','4335 1','8371 11129','6 11129',X'0301033d0156fc');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_cid0','1740 1','12706 12715','7 12715',X'0301023e34b9');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_cid0','1680 1','14446 15487','8 15487',X'0301033f011694');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_cid0','7163 1','20116 25431','32 25431',X'03020300a400ed26');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_cid0','1525 1','29100 29302','42 29302',X'03020200bb00d1');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_cid0','3703 1','30655 33323','45 33323',X'03020300be013fa5');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_cid0','2612 1','37767 38147','61 38147',X'03020200e32828');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_cid0','1882 1','40545 41584','63 41584',X'03020300ea01a35a');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_cid0','6984 1','44110 50863','73 50863',X'0302030102017467');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_cid0','1728 1','51230 51680','75 51680',X'030203010400b3e0');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_cid0','2805 1','55491 57936','95 57936',X'030203014101a004');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_cid0','2837 1','58934 59506','103 59506',X'030203015900a283');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_cid0','94 1','63492 63579','137 63579',X'0302030191016319');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_cid0','3573 1','63591 64497','140 64497',X'030203019c00822e');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_cid0','5037 1','70917 73033','160 73033',X'03020301c70091d9');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_cid0','1940 1','75954 76295','161 76295',X'03020201c817f1');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_cid0','1927 1','83926 84371','209 84371',X'03020202114295');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_cid0','1522 1','86601 88117','213 88117',X'030203021b01b7b5');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_cid0','210 1','88906 89011','226 89011',X'030203022800dbbb');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_cid0','6165 1','92125 98066','258 98066',X'030203024d0189ac');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_cid0','2900 1','100721 101727','293 101727',X'030203027500cf39');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_cid0','1501 1','110012 110154','503 110154',X'0302020380493a');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_id','1 1','11129 11129','11129 11129',X'03030300d84e014d51');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_id','1 1','12715 12715','12715 12715',X'03030200de816f51');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_id','1 1','13030 13030','13030 13030',X'03030200e05b6fc4');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_id','1 1','25431 25431','25431 25431',X'0303030123df00efb0');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_id','1 1','29302 29302','29302 29302',X'030302013a2812c7');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_id','1 1','35463 35463','35463 35463',X'03030301666e00f866');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_id','1 1','38147 38147','38147 38147',X'030302017a391b74');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_id','1 1','38525 38525','38525 38525',X'030303017c6e00fb58');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_id','1 1','50863 50863','50863 50863',X'03030201b68724dd');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_id','1 1','58461 58461','58461 58461',X'03030201d95b2e1e');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_id','1 1','59506 59506','59506 59506',X'03030301dd7000a0fb');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_id','1 1','63468 63468','63468 63468',X'03030301ecea011405');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_id','1 1','63579 63579','63579 63579',X'03030201ed5932d5');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_id','1 1','64497 64497','64497 64497',X'03030301f0ef00a680');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_id','1 1','73033 73033','73033 73033',X'0303030225b90190e5');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_id','1 1','75650 75650','75650 75650',X'030303023a19019362');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_id','1 1','76295 76295','76295 76295',X'030303023e9801940c');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_id','1 1','79152 79152','79152 79152',X'030303024be50196b9');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_id','1 1','83249 83249','83249 83249',X'0303030261750123b1');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_id','1 1','89011 89011','89011 89011',X'030303027b3900c3af');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_id','1 1','98066 98066','98066 98066',X'03030302a76500ce54');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_id','1 1','101590 101590','101590 101590',X'03030302b63d00d3b5');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_id','1 1','101727 101727','101727 101727',X'03030202b6f24e9b');
|
||||
INSERT INTO sqlite_stat4 VALUES('px','p_id','1 1','107960 107960','107960 107960',X'03030302d8ce0136ad');
|
||||
ANALYZE sqlite_master;
|
||||
} {}
|
||||
|
||||
# The following query should do a full table scan of cx in the outer loop.
|
||||
# It is not correct to search table px using indx p_pt in the outer loop
|
||||
# with cx in the middle loop. Test case from Bloomberg on 2014-09-05.
|
||||
#
|
||||
do_execsql_test 4.2 {
|
||||
EXPLAIN QUERY PLAN
|
||||
SELECT
|
||||
px.name,
|
||||
px.description
|
||||
FROM
|
||||
le,
|
||||
cx,
|
||||
px
|
||||
WHERE
|
||||
cx.code = '2990'
|
||||
AND cx.type=2
|
||||
AND px.cx_id = cx.cx_id
|
||||
AND px.px_tid = 0
|
||||
AND px.le_id = le.le_id;
|
||||
} {/.*SCAN TABLE cx.*SEARCH TABLE px.*SEARCH TABLE le.*/}
|
||||
|
||||
|
||||
finish_test
|
||||
|
Loading…
Reference in New Issue
Block a user