aboutsummaryrefslogtreecommitdiff
path: root/src/insert.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2016-01-01 13:25:06 +0000
committerdrh <drh@noemail.net>2016-01-01 13:25:06 +0000
commit8de1d77c60af1fbac5cc7eb7eb84efa3e43a320b (patch)
treeb2968afbe57bd3f1d1305f5a2241f575cca3b909 /src/insert.c
parent173b60999eb7b2fda450df311e286539fcd2b854 (diff)
parenta660caf2f01c99ef48085c731e200b5a2fa575b5 (diff)
downloadsqlite-8de1d77c60af1fbac5cc7eb7eb84efa3e43a320b.tar.gz
sqlite-8de1d77c60af1fbac5cc7eb7eb84efa3e43a320b.zip
Merge the latest enhancements from trunk.
FossilOrigin-Name: c0be246a740c8f33a7c07e1414688364dee56ece
Diffstat (limited to 'src/insert.c')
-rw-r--r--src/insert.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/src/insert.c b/src/insert.c
index 7585a7727..6261d4589 100644
--- a/src/insert.c
+++ b/src/insert.c
@@ -1417,7 +1417,7 @@ void sqlite3GenerateConstraintChecks(
int x;
if( iField==XN_EXPR ){
pParse->ckBase = regNewData+1;
- sqlite3ExprCode(pParse, pIdx->aColExpr->a[i].pExpr, regIdx+i);
+ sqlite3ExprCodeCopy(pParse, pIdx->aColExpr->a[i].pExpr, regIdx+i);
pParse->ckBase = 0;
VdbeComment((v, "%s column %d", pIdx->zName, i));
}else{
@@ -1719,20 +1719,6 @@ int sqlite3_xferopt_count;
#ifndef SQLITE_OMIT_XFER_OPT
/*
-** Check to collation names to see if they are compatible.
-*/
-static int xferCompatibleCollation(const char *z1, const char *z2){
- if( z1==0 ){
- return z2==0;
- }
- if( z2==0 ){
- return 0;
- }
- return sqlite3StrICmp(z1, z2)==0;
-}
-
-
-/*
** Check to see if index pSrc is compatible as a source of data
** for index pDest in an insert transfer optimization. The rules
** for a compatible index:
@@ -1767,7 +1753,7 @@ static int xferCompatibleIndex(Index *pDest, Index *pSrc){
if( pSrc->aSortOrder[i]!=pDest->aSortOrder[i] ){
return 0; /* Different sort orders */
}
- if( !xferCompatibleCollation(pSrc->azColl[i],pDest->azColl[i]) ){
+ if( sqlite3_stricmp(pSrc->azColl[i],pDest->azColl[i])!=0 ){
return 0; /* Different collating sequences */
}
}
@@ -1928,7 +1914,7 @@ static int xferOptimization(
if( pDestCol->affinity!=pSrcCol->affinity ){
return 0; /* Affinity must be the same on all columns */
}
- if( !xferCompatibleCollation(pDestCol->zColl, pSrcCol->zColl) ){
+ if( sqlite3_stricmp(pDestCol->zColl, pSrcCol->zColl)!=0 ){
return 0; /* Collating sequence must be the same on all columns */
}
if( pDestCol->notNull && !pSrcCol->notNull ){
@@ -2075,9 +2061,10 @@ static int xferOptimization(
** a VACUUM command. In that case keys may not be written in strictly
** sorted order. */
for(i=0; i<pSrcIdx->nColumn; i++){
- char *zColl = pSrcIdx->azColl[i];
- assert( zColl!=0 );
- if( sqlite3_stricmp("BINARY", zColl) ) break;
+ const char *zColl = pSrcIdx->azColl[i];
+ assert( sqlite3_stricmp(sqlite3StrBINARY, zColl)!=0
+ || sqlite3StrBINARY==zColl );
+ if( sqlite3_stricmp(sqlite3StrBINARY, zColl) ) break;
}
if( i==pSrcIdx->nColumn ){
idxInsFlags = OPFLAG_USESEEKRESULT;