diff options
author | drh <drh@noemail.net> | 2007-02-24 13:53:05 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2007-02-24 13:53:05 +0000 |
commit | dd73521bc26ccd24bc8652f672c74c2fcdc6f0f4 (patch) | |
tree | 5cb02f1e43c04897fdfe02f7cb0190634c501835 /src | |
parent | 8103b7d2b7fa06f42494cb8d22c75e67d4acd4cb (diff) | |
download | sqlite-dd73521bc26ccd24bc8652f672c74c2fcdc6f0f4.tar.gz sqlite-dd73521bc26ccd24bc8652f672c74c2fcdc6f0f4.zip |
Additional tests and some improvements to the INSERT transfer
optimization. More testing is needed. (CVS 3661)
FossilOrigin-Name: 830985814345f71ba2def3c206e36aabe9e1ee7c
Diffstat (limited to 'src')
-rw-r--r-- | src/expr.c | 4 | ||||
-rw-r--r-- | src/insert.c | 15 | ||||
-rw-r--r-- | src/test1.c | 5 |
3 files changed, 20 insertions, 4 deletions
diff --git a/src/expr.c b/src/expr.c index d0b858efd..39cb06585 100644 --- a/src/expr.c +++ b/src/expr.c @@ -12,7 +12,7 @@ ** This file contains routines used for analyzing expressions and ** for generating VDBE code that evaluates expressions in SQLite. ** -** $Id: expr.c,v 1.278 2007/02/24 11:52:53 drh Exp $ +** $Id: expr.c,v 1.279 2007/02/24 13:53:05 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -2210,7 +2210,7 @@ int sqlite3ExprCompare(Expr *pA, Expr *pB){ } if( pA->pSelect || pB->pSelect ) return 0; if( pA->iTable!=pB->iTable || pA->iColumn!=pB->iColumn ) return 0; - if( pA->token.z ){ + if( pA->op!=TK_COLUMN && pA->token.z ){ if( pB->token.z==0 ) return 0; if( pB->token.n!=pA->token.n ) return 0; if( sqlite3StrNICmp((char*)pA->token.z,(char*)pB->token.z,pB->token.n)!=0 ){ diff --git a/src/insert.c b/src/insert.c index 6823a72cb..84853d980 100644 --- a/src/insert.c +++ b/src/insert.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle INSERT statements in SQLite. ** -** $Id: insert.c,v 1.174 2007/02/24 13:23:52 drh Exp $ +** $Id: insert.c,v 1.175 2007/02/24 13:53:05 drh Exp $ */ #include "sqliteInt.h" @@ -1297,6 +1297,16 @@ static int xferCompatibleIndex(Index *pDest, Index *pSrc){ return 1; } +#ifdef SQLITE_TEST +/* +** The following global variable is incremented whenever the +** transfer optimization is used. This is used for testing +** purposes only - to make sure the transfer optimization really +** is happening when it is suppose to. +*/ +int sqlite3_xferopt_count; +#endif /* SQLITE_TEST */ + /* ** Attempt the transfer optimization on INSERTs of the form ** @@ -1464,6 +1474,9 @@ static int xferOptimization( ** * We can conditionally do the transfer if the destination ** table is empty. */ +#ifdef SQLITE_TEST + sqlite3_xferopt_count++; +#endif iDbSrc = sqlite3SchemaToIndex(pParse->db, pSrc->pSchema); v = sqlite3GetVdbe(pParse); iSrc = pParse->nTab++; diff --git a/src/test1.c b/src/test1.c index ac0de15c6..108de7a64 100644 --- a/src/test1.c +++ b/src/test1.c @@ -13,7 +13,7 @@ ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** -** $Id: test1.c,v 1.228 2007/02/05 14:21:48 danielk1977 Exp $ +** $Id: test1.c,v 1.229 2007/02/24 13:53:05 drh Exp $ */ #include "sqliteInt.h" #include "tcl.h" @@ -4224,6 +4224,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){ extern int sqlite3_memMax; extern int sqlite3_like_count; extern int sqlite3_tsd_count; + extern int sqlite3_xferopt_count; #if OS_UNIX && defined(SQLITE_TEST) && defined(THREADSAFE) && THREADSAFE extern int threadsOverrideEachOthersLocks; #endif @@ -4261,6 +4262,8 @@ int Sqlitetest1_Init(Tcl_Interp *interp){ (char*)&sqlite3_os_trace, TCL_LINK_INT); Tcl_LinkVar(interp, "sqlite3_tsd_count", (char*)&sqlite3_tsd_count, TCL_LINK_INT); + Tcl_LinkVar(interp, "sqlite3_xferopt_count", + (char*)&sqlite3_xferopt_count, TCL_LINK_INT); #ifndef SQLITE_OMIT_UTF16 Tcl_LinkVar(interp, "unaligned_string_counter", (char*)&unaligned_string_counter, TCL_LINK_INT); |