]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Split out sqlite3BtreeCursorHintFlags() from sqlite3BtreeCursorHint()
authordrh <drh@noemail.net>
Tue, 27 Oct 2015 13:24:37 +0000 (13:24 +0000)
committerdrh <drh@noemail.net>
Tue, 27 Oct 2015 13:24:37 +0000 (13:24 +0000)
the interface for improved performance.

FossilOrigin-Name: b3ec9a0d62c5543e91d4be2cd634ec4a3d6dca11

manifest
manifest.uuid
src/btree.c
src/btree.h
src/test_config.c
src/vdbe.c
test/cursorhint.test

index 289ffeb94106719f596f5116c99602ea528a0110..7410e88e6d54da7628db4a88db3217c0080eeedc 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Merge\sthe\sBTREE_FORDELETE\senhancement\swith\sthis\sbranch.
-D 2015-10-26T20:11:24.886
+C Split\sout\ssqlite3BtreeCursorHintFlags()\sfrom\ssqlite3BtreeCursorHint()\s\nthe\sinterface\sfor\simproved\sperformance.
+D 2015-10-27T13:24:37.039
 F Makefile.in 2ea961bc09e441874eb3d1bf7398e04feb24f3ee
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc 702d3e98f3afc6587a78481257f3c4c900efc3a4
@@ -280,8 +280,8 @@ F src/auth.c b56c78ebe40a2110fd361379f7e8162d23f92240
 F src/backup.c c3a9c4209439b806c44cf30daf466955727bf46c
 F src/bitvec.c d1f21d7d91690747881f03940584f4cc548c9d3d
 F src/btmutex.c 45a968cc85afed9b5e6cf55bf1f42f8d18107f79
-F src/btree.c 8022201b3008c9ff151cf56cf2c36a0db93689fd
-F src/btree.h 1957827f808875473750026cf60ca0c2b3676c98
+F src/btree.c 77343aac89c50bb5e06cbca3ace8c057c14de57c
+F src/btree.h b512723e4f27d7ba16b4b985cdecdb82c0f6d0c0
 F src/btreeInt.h 8177c9ab90d772d6d2c6c517e05bed774b7c92c0
 F src/build.c d6162335d690396dfc5c4bd59e8b2b0c14ba6285
 F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0
@@ -362,7 +362,7 @@ F src/test_autoext.c dea8a01a7153b9adc97bd26161e4226329546e12
 F src/test_backup.c 2e6e6a081870150f20c526a2e9d0d29cda47d803
 F src/test_blob.c e5a7a81d61a780da79101aeb1e60d300af169e07
 F src/test_btree.c 2e9978eca99a9a4bfa8cae949efb00886860a64f
-F src/test_config.c ada6f38b0acb6722fb7f0ed8c54fd66df41085b9
+F src/test_config.c 426527fbb12fc23669a1e973ecdc8c5e92c2e2cf
 F src/test_demovfs.c 0de72c2c89551629f58486fde5734b7d90758852
 F src/test_devsym.c e7498904e72ba7491d142d5c83b476c4e76993bc
 F src/test_fs.c ced436e3d4b8e4681328409b8081051ce614e28f
@@ -401,7 +401,7 @@ F src/update.c 40e51cd0883cb5bfd6abb7d8a7cd8aa47fab2945
 F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c
 F src/util.c fc612367108b74573c5fd13a85d0a23027f438bd
 F src/vacuum.c 2ddd5cad2a7b9cef7f9e431b8c7771634c6b1701
-F src/vdbe.c 1cdfa13e37dba217916112fffc639dee83406192
+F src/vdbe.c dfbaae2570172c523bce14299021d352b8508f7f
 F src/vdbe.h efb7a8c1459e31f3ea4377824c6a7e4cb5068637
 F src/vdbeInt.h 33403622c6a8feaaac5f0f3f17f5d1bf6df42286
 F src/vdbeapi.c 020681b943e77766b32ae1cddf86d7831b7374ca
@@ -563,7 +563,7 @@ F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2
 F test/createtab.test b5de160630b209c4b8925bdcbbaf48cc90b67fe8
 F test/cse.test 277350a26264495e86b1785f34d2d0c8600e021c
 F test/ctime.test 7bd009071e242aac4f18521581536b652b789a47
-F test/cursorhint.test 7d94f7602e22ec129ca51836f333b5ff994a2b02
+F test/cursorhint.test 432811b62bd5ffb812729f49bba3b9ad687550bb
 F test/date.test 42973251b9429f2c41b77eb98a7b0b0ba2d3b2c0
 F test/dbstatus.test 8de104bb5606f19537d23cd553b41349b5ab1204
 F test/dbstatus2.test 10418e62b3db5dca070f0c3eef3ea13946f339c2
@@ -1393,7 +1393,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 53d5a4add6b60722ad77daf98b6b8983b081e16a de6972515f65c5cf5da7cfdf876a05718299e9b8
-R eb548650b5c16f458e4886ea4649dc57
-U dan
-Z 682420f21bcc754cb8ec9b887c5ab3d8
+P 20da0849ce910ceb445954dfc5f985acf9a02695
+R 452da66a52ee276332ecb816f5e027f4
+U drh
+Z 67947be805126d86b3d9fe642be25131
index 02251806a88eb5a4a7a66f44637fa55e1c0d2afd..1580a0d41922b5e3a85b7585caae7e340e21db82 100644 (file)
@@ -1 +1 @@
-20da0849ce910ceb445954dfc5f985acf9a02695
\ No newline at end of file
+b3ec9a0d62c5543e91d4be2cd634ec4a3d6dca11
\ No newline at end of file
index 1370bef2d0d173884674b7fa8f4e71a8373ea617..8d183efb3100d7418643590100ac37eece3d2cde 100644 (file)
@@ -858,27 +858,26 @@ int sqlite3BtreeCursorRestore(BtCursor *pCur, int *pDifferentRow){
   return SQLITE_OK;
 }
 
