Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a81eb93bba | |||
| 2acd24d90c | |||
| 97258194a2 | |||
| 559656196b | |||
| 2def2f7e0a | |||
| 3df6c3b1c5 | |||
| a19543fe70 | |||
| 154896e8d2 | |||
| 3ed0f1c936 | |||
| 629ec14abc | |||
| 263a8b660f | |||
| bb6896226f | |||
| 4c08735732 | |||
| d33bcb8a3c | |||
| 74588ceb31 | |||
| 77187faf5a | |||
| bf60baa985 | |||
| 702948edbe | |||
| ca90eced28 | |||
| 3ba18adde5 | |||
| b9772e7fe8 | |||
| 3e1e14d818 | |||
| 68262d85ec | |||
| fa7b471c35 | |||
| 9ecd7086c1 | |||
| c2c6fd18dd | |||
| 226cef4ef1 | |||
| d351e7643f |
+2
-2
@@ -78,7 +78,7 @@ struct CsvReader {
|
||||
int nAlloc; /* Space allocated for z[] */
|
||||
int nLine; /* Current line number */
|
||||
int bNotFirst; /* True if prior text has been seen */
|
||||
char cTerm; /* Character that terminated the most recent field */
|
||||
int cTerm; /* Character that terminated the most recent field */
|
||||
size_t iIn; /* Next unread character in the input buffer */
|
||||
size_t nIn; /* Number of characters in the input buffer */
|
||||
char *zIn; /* The input buffer */
|
||||
@@ -166,7 +166,7 @@ static int csv_getc(CsvReader *p){
|
||||
if( p->in!=0 ) return csv_getc_refill(p);
|
||||
return EOF;
|
||||
}
|
||||
return p->zIn[p->iIn++];
|
||||
return ((unsigned char*)p->zIn)[p->iIn++];
|
||||
}
|
||||
|
||||
/* Increase the size of p->z and append character c to the end.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
C Refactor\snames\sof\sconstants\sand\sfunctions\sassociated\swith\sthe\sauxiliary\noperators\sfor\sxBestIndex.
|
||||
D 2017-09-11T19:47:37.315
|
||||
C Merge\slatest\strunk\schanges\swith\sthis\sbranch.
|
||||
D 2017-09-18T08:51:04.787
|
||||
F Makefile.in c644bbe8ebe4aae82ad6783eae6b6beea4c727b99ff97568b847ced5e2ac7afb
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc 6a7a74bf60ad395098c0bd175ab054cd65ef85d7f034198d52bcc4d9e5fb4c6b
|
||||
@@ -262,7 +262,7 @@ F ext/misc/carray.c ed96c218ea940b85c9a274c4d9c59fe9491c299147a38a8bba537687bd6c
|
||||
F ext/misc/closure.c 0d2a038df8fbae7f19de42e7c7d71f2e4dc88704
|
||||
F ext/misc/completion.c 52c3f01523e3e387eb321b4739a89d1fe47cbe6025aa1f2d8d3685e9e365df0f
|
||||
F ext/misc/compress.c 122faa92d25033d6c3f07c39231de074ab3d2e83
|
||||
F ext/misc/csv.c b10ea114cf29f446e384064ae61e01373b431f6f172896f41ca0ba3507709003
|
||||
F ext/misc/csv.c 1a009b93650732e22334edc92459c4630b9fa703397cbb3c8ca279921a36ca11
|
||||
F ext/misc/dbdump.c 3509fa6b8932d04e932d6b6b827b6a82ca362781b8e8f3c77336f416793e215e
|
||||
F ext/misc/eval.c f971962e92ebb8b0a4e6b62949463ee454d88fa2
|
||||
F ext/misc/fileio.c b1aa06c0f1dac277695d4529e5e976c65ab5678dcbb53a0304deaa8adc44b332
|
||||
@@ -410,10 +410,10 @@ F src/ctime.c ff1be3eed7bdd75aaca61ca8dc848f7c9f850ef2fb9cb56f2734e922a098f9c0
|
||||
F src/date.c 48f743d88bbe88f848532d333cca84f26e52a4f217e86f86be7fc1b919c33d74
|
||||
F src/dbstat.c 7a4ba8518b6369ef3600c49cf9c918ad979acba610b2aebef1b656d649b96720
|
||||
F src/delete.c 21a5f1812fdb599e9f7afb9f650bdabab60a3afd51d7e94e539c982f647b0023
|
||||
F src/expr.c 0f611840217016cf2c5e72f2eb8e412e48511bf740ae1fd5b58dc5e409c6e738
|
||||
F src/expr.c 38a225057f5b7d6a2bc403d7a5d3a67f59ee57b73fe7c546221e3c53202a3731
|
||||
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
|
||||
F src/fkey.c 5ff2c895fe087756d8085dc1a9bc229b5670e2a65c3929dd87c71e43649af333
|
||||
F src/func.c b4d259af627e3cd9510cf08db37f0bcc88b1887c735169c74490c3739d5cf5c6
|
||||
F src/func.c 8c46246dcb5779e77bf2ef192fa1355460aeec1d3d0b2537608d319bcd7d8778
|
||||
F src/global.c ac3094f1dc59fbeb919aef7cc0cc827a8459d1fb1adb7972ef75bd9e0c10b75b
|
||||
F src/hash.c a12580e143f10301ed5166ea4964ae2853d3905a511d4e0c44497245c7ce1f7a
|
||||
F src/hash.h ab34c5c54a9e9de2e790b24349ba5aab3dbb4fd4
|
||||
@@ -422,7 +422,7 @@ F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
|
||||
F src/insert.c d2d1bf12d2b5382450620d7cede84c7ffe57e6a89fa9a908f1aba68df2731cd9
|
||||
F src/legacy.c 134ab3e3fae00a0f67a5187981d6935b24b337bcf0f4b3e5c9fa5763da95bf4e
|
||||
F src/loadext.c 20865b183bb8a3723d59cf1efffc3c50217eb452c1021d077b908c94da26b0b2
|
||||
F src/main.c 34a58563358fe40979186124d1a3614b9a00c833124d7ebfa8e5d604ed1d2521
|
||||
F src/main.c cd03aeca7a9d5f221010d0212b3abdd558e37a317947f8e78dd9162a5d904223
|
||||
F src/malloc.c a02c9e69bc76bee0f639416b947a946412890b606301454727feadcb313536d6
|
||||
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
|
||||
F src/mem1.c c12a42539b1ba105e3707d0e628ad70e611040d8f5e38cf942cee30c867083de
|
||||
@@ -441,29 +441,29 @@ F src/os.c 93e0979b9b55df29c0c4923f73b48e9d3fe728f01dd8ed4f6a9d2f1d79779bc8
|
||||
F src/os.h 8e976e59eb4ca1c0fca6d35ee803e38951cb0343
|
||||
F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
|
||||
F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586
|
||||
F src/os_unix.c 489aa972ccc34f7b4770b891694b32101c59ddd4be4ef0ddd9a4da58c145c1a6
|
||||
F src/os_win.c 964165b66cde03abc72fe948198b01be608436894732eadb94c8720d2467f223
|
||||
F src/os_unix.c dffae52f34dbdc5f270616254b490c61d8e104a7a8fb5ceaa865db25f139ba3c
|
||||
F src/os_win.c 225432ab6512f63ab2f37eb76872f818b01f0483ba0bea04a7a1168be3070ea5
|
||||
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
|
||||
F src/pager.c 967168bba88d2dc790ed9618bd4ba7bfe475b67b521ef6da305a6425c592928f
|
||||
F src/pager.c 2a523bf8ec77678b35fe56b43ac24045d2f97ad44d58c6a0894c131feda3eeff
|
||||
F src/pager.h 581698f2177e8bd4008fe4760898ce20b6133d1df22139b9101b5155f900df7a
|
||||
F src/parse.y 52ef3cecd0934e9da4a45b585883a03243ad615d338ad94f44501a05891dcdfa
|
||||
F src/pcache.c 4bada070456980c3c1f16d58ec2e64e389ad77b935e3d77e0c96e7bbd397289c
|
||||
F src/pcache.h 072f94d29281cffd99e46c1539849f248c4b56ae7684c1f36626797fee375170
|
||||
F src/pcache1.c 716975564c15eb6679e97f734cec1bfd6c16ac3d4010f05f1f8e509fc7d19880
|
||||
F src/pragma.c faf5f9ec553b71035c63e08d31651bbd28bec826d546b32c8e9c295855ca3605
|
||||
F src/pragma.c 88d99aa4752894aaf4102eefd09b5e497f4277661aff69f8fff61f8611f19d14
|
||||
F src/pragma.h bb83728944b42f6d409c77f5838a8edbdb0fe83046c5496ffc9602b40340a324
|
||||
F src/prepare.c 9a141a1b02dca53beaa9771699d390aafcac01f5d1f1c0ae6e23ded8dcdb709a
|
||||
F src/printf.c 40aee47ae9be4bd3dbdc8968bd07fddc027be8edec8daddf24d3391d36698a1c
|
||||
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
|
||||
F src/random.c f27af4099afaea7284ade5c206224dcfdb2334cfd119d018b470d46356b3f27d
|
||||
F src/resolve.c 4324a94573b1e29286f8121e4881db59eaedc014afeb274c8d3e07ed282e0e20
|
||||
F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac
|
||||
F src/select.c c9b3d8444bbf6f167d84f41ca6f3672e2521cb163a8c706b19058dc82fffe9b8
|
||||
F src/select.c 420d3f5d9e24f0d81c28a0d4e5f7d7abf07beae6c25ce8981e51638e9e9ee2ae
|
||||
F src/shell.c c1206a23d9239f8f51751d3be9b8c3b02fa4103546bea1add7f864d84a8276ab
|
||||
F src/shell.c.in bb9720a8c5c98d3984b16ab7540e7142bcae959666ecf248bfc523a1d44220ee
|
||||
F src/sqlite.h.in ab4f8a29d1580dfaeb6891fa1b83cff8229ba0daa56994707ceaca71495d9ab7
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h a1fd3aa82f967da436164e0728a7d6841651fd0c6e27b9044e0eb9f6c8462e47
|
||||
F src/sqliteInt.h f9ae3609a583aa51712083e1d5817f62c7d97c0a203036a9a62c439059e8258b
|
||||
F src/sqliteInt.h cfcfc4238dd5d148bc1802d1588a35e16d7e57abb956779b1c3ffb69b90723ed
|
||||
F src/sqliteLimit.h 1513bfb7b20378aa0041e7022d04acb73525de35b80b252f1b83fedb4de6a76b
|
||||
F src/status.c 9737ed017279a9e0c5da748701c3c7bf1e8ae0dae459aad20dd64fcff97a7e35
|
||||
F src/table.c b46ad567748f24a326d9de40e5b9659f96ffff34
|
||||
@@ -523,23 +523,23 @@ F src/treeview.c 2ee4a5dada213d5ab08a742af5c876cee6f1aaae65f10a61923f3fb63846afe
|
||||
F src/trigger.c 48e0f7ed6749ce4d50a695e09e20ce9cf84ecabf2691852c965a51e0b620eccc
|
||||
F src/update.c 5404be9e840717323a69209190cdbc9d0d34adaedaaf1d1a1069babf2c4171c0
|
||||
F src/utf.c 810fbfebe12359f10bc2a011520a6e10879ab2a163bcb26c74768eab82ea62a5
|
||||
F src/util.c 773843506ce694714bc96fe67c30c37015f90ef515d0e70f1f8d5c9c24088152
|
||||
F src/util.c ece10cb34b4a62cbb3aab8d711b67e93a2765e0b81d0f72458cb801a3ac60703
|
||||
F src/vacuum.c 90839322fd5f00df9617eb21b68beda9b6e2a2937576b0d65985e4aeb1c53739
|
||||
F src/vdbe.c 82fc4553a0986a06bdd0d2b03a424e159bba5c74802fabb2841aa6cd27ccd962
|
||||
F src/vdbe.c 0a0ef7f0759ee4c3ed5ff0c6e9641216d4b31ebb0fea9a7b5a9c4a86ce875ff3
|
||||
F src/vdbe.h d50cadf12bcf9fb99117ef392ce1ea283aa429270481426b6e8b0280c101fd97
|
||||
F src/vdbeInt.h 1fe00770144c12c4913128f35262d11527ef3284561baaab59b947a41c08d0d9
|
||||
F src/vdbeapi.c 9c670ca0dcc1cd86373aa353b747b26fe531ca5cd4331690c611d1f03842e2a1
|
||||
F src/vdbeaux.c 2dff8186d34e0e525838f77b2fac70bd480f0273a77015bf21b6a08f2792da82
|
||||
F src/vdbeblob.c db3cf91060f6f4b2f1358a4200e844697990752177784c7c95da00b7ac9f1c7b
|
||||
F src/vdbeaux.c 3be977a032e54fe46cb1b1f3ba62158438b0cc93e091f6feca7742d20dad3203
|
||||
F src/vdbeblob.c 635a79b60340a6a14a622ea8dcb081f0a66b1ac3836870c587f232eec08c0286
|
||||
F src/vdbemem.c 2f9d672af5260f0145787e1dc2c6985414987cc0dc575133a0dc17dda767d868
|
||||
F src/vdbesort.c 731a09e5cb9e96b70c394c1b7cf3860fbe84acca7682e178615eb941a3a0ef2f
|
||||
F src/vdbetrace.c 48e11ebe040c6b41d146abed2602e3d00d621d7ebe4eb29b0a0f1617fd3c2f6c
|
||||
F src/vtab.c f1d5c23132fb0247af3e86146404112283ddedb6c518de0d4edc91cfb36970ef
|
||||
F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
|
||||
F src/wal.c 839db09792fead5052bb35e533fa485e134913d547d05b5f42e537b73e63f07a
|
||||
F src/wal.c 2a205ec9c9be4e4b2933d32481c4654b4c6b644d8a6c755a5f8c7a10ade64616
|
||||
F src/wal.h 8de5d2d3de0956d6f6cb48c83a4012d5f227b8fe940f3a349a4b7e85ebcb492a
|
||||
F src/walker.c 3ccfa8637f95355bff61144e01a615b8ef26f79c312880848da73f03367da1e6
|
||||
F src/where.c d97f97ca6017747b7361af7f168a640d667c41cd1d4e91c2c5b2bd7538815d07
|
||||
F src/where.c 21eea981920a13fd3c0ac3d6c128d0a34b22cbec064e4f0603375fe1ffe26ca6
|
||||
F src/whereInt.h 82c04c5075308abbac59180c8bad5ecb45b07453981f60a53f3c7dee21e1e971
|
||||
F src/wherecode.c e8c2ece5843ea56e6c90277d421f2d628f3f7b7c976642369cc519f008e1d2b1
|
||||
F src/whereexpr.c 4953ca4e769c047d0a00a1ba9085849626b1f3a6e89f6befcf5c38fa0722acdd
|
||||
@@ -676,7 +676,7 @@ F test/corrupt8.test 2399dfe40d2c0c63af86706e30f3e6302a8d0516
|
||||
F test/corrupt9.test 730a3db08d4ab9aa43392ea30d9c2b4879cbff85
|
||||
F test/corruptA.test 112f4b2ae0b95ebf3ea63718642fb969a93acea557ace3a307234d19c245989b
|
||||
F test/corruptB.test 73a8d6c0b9833697ecf16b63e3c5c05c945b5dec
|
||||
F test/corruptC.test 46ec43bd90a02fd7b37ad8a7a949c55aa5717f89
|
||||
F test/corruptC.test 138ecb02188ed1a719b533d4a139568204039f72f00e07a8d30d920bd83122db
|
||||
F test/corruptD.test b3c205fac7952b1de645ce44bb02335cd9e3e040
|
||||
F test/corruptE.test 82ccf4f8f543fdbedd4aa42c709cb077f7374c62
|
||||
F test/corruptF.test be9fde98e4c93648f1ba52b74e5318edc8f59fe4
|
||||
@@ -835,7 +835,7 @@ F test/fts3aux2.test 7ae2b2c13aefdf4169279a27a5f51780ce57f6ba
|
||||
F test/fts3b.test c15c4a9d04e210d0be67e54ce6a87b927168fbf9c1e3faec8c1a732c366fd491
|
||||
F test/fts3c.test fc723a9cf10b397fdfc2b32e73c53c8b1ec02958
|
||||
F test/fts3comp1.test a0f5b16a2df44dd0b15751787130af2183167c0c
|
||||
F test/fts3conf.test 60317efd562080e198b5bdc9fcd222ce32cf01d7
|
||||
F test/fts3conf.test c84bbaec81281c1788aa545ac6e78a6bd6cde2bdbbce2da261690e3659f5a76b
|
||||
F test/fts3corrupt.test 2710b77983cc7789295ddbffea52c1d3b7506dbb
|
||||
F test/fts3corrupt2.test 6d96efae2f8a6af3eeaf283aba437e6d0e5447ba
|
||||
F test/fts3corrupt3.test 56e0ee83e90b57f5f3644cb7d1b36a067b7b8b19cdf0dedce45e5e13cf752f65
|
||||
@@ -1037,7 +1037,7 @@ F test/minmax.test 6751e87b409fe11b02e70a306d846fa544e25a41
|
||||
F test/minmax2.test b44bae787fc7b227597b01b0ca5575c7cb54d3bc
|
||||
F test/minmax3.test cc1e8b010136db0d01a6f2a29ba5a9f321034354
|
||||
F test/minmax4.test 936941484ebdceb8adec7c86b6cd9b6e5e897c1f
|
||||
F test/misc1.test 51ec3f56a2a7965de226964cff856695e743186826561536647f1e8b7d1d0eb3
|
||||
F test/misc1.test 76737c259537586355f45e2a1e121b6e91b5476c4604ad5c53d1abfcb3acf786
|
||||
F test/misc2.test 00d7de54eda90e237fc9a38b9e5ccc769ebf6d4d
|
||||
F test/misc3.test cf3dda47d5dda3e53fc5804a100d3c82be736c9d
|
||||
F test/misc4.test 0d8be3466adf123a7791a66ba2bc8e8d229e87f3
|
||||
@@ -1046,6 +1046,7 @@ F test/misc6.test 953cc693924d88e6117aeba16f46f0bf5abede91
|
||||
F test/misc7.test edd0b63e2ee29a256900b0514f6fff27e19e9bb2
|
||||
F test/misc8.test ba03aaa08f02d62fbb8d3b2f5595c1b33aa9bbc5
|
||||
F test/misuse.test 9e7f78402005e833af71dcab32d048003869eca5abcaccc985d4f8dc1d86bcc7
|
||||
F test/mjournal.test 68b749956f9a179e7e633a3958b48a5a905d28d30c7ec88f3f26dc6f220129db
|
||||
F test/mmap1.test d2cfc1635171c434dcff0ece2f1c8e0a658807ce
|
||||
F test/mmap2.test 9d6dd9ddb4ad2379f29cc78f38ce1e63ed418022
|
||||
F test/mmap3.test b3c297e78e6a8520aafcc1a8f140535594c9086e
|
||||
@@ -1057,7 +1058,7 @@ F test/multiplex3.test d228f59eac91839a977eac19f21d053f03e4d101
|
||||
F test/multiplex4.test e8ae4c4bd70606a5727743241f13b5701990abe4
|
||||
F test/mutex1.test ea2cc74d97f077b9e74c84cbd024f14d79a8126f
|
||||
F test/mutex2.test bfeaeac2e73095b2ac32285d2756e3a65e681660
|
||||
F test/nan.test dacc57f80859c06a433d30839336fe227d2038b3
|
||||
F test/nan.test 437d40e6d0778b050d7750726c0cbd2c9936b81962926e8f8c48ca698f00f4d1
|
||||
F test/nockpt.test 9a436a7213ba5ef7a32304998d386d3ea3f76c9d
|
||||
F test/nolock.test f196cf8b8fbea4e2ca345140a2b3f3b0da45c76e
|
||||
F test/notify1.test 669b2b743618efdc18ca4b02f45423d5d2304abf
|
||||
@@ -1096,7 +1097,7 @@ F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b
|
||||
F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442
|
||||
F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff
|
||||
F test/permutations.test d911c9ba49088d22054a05dc73743f677872a92ac89288bcdeafa0ebf3f9c531
|
||||
F test/pragma.test faa8b64c4be28b67b3a0d3e9c977e2feff7dd2a4b08f2fd062a95d30f8c8fd1c
|
||||
F test/pragma.test c31b5e98998c160a4c85b1e04f590655c67f2daa7f73854640cd120610e3ac15
|
||||
F test/pragma2.test e5d5c176360c321344249354c0c16aec46214c9f
|
||||
F test/pragma3.test 14c12bc5352b1e100e0b6b44f371053a81ccf8ed
|
||||
F test/pragma4.test 6e85b6eab8e61ffc9c7db59d842276674e8e3264
|
||||
@@ -1120,7 +1121,7 @@ F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8
|
||||
F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8
|
||||
F test/regexp2.test 40e894223b3d6672655481493f1be12012f2b33c
|
||||
F test/reindex.test 44edd3966b474468b823d481eafef0c305022254
|
||||
F test/releasetest.tcl 7bb585433ce7fb2a2c255ae4b5e24f1bc27fe177ec1120f886cc4852f48f5ee9 x
|
||||
F test/releasetest.tcl 22bd6be9f227a1ad01ebfaa8ed92400b5eaaff1ecc1e14e269eec2631c7f43ab x
|
||||
F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb
|
||||
F test/rollback.test f580934279800d480a19176c6b44909df31ce7ad45267ea475a541daa522f3d3
|
||||
F test/rollback2.test 8435d6ff0f13f51d2a4181c232e706005fa90fc5
|
||||
@@ -1532,7 +1533,7 @@ F test/whereB.test 0def95db3bdec220a731c7e4bec5930327c1d8c5
|
||||
F test/whereC.test cae295158703cb3fc23bf1a108a9ab730efff0f6
|
||||
F test/whereD.test 711d4df58d6d4fb9b3f5ce040b818564198be002
|
||||
F test/whereE.test b3a055eef928c992b0a33198a7b8dc10eea5ad2f
|
||||
F test/whereF.test ec178da9a65f50d1fefeb0fd1303faa01fe74d1eec5b24db89b040b7c4faa9c7
|
||||
F test/whereF.test 7c426e0bf303407910c21f79d3a6742f7b33c9b27b2dddd230dfc8c2508981a6
|
||||
F test/whereG.test dde4c52a97385a55be6a7cd46be8373f0cf35501
|
||||
F test/whereH.test e4b07f7a3c2f5d31195cd33710054c78667573b2
|
||||
F test/whereI.test eab5b226bbc344ac70d7dc09b963a064860ae6d7
|
||||
@@ -1541,7 +1542,7 @@ F test/whereK.test f8e3cf26a8513ecc7f514f54df9f0572c046c42b
|
||||
F test/wherefault.test 1374c3aa198388925246475f84ad4cd5f9528864
|
||||
F test/wherelimit.test 5e9fd41e79bb2b2d588ed999d641d9c965619b31
|
||||
F test/wild001.test bca33f499866f04c24510d74baf1e578d4e44b1c
|
||||
F test/win32heap.test ea19770974795cff26e11575e12d422dbd16893c
|
||||
F test/win32heap.test 10fd891266bd00af68671e702317726375e5407561d859be1aa04696f2aeee74
|
||||
F test/win32lock.test fbf107c91d8f5512be5a5b87c4c42ab9fdd54972
|
||||
F test/win32longpath.test 169c75a3b2e43481f4a62122510210c67b08f26d
|
||||
F test/win32nolock.test ac4f08811a562e45a5755e661f45ca85892bdbbc
|
||||
@@ -1653,7 +1654,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P d3153abda6fd48015b007081734738b9cc4622e3564dc78a7a470a72dc2ca236
|
||||
R 6bf300e1c6f9b6f8c5e667046a0485fa
|
||||
U drh
|
||||
Z 6c35ef01413cc8966446242df55841d2
|
||||
P 8b1fc4b9f3e743bffcfbbb8e26991240441778e10512fb502b8eaec460184296 42f07775556758754e92e29a759d200d0d81d16eee83ab982b840db11292f834
|
||||
R 4a30c0e0d01ae979fbda091d7fb31409
|
||||
U dan
|
||||
Z 11c76cfa54aab138b4cbd06a81c15433
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
0fb992af669e765760a94d2b6e2330b21a98f39f18445a94b0a2290560368d58
|
||||
2e57335081287a2db9fd20d86a8e98218309a37569e1ca1df8deb5fb198d73ff
|
||||
+16
-8
@@ -1302,10 +1302,9 @@ ExprList *sqlite3ExprListDup(sqlite3 *db, ExprList *p, int flags){
|
||||
Expr *pPriorSelectCol = 0;
|
||||
assert( db!=0 );
|
||||
if( p==0 ) return 0;
|
||||
pNew = sqlite3DbMallocRawNN(db,
|
||||
sizeof(*pNew)+sizeof(pNew->a[0])*(p->nExpr-1) );
|
||||
pNew = sqlite3DbMallocRawNN(db, sqlite3DbMallocSize(db, p));
|
||||
if( pNew==0 ) return 0;
|
||||
pNew->nAlloc = pNew->nExpr = p->nExpr;
|
||||
pNew->nExpr = p->nExpr;
|
||||
pItem = pNew->a;
|
||||
pOldItem = p->a;
|
||||
for(i=0; i<p->nExpr; i++, pItem++, pOldItem++){
|
||||
@@ -1459,6 +1458,13 @@ Select *sqlite3SelectDup(sqlite3 *db, Select *p, int flags){
|
||||
** Add a new element to the end of an expression list. If pList is
|
||||
** initially NULL, then create a new expression list.
|
||||
**
|
||||
** The pList argument must be either NULL or a pointer to an ExprList
|
||||
** obtained from a prior call to sqlite3ExprListAppend(). This routine
|
||||
** may not be used with an ExprList obtained from sqlite3ExprListDup().
|
||||
** Reason: This routine assumes that the number of slots in pList->a[]
|
||||
** is a power of two. That is true for sqlite3ExprListAppend() returns
|
||||
** but is not necessarily true from the return value of sqlite3ExprListDup().
|
||||
**
|
||||
** If a memory allocation error occurs, the entire list is freed and
|
||||
** NULL is returned. If non-NULL is returned, then it is guaranteed
|
||||
** that the new entry was successfully appended.
|
||||
@@ -1477,16 +1483,14 @@ ExprList *sqlite3ExprListAppend(
|
||||
goto no_mem;
|
||||
}
|
||||
pList->nExpr = 0;
|
||||
pList->nAlloc = 1;
|
||||
}else if( pList->nExpr==pList->nAlloc ){
|
||||
}else if( (pList->nExpr & (pList->nExpr-1))==0 ){
|
||||
ExprList *pNew;
|
||||
pNew = sqlite3DbRealloc(db, pList,
|
||||
sizeof(*pList)+(2*pList->nAlloc - 1)*sizeof(pList->a[0]));
|
||||
sizeof(*pList)+(2*pList->nExpr - 1)*sizeof(pList->a[0]));
|
||||
if( pNew==0 ){
|
||||
goto no_mem;
|
||||
}
|
||||
pList = pNew;
|
||||
pList->nAlloc *= 2;
|
||||
}
|
||||
pItem = &pList->a[pList->nExpr++];
|
||||
assert( offsetof(struct ExprList_item,zName)==sizeof(pItem->pExpr) );
|
||||
@@ -4241,7 +4245,9 @@ void sqlite3ExprCodeAndCache(Parse *pParse, Expr *pExpr, int target){
|
||||
** Generate code that pushes the value of every element of the given
|
||||
** expression list into a sequence of registers beginning at target.
|
||||
**
|
||||
** Return the number of elements evaluated.
|
||||
** Return the number of elements evaluated. The number returned will
|
||||
** usually be pList->nExpr but might be reduced if SQLITE_ECEL_OMITREF
|
||||
** is defined.
|
||||
**
|
||||
** The SQLITE_ECEL_DUP flag prevents the arguments from being
|
||||
** filled using OP_SCopy. OP_Copy must be used instead.
|
||||
@@ -4252,6 +4258,8 @@ void sqlite3ExprCodeAndCache(Parse *pParse, Expr *pExpr, int target){
|
||||
** The SQLITE_ECEL_REF flag means that expressions in the list with
|
||||
** ExprList.a[].u.x.iOrderByCol>0 have already been evaluated and stored
|
||||
** in registers at srcReg, and so the value can be copied from there.
|
||||
** If SQLITE_ECEL_OMITREF is also set, then the values with u.x.iOrderByCol>0
|
||||
** are simply omitted rather than being copied from srcReg.
|
||||
*/
|
||||
int sqlite3ExprCodeExprList(
|
||||
Parse *pParse, /* Parsing context */
|
||||
|
||||
+4
-2
@@ -481,8 +481,9 @@ static void randomFunc(
|
||||
sqlite3_value **NotUsed2
|
||||
){
|
||||
sqlite_int64 r;
|
||||
sqlite3 *db = sqlite3_context_db_handle(context);
|
||||
UNUSED_PARAMETER2(NotUsed, NotUsed2);
|
||||
sqlite3_randomness(sizeof(r), &r);
|
||||
sqlite3FastRandomness(&db->sPrng, sizeof(r), &r);
|
||||
if( r<0 ){
|
||||
/* We need to prevent a random number of 0x8000000000000000
|
||||
** (or -9223372036854775808) since when you do abs() of that
|
||||
@@ -508,6 +509,7 @@ static void randomBlob(
|
||||
){
|
||||
int n;
|
||||
unsigned char *p;
|
||||
sqlite3 *db = sqlite3_context_db_handle(context);
|
||||
assert( argc==1 );
|
||||
UNUSED_PARAMETER(argc);
|
||||
n = sqlite3_value_int(argv[0]);
|
||||
@@ -516,7 +518,7 @@ static void randomBlob(
|
||||
}
|
||||
p = contextMalloc(context, n);
|
||||
if( p ){
|
||||
sqlite3_randomness(n, p);
|
||||
sqlite3FastRandomness(&db->sPrng, n, p);
|
||||
sqlite3_result_blob(context, (char*)p, n, sqlite3_free);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2865,6 +2865,7 @@ static int openDatabase(
|
||||
db->nDb = 2;
|
||||
db->magic = SQLITE_MAGIC_BUSY;
|
||||
db->aDb = db->aDbStatic;
|
||||
sqlite3FastPrngInit(&db->sPrng);
|
||||
|
||||
assert( sizeof(db->aLimit)==sizeof(aHardLimit) );
|
||||
memcpy(db->aLimit, aHardLimit, sizeof(db->aLimit));
|
||||
|
||||
+59
-20
@@ -46,6 +46,8 @@
|
||||
#include "sqliteInt.h"
|
||||
#if SQLITE_OS_UNIX /* This file is used on unix only */
|
||||
|
||||
/* #define SQLITE_SHARED_MAPPING 1 */
|
||||
|
||||
/*
|
||||
** There are various methods for file locking used for concurrency
|
||||
** control:
|
||||
@@ -1115,6 +1117,10 @@ struct unixInodeInfo {
|
||||
sem_t *pSem; /* Named POSIX semaphore */
|
||||
char aSemName[MAX_PATHNAME+2]; /* Name of that semaphore */
|
||||
#endif
|
||||
#ifdef SQLITE_SHARED_MAPPING
|
||||
sqlite3_int64 nSharedMapping; /* Size of mapped region in bytes */
|
||||
void *pSharedMapping; /* Memory mapped region */
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -1249,6 +1255,13 @@ static void releaseInodeInfo(unixFile *pFile){
|
||||
pInode->nRef--;
|
||||
if( pInode->nRef==0 ){
|
||||
assert( pInode->pShmNode==0 );
|
||||
#ifdef SQLITE_SHARED_MAPPING
|
||||
if( pInode->pSharedMapping ){
|
||||
osMunmap(pInode->pSharedMapping, pInode->nSharedMapping);
|
||||
pInode->pSharedMapping = 0;
|
||||
pInode->nSharedMapping = 0;
|
||||
}
|
||||
#endif
|
||||
closePendingFds(pFile);
|
||||
if( pInode->pPrev ){
|
||||
assert( pInode->pPrev->pNext==pInode );
|
||||
@@ -2055,6 +2068,14 @@ static int nolockUnlock(sqlite3_file *NotUsed, int NotUsed2){
|
||||
** Close the file.
|
||||
*/
|
||||
static int nolockClose(sqlite3_file *id) {
|
||||
#ifdef SQLITE_SHARED_MAPPING
|
||||
unixFile *pFd = (unixFile*)id;
|
||||
if( pFd->pInode ){
|
||||
unixEnterMutex();
|
||||
releaseInodeInfo(pFd);
|
||||
unixLeaveMutex();
|
||||
}
|
||||
#endif
|
||||
return closeUnixFile(id);
|
||||
}
|
||||
|
||||
@@ -3874,6 +3895,9 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){
|
||||
*(i64*)pArg = pFile->mmapSizeMax;
|
||||
if( newLimit>=0 && newLimit!=pFile->mmapSizeMax && pFile->nFetchOut==0 ){
|
||||
pFile->mmapSizeMax = newLimit;
|
||||
#ifdef SQLITE_SHARED_MAPPING
|
||||
if( pFile->pInode==0 )
|
||||
#endif
|
||||
if( pFile->mmapSize>0 ){
|
||||
unixUnmapfile(pFile);
|
||||
rc = unixMapfile(pFile, -1);
|
||||
@@ -4774,6 +4798,9 @@ static int unixShmUnmap(
|
||||
*/
|
||||
static void unixUnmapfile(unixFile *pFd){
|
||||
assert( pFd->nFetchOut==0 );
|
||||
#ifdef SQLITE_SHARED_MAPPING
|
||||
if( pFd->pInode ) return;
|
||||
#endif
|
||||
if( pFd->pMapRegion ){
|
||||
osMunmap(pFd->pMapRegion, pFd->mmapSizeActual);
|
||||
pFd->pMapRegion = 0;
|
||||
@@ -4905,6 +4932,28 @@ static int unixMapfile(unixFile *pFd, i64 nMap){
|
||||
nMap = pFd->mmapSizeMax;
|
||||
}
|
||||
|
||||
#ifdef SQLITE_SHARED_MAPPING
|
||||
if( pFd->pInode ){
|
||||
unixInodeInfo *pInode = pFd->pInode;
|
||||
if( pFd->pMapRegion ) return SQLITE_OK;
|
||||
unixEnterMutex();
|
||||
if( pInode->pSharedMapping==0 ){
|
||||
u8 *pNew = osMmap(0, nMap, PROT_READ, MAP_SHARED, pFd->h, 0);
|
||||
if( pNew==MAP_FAILED ){
|
||||
unixLogError(SQLITE_OK, "mmap", pFd->zPath);
|
||||
pFd->mmapSizeMax = 0;
|
||||
}else{
|
||||
pInode->pSharedMapping = pNew;
|
||||
pInode->nSharedMapping = nMap;
|
||||
}
|
||||
}
|
||||
pFd->pMapRegion = pInode->pSharedMapping;
|
||||
pFd->mmapSizeActual = pFd->mmapSize = pInode->nSharedMapping;
|
||||
unixLeaveMutex();
|
||||
return SQLITE_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
assert( nMap>0 || (pFd->mmapSize==0 && pFd->pMapRegion==0) );
|
||||
if( nMap!=pFd->mmapSize ){
|
||||
unixRemapfile(pFd, nMap);
|
||||
@@ -5300,17 +5349,6 @@ static int fillInUnixFile(
|
||||
|
||||
assert( pNew->pInode==NULL );
|
||||
|
||||
/* Usually the path zFilename should not be a relative pathname. The
|
||||
** exception is when opening the proxy "conch" file in builds that
|
||||
** include the special Apple locking styles.
|
||||
*/
|
||||
#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE
|
||||
assert( zFilename==0 || zFilename[0]=='/'
|
||||
|| pVfs->pAppData==(void*)&autolockIoFinder );
|
||||
#else
|
||||
assert( zFilename==0 || zFilename[0]=='/' );
|
||||
#endif
|
||||
|
||||
/* No locking occurs in temporary files */
|
||||
assert( zFilename!=0 || (ctrlFlags & UNIXFILE_NOLOCK)!=0 );
|
||||
|
||||
@@ -5353,6 +5391,9 @@ static int fillInUnixFile(
|
||||
if( pLockingStyle == &posixIoMethods
|
||||
#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE
|
||||
|| pLockingStyle == &nfsIoMethods
|
||||
#endif
|
||||
#ifdef SQLITE_SHARED_MAPPING
|
||||
|| pLockingStyle == &nolockIoMethods
|
||||
#endif
|
||||
){
|
||||
unixEnterMutex();
|
||||
@@ -5673,16 +5714,11 @@ static int findCreateFileMode(
|
||||
*/
|
||||
nDb = sqlite3Strlen30(zPath) - 1;
|
||||
while( zPath[nDb]!='-' ){
|
||||
#ifndef SQLITE_ENABLE_8_3_NAMES
|
||||
/* In the normal case (8+3 filenames disabled) the journal filename
|
||||
** is guaranteed to contain a '-' character. */
|
||||
assert( nDb>0 );
|
||||
assert( sqlite3Isalnum(zPath[nDb]) );
|
||||
#else
|
||||
/* If 8+3 names are possible, then the journal file might not contain
|
||||
** a '-' character. So check for that case and return early. */
|
||||
/* In normal operation, the journal file name will always contain
|
||||
** a '-' character. However in 8+3 filename mode, or if a corrupt
|
||||
** rollback journal specifies a master journal with a goofy name, then
|
||||
** the '-' might be missing. */
|
||||
if( nDb==0 || zPath[nDb]=='.' ) return SQLITE_OK;
|
||||
#endif
|
||||
nDb--;
|
||||
}
|
||||
memcpy(zDb, zPath, nDb);
|
||||
@@ -5968,6 +6004,9 @@ static int unixOpen(
|
||||
}
|
||||
#endif
|
||||
|
||||
assert( zPath==0 || zPath[0]=='/'
|
||||
|| eType==SQLITE_OPEN_MASTER_JOURNAL || eType==SQLITE_OPEN_MAIN_JOURNAL
|
||||
);
|
||||
rc = fillInUnixFile(pVfs, fd, pFile, zPath, ctrlFlags);
|
||||
|
||||
open_finished:
|
||||
|
||||
@@ -5696,9 +5696,6 @@ static int winRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
|
||||
EntropyGatherer e;
|
||||
UNUSED_PARAMETER(pVfs);
|
||||
memset(zBuf, 0, nBuf);
|
||||
#if defined(_MSC_VER) && _MSC_VER>=1400 && !SQLITE_OS_WINCE
|
||||
rand_s((unsigned int*)zBuf); /* rand_s() is not available with MinGW */
|
||||
#endif /* defined(_MSC_VER) && _MSC_VER>=1400 */
|
||||
e.a = (unsigned char*)zBuf;
|
||||
e.na = nBuf;
|
||||
e.nXor = 0;
|
||||
|
||||
+4
-4
@@ -2844,12 +2844,13 @@ static int pager_playback(Pager *pPager, int isHot){
|
||||
** pager_playback_one_page() call returns SQLITE_DONE or an IO error
|
||||
** occurs.
|
||||
*/
|
||||
while( 1 ){
|
||||
do{
|
||||
/* Read the next journal header from the journal file. If there are
|
||||
** not enough bytes left in the journal file for a complete header, or
|
||||
** it is corrupted, then a process must have failed while writing it.
|
||||
** This indicates nothing more needs to be rolled back.
|
||||
*/
|
||||
u32 savedPageSize = pPager->pageSize;
|
||||
rc = readJournalHdr(pPager, isHot, szJ, &nRec, &mxPg);
|
||||
if( rc!=SQLITE_OK ){
|
||||
if( rc==SQLITE_DONE ){
|
||||
@@ -2931,9 +2932,8 @@ static int pager_playback(Pager *pPager, int isHot){
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
assert( 0 );
|
||||
rc = sqlite3PagerSetPagesize(pPager, &savedPageSize, -1);
|
||||
}while( rc==SQLITE_OK );
|
||||
|
||||
end_playback:
|
||||
/* Following a rollback, the database file should be back in its original
|
||||
|
||||
+78
-72
@@ -298,16 +298,16 @@ static const PragmaName *pragmaLocate(const char *zName){
|
||||
/*
|
||||
** Helper subroutine for PRAGMA integrity_check:
|
||||
**
|
||||
** Generate code to output a single-column result row with the result
|
||||
** held in register regResult. Decrement the result count and halt if
|
||||
** the maximum number of result rows have been issued.
|
||||
** Generate code to output a single-column result row with a value of the
|
||||
** string held in register 3. Decrement the result count in register 1
|
||||
** and halt if the maximum number of result rows have been issued.
|
||||
*/
|
||||
static int integrityCheckResultRow(Vdbe *v, int regResult){
|
||||
static int integrityCheckResultRow(Vdbe *v){
|
||||
int addr;
|
||||
sqlite3VdbeAddOp2(v, OP_ResultRow, regResult, 1);
|
||||
sqlite3VdbeAddOp2(v, OP_ResultRow, 3, 1);
|
||||
addr = sqlite3VdbeAddOp3(v, OP_IfPos, 1, sqlite3VdbeCurrentAddr(v)+2, 1);
|
||||
VdbeCoverage(v);
|
||||
sqlite3VdbeAddOp2(v, OP_Halt, 0, 0);
|
||||
sqlite3VdbeAddOp0(v, OP_Halt);
|
||||
return addr;
|
||||
}
|
||||
|
||||
@@ -1484,12 +1484,11 @@ void sqlite3Pragma(
|
||||
|
||||
/* Do an integrity check on each database file */
|
||||
for(i=0; i<db->nDb; i++){
|
||||
HashElem *x;
|
||||
Hash *pTbls;
|
||||
int *aRoot;
|
||||
int cnt = 0;
|
||||
int mxIdx = 0;
|
||||
int nIdx;
|
||||
HashElem *x; /* For looping over tables in the schema */
|
||||
Hash *pTbls; /* Set of all tables in the schema */
|
||||
int *aRoot; /* Array of root page numbers of all btrees */
|
||||
int cnt = 0; /* Number of entries in aRoot[] */
|
||||
int mxIdx = 0; /* Maximum number of indexes for any table */
|
||||
|
||||
if( OMIT_TEMPDB && i==1 ) continue;
|
||||
if( iDb>=0 && i!=iDb ) continue;
|
||||
@@ -1504,8 +1503,9 @@ void sqlite3Pragma(
|
||||
assert( sqlite3SchemaMutexHeld(db, i, 0) );
|
||||
pTbls = &db->aDb[i].pSchema->tblHash;
|
||||
for(cnt=0, x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){
|
||||
Table *pTab = sqliteHashData(x);
|
||||
Index *pIdx;
|
||||
Table *pTab = sqliteHashData(x); /* Current table */
|
||||
Index *pIdx; /* An index on pTab */
|
||||
int nIdx; /* Number of indexes on pTab */
|
||||
if( HasRowid(pTab) ) cnt++;
|
||||
for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){ cnt++; }
|
||||
if( nIdx>mxIdx ) mxIdx = nIdx;
|
||||
@@ -1533,9 +1533,8 @@ void sqlite3Pragma(
|
||||
sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0,
|
||||
sqlite3MPrintf(db, "*** in database %s ***\n", db->aDb[i].zDbSName),
|
||||
P4_DYNAMIC);
|
||||
sqlite3VdbeAddOp3(v, OP_Move, 2, 4, 1);
|
||||
sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 2);
|
||||
integrityCheckResultRow(v, 2);
|
||||
sqlite3VdbeAddOp3(v, OP_Concat, 2, 3, 3);
|
||||
integrityCheckResultRow(v);
|
||||
sqlite3VdbeJumpHere(v, addr);
|
||||
|
||||
/* Make sure all the indices are constructed correctly.
|
||||
@@ -1549,16 +1548,13 @@ void sqlite3Pragma(
|
||||
int r1 = -1;
|
||||
|
||||
if( pTab->tnum<1 ) continue; /* Skip VIEWs or VIRTUAL TABLEs */
|
||||
if( pTab->pCheck==0
|
||||
&& (pTab->tabFlags & TF_HasNotNull)==0
|
||||
&& (pTab->pIndex==0 || isQuick)
|
||||
){
|
||||
continue; /* No additional checks needed for this table */
|
||||
}
|
||||
pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);
|
||||
sqlite3ExprCacheClear(pParse);
|
||||
sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenRead, 0,
|
||||
1, 0, &iDataCur, &iIdxCur);
|
||||
/* reg[7] counts the number of entries in the table.
|
||||
** reg[8+i] counts the number of entries in the i-th index
|
||||
*/
|
||||
sqlite3VdbeAddOp2(v, OP_Integer, 0, 7);
|
||||
for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
|
||||
sqlite3VdbeAddOp2(v, OP_Integer, 0, 8+j); /* index entries counter */
|
||||
@@ -1579,11 +1575,10 @@ void sqlite3Pragma(
|
||||
zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName,
|
||||
pTab->aCol[j].zName);
|
||||
sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC);
|
||||
integrityCheckResultRow(v, 3);
|
||||
integrityCheckResultRow(v);
|
||||
sqlite3VdbeJumpHere(v, jmp2);
|
||||
}
|
||||
/* Verify CHECK constraints */
|
||||
sqlite3VdbeAddOp3(v, OP_Column, iDataCur, pTab->nCol-1, 3);
|
||||
if( pTab->pCheck && (db->flags & SQLITE_IgnoreChecks)==0 ){
|
||||
ExprList *pCheck = sqlite3ExprListDup(db, pTab->pCheck, 0);
|
||||
if( db->mallocFailed==0 ){
|
||||
@@ -1603,57 +1598,62 @@ void sqlite3Pragma(
|
||||
zErr = sqlite3MPrintf(db, "CHECK constraint failed in %s",
|
||||
pTab->zName);
|
||||
sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC);
|
||||
integrityCheckResultRow(v, 3);
|
||||
integrityCheckResultRow(v);
|
||||
sqlite3VdbeResolveLabel(v, addrCkOk);
|
||||
sqlite3ExprCachePop(pParse);
|
||||
}
|
||||
sqlite3ExprListDelete(db, pCheck);
|
||||
}
|
||||
/* Validate index entries for the current row */
|
||||
for(j=0, pIdx=pTab->pIndex; pIdx && !isQuick; pIdx=pIdx->pNext, j++){
|
||||
int jmp2, jmp3, jmp4, jmp5;
|
||||
int ckUniq = sqlite3VdbeMakeLabel(v);
|
||||
if( pPk==pIdx ) continue;
|
||||
r1 = sqlite3GenerateIndexKey(pParse, pIdx, iDataCur, 0, 0, &jmp3,
|
||||
pPrior, r1);
|
||||
pPrior = pIdx;
|
||||
sqlite3VdbeAddOp2(v, OP_AddImm, 8+j, 1); /* increment entry count */
|
||||
/* Verify that an index entry exists for the current table row */
|
||||
jmp2 = sqlite3VdbeAddOp4Int(v, OP_Found, iIdxCur+j, ckUniq, r1,
|
||||
pIdx->nColumn); VdbeCoverage(v);
|
||||
sqlite3VdbeLoadString(v, 3, "row ");
|
||||
sqlite3VdbeAddOp3(v, OP_Concat, 7, 3, 3);
|
||||
sqlite3VdbeLoadString(v, 4, " missing from index ");
|
||||
sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3);
|
||||
jmp5 = sqlite3VdbeLoadString(v, 4, pIdx->zName);
|
||||
sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3);
|
||||
jmp4 = integrityCheckResultRow(v, 3);
|
||||
sqlite3VdbeJumpHere(v, jmp2);
|
||||
/* For UNIQUE indexes, verify that only one entry exists with the
|
||||
** current key. The entry is unique if (1) any column is NULL
|
||||
** or (2) the next entry has a different key */
|
||||
if( IsUniqueIndex(pIdx) ){
|
||||
int uniqOk = sqlite3VdbeMakeLabel(v);
|
||||
int jmp6;
|
||||
int kk;
|
||||
for(kk=0; kk<pIdx->nKeyCol; kk++){
|
||||
int iCol = pIdx->aiColumn[kk];
|
||||
assert( iCol!=XN_ROWID && iCol<pTab->nCol );
|
||||
if( iCol>=0 && pTab->aCol[iCol].notNull ) continue;
|
||||
sqlite3VdbeAddOp2(v, OP_IsNull, r1+kk, uniqOk);
|
||||
VdbeCoverage(v);
|
||||
if( !isQuick ){ /* Omit the remaining tests for quick_check */
|
||||
/* Sanity check on record header decoding */
|
||||
sqlite3VdbeAddOp3(v, OP_Column, iDataCur, pTab->nCol-1, 3);
|
||||
sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG);
|
||||
/* Validate index entries for the current row */
|
||||
for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
|
||||
int jmp2, jmp3, jmp4, jmp5;
|
||||
int ckUniq = sqlite3VdbeMakeLabel(v);
|
||||
if( pPk==pIdx ) continue;
|
||||
r1 = sqlite3GenerateIndexKey(pParse, pIdx, iDataCur, 0, 0, &jmp3,
|
||||
pPrior, r1);
|
||||
pPrior = pIdx;
|
||||
sqlite3VdbeAddOp2(v, OP_AddImm, 8+j, 1);/* increment entry count */
|
||||
/* Verify that an index entry exists for the current table row */
|
||||
jmp2 = sqlite3VdbeAddOp4Int(v, OP_Found, iIdxCur+j, ckUniq, r1,
|
||||
pIdx->nColumn); VdbeCoverage(v);
|
||||
sqlite3VdbeLoadString(v, 3, "row ");
|
||||
sqlite3VdbeAddOp3(v, OP_Concat, 7, 3, 3);
|
||||
sqlite3VdbeLoadString(v, 4, " missing from index ");
|
||||
sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3);
|
||||
jmp5 = sqlite3VdbeLoadString(v, 4, pIdx->zName);
|
||||
sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3);
|
||||
jmp4 = integrityCheckResultRow(v);
|
||||
sqlite3VdbeJumpHere(v, jmp2);
|
||||
/* For UNIQUE indexes, verify that only one entry exists with the
|
||||
** current key. The entry is unique if (1) any column is NULL
|
||||
** or (2) the next entry has a different key */
|
||||
if( IsUniqueIndex(pIdx) ){
|
||||
int uniqOk = sqlite3VdbeMakeLabel(v);
|
||||
int jmp6;
|
||||
int kk;
|
||||
for(kk=0; kk<pIdx->nKeyCol; kk++){
|
||||
int iCol = pIdx->aiColumn[kk];
|
||||
assert( iCol!=XN_ROWID && iCol<pTab->nCol );
|
||||
if( iCol>=0 && pTab->aCol[iCol].notNull ) continue;
|
||||
sqlite3VdbeAddOp2(v, OP_IsNull, r1+kk, uniqOk);
|
||||
VdbeCoverage(v);
|
||||
}
|
||||
jmp6 = sqlite3VdbeAddOp1(v, OP_Next, iIdxCur+j); VdbeCoverage(v);
|
||||
sqlite3VdbeGoto(v, uniqOk);
|
||||
sqlite3VdbeJumpHere(v, jmp6);
|
||||
sqlite3VdbeAddOp4Int(v, OP_IdxGT, iIdxCur+j, uniqOk, r1,
|
||||
pIdx->nKeyCol); VdbeCoverage(v);
|
||||
sqlite3VdbeLoadString(v, 3, "non-unique entry in index ");
|
||||
sqlite3VdbeGoto(v, jmp5);
|
||||
sqlite3VdbeResolveLabel(v, uniqOk);
|
||||
}
|
||||
jmp6 = sqlite3VdbeAddOp1(v, OP_Next, iIdxCur+j); VdbeCoverage(v);
|
||||
sqlite3VdbeGoto(v, uniqOk);
|
||||
sqlite3VdbeJumpHere(v, jmp6);
|
||||
sqlite3VdbeAddOp4Int(v, OP_IdxGT, iIdxCur+j, uniqOk, r1,
|
||||
pIdx->nKeyCol); VdbeCoverage(v);
|
||||
sqlite3VdbeLoadString(v, 3, "non-unique entry in index ");
|
||||
sqlite3VdbeGoto(v, jmp5);
|
||||
sqlite3VdbeResolveLabel(v, uniqOk);
|
||||
sqlite3VdbeJumpHere(v, jmp4);
|
||||
sqlite3ResolvePartIdxLabel(pParse, jmp3);
|
||||
}
|
||||
sqlite3VdbeJumpHere(v, jmp4);
|
||||
sqlite3ResolvePartIdxLabel(pParse, jmp3);
|
||||
}
|
||||
sqlite3VdbeAddOp2(v, OP_Next, iDataCur, loopTop); VdbeCoverage(v);
|
||||
sqlite3VdbeJumpHere(v, loopTop-1);
|
||||
@@ -1665,9 +1665,9 @@ void sqlite3Pragma(
|
||||
sqlite3VdbeAddOp2(v, OP_Count, iIdxCur+j, 3);
|
||||
addr = sqlite3VdbeAddOp3(v, OP_Eq, 8+j, 0, 3); VdbeCoverage(v);
|
||||
sqlite3VdbeChangeP5(v, SQLITE_NOTNULL);
|
||||
sqlite3VdbeLoadString(v, 3, pIdx->zName);
|
||||
sqlite3VdbeAddOp3(v, OP_Concat, 3, 2, 7);
|
||||
integrityCheckResultRow(v, 7);
|
||||
sqlite3VdbeLoadString(v, 4, pIdx->zName);
|
||||
sqlite3VdbeAddOp3(v, OP_Concat, 4, 2, 3);
|
||||
integrityCheckResultRow(v);
|
||||
sqlite3VdbeJumpHere(v, addr);
|
||||
}
|
||||
}
|
||||
@@ -1681,6 +1681,9 @@ void sqlite3Pragma(
|
||||
{ OP_IfNotZero, 1, 4, 0}, /* 1 */
|
||||
{ OP_String8, 0, 3, 0}, /* 2 */
|
||||
{ OP_ResultRow, 3, 1, 0}, /* 3 */
|
||||
{ OP_Halt, 0, 0, 0}, /* 4 */
|
||||
{ OP_String8, 0, 3, 0}, /* 5 */
|
||||
{ OP_Goto, 0, 3, 0}, /* 6 */
|
||||
};
|
||||
VdbeOp *aOp;
|
||||
|
||||
@@ -1689,7 +1692,10 @@ void sqlite3Pragma(
|
||||
aOp[0].p2 = 1-mxErr;
|
||||
aOp[2].p4type = P4_STATIC;
|
||||
aOp[2].p4.z = "ok";
|
||||
aOp[5].p4type = P4_STATIC;
|
||||
aOp[5].p4.z = (char*)sqlite3ErrStr(SQLITE_CORRUPT);
|
||||
}
|
||||
sqlite3VdbeChangeP3(v, 0, sqlite3VdbeCurrentAddr(v)-2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -106,6 +106,28 @@ void sqlite3_randomness(int N, void *pBuf){
|
||||
sqlite3_mutex_leave(mutex);
|
||||
}
|
||||
|
||||
/*
|
||||
** Initialize a fast PRNG. A Fast PRNG is called "fast" because it does
|
||||
** not need a mutex to operate, though it does use a mutex to initialize.
|
||||
** The quality of the randomness is not as good as the global PRNG.
|
||||
*/
|
||||
void sqlite3FastPrngInit(FastPrng *pPrng){
|
||||
sqlite3_randomness(sizeof(*pPrng), pPrng);
|
||||
pPrng->x |= 1;
|
||||
}
|
||||
|
||||
/*
|
||||
** Generate N bytes of pseudo-randomness using a FastPrng
|
||||
*/
|
||||
void sqlite3FastRandomness(FastPrng *pPrng, int N, void *P){
|
||||
unsigned char *pOut = (unsigned char*)P;
|
||||
while( N-->0 ){
|
||||
pPrng->x = ((pPrng->x)>>1) ^ ((1+~((pPrng->x)&1)) & 0xd0000001);
|
||||
pPrng->y = (pPrng->y)*1103515245 + 12345;
|
||||
*(pOut++) = (pPrng->x ^ pPrng->y) & 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef SQLITE_UNTESTABLE
|
||||
/*
|
||||
** For testing purposes, we sometimes want to preserve the state of
|
||||
|
||||
+24
-27
@@ -664,16 +664,15 @@ static void codeDistinct(
|
||||
** This routine generates the code for the inside of the inner loop
|
||||
** of a SELECT.
|
||||
**
|
||||
** If srcTab is negative, then the pEList expressions
|
||||
** If srcTab is negative, then the p->pEList expressions
|
||||
** are evaluated in order to get the data for this row. If srcTab is
|
||||
** zero or more, then data is pulled from srcTab and pEList is used only
|
||||
** zero or more, then data is pulled from srcTab and p->pEList is used only
|
||||
** to get the number of columns and the collation sequence for each column.
|
||||
*/
|
||||
static void selectInnerLoop(
|
||||
Parse *pParse, /* The parser context */
|
||||
Select *p, /* The complete select statement being coded */
|
||||
ExprList *pEList, /* List of values being extracted */
|
||||
int srcTab, /* Pull data from this table */
|
||||
int srcTab, /* Pull data from this table if non-negative */
|
||||
SortCtx *pSort, /* If not NULL, info on how to process ORDER BY */
|
||||
DistinctCtx *pDistinct, /* If not NULL, info on how to process DISTINCT */
|
||||
SelectDest *pDest, /* How to dispose of the results */
|
||||
@@ -697,7 +696,7 @@ static void selectInnerLoop(
|
||||
int regOrig; /* Start of memory holding full result (or 0) */
|
||||
|
||||
assert( v );
|
||||
assert( pEList!=0 );
|
||||
assert( p->pEList!=0 );
|
||||
hasDistinct = pDistinct ? pDistinct->eTnctType : WHERE_DISTINCT_NOOP;
|
||||
if( pSort && pSort->pOrderBy==0 ) pSort = 0;
|
||||
if( pSort==0 && !hasDistinct ){
|
||||
@@ -707,7 +706,7 @@ static void selectInnerLoop(
|
||||
|
||||
/* Pull the requested columns.
|
||||
*/
|
||||
nResultCol = pEList->nExpr;
|
||||
nResultCol = p->pEList->nExpr;
|
||||
|
||||
if( pDest->iSdst==0 ){
|
||||
if( pSort ){
|
||||
@@ -730,7 +729,7 @@ static void selectInnerLoop(
|
||||
if( srcTab>=0 ){
|
||||
for(i=0; i<nResultCol; i++){
|
||||
sqlite3VdbeAddOp3(v, OP_Column, srcTab, i, regResult+i);
|
||||
VdbeComment((v, "%s", pEList->a[i].zName));
|
||||
VdbeComment((v, "%s", p->pEList->a[i].zName));
|
||||
}
|
||||
}else if( eDest!=SRT_Exists ){
|
||||
/* If the destination is an EXISTS(...) expression, the actual
|
||||
@@ -743,24 +742,24 @@ static void selectInnerLoop(
|
||||
ecelFlags = 0;
|
||||
}
|
||||
if( pSort && hasDistinct==0 && eDest!=SRT_EphemTab && eDest!=SRT_Table ){
|
||||
/* For each expression in pEList that is a copy of an expression in
|
||||
/* For each expression in p->pEList that is a copy of an expression in
|
||||
** the ORDER BY clause (pSort->pOrderBy), set the associated
|
||||
** iOrderByCol value to one more than the index of the ORDER BY
|
||||
** expression within the sort-key that pushOntoSorter() will generate.
|
||||
** This allows the pEList field to be omitted from the sorted record,
|
||||
** This allows the p->pEList field to be omitted from the sorted record,
|
||||
** saving space and CPU cycles. */
|
||||
ecelFlags |= (SQLITE_ECEL_OMITREF|SQLITE_ECEL_REF);
|
||||
for(i=pSort->nOBSat; i<pSort->pOrderBy->nExpr; i++){
|
||||
int j;
|
||||
if( (j = pSort->pOrderBy->a[i].u.x.iOrderByCol)>0 ){
|
||||
pEList->a[j-1].u.x.iOrderByCol = i+1-pSort->nOBSat;
|
||||
p->pEList->a[j-1].u.x.iOrderByCol = i+1-pSort->nOBSat;
|
||||
}
|
||||
}
|
||||
regOrig = 0;
|
||||
assert( eDest==SRT_Set || eDest==SRT_Mem
|
||||
|| eDest==SRT_Coroutine || eDest==SRT_Output );
|
||||
}
|
||||
nResultCol = sqlite3ExprCodeExprList(pParse,pEList,regResult,0,ecelFlags);
|
||||
nResultCol = sqlite3ExprCodeExprList(pParse,p->pEList,regResult,0,ecelFlags);
|
||||
}
|
||||
|
||||
/* If the DISTINCT keyword was present on the SELECT statement
|
||||
@@ -792,7 +791,7 @@ static void selectInnerLoop(
|
||||
|
||||
iJump = sqlite3VdbeCurrentAddr(v) + nResultCol;
|
||||
for(i=0; i<nResultCol; i++){
|
||||
CollSeq *pColl = sqlite3ExprCollSeq(pParse, pEList->a[i].pExpr);
|
||||
CollSeq *pColl = sqlite3ExprCollSeq(pParse, p->pEList->a[i].pExpr);
|
||||
if( i<nResultCol-1 ){
|
||||
sqlite3VdbeAddOp3(v, OP_Ne, regResult+i, iJump, regPrev+i);
|
||||
VdbeCoverage(v);
|
||||
@@ -1745,7 +1744,7 @@ int sqlite3ColumnsFromExprList(
|
||||
if( zName[j]==':' ) nName = j;
|
||||
}
|
||||
zName = sqlite3MPrintf(db, "%.*z:%u", nName, zName, ++cnt);
|
||||
if( cnt>3 ) sqlite3_randomness(sizeof(cnt), &cnt);
|
||||
if( cnt>3 ) sqlite3FastRandomness(&db->sPrng, sizeof(cnt), &cnt);
|
||||
}
|
||||
pCol->zName = zName;
|
||||
sqlite3ColumnPropertiesFromName(0, pCol);
|
||||
@@ -1862,19 +1861,16 @@ Table *sqlite3ResultSetOfSelect(Parse *pParse, Select *pSelect){
|
||||
** Get a VDBE for the given parser context. Create a new one if necessary.
|
||||
** If an error occurs, return NULL and leave a message in pParse.
|
||||
*/
|
||||
static SQLITE_NOINLINE Vdbe *allocVdbe(Parse *pParse){
|
||||
Vdbe *v = pParse->pVdbe = sqlite3VdbeCreate(pParse);
|
||||
if( v ) sqlite3VdbeAddOp2(v, OP_Init, 0, 1);
|
||||
Vdbe *sqlite3GetVdbe(Parse *pParse){
|
||||
if( pParse->pVdbe ){
|
||||
return pParse->pVdbe;
|
||||
}
|
||||
if( pParse->pToplevel==0
|
||||
&& OptimizationEnabled(pParse->db,SQLITE_FactorOutConst)
|
||||
){
|
||||
pParse->okConstFactor = 1;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
Vdbe *sqlite3GetVdbe(Parse *pParse){
|
||||
Vdbe *v = pParse->pVdbe;
|
||||
return v ? v : allocVdbe(pParse);
|
||||
return sqlite3VdbeCreate(pParse);
|
||||
}
|
||||
|
||||
|
||||
@@ -2147,7 +2143,7 @@ static void generateWithRecursiveQuery(
|
||||
/* Output the single row in Current */
|
||||
addrCont = sqlite3VdbeMakeLabel(v);
|
||||
codeOffset(v, regOffset, addrCont);
|
||||
selectInnerLoop(pParse, p, p->pEList, iCurrent,
|
||||
selectInnerLoop(pParse, p, iCurrent,
|
||||
0, 0, pDest, addrCont, addrBreak);
|
||||
if( regLimit ){
|
||||
sqlite3VdbeAddOp2(v, OP_DecrJumpZero, regLimit, addrBreak);
|
||||
@@ -2466,7 +2462,7 @@ static int multiSelect(
|
||||
computeLimitRegisters(pParse, p, iBreak);
|
||||
sqlite3VdbeAddOp2(v, OP_Rewind, unionTab, iBreak); VdbeCoverage(v);
|
||||
iStart = sqlite3VdbeCurrentAddr(v);
|
||||
selectInnerLoop(pParse, p, p->pEList, unionTab,
|
||||
selectInnerLoop(pParse, p, unionTab,
|
||||
0, 0, &dest, iCont, iBreak);
|
||||
sqlite3VdbeResolveLabel(v, iCont);
|
||||
sqlite3VdbeAddOp2(v, OP_Next, unionTab, iStart); VdbeCoverage(v);
|
||||
@@ -2539,7 +2535,7 @@ static int multiSelect(
|
||||
iStart = sqlite3VdbeAddOp2(v, OP_RowData, tab1, r1);
|
||||
sqlite3VdbeAddOp4Int(v, OP_NotFound, tab2, iCont, r1, 0); VdbeCoverage(v);
|
||||
sqlite3ReleaseTempReg(pParse, r1);
|
||||
selectInnerLoop(pParse, p, p->pEList, tab1,
|
||||
selectInnerLoop(pParse, p, tab1,
|
||||
0, 0, &dest, iCont, iBreak);
|
||||
sqlite3VdbeResolveLabel(v, iCont);
|
||||
sqlite3VdbeAddOp2(v, OP_Next, tab1, iStart); VdbeCoverage(v);
|
||||
@@ -5545,7 +5541,8 @@ int sqlite3Select(
|
||||
}
|
||||
|
||||
/* Use the standard inner loop. */
|
||||
selectInnerLoop(pParse, p, pEList, -1, &sSort, &sDistinct, pDest,
|
||||
assert( p->pEList==pEList );
|
||||
selectInnerLoop(pParse, p, -1, &sSort, &sDistinct, pDest,
|
||||
sqlite3WhereContinueLabel(pWInfo),
|
||||
sqlite3WhereBreakLabel(pWInfo));
|
||||
|
||||
@@ -5848,7 +5845,7 @@ int sqlite3Select(
|
||||
sqlite3VdbeAddOp1(v, OP_Return, regOutputRow);
|
||||
finalizeAggFunctions(pParse, &sAggInfo);
|
||||
sqlite3ExprIfFalse(pParse, pHaving, addrOutputRow+1, SQLITE_JUMPIFNULL);
|
||||
selectInnerLoop(pParse, p, p->pEList, -1, &sSort,
|
||||
selectInnerLoop(pParse, p, -1, &sSort,
|
||||
&sDistinct, pDest,
|
||||
addrOutputRow+1, addrSetAbort);
|
||||
sqlite3VdbeAddOp1(v, OP_Return, regOutputRow);
|
||||
@@ -5992,7 +5989,7 @@ int sqlite3Select(
|
||||
|
||||
sSort.pOrderBy = 0;
|
||||
sqlite3ExprIfFalse(pParse, pHaving, addrEnd, SQLITE_JUMPIFNULL);
|
||||
selectInnerLoop(pParse, p, p->pEList, -1, 0, 0,
|
||||
selectInnerLoop(pParse, p, -1, 0, 0,
|
||||
pDest, addrEnd, addrEnd);
|
||||
sqlite3ExprListDelete(db, pDel);
|
||||
}
|
||||
|
||||
+12
-9
@@ -50,14 +50,6 @@
|
||||
# define SQLITE_TCLAPI
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Make sure that rand_s() is available on Windows systems with MSVC 2005
|
||||
** or higher.
|
||||
*/
|
||||
#if defined(_MSC_VER) && _MSC_VER>=1400
|
||||
# define _CRT_RAND_S
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Include the header file used to customize the compiler options for MSVC.
|
||||
** This should be done first so that it can successfully prevent spurious
|
||||
@@ -1073,6 +1065,7 @@ typedef struct NameContext NameContext;
|
||||
typedef struct Parse Parse;
|
||||
typedef struct PreUpdate PreUpdate;
|
||||
typedef struct PrintfArguments PrintfArguments;
|
||||
typedef struct FastPrng FastPrng;
|
||||
typedef struct RowSet RowSet;
|
||||
typedef struct Savepoint Savepoint;
|
||||
typedef struct Select Select;
|
||||
@@ -1145,6 +1138,14 @@ typedef int VList;
|
||||
# define SQLITE_DEFAULT_WAL_SYNCHRONOUS SQLITE_DEFAULT_SYNCHRONOUS
|
||||
#endif
|
||||
|
||||
/*
|
||||
** State of a simple PRNG used for the per-connection and per-pager
|
||||
** pseudo-random number generators.
|
||||
*/
|
||||
struct FastPrng {
|
||||
unsigned int x, y;
|
||||
};
|
||||
|
||||
/*
|
||||
** Each database file to be accessed by the system is an instance
|
||||
** of the following structure. There are normally two of these structures
|
||||
@@ -1351,6 +1352,7 @@ struct sqlite3 {
|
||||
u8 nSqlExec; /* Number of pending OP_SqlExec opcodes */
|
||||
int nextPagesize; /* Pagesize after VACUUM if >0 */
|
||||
u32 magic; /* Magic number for detect library misuse */
|
||||
FastPrng sPrng; /* State of the per-connection PRNG */
|
||||
int nChange; /* Value returned by sqlite3_changes() */
|
||||
int nTotalChange; /* Value returned by sqlite3_total_changes() */
|
||||
int aLimit[SQLITE_N_LIMIT]; /* Limits */
|
||||
@@ -2476,7 +2478,6 @@ struct Expr {
|
||||
*/
|
||||
struct ExprList {
|
||||
int nExpr; /* Number of expressions on the list */
|
||||
int nAlloc; /* Number of a[] slots allocated */
|
||||
struct ExprList_item { /* For each expression in the list */
|
||||
Expr *pExpr; /* The parse tree for this expression */
|
||||
char *zName; /* Token associated with this expression */
|
||||
@@ -3821,6 +3822,8 @@ Vdbe *sqlite3GetVdbe(Parse*);
|
||||
void sqlite3PrngSaveState(void);
|
||||
void sqlite3PrngRestoreState(void);
|
||||
#endif
|
||||
void sqlite3FastPrngInit(FastPrng*);
|
||||
void sqlite3FastRandomness(FastPrng*, int N, void *P);
|
||||
void sqlite3RollbackAll(sqlite3*,int);
|
||||
void sqlite3CodeVerifySchema(Parse*, int);
|
||||
void sqlite3CodeVerifyNamedSchema(Parse*, const char *zDb);
|
||||
|
||||
+7
-3
@@ -491,7 +491,11 @@ do_atof_calc:
|
||||
if( esign<0 ){
|
||||
result = 0.0*s;
|
||||
}else{
|
||||
#ifdef INFINITY
|
||||
result = INFINITY*s;
|
||||
#else
|
||||
result = 1e308*1e308*s; /* Infinity */
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}else{
|
||||
@@ -1276,7 +1280,7 @@ int sqlite3SafetyCheckSickOrOk(sqlite3 *db){
|
||||
** overflow, leave *pA unchanged and return 1.
|
||||
*/
|
||||
int sqlite3AddInt64(i64 *pA, i64 iB){
|
||||
#if GCC_VERSION>=5004000
|
||||
#if GCC_VERSION>=5004000 && !defined(__INTEL_COMPILER)
|
||||
return __builtin_add_overflow(*pA, iB, pA);
|
||||
#else
|
||||
i64 iA = *pA;
|
||||
@@ -1296,7 +1300,7 @@ int sqlite3AddInt64(i64 *pA, i64 iB){
|
||||
#endif
|
||||
}
|
||||
int sqlite3SubInt64(i64 *pA, i64 iB){
|
||||
#if GCC_VERSION>=5004000
|
||||
#if GCC_VERSION>=5004000 && !defined(__INTEL_COMPILER)
|
||||
return __builtin_sub_overflow(*pA, iB, pA);
|
||||
#else
|
||||
testcase( iB==SMALLEST_INT64+1 );
|
||||
@@ -1311,7 +1315,7 @@ int sqlite3SubInt64(i64 *pA, i64 iB){
|
||||
#endif
|
||||
}
|
||||
int sqlite3MulInt64(i64 *pA, i64 iB){
|
||||
#if GCC_VERSION>=5004000
|
||||
#if GCC_VERSION>=5004000 && !defined(__INTEL_COMPILER)
|
||||
return __builtin_mul_overflow(*pA, iB, pA);
|
||||
#else
|
||||
i64 iA = *pA;
|
||||
|
||||
+15
-5
@@ -2461,8 +2461,7 @@ case OP_Column: {
|
||||
** extra bytes for the header length itself. 32768*3 + 3 = 98307.
|
||||
*/
|
||||
if( aOffset[0] > 98307 || aOffset[0] > pC->payloadSize ){
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
goto abort_due_to_error;
|
||||
goto op_column_corrupt;
|
||||
}
|
||||
}else{
|
||||
/* This is an optimization. By skipping over the first few tests
|
||||
@@ -2535,8 +2534,7 @@ case OP_Column: {
|
||||
zHdr = zEndHdr;
|
||||
}else{
|
||||
if( pC->aRow==0 ) sqlite3VdbeMemRelease(&sMem);
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
goto abort_due_to_error;
|
||||
goto op_column_corrupt;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2631,6 +2629,15 @@ op_column_out:
|
||||
UPDATE_MAX_BLOBSIZE(pDest);
|
||||
REGISTER_TRACE(pOp->p3, pDest);
|
||||
break;
|
||||
|
||||
op_column_corrupt:
|
||||
if( aOp[0].p3>0 ){
|
||||
pOp = &aOp[aOp[0].p3-1];
|
||||
break;
|
||||
}else{
|
||||
rc = SQLITE_CORRUPT_BKPT;
|
||||
goto abort_due_to_error;
|
||||
}
|
||||
}
|
||||
|
||||
/* Opcode: Affinity P1 P2 * P4 *
|
||||
@@ -7015,7 +7022,7 @@ case OP_Function: {
|
||||
}
|
||||
|
||||
|
||||
/* Opcode: Init P1 P2 * P4 *
|
||||
/* Opcode: Init P1 P2 P3 P4 *
|
||||
** Synopsis: Start at P2
|
||||
**
|
||||
** Programs contain a single instance of this opcode as the very first
|
||||
@@ -7029,6 +7036,9 @@ case OP_Function: {
|
||||
**
|
||||
** Increment the value of P1 so that OP_Once opcodes will jump the
|
||||
** first time they are evaluated for this run.
|
||||
**
|
||||
** If P3 is not zero, then it is an address to jump to if an SQLITE_CORRUPT
|
||||
** error is encountered.
|
||||
*/
|
||||
case OP_Init: { /* jump */
|
||||
char *zTrace;
|
||||
|
||||
+15
-27
@@ -33,10 +33,12 @@ Vdbe *sqlite3VdbeCreate(Parse *pParse){
|
||||
db->pVdbe = p;
|
||||
p->magic = VDBE_MAGIC_INIT;
|
||||
p->pParse = pParse;
|
||||
pParse->pVdbe = p;
|
||||
assert( pParse->aLabel==0 );
|
||||
assert( pParse->nLabel==0 );
|
||||
assert( pParse->nOpAlloc==0 );
|
||||
assert( pParse->szOpAlloc==0 );
|
||||
sqlite3VdbeAddOp2(p, OP_Init, 0, 1);
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -2158,27 +2160,6 @@ static void closeAllCursors(Vdbe *p){
|
||||
assert( p->pAuxData==0 );
|
||||
}
|
||||
|
||||
/*
|
||||
** Clean up the VM after a single run.
|
||||
*/
|
||||
static void Cleanup(Vdbe *p){
|
||||
sqlite3 *db = p->db;
|
||||
|
||||
#ifdef SQLITE_DEBUG
|
||||
/* Execute assert() statements to ensure that the Vdbe.apCsr[] and
|
||||
** Vdbe.aMem[] arrays have already been cleaned up. */
|
||||
int i;
|
||||
if( p->apCsr ) for(i=0; i<p->nCursor; i++) assert( p->apCsr[i]==0 );
|
||||
if( p->aMem ){
|
||||
for(i=0; i<p->nMem; i++) assert( p->aMem[i].flags==MEM_Undefined );
|
||||
}
|
||||
#endif
|
||||
|
||||
sqlite3DbFree(db, p->zErrMsg);
|
||||
p->zErrMsg = 0;
|
||||
p->pResultSet = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** Set the number of result columns that will be returned by this SQL
|
||||
** statement. This is now set at compile time, rather than during
|
||||
@@ -2904,8 +2885,6 @@ int sqlite3VdbeReset(Vdbe *p){
|
||||
if( p->pc>=0 ){
|
||||
vdbeInvokeSqllog(p);
|
||||
sqlite3VdbeTransferError(p);
|
||||
sqlite3DbFree(db, p->zErrMsg);
|
||||
p->zErrMsg = 0;
|
||||
if( p->runOnlyOnce ) p->expired = 1;
|
||||
}else if( p->rc && p->expired ){
|
||||
/* The expired flag was set on the VDBE before the first call
|
||||
@@ -2913,13 +2892,22 @@ int sqlite3VdbeReset(Vdbe *p){
|
||||
** called), set the database error in this case as well.
|
||||
*/
|
||||
sqlite3ErrorWithMsg(db, p->rc, p->zErrMsg ? "%s" : 0, p->zErrMsg);
|
||||
sqlite3DbFree(db, p->zErrMsg);
|
||||
p->zErrMsg = 0;
|
||||
}
|
||||
|
||||
/* Reclaim all memory used by the VDBE
|
||||
/* Reset register contents and reclaim error message memory.
|
||||
*/
|
||||
Cleanup(p);
|
||||
#ifdef SQLITE_DEBUG
|
||||
/* Execute assert() statements to ensure that the Vdbe.apCsr[] and
|
||||
** Vdbe.aMem[] arrays have already been cleaned up. */
|
||||
int i;
|
||||
if( p->apCsr ) for(i=0; i<p->nCursor; i++) assert( p->apCsr[i]==0 );
|
||||
if( p->aMem ){
|
||||
for(i=0; i<p->nMem; i++) assert( p->aMem[i].flags==MEM_Undefined );
|
||||
}
|
||||
#endif
|
||||
sqlite3DbFree(db, p->zErrMsg);
|
||||
p->zErrMsg = 0;
|
||||
p->pResultSet = 0;
|
||||
|
||||
/* Save profiling information from this VDBE run.
|
||||
*/
|
||||
|
||||
+3
-2
@@ -275,7 +275,8 @@ int sqlite3_blob_open(
|
||||
sqlite3VdbeAddOp4Int(v, OP_Transaction, iDb, wrFlag,
|
||||
pTab->pSchema->schema_cookie,
|
||||
pTab->pSchema->iGeneration);
|
||||
sqlite3VdbeChangeP5(v, 1);
|
||||
sqlite3VdbeChangeP5(v, 1);
|
||||
assert( sqlite3VdbeCurrentAddr(v)==2 || db->mallocFailed );
|
||||
aOp = sqlite3VdbeAddOpList(v, ArraySize(openBlob), openBlob, iLn);
|
||||
|
||||
/* Make sure a mutex is held on the table to be accessed */
|
||||
@@ -290,7 +291,7 @@ int sqlite3_blob_open(
|
||||
aOp[0].p1 = iDb;
|
||||
aOp[0].p2 = pTab->tnum;
|
||||
aOp[0].p3 = wrFlag;
|
||||
sqlite3VdbeChangeP4(v, 1, pTab->zName, P4_TRANSIENT);
|
||||
sqlite3VdbeChangeP4(v, 2, pTab->zName, P4_TRANSIENT);
|
||||
}
|
||||
if( db->mallocFailed==0 ){
|
||||
#endif
|
||||
|
||||
@@ -448,6 +448,7 @@ struct Wal {
|
||||
u32 iReCksum; /* On commit, recalculate checksums from here */
|
||||
const char *zWalName; /* Name of WAL file */
|
||||
u32 nCkpt; /* Checkpoint sequence counter in the wal-header */
|
||||
FastPrng sPrng; /* Random number generator */
|
||||
#ifdef SQLITE_DEBUG
|
||||
u8 lockError; /* True if a locking error has occurred */
|
||||
#endif
|
||||
@@ -1323,6 +1324,7 @@ int sqlite3WalOpen(
|
||||
pRet->syncHeader = 1;
|
||||
pRet->padToSectorBoundary = 1;
|
||||
pRet->exclusiveMode = (bNoShm ? WAL_HEAPMEMORY_MODE: WAL_NORMAL_MODE);
|
||||
sqlite3FastPrngInit(&pRet->sPrng);
|
||||
|
||||
/* Open file handle on the write-ahead log file. */
|
||||
flags = (SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_WAL);
|
||||
@@ -1870,7 +1872,7 @@ static int walCheckpoint(
|
||||
rc = SQLITE_BUSY;
|
||||
}else if( eMode>=SQLITE_CHECKPOINT_RESTART ){
|
||||
u32 salt1;
|
||||
sqlite3_randomness(4, &salt1);
|
||||
sqlite3FastRandomness(&pWal->sPrng, 4, &salt1);
|
||||
assert( pInfo->nBackfill==pWal->hdr.mxFrame );
|
||||
rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(1), WAL_NREADER-1);
|
||||
if( rc==SQLITE_OK ){
|
||||
@@ -2878,7 +2880,7 @@ static int walRestartLog(Wal *pWal){
|
||||
assert( pInfo->nBackfill==pWal->hdr.mxFrame );
|
||||
if( pInfo->nBackfill>0 ){
|
||||
u32 salt1;
|
||||
sqlite3_randomness(4, &salt1);
|
||||
sqlite3FastRandomness(&pWal->sPrng, 4, &salt1);
|
||||
rc = walLockExclusive(pWal, WAL_READ_LOCK(1), WAL_NREADER-1);
|
||||
if( rc==SQLITE_OK ){
|
||||
/* If all readers are using WAL_READ_LOCK(0) (in other words if no
|
||||
@@ -3094,7 +3096,7 @@ int sqlite3WalFrames(
|
||||
sqlite3Put4byte(&aWalHdr[4], WAL_MAX_VERSION);
|
||||
sqlite3Put4byte(&aWalHdr[8], szPage);
|
||||
sqlite3Put4byte(&aWalHdr[12], pWal->nCkpt);
|
||||
if( pWal->nCkpt==0 ) sqlite3_randomness(8, pWal->hdr.aSalt);
|
||||
if( pWal->nCkpt==0 ) sqlite3FastRandomness(&pWal->sPrng, 8, pWal->hdr.aSalt);
|
||||
memcpy(&aWalHdr[16], pWal->hdr.aSalt, 8);
|
||||
walChecksumBytes(1, aWalHdr, WAL_HDRSIZE-2*4, 0, aCksum);
|
||||
sqlite3Put4byte(&aWalHdr[24], aCksum[0]);
|
||||
|
||||
+1
-1
@@ -4798,7 +4798,7 @@ WhereInfo *sqlite3WhereBegin(
|
||||
Index *pIx = pLoop->u.btree.pIndex;
|
||||
int iIndexCur;
|
||||
int op = OP_OpenRead;
|
||||
/* iAuxArg is always set if to a positive value if ONEPASS is possible */
|
||||
/* iAuxArg is always set to a positive value if ONEPASS is possible */
|
||||
assert( iAuxArg!=0 || (pWInfo->wctrlFlags & WHERE_ONEPASS_DESIRED)==0 );
|
||||
if( !HasRowid(pTab) && IsPrimaryKeyIndex(pIx)
|
||||
&& (wctrlFlags & WHERE_OR_SUBCLAUSE)!=0
|
||||
|
||||
+1
-1
@@ -164,7 +164,7 @@ do_test corruptC-2.5 {
|
||||
catchsql {BEGIN; UPDATE t2 SET y='abcdef-uvwxyz'; ROLLBACK;}
|
||||
catchsql {PRAGMA integrity_check}
|
||||
} {0 {{*** in database main ***
|
||||
On tree page 4 cell 19: Extends off end of page}}}
|
||||
On tree page 4 cell 19: Extends off end of page} {database disk image is malformed}}}
|
||||
|
||||
# {0 {{*** in database main ***
|
||||
# Corruption detected in cell 710 on page 4
|
||||
|
||||
+43
-41
@@ -136,47 +136,49 @@ do_execsql_test 2.2.2 { COMMIT }
|
||||
do_execsql_test 2.2.3 { SELECT * FROM t1 } {{a b c} {a b c}}
|
||||
fts3_integrity 2.2.4 db t1
|
||||
|
||||
do_execsql_test 3.1 {
|
||||
CREATE VIRTUAL TABLE t3 USING fts4;
|
||||
REPLACE INTO t3(docid, content) VALUES (1, 'one two');
|
||||
SELECT quote(matchinfo(t3, 'na')) FROM t3 WHERE t3 MATCH 'one'
|
||||
} {X'0100000002000000'}
|
||||
|
||||
do_execsql_test 3.2 {
|
||||
REPLACE INTO t3(docid, content) VALUES (2, 'one two three four');
|
||||
SELECT quote(matchinfo(t3, 'na')) FROM t3 WHERE t3 MATCH 'four'
|
||||
} {X'0200000003000000'}
|
||||
|
||||
do_execsql_test 3.3 {
|
||||
REPLACE INTO t3(docid, content) VALUES (1, 'one two three four five six');
|
||||
SELECT quote(matchinfo(t3, 'na')) FROM t3 WHERE t3 MATCH 'six'
|
||||
} {X'0200000005000000'}
|
||||
|
||||
do_execsql_test 3.4 {
|
||||
UPDATE OR REPLACE t3 SET docid = 2 WHERE docid=1;
|
||||
SELECT quote(matchinfo(t3, 'na')) FROM t3 WHERE t3 MATCH 'six'
|
||||
} {X'0100000006000000'}
|
||||
|
||||
do_execsql_test 3.5 {
|
||||
UPDATE OR REPLACE t3 SET docid = 3 WHERE docid=2;
|
||||
SELECT quote(matchinfo(t3, 'na')) FROM t3 WHERE t3 MATCH 'six'
|
||||
} {X'0100000006000000'}
|
||||
|
||||
do_execsql_test 3.6 {
|
||||
REPLACE INTO t3(docid, content) VALUES (3, 'one two');
|
||||
SELECT quote(matchinfo(t3, 'na')) FROM t3 WHERE t3 MATCH 'one'
|
||||
} {X'0100000002000000'}
|
||||
|
||||
do_execsql_test 3.7 {
|
||||
REPLACE INTO t3(docid, content) VALUES (NULL, 'one two three four');
|
||||
REPLACE INTO t3(docid, content) VALUES (NULL, 'one two three four five six');
|
||||
SELECT docid FROM t3;
|
||||
} {3 4 5}
|
||||
|
||||
do_execsql_test 3.8 {
|
||||
UPDATE OR REPLACE t3 SET docid = 5, content='three four' WHERE docid = 4;
|
||||
SELECT quote(matchinfo(t3, 'na')) FROM t3 WHERE t3 MATCH 'one'
|
||||
} {X'0200000002000000'}
|
||||
if {$tcl_platform(byteOrder)=="littleEndian"} {
|
||||
do_execsql_test 3.1 {
|
||||
CREATE VIRTUAL TABLE t3 USING fts4;
|
||||
REPLACE INTO t3(docid, content) VALUES (1, 'one two');
|
||||
SELECT quote(matchinfo(t3, 'na')) FROM t3 WHERE t3 MATCH 'one'
|
||||
} {X'0100000002000000'}
|
||||
|
||||
do_execsql_test 3.2 {
|
||||
REPLACE INTO t3(docid, content) VALUES (2, 'one two three four');
|
||||
SELECT quote(matchinfo(t3, 'na')) FROM t3 WHERE t3 MATCH 'four'
|
||||
} {X'0200000003000000'}
|
||||
|
||||
do_execsql_test 3.3 {
|
||||
REPLACE INTO t3(docid, content) VALUES (1, 'one two three four five six');
|
||||
SELECT quote(matchinfo(t3, 'na')) FROM t3 WHERE t3 MATCH 'six'
|
||||
} {X'0200000005000000'}
|
||||
|
||||
do_execsql_test 3.4 {
|
||||
UPDATE OR REPLACE t3 SET docid = 2 WHERE docid=1;
|
||||
SELECT quote(matchinfo(t3, 'na')) FROM t3 WHERE t3 MATCH 'six'
|
||||
} {X'0100000006000000'}
|
||||
|
||||
do_execsql_test 3.5 {
|
||||
UPDATE OR REPLACE t3 SET docid = 3 WHERE docid=2;
|
||||
SELECT quote(matchinfo(t3, 'na')) FROM t3 WHERE t3 MATCH 'six'
|
||||
} {X'0100000006000000'}
|
||||
|
||||
do_execsql_test 3.6 {
|
||||
REPLACE INTO t3(docid, content) VALUES (3, 'one two');
|
||||
SELECT quote(matchinfo(t3, 'na')) FROM t3 WHERE t3 MATCH 'one'
|
||||
} {X'0100000002000000'}
|
||||
|
||||
do_execsql_test 3.7 {
|
||||
REPLACE INTO t3(docid, content) VALUES(NULL,'one two three four');
|
||||
REPLACE INTO t3(docid, content) VALUES(NULL,'one two three four five six');
|
||||
SELECT docid FROM t3;
|
||||
} {3 4 5}
|
||||
|
||||
do_execsql_test 3.8 {
|
||||
UPDATE OR REPLACE t3 SET docid = 5, content='three four' WHERE docid = 4;
|
||||
SELECT quote(matchinfo(t3, 'na')) FROM t3 WHERE t3 MATCH 'one'
|
||||
} {X'0200000002000000'}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Test that the xSavepoint is invoked correctly if the first write
|
||||
|
||||
@@ -711,5 +711,15 @@ SELECT-1 UNION SELECT 5 UNION SELECT 0 UNION SElECT*from(SELECT-5) UNION SELECT
|
||||
$group,:conc ap0,1)fro,(select"",:PBAG,c,a,b,b,c,a,b,c,e,d,d,c,a,b,b,c,d,d,c,a,b,c,e,d,c,d,c,a,b,c,e,c,d,c,d,c,a,b,b,c,d,c,a,b,c,e,c,d,c,a,b,b,c,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,a,b,c,e,c,d,c,a,b,b,c,d,c,d,c,a,b,c,e,d,d,c,a,b,b,c,c,a,b,b,c,d,c,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,c,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,a,b,c,e,d,c,d,c,a,b,c,e,c,d,c,a,b,b,c,d,c,a,b,c,e,d,d,c,a,b,b,b,c,e,d,d,c,a,b,b,c,c,a,b,b,c,d,c,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,c,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,a,b,c,e,c,d,c,a,b,b,c,d,c,d,c,e,d,d,c,a,b,b,c,c,a,b,b,E,d,c,d,c,b,c,d,c,d,c,c,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,a,b,c,e,c,d,c,a,b,b,c,a,b,c,e,d,d,c,a,b,b,c,d,d,c,a,b,c,e,d,c,d,c,a,b,c,e,c,d,c,d,c,a,b,b,c,d,c,a,b,c,e,c,d,c,a,b,b,c,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,a,b,c,e,c,d,c,a,b,b,c,d,c,d,c,a,b,c,e,d,d,c,a,b,b,c,c,a,b,b,c,d,c,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,c,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,a,b,c,e,c,d,c,a,b,b,c,d,c,d,c,e,d,d,c,a,b,b,c,c,a,b,b,E,d,c,d,c,b,c,d,c,d,c,c,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,a,b,c,e,c,d,c,a,b,b,c,a,b,c,e,d,d,c,a,b,b,c,d,d,c,a,b,c,e,d,c,d,c,a,b,c,e,c,d,c,a,b,b,c,c,d,c,c,a,a,b,d,d,c,a,b,b,c,d,c,a,b,e,e,d,b,c,d,c,a,b,b,c,d,c,a,b,c,e,c,d,c,a,b,b,c,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,a,b,c,e,c,d,c,a,b,b,c,d,c,d,c,a,b,c,e,d,d,c,a,b,b,c,c,a,b,b,c,d,c,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,c,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,a,b,c,e,c,d,c,a,b,b,c,d, foreign_keysc,d,c,e,d,d,c,a,b,b,c,c,a,b,b,E,d,c,d,c,b,c,d,c,d,c,c,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,a,a,b,d,d,c,a,b,b,c,d,c,a,b,e,e,d,b,c,d,c,a,b,b,c,d,c,a,b,c,e,c,d,c,a,b,b,c,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,a,b,c,e,c,d,c,a,b,b,c,d,c,d,c,a,b,c,d,c,a,b,c,e,c,d,c,a,b,b,c,d,c,d,c,e,d,d,c,a,b,b,c,c,a,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,a,b,c,e,c,d,c,a,b,b,c,d,c,d,c,a,b,c,d,c,a,b,c,e,c,d,c,a,b,b,c,d,c,d,c,e,d,d,c,a,b,b,c,c,a,b,b,E,d,c,d,c,b,c,d,c,d,c,c,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,a,b,c,e,c,d,c,a,b,b,c,a,b,c,e,d,d,c,a,b,b,c,d,d,c,a,b,c,e,d,c,d,c,a,b,c,e,c,d,c,a,b,b,c,c,d,c,a,b,d,d,c,a,a,b,d,d,c,a,b,b,c,d,c,a,b,e,e,d,b,c,d,c,a,b,b,c,d,c,a,b,c,e,c,d,c,a,b,b,c,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,a,b,c,e,c,d,c,a,b,b,c,d,c,d,c,a,b,c,e,d,d,c,a,b,b,c,c,a,b,b,c,d,c,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,c,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,a,b,c,e,c,d,c,a,b,b,c,d,c,d,c,e,d,d,c,a,b,b,c,c,a,b,b,E,d,c,d,c,b,c,d,c,d,c,c,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,a,a,b,d,d,c,a,b,b,c,d,c,a,b,e,e,d,b,c,d,c,a,b,b,c,d,c,a,b,c,e,c,d,c,a,b,b,c,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,a,b,c,e,c,d,c,a,b,b,c,d,c,d,c,a,b,c,e,d,d,c,a,b,b,c,c,a,b,b,c,d,c,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,c,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,a,b,c,e,c,d,c,a,b,b,c,d,c,d,c,e,d,d,c,a,b,b,c,c,a,b,b,E,d,c,d,c,b,c,d,c,d,c,c,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,a,b,c,e,c,d,c,a,b,b,c,a,bb,b,E,d,c,d,c,b,c,d,c,d,c,c,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,a,b,c,e,c,d,c,a,b,b,c,a,b,c,e,d,d,c,a,b,b,c,d,d,c,a,b,c,e,d,c,d,c,a,b,c,e,c,d,c,a,b,b,c,c,d,c,a,b,d,d,c,a,a,b,d,d,c,a,b,b,c,d,c,a,b,e,e,d,b,c,d,c,a,b,b,c,d,c,a,b,c,e,c,d,c,a,b,b,c,d,c,a,b,c,e,d,d,c,a,b,b,c,d,c,d,c,a,b,c,e,c,d,c,a,b,b,c,d,MAato_aecSELEC,+?b," "O,"i","a",""b ,5 ))KEY)SELECT*FROM((k()reaC,k,K) eA,k '' )t ,K M);
|
||||
} {1 {'k' is not a function}}
|
||||
|
||||
# 2017-09-17
|
||||
#
|
||||
# Sometimes sqlite3ExprListAppend() can be invoked on an ExprList that
|
||||
# was obtained from sqlite3ExprListDup().
|
||||
#
|
||||
do_execsql_test misc1-26.0 {
|
||||
DROP TABLE IF EXISTS abc;
|
||||
CREATE TABLE abc(a, b, c);
|
||||
SELECT randomblob(min(max(coalesce(EXISTS (SELECT 1 FROM ( SELECT (SELECT 2147483647) NOT IN (SELECT 2147483649 UNION ALL SELECT DISTINCT -1) IN (SELECT 2147483649), 'fault', (SELECT ALL -1 INTERSECT SELECT 'experiments') IN (SELECT ALL 56.1 ORDER BY 'experiments' DESC) FROM (SELECT DISTINCT 2147483648, 'hardware' UNION ALL SELECT -2147483648, 'experiments' ORDER BY 2147483648 LIMIT 1 OFFSET 123456789.1234567899) GROUP BY (SELECT ALL 0 INTERSECT SELECT 'in') IN (SELECT DISTINCT 'experiments' ORDER BY zeroblob(1000) LIMIT 56.1 OFFSET -456) HAVING EXISTS (SELECT 'fault' EXCEPT SELECT DISTINCT 56.1) UNION SELECT 'The', 'The', 2147483649 UNION ALL SELECT DISTINCT 'hardware', 'first', 'experiments' ORDER BY 'hardware' LIMIT 123456789.1234567899 OFFSET -2147483647)) NOT IN (SELECT (SELECT DISTINCT (SELECT 'The') FROM abc ORDER BY EXISTS (SELECT -1 INTERSECT SELECT ALL NULL) ASC) IN (SELECT DISTINCT EXISTS (SELECT ALL 123456789.1234567899 ORDER BY 1 ASC, NULL DESC) FROM sqlite_master INTERSECT SELECT 456)), (SELECT ALL 'injection' UNION ALL SELECT ALL (SELECT DISTINCT 'first' UNION SELECT DISTINCT 'The') FROM (SELECT 456, 'in', 2147483649))),1), 500)), 'first', EXISTS (SELECT DISTINCT 456 FROM abc ORDER BY 'experiments' DESC) FROM abc;
|
||||
} {}
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
# 2017 September 15
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library.
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
set testprefix mjournal
|
||||
|
||||
# Test that nothing bad happens if a journal file contains a pointer to
|
||||
# a master journal file that does not have a "-" in the name. At one point
|
||||
# this was causing a segfault on unix.
|
||||
#
|
||||
do_execsql_test 1.0 {
|
||||
CREATE TABLE t1(a, b);
|
||||
}
|
||||
|
||||
do_test 1.1 {
|
||||
forcedelete test.db2journal test.db-journal
|
||||
|
||||
close [open test.db-journal w]
|
||||
|
||||
hexio_write test.db-journal 0 746573742e6462326a6f75726e616c00
|
||||
hexio_write test.db-journal 16 00000010
|
||||
hexio_write test.db-journal 20 000005e1
|
||||
hexio_write test.db-journal 24 d9d505f920a163d7
|
||||
|
||||
close [open test.db2journal w]
|
||||
hexio_write test.db2journal 0 abcd
|
||||
} {2}
|
||||
|
||||
do_execsql_test 1.2 {
|
||||
SELECT * FROM t1;
|
||||
}
|
||||
|
||||
do_test 1.3 {
|
||||
forcedelete test0db2journal test.db-journal
|
||||
close [open test.db-journal w]
|
||||
hexio_write test.db-journal 0 74657374306462326a6f75726e616c00
|
||||
hexio_write test.db-journal 16 00000010
|
||||
hexio_write test.db-journal 20 000005e3
|
||||
hexio_write test.db-journal 24 d9d505f920a163d7
|
||||
|
||||
close [open test0db2journal w]
|
||||
hexio_write test0db2journal 0 abcd
|
||||
} {2}
|
||||
|
||||
do_execsql_test 1.4 {
|
||||
SELECT * FROM t1;
|
||||
}
|
||||
|
||||
# And now test that nothing bad happens if a master journal contains a
|
||||
# pointer to a journal file that does not have a "-" in the name.
|
||||
#
|
||||
do_test 1.5 {
|
||||
forcedelete test.db2-master test.db-journal test1
|
||||
close [open test.db-journal w]
|
||||
hexio_write test.db-journal 0 746573742e6462322d6d617374657200
|
||||
hexio_write test.db-journal 16 00000010
|
||||
hexio_write test.db-journal 20 0000059f
|
||||
hexio_write test.db-journal 24 d9d505f920a163d7
|
||||
|
||||
close [open test.db2-master w]
|
||||
hexio_write test.db2-master 0 746573743100
|
||||
|
||||
close [open test1 w]
|
||||
hexio_write test1 0 abcd
|
||||
} {2}
|
||||
|
||||
do_execsql_test 1.6 {
|
||||
SELECT * FROM t1;
|
||||
}
|
||||
|
||||
|
||||
finish_test
|
||||
+5
-3
@@ -366,8 +366,10 @@ do_realnum_test nan-4.35 {
|
||||
}
|
||||
} {0.0 real}
|
||||
|
||||
|
||||
|
||||
|
||||
do_realnum_test nan-4.40 {
|
||||
db eval {
|
||||
SELECT cast('-1e999' AS real);
|
||||
}
|
||||
} {-inf}
|
||||
|
||||
finish_test
|
||||
|
||||
+2
-1
@@ -1932,6 +1932,7 @@ do_test 23.5 {
|
||||
PRAGMA foreign_key_list(t2);
|
||||
}
|
||||
} {0 0 t1 y {} {NO ACTION} {NO ACTION} NONE}
|
||||
db2 close
|
||||
|
||||
reset_db
|
||||
do_execsql_test 24.0 {
|
||||
@@ -1952,7 +1953,7 @@ do_catchsql_test 24.1 {
|
||||
} {1 {database disk image is malformed}}
|
||||
do_catchsql_test 24.2 {
|
||||
PRAGMA integrity_check;
|
||||
} {1 {database disk image is malformed}}
|
||||
} {0 {{database disk image is malformed}}}
|
||||
|
||||
database_never_corrupt
|
||||
finish_test
|
||||
|
||||
@@ -114,7 +114,7 @@ array set ::Configs [strip_comments {
|
||||
}
|
||||
"Debug-One" {
|
||||
--disable-shared
|
||||
-O2
|
||||
-O2 -funsigned-char
|
||||
-DSQLITE_DEBUG=1
|
||||
-DSQLITE_MEMDEBUG=1
|
||||
-DSQLITE_MUTEX_NOOP=1
|
||||
|
||||
@@ -184,6 +184,18 @@ ifcapable json1 {
|
||||
CREATE TABLE t6(x);
|
||||
SELECT * FROM t6 WHERE 1 IN (SELECT value FROM json_each(x));
|
||||
} {}
|
||||
|
||||
do_execsql_test 6.2 {
|
||||
DROP TABLE t6;
|
||||
CREATE TABLE t6(a,b,c);
|
||||
INSERT INTO t6 VALUES
|
||||
(0,null,'{"a":0,"b":[3,4,5],"c":{"x":4.5,"y":7.8}}'),
|
||||
(1,null,'{"a":1,"b":[3,4,5],"c":{"x":4.5,"y":7.8}}'),
|
||||
(2,null,'{"a":9,"b":[3,4,5],"c":{"x":4.5,"y":7.8}}');
|
||||
SELECT * FROM t6
|
||||
WHERE (EXISTS (SELECT 1 FROM json_each(t6.c) AS x WHERE x.value=1));
|
||||
} {1 {} {{"a":1,"b":[3,4,5],"c":{"x":4.5,"y":7.8}}}}
|
||||
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
||||
+1
-2
@@ -9,8 +9,7 @@
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this script is recovery from transient manditory locks
|
||||
# that sometimes appear on database files due to anti-virus software.
|
||||
# focus of this script is the Win32 heap implementation.
|
||||
#
|
||||
|
||||
if {$tcl_platform(platform)!="windows"} return
|
||||
|
||||
Reference in New Issue
Block a user