mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Merge performance enhancements and compiler warning fixes from trunk.
FossilOrigin-Name: 3e4033285deb417bd72c008917729dbf3bf4e90d
This commit is contained in:
@@ -504,6 +504,7 @@ static int fts3StringAppend(
|
|||||||
pStr->z = zNew;
|
pStr->z = zNew;
|
||||||
pStr->nAlloc = nAlloc;
|
pStr->nAlloc = nAlloc;
|
||||||
}
|
}
|
||||||
|
assert( pStr->z!=0 && (pStr->nAlloc >= pStr->n+nAppend+1) );
|
||||||
|
|
||||||
/* Append the data to the string buffer. */
|
/* Append the data to the string buffer. */
|
||||||
memcpy(&pStr->z[pStr->n], zAppend, nAppend);
|
memcpy(&pStr->z[pStr->n], zAppend, nAppend);
|
||||||
|
@@ -1461,7 +1461,7 @@ static int fts3SegReaderNextDocid(
|
|||||||
/* The following line of code (and the "p++" below the while() loop) is
|
/* The following line of code (and the "p++" below the while() loop) is
|
||||||
** normally all that is required to move pointer p to the desired
|
** normally all that is required to move pointer p to the desired
|
||||||
** position. The exception is if this node is being loaded from disk
|
** position. The exception is if this node is being loaded from disk
|
||||||
** incrementally and pointer "p" now points to the first byte passed
|
** incrementally and pointer "p" now points to the first byte past
|
||||||
** the populated part of pReader->aNode[].
|
** the populated part of pReader->aNode[].
|
||||||
*/
|
*/
|
||||||
while( *p | c ) c = *p++ & 0x80;
|
while( *p | c ) c = *p++ & 0x80;
|
||||||
@@ -2848,8 +2848,8 @@ int sqlite3Fts3SegReaderStep(
|
|||||||
fts3SegReaderSort(apSegment, nMerge, nMerge, xCmp);
|
fts3SegReaderSort(apSegment, nMerge, nMerge, xCmp);
|
||||||
while( apSegment[0]->pOffsetList ){
|
while( apSegment[0]->pOffsetList ){
|
||||||
int j; /* Number of segments that share a docid */
|
int j; /* Number of segments that share a docid */
|
||||||
char *pList;
|
char *pList = 0;
|
||||||
int nList;
|
int nList = 0;
|
||||||
int nByte;
|
int nByte;
|
||||||
sqlite3_int64 iDocid = apSegment[0]->iDocid;
|
sqlite3_int64 iDocid = apSegment[0]->iDocid;
|
||||||
fts3SegReaderNextDocid(p, apSegment[0], &pList, &nList);
|
fts3SegReaderNextDocid(p, apSegment[0], &pList, &nList);
|
||||||
|
36
manifest
36
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Merge\sin\sall\sthe\slatest\supdates\sand\senhancements\sfrom\strunk.
|
C Merge\sperformance\senhancements\sand\scompiler\swarning\sfixes\sfrom\strunk.
|
||||||
D 2013-08-19T12:49:06.766
|
D 2013-08-20T13:02:16.832
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in aff38bc64c582dd147f18739532198372587b0f0
|
F Makefile.in aff38bc64c582dd147f18739532198372587b0f0
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@@ -87,7 +87,7 @@ F ext/fts3/fts3_hash.c 8dd2d06b66c72c628c2732555a32bc0943114914
|
|||||||
F ext/fts3/fts3_hash.h 39cf6874dc239d6b4e30479b1975fe5b22a3caaf
|
F ext/fts3/fts3_hash.h 39cf6874dc239d6b4e30479b1975fe5b22a3caaf
|
||||||
F ext/fts3/fts3_icu.c e319e108661147bcca8dd511cd562f33a1ba81b5
|
F ext/fts3/fts3_icu.c e319e108661147bcca8dd511cd562f33a1ba81b5
|
||||||
F ext/fts3/fts3_porter.c a465b49fcb8249a755792f87516eff182efa42b3
|
F ext/fts3/fts3_porter.c a465b49fcb8249a755792f87516eff182efa42b3
|
||||||
F ext/fts3/fts3_snippet.c 5fcfcafff46a2a3a63b8e59fcb51987d01c74695
|
F ext/fts3/fts3_snippet.c e8ee8c101dd9cfbc9568d134e869d2bd2f7f6d4d
|
||||||
F ext/fts3/fts3_term.c a521f75132f9a495bdca1bdd45949b3191c52763
|
F ext/fts3/fts3_term.c a521f75132f9a495bdca1bdd45949b3191c52763
|
||||||
F ext/fts3/fts3_test.c f9a1a1702db1bfad3e2d0064746eeb808f125489
|
F ext/fts3/fts3_test.c f9a1a1702db1bfad3e2d0064746eeb808f125489
|
||||||
F ext/fts3/fts3_tokenize_vtab.c 011170fe9eba5ff062f1a31d3188e00267716706
|
F ext/fts3/fts3_tokenize_vtab.c 011170fe9eba5ff062f1a31d3188e00267716706
|
||||||
@@ -96,7 +96,7 @@ F ext/fts3/fts3_tokenizer.h 64c6ef6c5272c51ebe60fc607a896e84288fcbc3
|
|||||||
F ext/fts3/fts3_tokenizer1.c 5c98225a53705e5ee34824087478cf477bdb7004
|
F ext/fts3/fts3_tokenizer1.c 5c98225a53705e5ee34824087478cf477bdb7004
|
||||||
F ext/fts3/fts3_unicode.c 92391b4b4fb043564c6539ea9b8661e3bcba47b9
|
F ext/fts3/fts3_unicode.c 92391b4b4fb043564c6539ea9b8661e3bcba47b9
|
||||||
F ext/fts3/fts3_unicode2.c 0113d3acf13429e6dc38e0647d1bc71211c31a4d
|
F ext/fts3/fts3_unicode2.c 0113d3acf13429e6dc38e0647d1bc71211c31a4d
|
||||||
F ext/fts3/fts3_write.c cd264daa4f92b8eb6d61245333d0e3b147e8fd80
|
F ext/fts3/fts3_write.c edf39aea5d45080195f6b38aa5efee3804716dd0
|
||||||
F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9
|
F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9
|
||||||
F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100
|
F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100
|
||||||
F ext/fts3/tool/fts3view.c 6cfc5b67a5f0e09c0d698f9fd012c784bfaa9197
|
F ext/fts3/tool/fts3view.c 6cfc5b67a5f0e09c0d698f9fd012c784bfaa9197
|
||||||
@@ -176,16 +176,16 @@ F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
|
|||||||
F src/backup.c 43b348822db3e4cef48b2ae5a445fbeb6c73a165
|
F src/backup.c 43b348822db3e4cef48b2ae5a445fbeb6c73a165
|
||||||
F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb
|
F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb
|
||||||
F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7
|
F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7
|
||||||
F src/btree.c 9b985e4f334a1b3df5733e2ac2de1de9bdd41be7
|
F src/btree.c adea13e65d6c7b969bcd74cea6ae79b2d3c393fa
|
||||||
F src/btree.h bfe0e8c5759b4ec77b0d18390064a6ef3cdffaaf
|
F src/btree.h bfe0e8c5759b4ec77b0d18390064a6ef3cdffaaf
|
||||||
F src/btreeInt.h eecc84f02375b2bb7a44abbcbbe3747dde73edb2
|
F src/btreeInt.h 51cf220a9b9223354770883e93a859dc377aa27f
|
||||||
F src/build.c f99a715ff9290996b579d5e1ec8e94239dc9ae5e
|
F src/build.c f99a715ff9290996b579d5e1ec8e94239dc9ae5e
|
||||||
F src/callback.c d7e46f40c3cf53c43550b7da7a1d0479910b62cc
|
F src/callback.c d7e46f40c3cf53c43550b7da7a1d0479910b62cc
|
||||||
F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac
|
F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac
|
||||||
F src/ctime.c 4262c227bc91cecc61ae37ed3a40f08069cfa267
|
F src/ctime.c 4262c227bc91cecc61ae37ed3a40f08069cfa267
|
||||||
F src/date.c 067a81c9942c497aafd2c260e13add8a7d0c7dd4
|
F src/date.c 067a81c9942c497aafd2c260e13add8a7d0c7dd4
|
||||||
F src/delete.c 30ed4bc76a1a32c55bf17ac1528c5867aa5502c0
|
F src/delete.c 30ed4bc76a1a32c55bf17ac1528c5867aa5502c0
|
||||||
F src/expr.c 0bbb44462a19169189b2709fbbd800950521b5ae
|
F src/expr.c 42d8235af422661ab80be097bebca485b33e2e14
|
||||||
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
|
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
|
||||||
F src/fkey.c 914a6bbd987d857c41ac9d244efa6641f36faadb
|
F src/fkey.c 914a6bbd987d857c41ac9d244efa6641f36faadb
|
||||||
F src/func.c 5c50c1ea31fd864b0fe921fe1a8d4c55acd609ef
|
F src/func.c 5c50c1ea31fd864b0fe921fe1a8d4c55acd609ef
|
||||||
@@ -222,7 +222,7 @@ F src/pager.h 66e42d6942a445d4c25651733ab2079dbebc7ca9
|
|||||||
F src/parse.y 27c6b4138497d6f8360ba7847da6ed48033f957f
|
F src/parse.y 27c6b4138497d6f8360ba7847da6ed48033f957f
|
||||||
F src/pcache.c f8043b433a57aba85384a531e3937a804432a346
|
F src/pcache.c f8043b433a57aba85384a531e3937a804432a346
|
||||||
F src/pcache.h a5e4f5d9f5d592051d91212c5949517971ae6222
|
F src/pcache.h a5e4f5d9f5d592051d91212c5949517971ae6222
|
||||||
F src/pcache1.c d23d07716de96c7c0c2503ec5051a4384c3fb938
|
F src/pcache1.c a467393909a4ed7ca9de066d85ba5c5b04a5be63
|
||||||
F src/pragma.c 1d96ba749253b49bc229c6294f9c2e5ef3dca85c
|
F src/pragma.c 1d96ba749253b49bc229c6294f9c2e5ef3dca85c
|
||||||
F src/prepare.c fa6988589f39af8504a61731614cd4f6ae71554f
|
F src/prepare.c fa6988589f39af8504a61731614cd4f6ae71554f
|
||||||
F src/printf.c 41c49dac366a3a411190001a8ab495fa8887974e
|
F src/printf.c 41c49dac366a3a411190001a8ab495fa8887974e
|
||||||
@@ -230,7 +230,7 @@ F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
|
|||||||
F src/resolve.c 9d53899cc6e1f4ec0b4632d07e97d57827bf63b9
|
F src/resolve.c 9d53899cc6e1f4ec0b4632d07e97d57827bf63b9
|
||||||
F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0
|
F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0
|
||||||
F src/select.c 8b148eb851f384412aea57091659d14b369918ca
|
F src/select.c 8b148eb851f384412aea57091659d14b369918ca
|
||||||
F src/shell.c 909f6c4a52c8e0265ce0048e2b3cbadda1bd6051
|
F src/shell.c 1c317a4c96d61d8d9fdad9fd1811d9b10b8c7f57
|
||||||
F src/sqlite.h.in dcca940021f8f6643630fb7711bfd4e3fa002566
|
F src/sqlite.h.in dcca940021f8f6643630fb7711bfd4e3fa002566
|
||||||
F src/sqlite3.rc fea433eb0a59f4c9393c8e6d76a6e2596b1fe0c0
|
F src/sqlite3.rc fea433eb0a59f4c9393c8e6d76a6e2596b1fe0c0
|
||||||
F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc
|
F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc
|
||||||
@@ -290,10 +290,10 @@ F src/update.c e3668141dd9701023681239265e001388f182236
|
|||||||
F src/utf.c 8d819e2e5104a430fc2005f018db14347c95a38f
|
F src/utf.c 8d819e2e5104a430fc2005f018db14347c95a38f
|
||||||
F src/util.c f566b5138099a2df8533b190d0dcc74b7dfbe0c9
|
F src/util.c f566b5138099a2df8533b190d0dcc74b7dfbe0c9
|
||||||
F src/vacuum.c d9c5759f4c5a438bb43c2086f72c5d2edabc36c8
|
F src/vacuum.c d9c5759f4c5a438bb43c2086f72c5d2edabc36c8
|
||||||
F src/vdbe.c fab5d86a09f735db4bfd53d977465fa82cd5c213
|
F src/vdbe.c 76502f0813c3ecf1a54611fc5262c8bc77a54fb7
|
||||||
F src/vdbe.h 7aa3ab6210a68471c8490dedfc9aa4ef5684b9a0
|
F src/vdbe.h 7aa3ab6210a68471c8490dedfc9aa4ef5684b9a0
|
||||||
F src/vdbeInt.h cc1974b94efa98ecaec6fa14a2584d7c1e82eadf
|
F src/vdbeInt.h 9bf236dc477fb8f1f54b078cf80064663f8a409a
|
||||||
F src/vdbeapi.c c8c433043d14b5e00e2ed6f7e44543bcc92d1594
|
F src/vdbeapi.c ae87d198eb3ce67c02886601baee0fd478092076
|
||||||
F src/vdbeaux.c 6549864e5fffa3d04941551610e4800de72e1be9
|
F src/vdbeaux.c 6549864e5fffa3d04941551610e4800de72e1be9
|
||||||
F src/vdbeblob.c 1268e0bcb8e21fa32520b0fc376e1bcdfaa0c642
|
F src/vdbeblob.c 1268e0bcb8e21fa32520b0fc376e1bcdfaa0c642
|
||||||
F src/vdbemem.c 833005f1cbbf447289f1973dba2a0c2228c7b8ab
|
F src/vdbemem.c 833005f1cbbf447289f1973dba2a0c2228c7b8ab
|
||||||
@@ -303,7 +303,7 @@ F src/vtab.c 2e8b489db47e20ae36cd247932dc671c9ded0624
|
|||||||
F src/wal.c 7dc3966ef98b74422267e7e6e46e07ff6c6eb1b4
|
F src/wal.c 7dc3966ef98b74422267e7e6e46e07ff6c6eb1b4
|
||||||
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
|
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
|
||||||
F src/walker.c 4fa43583d0a84b48f93b1e88f11adf2065be4e73
|
F src/walker.c 4fa43583d0a84b48f93b1e88f11adf2065be4e73
|
||||||
F src/where.c 67a823e7816464bc1de998841e87a2a3e4c20a94
|
F src/where.c 03a50ecb2f4f02b5492d669a84875947b56b8906
|
||||||
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
||||||
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
||||||
F test/aggnested.test 45c0201e28045ad38a530b5a144b73cd4aa2cfd6
|
F test/aggnested.test 45c0201e28045ad38a530b5a144b73cd4aa2cfd6
|
||||||
@@ -548,7 +548,7 @@ F test/fts3fault.test cb72dccb0a3b9f730f16c5240f3fcb9303eb1660
|
|||||||
F test/fts3fault2.test 3198eef2804deea7cac8403e771d9cbcb752d887
|
F test/fts3fault2.test 3198eef2804deea7cac8403e771d9cbcb752d887
|
||||||
F test/fts3first.test dbdedd20914c8d539aa3206c9b34a23775644641
|
F test/fts3first.test dbdedd20914c8d539aa3206c9b34a23775644641
|
||||||
F test/fts3malloc.test b0e4c133b8d61d4f6d112d8110f8320e9e453ef6
|
F test/fts3malloc.test b0e4c133b8d61d4f6d112d8110f8320e9e453ef6
|
||||||
F test/fts3matchinfo.test 3f297e14e3f0d5be8595246f5fcd426625cc5881
|
F test/fts3matchinfo.test ff423e73faab8fc6d7adeefedf74dd8e2b0b14e0
|
||||||
F test/fts3near.test 12895557870b0f9af7cc0be81a0171abb2d12f12
|
F test/fts3near.test 12895557870b0f9af7cc0be81a0171abb2d12f12
|
||||||
F test/fts3prefix.test b36d4f00b128a51e7b386cc013a874246d9d7dc1
|
F test/fts3prefix.test b36d4f00b128a51e7b386cc013a874246d9d7dc1
|
||||||
F test/fts3prefix2.test e1f0a822ca661dced7f12ce392e14eaf65609dce
|
F test/fts3prefix2.test e1f0a822ca661dced7f12ce392e14eaf65609dce
|
||||||
@@ -729,7 +729,7 @@ F test/pcache2.test a83efe2dec0d392f814bfc998def1d1833942025
|
|||||||
F test/percentile.test b98fc868d71eb5619d42a1702e9ab91718cbed54
|
F test/percentile.test b98fc868d71eb5619d42a1702e9ab91718cbed54
|
||||||
F test/permutations.test 742b8005bb3c782797a20beccdbe213ef52531fb
|
F test/permutations.test 742b8005bb3c782797a20beccdbe213ef52531fb
|
||||||
F test/pragma.test 5e7de6c32a5d764f09437d2025f07e4917b9e178
|
F test/pragma.test 5e7de6c32a5d764f09437d2025f07e4917b9e178
|
||||||
F test/pragma2.test 76e4a54cd4677966e4e75f8a7fe86ccbc250de2a
|
F test/pragma2.test 224f0381f9411a78ae685cac24c13656a62021b7
|
||||||
F test/printf.test ec9870c4dce8686a37818e0bf1aba6e6a1863552
|
F test/printf.test ec9870c4dce8686a37818e0bf1aba6e6a1863552
|
||||||
F test/progress.test 552dc1edc37333a8d3098b8c26a2b7f06f5799d7
|
F test/progress.test 552dc1edc37333a8d3098b8c26a2b7f06f5799d7
|
||||||
F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc
|
F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc
|
||||||
@@ -1119,7 +1119,7 @@ F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
|||||||
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
||||||
F tool/wherecosttest.c f407dc4c79786982a475261866a161cd007947ae
|
F tool/wherecosttest.c f407dc4c79786982a475261866a161cd007947ae
|
||||||
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
|
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
|
||||||
P 69d5bed017bda3e184857febcc8b6f6bed6ad228 a0d9ca4f07f1dc3a189864f8ed9cdb0b1d791b1a
|
P 67587a3348b84424b2ab1f2df1ea923a5168e2e4 7f72fc4f47445a2c01910b268335873de9f75059
|
||||||
R 144b203c75da112b948140b14b84bcaf
|
R 38645eeb23d643e57952026ace84c002
|
||||||
U drh
|
U drh
|
||||||
Z e4751f746fc0244a4adaef8846371a84
|
Z 8d51de2c92073e757664e09f591c4bfa
|
||||||
|
@@ -1 +1 @@
|
|||||||
67587a3348b84424b2ab1f2df1ea923a5168e2e4
|
3e4033285deb417bd72c008917729dbf3bf4e90d
|
82
src/btree.c
82
src/btree.c
@@ -724,6 +724,9 @@ static int btreeRestoreCursorPosition(BtCursor *pCur){
|
|||||||
sqlite3_free(pCur->pKey);
|
sqlite3_free(pCur->pKey);
|
||||||
pCur->pKey = 0;
|
pCur->pKey = 0;
|
||||||
assert( pCur->eState==CURSOR_VALID || pCur->eState==CURSOR_INVALID );
|
assert( pCur->eState==CURSOR_VALID || pCur->eState==CURSOR_INVALID );
|
||||||
|
if( pCur->skipNext && pCur->eState==CURSOR_VALID ){
|
||||||
|
pCur->eState = CURSOR_SKIPNEXT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@@ -749,7 +752,7 @@ int sqlite3BtreeCursorHasMoved(BtCursor *pCur, int *pHasMoved){
|
|||||||
*pHasMoved = 1;
|
*pHasMoved = 1;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
if( pCur->eState!=CURSOR_VALID || pCur->skipNext!=0 ){
|
if( pCur->eState!=CURSOR_VALID || NEVER(pCur->skipNext!=0) ){
|
||||||
*pHasMoved = 1;
|
*pHasMoved = 1;
|
||||||
}else{
|
}else{
|
||||||
*pHasMoved = 0;
|
*pHasMoved = 0;
|
||||||
@@ -4796,21 +4799,29 @@ int sqlite3BtreeNext(BtCursor *pCur, int *pRes){
|
|||||||
MemPage *pPage;
|
MemPage *pPage;
|
||||||
|
|
||||||
assert( cursorHoldsMutex(pCur) );
|
assert( cursorHoldsMutex(pCur) );
|
||||||
rc = restoreCursorPosition(pCur);
|
|
||||||
if( rc!=SQLITE_OK ){
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
assert( pRes!=0 );
|
assert( pRes!=0 );
|
||||||
if( CURSOR_INVALID==pCur->eState ){
|
assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );
|
||||||
*pRes = 1;
|
if( pCur->eState!=CURSOR_VALID ){
|
||||||
return SQLITE_OK;
|
rc = restoreCursorPosition(pCur);
|
||||||
|
if( rc!=SQLITE_OK ){
|
||||||
|
*pRes = 0;
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
if( CURSOR_INVALID==pCur->eState ){
|
||||||
|
*pRes = 1;
|
||||||
|
return SQLITE_OK;
|
||||||
|
}
|
||||||
|
if( pCur->skipNext ){
|
||||||
|
assert( pCur->eState==CURSOR_VALID || pCur->eState==CURSOR_SKIPNEXT );
|
||||||
|
pCur->eState = CURSOR_VALID;
|
||||||
|
if( pCur->skipNext>0 ){
|
||||||
|
pCur->skipNext = 0;
|
||||||
|
*pRes = 0;
|
||||||
|
return SQLITE_OK;
|
||||||
|
}
|
||||||
|
pCur->skipNext = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if( pCur->skipNext>0 ){
|
|
||||||
pCur->skipNext = 0;
|
|
||||||
*pRes = 0;
|
|
||||||
return SQLITE_OK;
|
|
||||||
}
|
|
||||||
pCur->skipNext = 0;
|
|
||||||
|
|
||||||
pPage = pCur->apPage[pCur->iPage];
|
pPage = pCur->apPage[pCur->iPage];
|
||||||
idx = ++pCur->aiIdx[pCur->iPage];
|
idx = ++pCur->aiIdx[pCur->iPage];
|
||||||
@@ -4828,7 +4839,10 @@ int sqlite3BtreeNext(BtCursor *pCur, int *pRes){
|
|||||||
if( idx>=pPage->nCell ){
|
if( idx>=pPage->nCell ){
|
||||||
if( !pPage->leaf ){
|
if( !pPage->leaf ){
|
||||||
rc = moveToChild(pCur, get4byte(&pPage->aData[pPage->hdrOffset+8]));
|
rc = moveToChild(pCur, get4byte(&pPage->aData[pPage->hdrOffset+8]));
|
||||||
if( rc ) return rc;
|
if( rc ){
|
||||||
|
*pRes = 0;
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
rc = moveToLeftmost(pCur);
|
rc = moveToLeftmost(pCur);
|
||||||
*pRes = 0;
|
*pRes = 0;
|
||||||
return rc;
|
return rc;
|
||||||
@@ -4870,21 +4884,32 @@ int sqlite3BtreePrevious(BtCursor *pCur, int *pRes){
|
|||||||
MemPage *pPage;
|
MemPage *pPage;
|
||||||
|
|
||||||
assert( cursorHoldsMutex(pCur) );
|
assert( cursorHoldsMutex(pCur) );
|
||||||
rc = restoreCursorPosition(pCur);
|
assert( pRes!=0 );
|
||||||
if( rc!=SQLITE_OK ){
|
assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
pCur->atLast = 0;
|
pCur->atLast = 0;
|
||||||
if( CURSOR_INVALID==pCur->eState ){
|
if( pCur->eState!=CURSOR_VALID ){
|
||||||
*pRes = 1;
|
if( ALWAYS(pCur->eState>=CURSOR_REQUIRESEEK) ){
|
||||||
return SQLITE_OK;
|
rc = btreeRestoreCursorPosition(pCur);
|
||||||
|
if( rc!=SQLITE_OK ){
|
||||||
|
*pRes = 0;
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( CURSOR_INVALID==pCur->eState ){
|
||||||
|
*pRes = 1;
|
||||||
|
return SQLITE_OK;
|
||||||
|
}
|
||||||
|
if( pCur->skipNext ){
|
||||||
|
assert( pCur->eState==CURSOR_VALID || pCur->eState==CURSOR_SKIPNEXT );
|
||||||
|
pCur->eState = CURSOR_VALID;
|
||||||
|
if( pCur->skipNext<0 ){
|
||||||
|
pCur->skipNext = 0;
|
||||||
|
*pRes = 0;
|
||||||
|
return SQLITE_OK;
|
||||||
|
}
|
||||||
|
pCur->skipNext = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if( pCur->skipNext<0 ){
|
|
||||||
pCur->skipNext = 0;
|
|
||||||
*pRes = 0;
|
|
||||||
return SQLITE_OK;
|
|
||||||
}
|
|
||||||
pCur->skipNext = 0;
|
|
||||||
|
|
||||||
pPage = pCur->apPage[pCur->iPage];
|
pPage = pCur->apPage[pCur->iPage];
|
||||||
assert( pPage->isInit );
|
assert( pPage->isInit );
|
||||||
@@ -4892,6 +4917,7 @@ int sqlite3BtreePrevious(BtCursor *pCur, int *pRes){
|
|||||||
int idx = pCur->aiIdx[pCur->iPage];
|
int idx = pCur->aiIdx[pCur->iPage];
|
||||||
rc = moveToChild(pCur, get4byte(findCell(pPage, idx)));
|
rc = moveToChild(pCur, get4byte(findCell(pPage, idx)));
|
||||||
if( rc ){
|
if( rc ){
|
||||||
|
*pRes = 0;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
rc = moveToRightmost(pCur);
|
rc = moveToRightmost(pCur);
|
||||||
|
@@ -520,14 +520,19 @@ struct BtCursor {
|
|||||||
/*
|
/*
|
||||||
** Potential values for BtCursor.eState.
|
** Potential values for BtCursor.eState.
|
||||||
**
|
**
|
||||||
** CURSOR_VALID:
|
|
||||||
** Cursor points to a valid entry. getPayload() etc. may be called.
|
|
||||||
**
|
|
||||||
** CURSOR_INVALID:
|
** CURSOR_INVALID:
|
||||||
** Cursor does not point to a valid entry. This can happen (for example)
|
** Cursor does not point to a valid entry. This can happen (for example)
|
||||||
** because the table is empty or because BtreeCursorFirst() has not been
|
** because the table is empty or because BtreeCursorFirst() has not been
|
||||||
** called.
|
** called.
|
||||||
**
|
**
|
||||||
|
** CURSOR_VALID:
|
||||||
|
** Cursor points to a valid entry. getPayload() etc. may be called.
|
||||||
|
**
|
||||||
|
** CURSOR_SKIPNEXT:
|
||||||
|
** Cursor is valid except that the Cursor.skipNext field is non-zero
|
||||||
|
** indicating that the next sqlite3BtreeNext() or sqlite3BtreePrevious()
|
||||||
|
** operation should be a no-op.
|
||||||
|
**
|
||||||
** CURSOR_REQUIRESEEK:
|
** CURSOR_REQUIRESEEK:
|
||||||
** The table that this cursor was opened on still exists, but has been
|
** The table that this cursor was opened on still exists, but has been
|
||||||
** modified since the cursor was last used. The cursor position is saved
|
** modified since the cursor was last used. The cursor position is saved
|
||||||
@@ -544,8 +549,9 @@ struct BtCursor {
|
|||||||
*/
|
*/
|
||||||
#define CURSOR_INVALID 0
|
#define CURSOR_INVALID 0
|
||||||
#define CURSOR_VALID 1
|
#define CURSOR_VALID 1
|
||||||
#define CURSOR_REQUIRESEEK 2
|
#define CURSOR_SKIPNEXT 2
|
||||||
#define CURSOR_FAULT 3
|
#define CURSOR_REQUIRESEEK 3
|
||||||
|
#define CURSOR_FAULT 4
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** The database page the PENDING_BYTE occupies. This page is never used.
|
** The database page the PENDING_BYTE occupies. This page is never used.
|
||||||
|
@@ -1279,6 +1279,7 @@ int sqlite3ExprIsInteger(Expr *p, int *pValue){
|
|||||||
case TK_UMINUS: {
|
case TK_UMINUS: {
|
||||||
int v;
|
int v;
|
||||||
if( sqlite3ExprIsInteger(p->pLeft, &v) ){
|
if( sqlite3ExprIsInteger(p->pLeft, &v) ){
|
||||||
|
assert( v!=-2147483648 );
|
||||||
*pValue = -v;
|
*pValue = -v;
|
||||||
rc = 1;
|
rc = 1;
|
||||||
}
|
}
|
||||||
|
@@ -765,6 +765,7 @@ static sqlite3_pcache_page *pcache1Fetch(
|
|||||||
if( pCache->nPage>=pCache->nHash && pcache1ResizeHash(pCache) ){
|
if( pCache->nPage>=pCache->nHash && pcache1ResizeHash(pCache) ){
|
||||||
goto fetch_out;
|
goto fetch_out;
|
||||||
}
|
}
|
||||||
|
assert( pCache->nHash>0 && pCache->apHash );
|
||||||
|
|
||||||
/* Step 4. Try to recycle a page. */
|
/* Step 4. Try to recycle a page. */
|
||||||
if( pCache->bPurgeable && pGroup->pLruTail && (
|
if( pCache->bPurgeable && pGroup->pLruTail && (
|
||||||
|
@@ -3188,7 +3188,6 @@ int main(int argc, char **argv){
|
|||||||
stdin_is_interactive = 0;
|
stdin_is_interactive = 0;
|
||||||
}else if( strcmp(z,"-heap")==0 ){
|
}else if( strcmp(z,"-heap")==0 ){
|
||||||
#if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)
|
#if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)
|
||||||
int j, c;
|
|
||||||
const char *zSize;
|
const char *zSize;
|
||||||
sqlite3_int64 szHeap;
|
sqlite3_int64 szHeap;
|
||||||
|
|
||||||
|
34
src/vdbe.c
34
src/vdbe.c
@@ -598,7 +598,7 @@ int sqlite3VdbeExec(
|
|||||||
#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
|
#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
|
||||||
if( db->xProgress ){
|
if( db->xProgress ){
|
||||||
assert( 0 < db->nProgressOps );
|
assert( 0 < db->nProgressOps );
|
||||||
nProgressLimit = (unsigned)p->aCounter[SQLITE_STMTSTATUS_VM_STEP-1];
|
nProgressLimit = (unsigned)p->aCounter[SQLITE_STMTSTATUS_VM_STEP];
|
||||||
if( nProgressLimit==0 ){
|
if( nProgressLimit==0 ){
|
||||||
nProgressLimit = db->nProgressOps;
|
nProgressLimit = db->nProgressOps;
|
||||||
}else{
|
}else{
|
||||||
@@ -1459,7 +1459,7 @@ case OP_Function: {
|
|||||||
sqlite3VdbeMemMove(&ctx.s, pOut);
|
sqlite3VdbeMemMove(&ctx.s, pOut);
|
||||||
MemSetTypeFlag(&ctx.s, MEM_Null);
|
MemSetTypeFlag(&ctx.s, MEM_Null);
|
||||||
|
|
||||||
ctx.isError = 0;
|
ctx.fErrorOrAux = 0;
|
||||||
if( ctx.pFunc->flags & SQLITE_FUNC_NEEDCOLL ){
|
if( ctx.pFunc->flags & SQLITE_FUNC_NEEDCOLL ){
|
||||||
assert( pOp>aOp );
|
assert( pOp>aOp );
|
||||||
assert( pOp[-1].p4type==P4_COLLSEQ );
|
assert( pOp[-1].p4type==P4_COLLSEQ );
|
||||||
@@ -1470,11 +1470,6 @@ case OP_Function: {
|
|||||||
(*ctx.pFunc->xFunc)(&ctx, n, apVal); /* IMP: R-24505-23230 */
|
(*ctx.pFunc->xFunc)(&ctx, n, apVal); /* IMP: R-24505-23230 */
|
||||||
lastRowid = db->lastRowid;
|
lastRowid = db->lastRowid;
|
||||||
|
|
||||||
/* If any auxiliary data functions have been called by this user function,
|
|
||||||
** immediately call the destructor for any non-static values.
|
|
||||||
*/
|
|
||||||
sqlite3VdbeDeleteAuxData(p, pc, pOp->p1);
|
|
||||||
|
|
||||||
if( db->mallocFailed ){
|
if( db->mallocFailed ){
|
||||||
/* Even though a malloc() has failed, the implementation of the
|
/* Even though a malloc() has failed, the implementation of the
|
||||||
** user function may have called an sqlite3_result_XXX() function
|
** user function may have called an sqlite3_result_XXX() function
|
||||||
@@ -1486,9 +1481,12 @@ case OP_Function: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If the function returned an error, throw an exception */
|
/* If the function returned an error, throw an exception */
|
||||||
if( ctx.isError ){
|
if( ctx.fErrorOrAux ){
|
||||||
sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3_value_text(&ctx.s));
|
if( ctx.isError ){
|
||||||
rc = ctx.isError;
|
sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3_value_text(&ctx.s));
|
||||||
|
rc = ctx.isError;
|
||||||
|
}
|
||||||
|
sqlite3VdbeDeleteAuxData(p, pc, pOp->p1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the result of the function into register P3 */
|
/* Copy the result of the function into register P3 */
|
||||||
@@ -1860,12 +1858,12 @@ case OP_Ge: { /* same as TK_GE, jump, in1, in3 */
|
|||||||
** then the result is always NULL.
|
** then the result is always NULL.
|
||||||
** The jump is taken if the SQLITE_JUMPIFNULL bit is set.
|
** The jump is taken if the SQLITE_JUMPIFNULL bit is set.
|
||||||
*/
|
*/
|
||||||
if( pOp->p5 & SQLITE_STOREP2 ){
|
if( pOp->p5 & SQLITE_JUMPIFNULL ){
|
||||||
|
pc = pOp->p2-1;
|
||||||
|
}else if( pOp->p5 & SQLITE_STOREP2 ){
|
||||||
pOut = &aMem[pOp->p2];
|
pOut = &aMem[pOp->p2];
|
||||||
MemSetTypeFlag(pOut, MEM_Null);
|
MemSetTypeFlag(pOut, MEM_Null);
|
||||||
REGISTER_TRACE(pOp->p2, pOut);
|
REGISTER_TRACE(pOp->p2, pOut);
|
||||||
}else if( pOp->p5 & SQLITE_JUMPIFNULL ){
|
|
||||||
pc = pOp->p2-1;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -4492,7 +4490,7 @@ case OP_Sort: { /* jump */
|
|||||||
sqlite3_sort_count++;
|
sqlite3_sort_count++;
|
||||||
sqlite3_search_count--;
|
sqlite3_search_count--;
|
||||||
#endif
|
#endif
|
||||||
p->aCounter[SQLITE_STMTSTATUS_SORT-1]++;
|
p->aCounter[SQLITE_STMTSTATUS_SORT]++;
|
||||||
/* Fall through into OP_Rewind */
|
/* Fall through into OP_Rewind */
|
||||||
}
|
}
|
||||||
/* Opcode: Rewind P1 P2 * * *
|
/* Opcode: Rewind P1 P2 * * *
|
||||||
@@ -4571,7 +4569,7 @@ case OP_Next: { /* jump */
|
|||||||
int res;
|
int res;
|
||||||
|
|
||||||
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
|
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
|
||||||
assert( pOp->p5<=ArraySize(p->aCounter) );
|
assert( pOp->p5<ArraySize(p->aCounter) );
|
||||||
pC = p->apCsr[pOp->p1];
|
pC = p->apCsr[pOp->p1];
|
||||||
if( pC==0 ){
|
if( pC==0 ){
|
||||||
break; /* See ticket #2273 */
|
break; /* See ticket #2273 */
|
||||||
@@ -4581,7 +4579,7 @@ case OP_Next: { /* jump */
|
|||||||
assert( pOp->opcode==OP_SorterNext );
|
assert( pOp->opcode==OP_SorterNext );
|
||||||
rc = sqlite3VdbeSorterNext(db, pC, &res);
|
rc = sqlite3VdbeSorterNext(db, pC, &res);
|
||||||
}else{
|
}else{
|
||||||
res = 1;
|
/* res = 1; // Always initialized by the xAdvance() call */
|
||||||
assert( pC->deferredMoveto==0 );
|
assert( pC->deferredMoveto==0 );
|
||||||
assert( pC->pCursor );
|
assert( pC->pCursor );
|
||||||
assert( pOp->opcode!=OP_Next || pOp->p4.xAdvance==sqlite3BtreeNext );
|
assert( pOp->opcode!=OP_Next || pOp->p4.xAdvance==sqlite3BtreeNext );
|
||||||
@@ -4592,7 +4590,7 @@ case OP_Next: { /* jump */
|
|||||||
pC->cacheStatus = CACHE_STALE;
|
pC->cacheStatus = CACHE_STALE;
|
||||||
if( res==0 ){
|
if( res==0 ){
|
||||||
pc = pOp->p2 - 1;
|
pc = pOp->p2 - 1;
|
||||||
if( pOp->p5 ) p->aCounter[pOp->p5-1]++;
|
p->aCounter[pOp->p5]++;
|
||||||
#ifdef SQLITE_TEST
|
#ifdef SQLITE_TEST
|
||||||
sqlite3_search_count++;
|
sqlite3_search_count++;
|
||||||
#endif
|
#endif
|
||||||
@@ -6295,7 +6293,7 @@ vdbe_error_halt:
|
|||||||
vdbe_return:
|
vdbe_return:
|
||||||
db->lastRowid = lastRowid;
|
db->lastRowid = lastRowid;
|
||||||
testcase( nVmStep>0 );
|
testcase( nVmStep>0 );
|
||||||
p->aCounter[SQLITE_STMTSTATUS_VM_STEP-1] += (int)nVmStep;
|
p->aCounter[SQLITE_STMTSTATUS_VM_STEP] += (int)nVmStep;
|
||||||
sqlite3VdbeLeave(p);
|
sqlite3VdbeLeave(p);
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
@@ -266,10 +266,11 @@ struct sqlite3_context {
|
|||||||
Mem s; /* The return value is stored here */
|
Mem s; /* The return value is stored here */
|
||||||
Mem *pMem; /* Memory cell used to store aggregate context */
|
Mem *pMem; /* Memory cell used to store aggregate context */
|
||||||
CollSeq *pColl; /* Collating sequence */
|
CollSeq *pColl; /* Collating sequence */
|
||||||
int isError; /* Error code returned by the function. */
|
|
||||||
int skipFlag; /* Skip skip accumulator loading if true */
|
|
||||||
int iOp; /* Instruction number of OP_Function */
|
|
||||||
Vdbe *pVdbe; /* The VM that owns this context */
|
Vdbe *pVdbe; /* The VM that owns this context */
|
||||||
|
int iOp; /* Instruction number of OP_Function */
|
||||||
|
int isError; /* Error code returned by the function. */
|
||||||
|
u8 skipFlag; /* Skip skip accumulator loading if true */
|
||||||
|
u8 fErrorOrAux; /* isError!=0 or pVdbe->pAuxData modified */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -345,7 +346,7 @@ struct Vdbe {
|
|||||||
yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */
|
yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */
|
||||||
yDbMask lockMask; /* Subset of btreeMask that requires a lock */
|
yDbMask lockMask; /* Subset of btreeMask that requires a lock */
|
||||||
int iStatement; /* Statement number (or 0 if has not opened stmt) */
|
int iStatement; /* Statement number (or 0 if has not opened stmt) */
|
||||||
int aCounter[4]; /* Counters used by sqlite3_stmt_status() */
|
u32 aCounter[5]; /* Counters used by sqlite3_stmt_status() */
|
||||||
#ifndef SQLITE_OMIT_TRACE
|
#ifndef SQLITE_OMIT_TRACE
|
||||||
i64 startTime; /* Time when query started - used for profiling */
|
i64 startTime; /* Time when query started - used for profiling */
|
||||||
#endif
|
#endif
|
||||||
|
@@ -211,12 +211,14 @@ void sqlite3_result_double(sqlite3_context *pCtx, double rVal){
|
|||||||
void sqlite3_result_error(sqlite3_context *pCtx, const char *z, int n){
|
void sqlite3_result_error(sqlite3_context *pCtx, const char *z, int n){
|
||||||
assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
|
assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
|
||||||
pCtx->isError = SQLITE_ERROR;
|
pCtx->isError = SQLITE_ERROR;
|
||||||
|
pCtx->fErrorOrAux = 1;
|
||||||
sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF8, SQLITE_TRANSIENT);
|
sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF8, SQLITE_TRANSIENT);
|
||||||
}
|
}
|
||||||
#ifndef SQLITE_OMIT_UTF16
|
#ifndef SQLITE_OMIT_UTF16
|
||||||
void sqlite3_result_error16(sqlite3_context *pCtx, const void *z, int n){
|
void sqlite3_result_error16(sqlite3_context *pCtx, const void *z, int n){
|
||||||
assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
|
assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
|
||||||
pCtx->isError = SQLITE_ERROR;
|
pCtx->isError = SQLITE_ERROR;
|
||||||
|
pCtx->fErrorOrAux = 1;
|
||||||
sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF16NATIVE, SQLITE_TRANSIENT);
|
sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF16NATIVE, SQLITE_TRANSIENT);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -280,6 +282,7 @@ void sqlite3_result_zeroblob(sqlite3_context *pCtx, int n){
|
|||||||
}
|
}
|
||||||
void sqlite3_result_error_code(sqlite3_context *pCtx, int errCode){
|
void sqlite3_result_error_code(sqlite3_context *pCtx, int errCode){
|
||||||
pCtx->isError = errCode;
|
pCtx->isError = errCode;
|
||||||
|
pCtx->fErrorOrAux = 1;
|
||||||
if( pCtx->s.flags & MEM_Null ){
|
if( pCtx->s.flags & MEM_Null ){
|
||||||
sqlite3VdbeMemSetStr(&pCtx->s, sqlite3ErrStr(errCode), -1,
|
sqlite3VdbeMemSetStr(&pCtx->s, sqlite3ErrStr(errCode), -1,
|
||||||
SQLITE_UTF8, SQLITE_STATIC);
|
SQLITE_UTF8, SQLITE_STATIC);
|
||||||
@@ -290,6 +293,7 @@ void sqlite3_result_error_code(sqlite3_context *pCtx, int errCode){
|
|||||||
void sqlite3_result_error_toobig(sqlite3_context *pCtx){
|
void sqlite3_result_error_toobig(sqlite3_context *pCtx){
|
||||||
assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
|
assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
|
||||||
pCtx->isError = SQLITE_TOOBIG;
|
pCtx->isError = SQLITE_TOOBIG;
|
||||||
|
pCtx->fErrorOrAux = 1;
|
||||||
sqlite3VdbeMemSetStr(&pCtx->s, "string or blob too big", -1,
|
sqlite3VdbeMemSetStr(&pCtx->s, "string or blob too big", -1,
|
||||||
SQLITE_UTF8, SQLITE_STATIC);
|
SQLITE_UTF8, SQLITE_STATIC);
|
||||||
}
|
}
|
||||||
@@ -299,6 +303,7 @@ void sqlite3_result_error_nomem(sqlite3_context *pCtx){
|
|||||||
assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
|
assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
|
||||||
sqlite3VdbeMemSetNull(&pCtx->s);
|
sqlite3VdbeMemSetNull(&pCtx->s);
|
||||||
pCtx->isError = SQLITE_NOMEM;
|
pCtx->isError = SQLITE_NOMEM;
|
||||||
|
pCtx->fErrorOrAux = 1;
|
||||||
pCtx->s.db->mallocFailed = 1;
|
pCtx->s.db->mallocFailed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -621,6 +626,10 @@ void sqlite3_set_auxdata(
|
|||||||
pAuxData->iArg = iArg;
|
pAuxData->iArg = iArg;
|
||||||
pAuxData->pNext = pVdbe->pAuxData;
|
pAuxData->pNext = pVdbe->pAuxData;
|
||||||
pVdbe->pAuxData = pAuxData;
|
pVdbe->pAuxData = pAuxData;
|
||||||
|
if( pCtx->fErrorOrAux==0 ){
|
||||||
|
pCtx->isError = 0;
|
||||||
|
pCtx->fErrorOrAux = 1;
|
||||||
|
}
|
||||||
}else if( pAuxData->xDelete ){
|
}else if( pAuxData->xDelete ){
|
||||||
pAuxData->xDelete(pAuxData->pAux);
|
pAuxData->xDelete(pAuxData->pAux);
|
||||||
}
|
}
|
||||||
@@ -1309,9 +1318,9 @@ sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt){
|
|||||||
*/
|
*/
|
||||||
int sqlite3_stmt_status(sqlite3_stmt *pStmt, int op, int resetFlag){
|
int sqlite3_stmt_status(sqlite3_stmt *pStmt, int op, int resetFlag){
|
||||||
Vdbe *pVdbe = (Vdbe*)pStmt;
|
Vdbe *pVdbe = (Vdbe*)pStmt;
|
||||||
int v = pVdbe->aCounter[op-1];
|
u32 v = pVdbe->aCounter[op];
|
||||||
if( resetFlag ) pVdbe->aCounter[op-1] = 0;
|
if( resetFlag ) pVdbe->aCounter[op] = 0;
|
||||||
return v;
|
return (int)v;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
|
#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
|
||||||
|
@@ -4337,7 +4337,9 @@ static int whereLoopAddBtreeIndex(
|
|||||||
int nIn = 0;
|
int nIn = 0;
|
||||||
if( pTerm->prereqRight & pNew->maskSelf ) continue;
|
if( pTerm->prereqRight & pNew->maskSelf ) continue;
|
||||||
#ifdef SQLITE_ENABLE_STAT3
|
#ifdef SQLITE_ENABLE_STAT3
|
||||||
if( (pTerm->wtFlags & TERM_VNULL)!=0 && pSrc->pTab->aCol[iCol].notNull ){
|
if( (pTerm->wtFlags & TERM_VNULL)!=0
|
||||||
|
&& (iCol<0 || pSrc->pTab->aCol[iCol].notNull)
|
||||||
|
){
|
||||||
continue; /* skip IS NOT NULL constraints on a NOT NULL column */
|
continue; /* skip IS NOT NULL constraints on a NOT NULL column */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -4480,6 +4482,7 @@ static Bitmask columnsInIndex(Index *pIdx){
|
|||||||
int j;
|
int j;
|
||||||
for(j=pIdx->nColumn-1; j>=0; j--){
|
for(j=pIdx->nColumn-1; j>=0; j--){
|
||||||
int x = pIdx->aiColumn[j];
|
int x = pIdx->aiColumn[j];
|
||||||
|
assert( x>=0 );
|
||||||
testcase( x==BMS-1 );
|
testcase( x==BMS-1 );
|
||||||
testcase( x==BMS-2 );
|
testcase( x==BMS-2 );
|
||||||
if( x<BMS-1 ) m |= MASKBIT(x);
|
if( x<BMS-1 ) m |= MASKBIT(x);
|
||||||
|
@@ -426,4 +426,11 @@ do_execsql_test 8.3 {
|
|||||||
{0 3 2 0 3 2 1 4 3} {1 3 2 1 3 2 1 4 3} {2 3 2 2 3 2 2 4 3}
|
{0 3 2 0 3 2 1 4 3} {1 3 2 1 3 2 1 4 3} {2 3 2 2 3 2 2 4 3}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
do_execsql_test 9.1 {
|
||||||
|
CREATE VIRTUAL TABLE ft2 USING fts4;
|
||||||
|
INSERT INTO ft2 VALUES('a b c d e');
|
||||||
|
INSERT INTO ft2 VALUES('f a b c d');
|
||||||
|
SELECT snippet(ft2, '[', ']', '', -1, 1) FROM ft2 WHERE ft2 MATCH 'c';
|
||||||
|
} {{[c]} {[c]}}
|
||||||
|
|
||||||
finish_test
|
finish_test
|
||||||
|
@@ -154,6 +154,7 @@ do_execsql_test pragma2-4.3 {
|
|||||||
DETACH aux1;
|
DETACH aux1;
|
||||||
PRAGMA cache_spill=ON;
|
PRAGMA cache_spill=ON;
|
||||||
} {}
|
} {}
|
||||||
|
sqlite3_release_memory
|
||||||
do_test pragma2-4.4 {
|
do_test pragma2-4.4 {
|
||||||
db eval {
|
db eval {
|
||||||
BEGIN;
|
BEGIN;
|
||||||
@@ -184,6 +185,9 @@ do_execsql_test pragma2-4.6 {
|
|||||||
} {main unlocked temp unknown aux1 reserved}
|
} {main unlocked temp unknown aux1 reserved}
|
||||||
do_execsql_test pragma2-4.7 {
|
do_execsql_test pragma2-4.7 {
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
}
|
||||||
|
sqlite3_release_memory
|
||||||
|
do_execsql_test pragma2-4.8 {
|
||||||
PRAGMA cache_spill=ON; -- Applies to all databases
|
PRAGMA cache_spill=ON; -- Applies to all databases
|
||||||
BEGIN;
|
BEGIN;
|
||||||
UPDATE t2 SET c=c-1;
|
UPDATE t2 SET c=c-1;
|
||||||
|
Reference in New Issue
Block a user