+#ifdef SQLITE_ENABLE_CURSOR_HINTS
 /*
 ** Provide hints to the cursor.  The particular hint given (and the type
 ** and number of the varargs parameters) is determined by the eHintType
 ** parameter.  See the definitions of the BTREE_HINT_* macros for details.
 */
 void sqlite3BtreeCursorHint(BtCursor *pCur, int eHintType, ...){
-  va_list ap;
-  va_start(ap, eHintType);
-#ifdef SQLITE_ENABLE_CURSOR_HINTS
-  if( eHintType==BTREE_HINT_FLAGS )
-#else
-  assert( eHintType==BTREE_HINT_FLAGS );
+  /* Used only by system that substitute their own storage engine */
+}
 #endif
-  {
-    pCur->hints = va_arg(ap, unsigned int);
-    assert( pCur->hints==BTREE_SEEK_EQ || pCur->hints==BTREE_BULKLOAD
-                || pCur->hints==0 );
-  }
-  va_end(ap);
+
+/*
+** Provide flag hints to the cursor.
+*/
+void sqlite3BtreeCursorHintFlags(BtCursor *pCur, unsigned x){
+  assert( x==BTREE_SEEK_EQ || x==BTREE_BULKLOAD || x==0 );
+  pCur->hints = x;
 }
 
+
 #ifndef SQLITE_OMIT_AUTOVACUUM
 /*
 ** Given a page number of a regular database page, return the page
index ba6cc5a948be8a3f185610148d5e48703ae09b00..f37ec5e7fc73e1178f98b49622971852b34a6be1 100644 (file)
@@ -153,12 +153,6 @@ int sqlite3BtreeNewDb(Btree *p);
 ** Kinds of hints that can be passed into the sqlite3BtreeCursorHint()
 ** interface.
 **
-** BTREE_HINT_FLAGS  (arguments: unsigned int)
-**
-**     Some combinatation of BTREE_BULKLOAD and BTREE_SEEK_EQ flags.  The
-**     argument is a single unsigned integer which overwrites all prior
-**     flag settings.
-**
 ** BTREE_HINT_RANGE  (arguments: Expr*, Mem*)
 **
 **     The first argument is an Expr* (which is guaranteed to be constant for
@@ -182,8 +176,7 @@ int sqlite3BtreeNewDb(Btree *p);
 ** the SQLite parser and code generator but substitute their own storage
 ** engine.
 */
-#define BTREE_HINT_FLAGS 1       /* Set flags indicating cursor usage */
-#define BTREE_HINT_RANGE 2       /* Range constraints on queries */
+#define BTREE_HINT_RANGE 0       /* Range constraints on queries */
 
 /*
 ** Values that may be OR'd together to form the argument to the
@@ -226,7 +219,10 @@ int sqlite3BtreeCursor(
 );
 int sqlite3BtreeCursorSize(void);
 void sqlite3BtreeCursorZero(BtCursor*);
+void sqlite3BtreeCursorHintFlags(BtCursor*, unsigned);
+#ifdef SQLITE_ENABLE_CURSOR_HINTS
 void sqlite3BtreeCursorHint(BtCursor*, int, ...);
+#endif
 
 int sqlite3BtreeCloseCursor(BtCursor*);
 int sqlite3BtreeMovetoUnpacked(
index 5da2df16b7777ea31b00d459d89d1a4a8134b95f..be43f87e739dba7d368de6026d7fe7e365a5ef2e 100644 (file)
@@ -119,6 +119,12 @@ static void set_options(Tcl_Interp *interp){
   Tcl_SetVar2(interp, "sqlite_options", "8_3_names", "0", TCL_GLOBAL_ONLY);
 #endif
 
+#ifdef SQLITE_ENABLE_CURSOR_HINTS
+  Tcl_SetVar2(interp, "sqlite_options", "cursorhints", "1", TCL_GLOBAL_ONLY);
+#else
+  Tcl_SetVar2(interp, "sqlite_options", "cursorhints", "0", TCL_GLOBAL_ONLY);
+#endif
+
 #ifdef SQLITE_ENABLE_MEMSYS3
   Tcl_SetVar2(interp, "sqlite_options", "mem3", "1", TCL_GLOBAL_ONLY);
 #else
index d702313b84ad487de20a0f2e3b93102392911c85..c5508a2b2663d2d2e34313af027826cb86cc1f9d 100644 (file)
@@ -3401,8 +3401,8 @@ open_cursor_set_hints:
 #ifdef SQLITE_ENABLE_CURSOR_HINT
   testcase( pOp->p2 & OPFLAG_SEEKEQ );
 #endif
-  sqlite3BtreeCursorHint(pCur->pCursor, BTREE_HINT_FLAGS,
-                         (pOp->p5 & (OPFLAG_BULKCSR|OPFLAG_SEEKEQ)));
+  sqlite3BtreeCursorHintFlags(pCur->pCursor,
+                               (pOp->p5 & (OPFLAG_BULKCSR|OPFLAG_SEEKEQ)));
   break;
 }
 
index 75f3eb04e22f86359d2983da9aada6c77e2afbfb..69bc248cd787f0659acdc3aa04ade0d5bdfebf98 100644 (file)
@@ -15,6 +15,11 @@ set testdir [file dirname $argv0]
 source $testdir/tester.tcl
 set testprefix cursorhint
 
+ifcapable !cursorhints {
+  finish_test
+  return
+}
+
 do_execsql_test 1.0 {
   CREATE TABLE t1(a,b,c,d);
   CREATE TABLE t2(x,y,z);