From 3bb9b93f1f725d75d7c39b56f2611e8d425b922b Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 6 Aug 2010 02:10:00 +0000 Subject: [PATCH 1/2] Change two automatic array variables into static constant arrays. Update and reformat some comments for cleaner presentation. FossilOrigin-Name: a7a15547cccb4aeb719aba19641f31390c316d8c --- manifest | 22 +++++++++++----------- manifest.uuid | 2 +- src/sqliteInt.h | 2 +- src/vdbe.c | 2 +- src/where.c | 14 +++++++------- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/manifest b/manifest index 2057083d8f..a24bdc4781 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -C Make\sthe\ssize\sof\sa\sBitvec\sobject\s512\sbytes\son\sall\splatforms,\sinstead\sof\nhaving\sthe\ssize\sdepend\son\sthe\ssize\sof\sa\spointer.\s\sThis\smakes\stesting\seasier. -D 2010-08-05T11:56:01 +C Change\stwo\sautomatic\sarray\svariables\sinto\sstatic\sconstant\sarrays.\nUpdate\sand\sreformat\ssome\scomments\sfor\scleaner\spresentation. +D 2010-08-06T02:10:00 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -175,7 +175,7 @@ F src/select.c 74fef1334bec27e606ef0b19e5c41cd0a639e69c F src/shell.c 8517fc1f9c59ae4007e6cc8b9af91ab231ea2056 F src/sqlite.h.in ae47c9a641c0ce766719aa4657e26b319d253c8c F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89 -F src/sqliteInt.h a9be6badc6cd6a3c1ae54475a98661cf351ecad5 +F src/sqliteInt.h 1086f4a396d6a99c6a8d6654dfb5eb6adf3a476b F src/sqliteLimit.h 196e2f83c3b444c4548fc1874f52f84fdbda40f3 F src/status.c 496913d4e8441195f6f2a75b1c95993a45b9b30b F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e @@ -221,7 +221,7 @@ F src/update.c 1521162d20c2994af1fdc8833e1a88dae09052c8 F src/utf.c 1baeeac91707a4df97ccc6141ec0f808278af685 F src/util.c 32aebf04c10e51ad3977a928b7416bed671b620b F src/vacuum.c 241a8386727c1497eba4955933356dfba6ff8c9f -F src/vdbe.c cefff41564b68a412e65e6a1013ec1b1c1ece6c4 +F src/vdbe.c 66c262a923915e596379b1d597178e04c5d719e4 F src/vdbe.h 4de0efb4b0fdaaa900cf419b35c458933ef1c6d2 F src/vdbeInt.h ffd68c4d4229227a5089bec53a1c635146177abc F src/vdbeapi.c d0f4407e465f261780ad725c1caece7d66a6aa35 @@ -233,7 +233,7 @@ F src/vtab.c 82200af3881fa4e1c9cf07cf31d98c09d437e3ab F src/wal.c 0925601f3299c2941a67c9cfff41ee710f70ca82 F src/wal.h 906c85760598b18584921fe08008435aa4eeeeb2 F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f -F src/where.c a4b2cb14dbd727ff277be3f52851425191a87f66 +F src/where.c 7db3e41c2a846f9deeb24f1bbb75461b4010b7b5 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87 F test/all.test 6745008c144bd2956d58864d21f7b304689c1cce @@ -844,14 +844,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P fbe70e1106bcc5086ceb9d8f39cc39baf3643092 -R a25d4976c28303b9ae9125c186188014 +P ca479f3de2927ccc05dc76d10e40c00b8e0c88d1 +R 64f852d682dc3f154b6b3ff0ef239170 U drh -Z 8f5efa6fecfd7fa3fad1ed81decfa1dd +Z 26ba9cd8b96f683b407f392f1d6bc552 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) -iD8DBQFMWqbVoxKgR168RlERAscFAJ45yMty4Qnb2iMTPTMkwlnUoOKhngCfQYvQ -vojbw1sglMnSTmStMZz2HhI= -=ZUPy +iD8DBQFMW278oxKgR168RlERAgj0AJ92KeE7Pu9xmm9ax2ljGa1ynmj4KgCfSE5R +Kjjl2xbC7iD1zbZvAMYEGpQ= +=c2NC -----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index 7b55127e1c..e09c948e41 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ca479f3de2927ccc05dc76d10e40c00b8e0c88d1 \ No newline at end of file +a7a15547cccb4aeb719aba19641f31390c316d8c \ No newline at end of file diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 45b893b2dc..b136b8b763 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -1356,7 +1356,7 @@ struct KeyInfo { sqlite3 *db; /* The database connection */ u8 enc; /* Text encoding - one of the TEXT_Utf* values */ u16 nField; /* Number of entries in aColl[] */ - u8 *aSortOrder; /* If defined an aSortOrder[i] is true, sort DESC */ + u8 *aSortOrder; /* Sort order for each column. May be NULL */ CollSeq *aColl[1]; /* Collating sequence for each term of the key */ }; diff --git a/src/vdbe.c b/src/vdbe.c index 29c2d498d3..1e7fc16752 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -4349,7 +4349,7 @@ case OP_IdxRowid: { /* out2-prerelease */ ** that if the key from register P3 is a prefix of the key in the cursor, ** the result is false whereas it would be true with IdxGT. */ -/* Opcode: IdxLT P1 P2 P3 * P5 +/* Opcode: IdxLT P1 P2 P3 P4 P5 ** ** The P4 register values beginning with P3 form an unpacked index ** key that omits the ROWID. Compare this key value against the index diff --git a/src/where.c b/src/where.c index ae9bf85fab..9040ad0d68 100644 --- a/src/where.c +++ b/src/where.c @@ -3365,7 +3365,7 @@ static Bitmask codeOneLoopStart( ** constraints but an index is selected anyway, in order ** to force the output order to conform to an ORDER BY. */ - int aStartOp[] = { + static const u8 aStartOp[] = { 0, 0, OP_Rewind, /* 2: (!start_constraints && startEq && !bRev) */ @@ -3375,12 +3375,12 @@ static Bitmask codeOneLoopStart( OP_SeekGe, /* 6: (start_constraints && startEq && !bRev) */ OP_SeekLe /* 7: (start_constraints && startEq && bRev) */ }; - int aEndOp[] = { + static const u8 aEndOp[] = { OP_Noop, /* 0: (!end_constraints) */ OP_IdxGE, /* 1: (end_constraints && !bRev) */ OP_IdxLT /* 2: (end_constraints && bRev) */ }; - int nEq = pLevel->plan.nEq; + int nEq = pLevel->plan.nEq; /* Number of == or IN terms */ int isMinQuery = 0; /* If this is an optimized SELECT min(x).. */ int regBase; /* Base register holding constraint values */ int r1; /* Temp register */ @@ -3390,10 +3390,10 @@ static Bitmask codeOneLoopStart( int endEq; /* True if range end uses ==, >= or <= */ int start_constraints; /* Start of range is constrained */ int nConstraint; /* Number of constraint terms */ - Index *pIdx; /* The index we will be using */ - int iIdxCur; /* The VDBE cursor for the index */ - int nExtraReg = 0; /* Number of extra registers needed */ - int op; /* Instruction opcode */ + Index *pIdx; /* The index we will be using */ + int iIdxCur; /* The VDBE cursor for the index */ + int nExtraReg = 0; /* Number of extra registers needed */ + int op; /* Instruction opcode */ char *zStartAff; /* Affinity for start of range constraint */ char *zEndAff; /* Affinity for end of range constraint */ From cb79e5137c2c492d8d626c6d3e53a1edd783afa9 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 6 Aug 2010 13:50:07 +0000 Subject: [PATCH 2/2] Do not run some tests in notify3.test with the inmemory_journal permutation. They do not pass as the tests assume that the database schema is not loaded until the first invocation of [db eval]. This is not true with the inmemory_journal permutation. FossilOrigin-Name: 698fba826e40ce6414cf6c261441d68b174c1637 --- manifest | 26 ++++--------- manifest.uuid | 2 +- test/notify3.test | 95 +++++++++++++++++++++++++---------------------- test/tester.tcl | 6 +++ 4 files changed, 66 insertions(+), 63 deletions(-) diff --git a/manifest b/manifest index a24bdc4781..91eccdb9fd 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,5 @@ ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA1 - -C Change\stwo\sautomatic\sarray\svariables\sinto\sstatic\sconstant\sarrays.\nUpdate\sand\sreformat\ssome\scomments\sfor\scleaner\spresentation. -D 2010-08-06T02:10:00 +C Do\snot\srun\ssome\stests\sin\snotify3.test\swith\sthe\sinmemory_journal\spermutation.\sThey\sdo\snot\spass\sas\sthe\stests\sassume\sthat\sthe\sdatabase\sschema\sis\snot\sloaded\suntil\sthe\sfirst\sinvocation\sof\s[db\seval].\sThis\sis\snot\strue\swith\sthe\sinmemory_journal\spermutation. +D 2010-08-06T13:50:07 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -537,7 +534,7 @@ F test/mutex2.test bfeaeac2e73095b2ac32285d2756e3a65e681660 F test/nan.test a44e04df1486fcfb02d32468cbcd3c8e1e433723 F test/notify1.test 8433bc74bd952fb8a6e3f8d7a4c2b28dfd69e310 F test/notify2.test 195a467e021f74197be2c4fb02d6dee644b8d8db -F test/notify3.test 7eeba3628c4e707c004b72a2489c48fbdbc5c2ee +F test/notify3.test d60923e186e0900f4812a845fcdfd8eea096e33a F test/notnull.test cc7c78340328e6112a13c3e311a9ab3127114347 F test/null.test a8b09b8ed87852742343b33441a9240022108993 F test/openv2.test af02ed0a9cbc0d2a61b8f35171d4d117e588e4ec @@ -622,7 +619,7 @@ F test/tclsqlite.test 8c154101e704170c2be10f137a5499ac2c6da8d3 F test/tempdb.test 800c36623d67a2ad1f58784b9c5644e0405af6e6 F test/temptable.test f42121a0d29a62f00f93274464164177ab1cc24a F test/temptrigger.test b0273db072ce5f37cf19140ceb1f0d524bbe9f05 -F test/tester.tcl 36552bcc93adb3a932a487da84da6597cdc5871b +F test/tester.tcl 6135019fcfac363ea0e11aee670cc97080ab578e F test/thread001.test a3e6a7254d1cb057836cb3145b60c10bf5b7e60f F test/thread002.test afd20095e6e845b405df4f2c920cb93301ca69db F test/thread003.test b824d4f52b870ae39fc5bae4d8070eca73085dca @@ -844,14 +841,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P ca479f3de2927ccc05dc76d10e40c00b8e0c88d1 -R 64f852d682dc3f154b6b3ff0ef239170 -U drh -Z 26ba9cd8b96f683b407f392f1d6bc552 ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.6 (GNU/Linux) - -iD8DBQFMW278oxKgR168RlERAgj0AJ92KeE7Pu9xmm9ax2ljGa1ynmj4KgCfSE5R -Kjjl2xbC7iD1zbZvAMYEGpQ= -=c2NC ------END PGP SIGNATURE----- +P a7a15547cccb4aeb719aba19641f31390c316d8c +R da6a7e3b792474c6501a800e8485c2ad +U dan +Z 24f7070a35c4e17ac7f061d90b9ace3b diff --git a/manifest.uuid b/manifest.uuid index e09c948e41..d5cb04f362 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a7a15547cccb4aeb719aba19641f31390c316d8c \ No newline at end of file +698fba826e40ce6414cf6c261441d68b174c1637 \ No newline at end of file diff --git a/test/notify3.test b/test/notify3.test index 7c7d5acf5c..0d06ce19c0 100644 --- a/test/notify3.test +++ b/test/notify3.test @@ -92,50 +92,57 @@ set noerr {{0 {}}} # it is possible to use the unlock-notify mechanism to determine when # the ATTACH might succeed. # -foreach { - tn - db1_loaded - db2_loaded - enable_extended_errors - result - error1 error2 -} " - 0 0 0 0 $err SQLITE_LOCKED SQLITE_LOCKED_SHAREDCACHE - 1 0 0 1 $err SQLITE_LOCKED_SHAREDCACHE SQLITE_LOCKED_SHAREDCACHE - 2 0 1 0 $err SQLITE_LOCKED SQLITE_LOCKED_SHAREDCACHE - 3 0 1 1 $err SQLITE_LOCKED_SHAREDCACHE SQLITE_LOCKED_SHAREDCACHE - 4 1 0 0 $err SQLITE_LOCKED SQLITE_LOCKED_SHAREDCACHE - 5 1 0 1 $err SQLITE_LOCKED_SHAREDCACHE SQLITE_LOCKED_SHAREDCACHE - 6 1 1 0 $noerr SQLITE_OK SQLITE_OK - 7 1 1 1 $noerr SQLITE_OK SQLITE_OK -" { - - do_test notify3-2.$tn.1 { - catch { db1 close } - catch { db2 close } - sqlite3 db1 test.db - sqlite3 db2 test.db2 - - sqlite3_extended_result_codes db1 $enable_extended_errors - sqlite3_extended_result_codes db2 $enable_extended_errors - - if { $db1_loaded } { db1 eval "SELECT * FROM sqlite_master" } - if { $db2_loaded } { db2 eval "SELECT * FROM sqlite_master" } - - db2 eval "BEGIN EXCLUSIVE" - catchsql "ATTACH 'test.db2' AS two" db1 - } $result - - do_test notify3-2.$tn.2 { - list [sqlite3_errcode db1] [sqlite3_extended_errcode db1] - } [list $error1 $error2] - - do_test notify3-2.$tn.3 { - db1 unlock_notify {set invoked 1} - set invoked 0 - db2 eval commit - set invoked - } [lindex $result 0] +# This test does not work for test-permutations that specify SQL to +# be executed as part of the [sqlite3] command that opens the database. +# Executing such SQL causes SQLite to load the database schema into memory +# earlier than expected, causing test cases to fail. +# +if {[presql] == ""} { + foreach { + tn + db1_loaded + db2_loaded + enable_extended_errors + result + error1 error2 + } " + 0 0 0 0 $err SQLITE_LOCKED SQLITE_LOCKED_SHAREDCACHE + 1 0 0 1 $err SQLITE_LOCKED_SHAREDCACHE SQLITE_LOCKED_SHAREDCACHE + 2 0 1 0 $err SQLITE_LOCKED SQLITE_LOCKED_SHAREDCACHE + 3 0 1 1 $err SQLITE_LOCKED_SHAREDCACHE SQLITE_LOCKED_SHAREDCACHE + 4 1 0 0 $err SQLITE_LOCKED SQLITE_LOCKED_SHAREDCACHE + 5 1 0 1 $err SQLITE_LOCKED_SHAREDCACHE SQLITE_LOCKED_SHAREDCACHE + 6 1 1 0 $noerr SQLITE_OK SQLITE_OK + 7 1 1 1 $noerr SQLITE_OK SQLITE_OK + " { + + do_test notify3-2.$tn.1 { + catch { db1 close } + catch { db2 close } + sqlite3 db1 test.db + sqlite3 db2 test.db2 + + sqlite3_extended_result_codes db1 $enable_extended_errors + sqlite3_extended_result_codes db2 $enable_extended_errors + + if { $db1_loaded } { db1 eval "SELECT * FROM sqlite_master" } + if { $db2_loaded } { db2 eval "SELECT * FROM sqlite_master" } + + db2 eval "BEGIN EXCLUSIVE" + catchsql "ATTACH 'test.db2' AS two" db1 + } $result + + do_test notify3-2.$tn.2 { + list [sqlite3_errcode db1] [sqlite3_extended_errcode db1] + } [list $error1 $error2] + + do_test notify3-2.$tn.3 { + db1 unlock_notify {set invoked 1} + set invoked 0 + db2 eval commit + set invoked + } [lindex $result 0] + } } catch { db1 close } catch { db2 close } diff --git a/test/tester.tcl b/test/tester.tcl index e4193b48f8..fb26561b23 100644 --- a/test/tester.tcl +++ b/test/tester.tcl @@ -70,6 +70,7 @@ # wal_set_journal_mode ?DB? # wal_check_journal_mode TESTNAME?DB? # permutation +# presql # # Set the precision of FP arithmatic used by the interpreter. And @@ -1150,6 +1151,11 @@ proc permutation {} { catch {set perm $::G(perm:name)} set perm } +proc presql {} { + set presql "" + catch {set presql $::G(perm:presql)} + set presql +} #------------------------------------------------------------------------- #