Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Change all occurrences of sqlite4StrICmp to sqlite4_stricmp and change sqlite4StrNICmp to sqlite4_strnicmp. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
b6d0a6204839d1e787c24531aef66bcf |
User & Date: | drh 2013-01-31 05:36:26.856 |
Context
2013-01-31
| ||
05:58 | Add the definition of sqlite4_stricmp() to sqlite.h.in. Avoid multiple declarations the u8 and similar typedefs in the amalgmation. check-in: d966049dd6 user: drh tags: trunk | |
05:36 | Change all occurrences of sqlite4StrICmp to sqlite4_stricmp and change sqlite4StrNICmp to sqlite4_strnicmp. check-in: b6d0a62048 user: drh tags: trunk | |
05:27 | Publish routines sqlite4_stricmp() and sqlite4_strnicmp() that do simple unicode case folding. Use these routines for all internal case-insensitive string comparisons. check-in: 19e9278b9c user: drh tags: trunk | |
Changes
Changes to src/alter.c.
︙ | ︙ | |||
125 126 127 128 129 130 131 | z += n; n = sqlite4GetToken(z, &token); }while( token==TK_SPACE ); zParent = sqlite4DbStrNDup(db, (const char *)z, n); if( zParent==0 ) break; sqlite4Dequote(zParent); | | | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | z += n; n = sqlite4GetToken(z, &token); }while( token==TK_SPACE ); zParent = sqlite4DbStrNDup(db, (const char *)z, n); if( zParent==0 ) break; sqlite4Dequote(zParent); if( 0==sqlite4_stricmp((const char *)zOld, zParent) ){ char *zOut = sqlite4MPrintf(db, "%s%.*s\"%w\"", (zOutput?zOutput:""), z-zInput, zInput, (const char *)zNew ); sqlite4DbFree(db, zOutput); zOutput = zOut; zInput = &z[n]; } |
︙ | ︙ | |||
377 378 379 380 381 382 383 | ** (either with ALTER TABLE ... RENAME TO or ALTER TABLE ... ADD COLUMN). ** If the table is a system table, this function leaves an error message ** in pParse->zErr (system tables may not be altered) and returns non-zero. ** ** Or, if zName is not a system table, zero is returned. */ static int isSystemTable(Parse *pParse, const char *zName){ | | | 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 | ** (either with ALTER TABLE ... RENAME TO or ALTER TABLE ... ADD COLUMN). ** If the table is a system table, this function leaves an error message ** in pParse->zErr (system tables may not be altered) and returns non-zero. ** ** Or, if zName is not a system table, zero is returned. */ static int isSystemTable(Parse *pParse, const char *zName){ if( sqlite4Strlen30(zName)>6 && 0==sqlite4_strnicmp(zName, "sqlite_", 7) ){ sqlite4ErrorMsg(pParse, "table %s may not be altered", zName); return 1; } return 0; } /* |
︙ | ︙ |
Changes to src/attach.c.
︙ | ︙ | |||
98 99 100 101 102 103 104 | if( db->pSavepoint ){ zErrDyn = sqlite4MPrintf(db, "cannot ATTACH database within transaction"); goto attach_error; } for(i=0; i<db->nDb; i++){ char *z = db->aDb[i].zName; assert( z && zName ); | | | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | if( db->pSavepoint ){ zErrDyn = sqlite4MPrintf(db, "cannot ATTACH database within transaction"); goto attach_error; } for(i=0; i<db->nDb; i++){ char *z = db->aDb[i].zName; assert( z && zName ); if( sqlite4_stricmp(z, zName)==0 ){ zErrDyn = sqlite4MPrintf(db, "database %s is already in use", zName); goto attach_error; } } /* Allocate the new entry in the db->aDb[] array and initialise the schema ** hash tables. |
︙ | ︙ | |||
216 217 218 219 220 221 222 | UNUSED_PARAMETER(NotUsed); if( zName==0 ) zName = ""; for(i=0; i<db->nDb; i++){ pDb = &db->aDb[i]; if( pDb->pKV==0 ) continue; | | | 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | UNUSED_PARAMETER(NotUsed); if( zName==0 ) zName = ""; for(i=0; i<db->nDb; i++){ pDb = &db->aDb[i]; if( pDb->pKV==0 ) continue; if( sqlite4_stricmp(pDb->zName, zName)==0 ) break; } if( i>=db->nDb ){ sqlite4_snprintf(zErr,sizeof(zErr), "no such database: %s", zName); goto detach_error; } if( i<2 ){ |
︙ | ︙ | |||
418 419 420 421 422 423 424 | SrcListItem *pItem; if( NEVER(pList==0) ) return 0; zDb = pFix->zDb; for(i=0, pItem=pList->a; i<pList->nSrc; i++, pItem++){ if( pItem->zDatabase==0 ){ pItem->zDatabase = sqlite4DbStrDup(pFix->pParse->db, zDb); | | | 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | SrcListItem *pItem; if( NEVER(pList==0) ) return 0; zDb = pFix->zDb; for(i=0, pItem=pList->a; i<pList->nSrc; i++, pItem++){ if( pItem->zDatabase==0 ){ pItem->zDatabase = sqlite4DbStrDup(pFix->pParse->db, zDb); }else if( sqlite4_stricmp(pItem->zDatabase,zDb)!=0 ){ sqlite4ErrorMsg(pFix->pParse, "%s %T cannot reference objects in database %s", pFix->zType, pFix->pName, pItem->zDatabase); return 1; } #if !defined(SQLITE4_OMIT_VIEW) || !defined(SQLITE4_OMIT_TRIGGER) if( sqlite4FixSelect(pFix, pItem->pSelect) ) return 1; |
︙ | ︙ |
Changes to src/build.c.
︙ | ︙ | |||
213 214 215 216 217 218 219 | int i; int nName; assert( zName!=0 ); nName = sqlite4Strlen30(zName); /* All mutexes are required for schema access. Make sure we hold them. */ for(i=OMIT_TEMPDB; i<db->nDb; i++){ int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */ | | | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | int i; int nName; assert( zName!=0 ); nName = sqlite4Strlen30(zName); /* All mutexes are required for schema access. Make sure we hold them. */ for(i=OMIT_TEMPDB; i<db->nDb; i++){ int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */ if( zDatabase!=0 && sqlite4_stricmp(zDatabase, db->aDb[j].zName) ) continue; p = sqlite4HashFind(&db->aDb[j].pSchema->tblHash, zName, nName); if( p ) break; } return p; } /* |
︙ | ︙ | |||
278 279 280 281 282 283 284 | int i; int nName = sqlite4Strlen30(zName); /* All mutexes are required for schema access. Make sure we hold them. */ for(i=OMIT_TEMPDB; i<db->nDb; i++){ int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */ Schema *pSchema = db->aDb[j].pSchema; assert( pSchema ); | | | 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | int i; int nName = sqlite4Strlen30(zName); /* All mutexes are required for schema access. Make sure we hold them. */ for(i=OMIT_TEMPDB; i<db->nDb; i++){ int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */ Schema *pSchema = db->aDb[j].pSchema; assert( pSchema ); if( zDb && sqlite4_stricmp(zDb, db->aDb[j].zName) ) continue; p = sqlite4HashFind(&pSchema->idxHash, zName, nName); if( p ) break; } return p; } /* |
︙ | ︙ | |||
546 547 548 549 550 551 552 | int sqlite4FindDbName(sqlite4 *db, const char *zName){ int i = -1; /* Database number */ if( zName ){ Db *pDb; int n = sqlite4Strlen30(zName); for(i=(db->nDb-1), pDb=&db->aDb[i]; i>=0; i--, pDb--){ if( (!OMIT_TEMPDB || i!=1 ) && n==sqlite4Strlen30(pDb->zName) && | | | 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | int sqlite4FindDbName(sqlite4 *db, const char *zName){ int i = -1; /* Database number */ if( zName ){ Db *pDb; int n = sqlite4Strlen30(zName); for(i=(db->nDb-1), pDb=&db->aDb[i]; i>=0; i--, pDb--){ if( (!OMIT_TEMPDB || i!=1 ) && n==sqlite4Strlen30(pDb->zName) && 0==sqlite4_stricmp(pDb->zName, zName) ){ break; } } } return i; } |
︙ | ︙ | |||
625 626 627 628 629 630 631 | ** trigger). All names are legal except those that begin with the string ** "sqlite_" (in upper, lower or mixed case). This portion of the namespace ** is reserved for internal use. */ int sqlite4CheckObjectName(Parse *pParse, const char *zName){ if( !pParse->db->init.busy && pParse->nested==0 && (pParse->db->flags & SQLITE4_WriteSchema)==0 | | | 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 | ** trigger). All names are legal except those that begin with the string ** "sqlite_" (in upper, lower or mixed case). This portion of the namespace ** is reserved for internal use. */ int sqlite4CheckObjectName(Parse *pParse, const char *zName){ if( !pParse->db->init.busy && pParse->nested==0 && (pParse->db->flags & SQLITE4_WriteSchema)==0 && 0==sqlite4_strnicmp(zName, "sqlite_", 7) ){ sqlite4ErrorMsg(pParse, "object name reserved for internal use: %s", zName); return SQLITE4_ERROR; } return SQLITE4_OK; } /* |
︙ | ︙ | |||
836 837 838 839 840 841 842 | begin_table_error: sqlite4DbFree(db, zName); return; } /* ** This macro is used to compare two strings in a case-insensitive manner. | | | | 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 | begin_table_error: sqlite4DbFree(db, zName); return; } /* ** This macro is used to compare two strings in a case-insensitive manner. ** It is slightly faster than calling sqlite4_stricmp() directly, but ** produces larger code. ** ** WARNING: This macro is not compatible with the strcmp() family. It ** returns true if the two strings are equal, otherwise false. */ #define STRICMP(x, y) (\ sqlite4UpperToLower[*(unsigned char *)(x)]== \ sqlite4UpperToLower[*(unsigned char *)(y)] \ && sqlite4_stricmp((x)+1,(y)+1)==0 ) /* ** Add a new column to the table currently being constructed. ** ** The parser calls this routine once for each column declaration ** in a CREATE TABLE statement. sqlite4StartTable() gets called ** first to get things going. Then this routine is called for each |
︙ | ︙ | |||
1062 1063 1064 1065 1066 1067 1068 | if( pList==0 ){ iCol = pTab->nCol - 1; pTab->aCol[iCol].isPrimKey = 1; pTab->aCol[iCol].notNull = 1; }else{ for(i=0; i<pList->nExpr; i++){ for(iCol=0; iCol<pTab->nCol; iCol++){ | | | | 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 | if( pList==0 ){ iCol = pTab->nCol - 1; pTab->aCol[iCol].isPrimKey = 1; pTab->aCol[iCol].notNull = 1; }else{ for(i=0; i<pList->nExpr; i++){ for(iCol=0; iCol<pTab->nCol; iCol++){ if( sqlite4_stricmp(pList->a[i].zName, pTab->aCol[iCol].zName)==0 ){ break; } } if( iCol<pTab->nCol ){ pTab->aCol[iCol].isPrimKey = i+1; pTab->aCol[iCol].notNull = 1; } } if( pList->nExpr>1 ) iCol = -1; } pPk = sqlite4CreateIndex( pParse, 0, 0, 0, pList, onError, 0, 0, sortOrder, 0, 1 ); if( iCol>=0 && iCol<pTab->nCol && (zType = pTab->aCol[iCol].zType)!=0 && sqlite4_stricmp(zType, "INTEGER")==0 && sortOrder==SQLITE4_SO_ASC && pPk ){ pPk->fIndex |= IDX_IntPK; assert( autoInc==0 || autoInc==1 ); pTab->tabFlags |= (-autoInc)&TF_Autoincrement; }else if( autoInc ){ |
︙ | ︙ | |||
2043 2044 2045 2046 2047 2048 2049 | goto exit_drop_table; } if( sqlite4AuthCheck(pParse, SQLITE4_DELETE, pTab->zName, 0, zDb) ){ goto exit_drop_table; } } #endif | | | | 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 | goto exit_drop_table; } if( sqlite4AuthCheck(pParse, SQLITE4_DELETE, pTab->zName, 0, zDb) ){ goto exit_drop_table; } } #endif if( sqlite4_strnicmp(pTab->zName, "sqlite_", 7)==0 && sqlite4_strnicmp(pTab->zName, "sqlite_stat", 11)!=0 ){ sqlite4ErrorMsg(pParse, "table %s may not be dropped", pTab->zName); goto exit_drop_table; } #ifndef SQLITE4_OMIT_VIEW /* Ensure DROP TABLE is not used on a view, and DROP VIEW is not used ** on a table. |
︙ | ︙ | |||
2156 2157 2158 2159 2160 2161 2162 | pFKey->nCol = nCol; if( pFromCol==0 ){ pFKey->aCol[0].iFrom = p->nCol-1; }else{ for(i=0; i<nCol; i++){ int j; for(j=0; j<p->nCol; j++){ | | | 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 | pFKey->nCol = nCol; if( pFromCol==0 ){ pFKey->aCol[0].iFrom = p->nCol-1; }else{ for(i=0; i<nCol; i++){ int j; for(j=0; j<p->nCol; j++){ if( sqlite4_stricmp(p->aCol[j].zName, pFromCol->a[i].zName)==0 ){ pFKey->aCol[i].iFrom = j; break; } } if( j>=p->nCol ){ sqlite4ErrorMsg(pParse, "unknown column \"%s\" in foreign key definition", |
︙ | ︙ | |||
2359 2360 2361 2362 2363 2364 2365 | if( !pTab || db->mallocFailed ) return 0; assert( db->aDb[iDb].pSchema==pTab->pSchema ); assert( pParse->nErr==0 ); /* TODO: We will need to reinstate this block when sqlite_master is ** modified to use an implicit primary key. */ #if 0 | | | 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 | if( !pTab || db->mallocFailed ) return 0; assert( db->aDb[iDb].pSchema==pTab->pSchema ); assert( pParse->nErr==0 ); /* TODO: We will need to reinstate this block when sqlite_master is ** modified to use an implicit primary key. */ #if 0 if( sqlite4_strnicmp(pTab->zName, "sqlite_", 7)==0 && memcmp(&pTab->zName[7],"altertab_",9)!=0 ){ sqlite4ErrorMsg(pParse, "table %s may not be indexed", pTab->zName); goto exit_create_index; } #endif /* Verify that this is not an attempt to create an index on a view or |
︙ | ︙ | |||
2724 2725 2726 2727 2728 2729 2730 | */ for(i=0, pListItem=pList->a; i<pList->nExpr; i++, pListItem++){ const char *zColName = pListItem->zName; Column *pTabCol; char *zColl; /* Collation sequence name */ for(j=0, pTabCol=pTab->aCol; j<pTab->nCol; j++, pTabCol++){ | | | 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 | */ for(i=0, pListItem=pList->a; i<pList->nExpr; i++, pListItem++){ const char *zColName = pListItem->zName; Column *pTabCol; char *zColl; /* Collation sequence name */ for(j=0, pTabCol=pTab->aCol; j<pTab->nCol; j++, pTabCol++){ if( sqlite4_stricmp(zColName, pTabCol->zName)==0 ) break; } if( j>=pTab->nCol ){ sqlite4ErrorMsg(pParse, "table %s has no column named %s", pTab->zName, zColName); pParse->checkSchema = 1; goto exit_create_index; } |
︙ | ︙ | |||
2792 2793 2794 2795 2796 2797 2798 | if( pIdx->nColumn!=pIndex->nColumn ) continue; for(k=0; k<pIdx->nColumn; k++){ const char *z1; const char *z2; if( pIdx->aiColumn[k]!=pIndex->aiColumn[k] ) break; z1 = pIdx->azColl[k]; z2 = pIndex->azColl[k]; | | | 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 | if( pIdx->nColumn!=pIndex->nColumn ) continue; for(k=0; k<pIdx->nColumn; k++){ const char *z1; const char *z2; if( pIdx->aiColumn[k]!=pIndex->aiColumn[k] ) break; z1 = pIdx->azColl[k]; z2 = pIndex->azColl[k]; if( z1!=z2 && sqlite4_stricmp(z1, z2) ) break; } if( k==pIdx->nColumn ){ if( pIdx->onError!=pIndex->onError ){ /* This constraint creates the same index as a previous ** constraint specified somewhere in the CREATE TABLE statement. ** However the ON CONFLICT clauses are different. If both this ** constraint and the previous equivalent constraint have explicit |
︙ | ︙ | |||
3088 3089 3090 3091 3092 3093 3094 | ** Return the index in pList of the identifier named zId. Return -1 ** if not found. */ int sqlite4IdListIndex(IdList *pList, const char *zName){ int i; if( pList==0 ) return -1; for(i=0; i<pList->nId; i++){ | | | 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 | ** Return the index in pList of the identifier named zId. Return -1 ** if not found. */ int sqlite4IdListIndex(IdList *pList, const char *zName){ int i; if( pList==0 ) return -1; for(i=0; i<pList->nId; i++){ if( sqlite4_stricmp(pList->a[i].zName, zName)==0 ) return i; } return -1; } /* ** Expand the space allocated for the given SrcList object by ** creating nExtra new slots beginning at iStart. iStart is zero based. |
︙ | ︙ | |||
3511 3512 3513 3514 3515 3516 3517 | ** attached database. Otherwise, invoke it for the database named zDb only. */ void sqlite4CodeVerifyNamedSchema(Parse *pParse, const char *zDb){ sqlite4 *db = pParse->db; int i; for(i=0; i<db->nDb; i++){ Db *pDb = &db->aDb[i]; | | | 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 | ** attached database. Otherwise, invoke it for the database named zDb only. */ void sqlite4CodeVerifyNamedSchema(Parse *pParse, const char *zDb){ sqlite4 *db = pParse->db; int i; for(i=0; i<db->nDb; i++){ Db *pDb = &db->aDb[i]; if( pDb->pKV && (!zDb || 0==sqlite4_stricmp(zDb, pDb->zName)) ){ sqlite4CodeVerifySchema(pParse, i); } } } /* ** Generate VDBE code that prepares for doing an operation that |
︙ | ︙ | |||
3594 3595 3596 3597 3598 3599 3600 | #ifndef SQLITE4_OMIT_REINDEX static int collationMatch(const char *zColl, Index *pIndex){ int i; assert( zColl!=0 ); for(i=0; i<pIndex->nColumn; i++){ const char *z = pIndex->azColl[i]; assert( z!=0 ); | | | 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 | #ifndef SQLITE4_OMIT_REINDEX static int collationMatch(const char *zColl, Index *pIndex){ int i; assert( zColl!=0 ); for(i=0; i<pIndex->nColumn; i++){ const char *z = pIndex->azColl[i]; assert( z!=0 ); if( 0==sqlite4_stricmp(z, zColl) ){ return 1; } } return 0; } #endif |
︙ | ︙ |
Changes to src/callback.c.
︙ | ︙ | |||
266 267 268 269 270 271 272 | FuncDefTable *pFuncTab, /* Lookup table to search */ const char *zFunc, /* Name of function */ int nFunc /* Number of bytes in zFunc */ ){ FuncDef *p; if( nFunc<0 ) nFunc = sqlite4Strlen30(zFunc); for(p=pFuncTab->pFirst; p; p=p->pNextName){ | | | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | FuncDefTable *pFuncTab, /* Lookup table to search */ const char *zFunc, /* Name of function */ int nFunc /* Number of bytes in zFunc */ ){ FuncDef *p; if( nFunc<0 ) nFunc = sqlite4Strlen30(zFunc); for(p=pFuncTab->pFirst; p; p=p->pNextName){ if( sqlite4_strnicmp(p->zName, zFunc, nFunc)==0 && p->zName[nFunc]==0 ){ return p; } } return 0; } /* |
︙ | ︙ | |||
295 296 297 298 299 300 301 | assert( pDef->pSameName==0 || isBuiltIn ); assert( pDef->pNextName==0 || isBuiltIn ); if( pFuncTab->pFirst==0 ){ pFuncTab->pFirst = pDef; pFuncTab->pLast = pDef; pFuncTab->pSame = pDef; }else if( isBuiltIn | | | 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | assert( pDef->pSameName==0 || isBuiltIn ); assert( pDef->pNextName==0 || isBuiltIn ); if( pFuncTab->pFirst==0 ){ pFuncTab->pFirst = pDef; pFuncTab->pLast = pDef; pFuncTab->pSame = pDef; }else if( isBuiltIn && sqlite4_stricmp(pDef->zName, pFuncTab->pLast->zName)==0 ){ assert( pFuncTab->pSame->pSameName==0 || pFuncTab->pSame->pSameName==pDef ); pFuncTab->pSame->pSameName = pDef; pFuncTab->pSame = pDef; }else if( !isBuiltIn && (pOther=functionSearch(pFuncTab,pDef->zName,-1))!=0 ){ pDef->pSameName = pOther->pSameName; pOther->pSameName = pDef; }else{ |
︙ | ︙ |
Changes to src/complete.c.
︙ | ︙ | |||
196 197 198 199 200 201 202 | int nId; for(nId=1; IdChar(zSql[nId]); nId++){} #ifdef SQLITE4_OMIT_TRIGGER token = tkOTHER; #else switch( *zSql ){ case 'c': case 'C': { | | | | | | | | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | int nId; for(nId=1; IdChar(zSql[nId]); nId++){} #ifdef SQLITE4_OMIT_TRIGGER token = tkOTHER; #else switch( *zSql ){ case 'c': case 'C': { if( nId==6 && sqlite4_strnicmp(zSql, "create", 6)==0 ){ token = tkCREATE; }else{ token = tkOTHER; } break; } case 't': case 'T': { if( nId==7 && sqlite4_strnicmp(zSql, "trigger", 7)==0 ){ token = tkTRIGGER; }else if( nId==4 && sqlite4_strnicmp(zSql, "temp", 4)==0 ){ token = tkTEMP; }else if( nId==9 && sqlite4_strnicmp(zSql, "temporary", 9)==0 ){ token = tkTEMP; }else{ token = tkOTHER; } break; } case 'e': case 'E': { if( nId==3 && sqlite4_strnicmp(zSql, "end", 3)==0 ){ token = tkEND; }else #ifndef SQLITE4_OMIT_EXPLAIN if( nId==7 && sqlite4_strnicmp(zSql, "explain", 7)==0 ){ token = tkEXPLAIN; }else #endif { token = tkOTHER; } break; |
︙ | ︙ |
Changes to src/ctime.c.
︙ | ︙ | |||
342 343 344 345 346 347 348 | ** was used and false if not. ** ** The name can optionally begin with "SQLITE4_" but the "SQLITE4_" prefix ** is not required for a match. */ int sqlite4_compileoption_used(const char *zOptName){ int i, n; | | | | 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 | ** was used and false if not. ** ** The name can optionally begin with "SQLITE4_" but the "SQLITE4_" prefix ** is not required for a match. */ int sqlite4_compileoption_used(const char *zOptName){ int i, n; if( sqlite4_strnicmp(zOptName, "SQLITE4_", 8)==0 ) zOptName += 8; n = sqlite4Strlen30(zOptName); /* Since ArraySize(azCompileOpt) is normally in single digits, a ** linear search is adequate. No need for a binary search. */ for(i=0; i<ArraySize(azCompileOpt); i++){ if( (sqlite4_strnicmp(zOptName, azCompileOpt[i], n)==0) && ( (azCompileOpt[i][n]==0) || (azCompileOpt[i][n]=='=') ) ) return 1; } return 0; } /* ** Return the N-th compile-time option string. If N is out of range, |
︙ | ︙ |
Changes to src/date.c.
︙ | ︙ | |||
324 325 326 327 328 329 330 | DateTime *p ){ double r; if( parseYyyyMmDd(zDate,p)==0 ){ return 0; }else if( parseHhMmSs(zDate, p)==0 ){ return 0; | | | 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | DateTime *p ){ double r; if( parseYyyyMmDd(zDate,p)==0 ){ return 0; }else if( parseHhMmSs(zDate, p)==0 ){ return 0; }else if( sqlite4_stricmp(zDate,"now")==0){ return setDateTimeToCurrent(context, p); }else if( sqlite4AtoF(zDate, &r, sqlite4Strlen30(zDate), SQLITE4_UTF8) ){ p->iJD = (sqlite4_int64)(r*86400000.0 + 0.5); p->validJD = 1; return 0; } return 1; |
︙ | ︙ |
Changes to src/fkey.c.
︙ | ︙ | |||
237 238 239 240 241 242 243 | /* If the index uses a collation sequence that is different from ** the default collation sequence for the column, this index is ** unusable. Bail out early in this case. */ zDfltColl = pParent->aCol[iCol].zColl; if( !zDfltColl ){ zDfltColl = "BINARY"; } | | | | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | /* If the index uses a collation sequence that is different from ** the default collation sequence for the column, this index is ** unusable. Bail out early in this case. */ zDfltColl = pParent->aCol[iCol].zColl; if( !zDfltColl ){ zDfltColl = "BINARY"; } if( sqlite4_stricmp(pIdx->azColl[i], zDfltColl) ) break; zIdxCol = pParent->aCol[iCol].zName; for(j=0; j<nCol; j++){ if( sqlite4_stricmp(pFKey->aCol[j].zCol, zIdxCol)==0 ){ if( aiCol ) aiCol[i] = pFKey->aCol[j].iFrom; break; } } if( j==nCol ) break; } if( i==nCol ) break; /* pIdx is usable */ |
︙ | ︙ | |||
864 865 866 867 868 869 870 | /* Check if any parent key columns are being modified. */ for(p=sqlite4FkReferences(pTab); p; p=p->pNextTo){ for(i=0; i<p->nCol; i++){ char *zKey = p->aCol[i].zCol; int iKey; for(iKey=0; iKey<pTab->nCol; iKey++){ Column *pCol = &pTab->aCol[iKey]; | | | 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 | /* Check if any parent key columns are being modified. */ for(p=sqlite4FkReferences(pTab); p; p=p->pNextTo){ for(i=0; i<p->nCol; i++){ char *zKey = p->aCol[i].zCol; int iKey; for(iKey=0; iKey<pTab->nCol; iKey++){ Column *pCol = &pTab->aCol[iKey]; if( (zKey ? !sqlite4_stricmp(pCol->zName, zKey) : pCol->isPrimKey) ){ if( aChange[iKey]>=0 ) return 1; } } } } } } |
︙ | ︙ |
Changes to src/fts5.c.
︙ | ︙ | |||
716 717 718 719 720 721 722 | } pPhrase->iCol = -1; /* Check if this first primitive is a column name or not. */ if( pParse->next.eType==TOKEN_COLON ){ int iCol; for(iCol=0; iCol<pParse->nCol; iCol++){ | | | 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 | } pPhrase->iCol = -1; /* Check if this first primitive is a column name or not. */ if( pParse->next.eType==TOKEN_COLON ){ int iCol; for(iCol=0; iCol<pParse->nCol; iCol++){ if( sqlite4_strnicmp(pParse->azCol[iCol], t.z, t.n)==0 ) break; } if( iCol==pParse->nCol ){ pParse->zErr = sqlite4MPrintf(pParse->db, "fts5: no such column: %.*s", t.n, t.z ); rc = SQLITE4_ERROR; goto token_or_phrase_out; |
︙ | ︙ | |||
1032 1033 1034 1035 1036 1037 1038 | /* ** Search for the Fts5Tokenizer object named zName. Return a pointer to it ** if it exists, or NULL otherwise. */ static Fts5Tokenizer *fts5FindTokenizer(sqlite4 *db, const char *zName){ Fts5Tokenizer *p; for(p=db->pTokenizer; p; p=p->pNext){ | | | 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 | /* ** Search for the Fts5Tokenizer object named zName. Return a pointer to it ** if it exists, or NULL otherwise. */ static Fts5Tokenizer *fts5FindTokenizer(sqlite4 *db, const char *zName){ Fts5Tokenizer *p; for(p=db->pTokenizer; p; p=p->pNext){ if( 0==sqlite4_stricmp(zName, p->zName) ) break; } return p; } static void fts5TokenizerCreate( Parse *pParse, Fts5Index *pFts, |
︙ | ︙ | |||
1147 1148 1149 1150 1151 1152 1153 | if( pArgs ){ int i; for(i=0; pParse->nErr==0 && i<pArgs->nExpr; i++){ char *zArg = pArgs->a[i].zName; char *zVal = pArgs->a[i].pExpr->u.zToken; | | | 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 | if( pArgs ){ int i; for(i=0; pParse->nErr==0 && i<pArgs->nExpr; i++){ char *zArg = pArgs->a[i].zName; char *zVal = pArgs->a[i].pExpr->u.zToken; if( zArg && sqlite4_stricmp(zArg, "tokenizer")==0 ){ /* zVal is the name of the tokenizer to use. Any subsequent arguments ** that do not contain assignment operators (=) are also passed to ** the tokenizer. Figure out how many bytes of space are required for ** all. */ int j; char *pSpace; int nByte = sqlite4Strlen30(zVal) + 1; |
︙ | ︙ |
Changes to src/hash.c.
︙ | ︙ | |||
25 26 27 28 29 30 31 | h = (h<<3) ^ h ^ sqlite4UpperToLower[(unsigned char)*z++]; nKey--; } return h; } static int strCmp(const char *z1, const char *z2, int n){ | | | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | h = (h<<3) ^ h ^ sqlite4UpperToLower[(unsigned char)*z++]; nKey--; } return h; } static int strCmp(const char *z1, const char *z2, int n){ return sqlite4_strnicmp(z1, z2, n); } static unsigned int binHash(const char *z, int nKey){ int h = 0; assert( nKey>=0 ); while( nKey > 0 ){ h = (h<<3) ^ h ^ ((unsigned char)*z++); |
︙ | ︙ |
Changes to src/insert.c.
︙ | ︙ | |||
779 780 781 782 783 784 785 | if( pColumn ){ for(i=0; i<pColumn->nId; i++){ pColumn->a[i].idx = -1; } for(i=0; i<pColumn->nId; i++){ char *zTest = pColumn->a[i].zName; for(j=0; j<pTab->nCol; j++){ | | | 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 | if( pColumn ){ for(i=0; i<pColumn->nId; i++){ pColumn->a[i].idx = -1; } for(i=0; i<pColumn->nId; i++){ char *zTest = pColumn->a[i].zName; for(j=0; j<pTab->nCol; j++){ if( sqlite4_stricmp(zTest, pTab->aCol[j].zName)==0 ){ pColumn->a[i].idx = j; break; } } if( j==pTab->nCol ){ sqlite4ErrorMsg(pParse, "table %S has no column named %s", pTabList, 0, pColumn->a[i].zName); |
︙ | ︙ | |||
1535 1536 1537 1538 1539 1540 1541 | static int xferCompatibleCollation(const char *z1, const char *z2){ if( z1==0 ){ return z2==0; } if( z2==0 ){ return 0; } | | | 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 | static int xferCompatibleCollation(const char *z1, const char *z2){ if( z1==0 ){ return z2==0; } if( z2==0 ){ return 0; } return sqlite4_stricmp(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: |
︙ | ︙ |
Changes to src/main.c.
︙ | ︙ | |||
2010 2011 2012 2013 2014 2015 2016 | int i; sqlite4_mutex_enter(db->mutex); /* Find the named key-value store */ for(i=0; i<db->nDb; i++){ Db *pDb = &db->aDb[i]; | | | 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 | int i; sqlite4_mutex_enter(db->mutex); /* Find the named key-value store */ for(i=0; i<db->nDb; i++){ Db *pDb = &db->aDb[i]; if( pDb->pKV && (0==zDbName || 0==sqlite4_stricmp(zDbName, pDb->zName)) ){ pKV = pDb->pKV; break; } } /* If the named key-value store was located, invoke its xControl() method. */ if( pKV ){ |
︙ | ︙ |
Changes to src/pragma.c.
︙ | ︙ | |||
24 25 26 27 28 29 30 | static const u8 iValue[] = {1, 0, 0, 0, 1, 1}; int i, n; if( sqlite4Isdigit(*z) ){ return (u8)sqlite4Atoi(z); } n = sqlite4Strlen30(z); for(i=0; i<ArraySize(iLength); i++){ | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | static const u8 iValue[] = {1, 0, 0, 0, 1, 1}; int i, n; if( sqlite4Isdigit(*z) ){ return (u8)sqlite4Atoi(z); } n = sqlite4Strlen30(z); for(i=0; i<ArraySize(iLength); i++){ if( iLength[i]==n && sqlite4_strnicmp(&zText[iOffset[i]],z,n)==0 ){ return iValue[i]; } } return 1; } /* The sqlite4GetBoolean() function is used by other modules but the |
︙ | ︙ | |||
89 90 91 92 93 94 95 | #if !defined(SQLITE4_OMIT_FOREIGN_KEY) && !defined(SQLITE4_OMIT_TRIGGER) { "foreign_keys", SQLITE4_ForeignKeys }, #endif }; int i, j; const struct sPragmaType *p; for(i=0, p=aPragma; i<ArraySize(aPragma); i++, p++){ | | | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | #if !defined(SQLITE4_OMIT_FOREIGN_KEY) && !defined(SQLITE4_OMIT_TRIGGER) { "foreign_keys", SQLITE4_ForeignKeys }, #endif }; int i, j; const struct sPragmaType *p; for(i=0, p=aPragma; i<ArraySize(aPragma); i++, p++){ if( sqlite4_stricmp(zLeft, p->zName)==0 ){ sqlite4 *db = pParse->db; Vdbe *v; v = sqlite4GetVdbe(pParse); assert( v!=0 ); /* Already allocated by sqlite4Pragma() */ if( ALWAYS(v) ){ if( zRight==0 ){ returnSingleInt(pParse, p->zName, (db->flags & p->mask)!=0 ); |
︙ | ︙ | |||
220 221 222 223 224 225 226 | #ifndef SQLITE4_OMIT_FLAG_PRAGMAS if( flagPragma(pParse, zLeft, zRight) ){ /* The flagPragma() subroutine also generates any necessary code ** there is nothing more to do here */ }else #endif /* SQLITE4_OMIT_FLAG_PRAGMAS */ | | | | | | 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | #ifndef SQLITE4_OMIT_FLAG_PRAGMAS if( flagPragma(pParse, zLeft, zRight) ){ /* The flagPragma() subroutine also generates any necessary code ** there is nothing more to do here */ }else #endif /* SQLITE4_OMIT_FLAG_PRAGMAS */ if( sqlite4_stricmp(zLeft, "lsm_flush")==0 ){ sqlite4_kvstore_control(db, zDb, SQLITE4_KVCTRL_LSM_FLUSH, 0); }else if( sqlite4_stricmp(zLeft, "lsm_checkpoint")==0 ){ sqlite4_kvstore_control(db, zDb, SQLITE4_KVCTRL_LSM_CHECKPOINT, 0); }else if( sqlite4_stricmp(zLeft, "lsm_merge")==0 ){ int nPage = zRight ? sqlite4Atoi(zRight) : 1000; sqlite4_kvstore_control(db, zDb, SQLITE4_KVCTRL_LSM_MERGE, &nPage); returnSingleInt(pParse, "nWrite", (sqlite4_int64)nPage); }else /* ** PRAGMA fts_check(<index>) */ if( sqlite4_stricmp(zLeft, "fts_check")==0 && zRight ){ int iCksum1; int iCksum2; Index *pIdx; Table *pTab; Vdbe *v = sqlite4GetVdbe(pParse); if( v==0 || sqlite4ReadSchema(pParse) ) goto pragma_out; |
︙ | ︙ | |||
313 314 315 316 317 318 319 | ** ** cid: Column id (numbered from left to right, starting at 0) ** name: Column name ** type: Column declaration type. ** notnull: True if 'NOT NULL' is part of column declaration ** dflt_value: The default value for the column, if any. */ | | | 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | ** ** cid: Column id (numbered from left to right, starting at 0) ** name: Column name ** type: Column declaration type. ** notnull: True if 'NOT NULL' is part of column declaration ** dflt_value: The default value for the column, if any. */ if( sqlite4_stricmp(zLeft, "table_info")==0 && zRight ){ Table *pTab; if( sqlite4ReadSchema(pParse) ) goto pragma_out; pTab = sqlite4FindTable(db, zRight, zDb); if( pTab ){ int i; int nHidden = 0; Column *pCol; |
︙ | ︙ | |||
351 352 353 354 355 356 357 | } sqlite4VdbeAddOp2(v, OP_Integer, pCol->isPrimKey, 6); sqlite4VdbeAddOp2(v, OP_ResultRow, 1, 6); } } }else | | | 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | } sqlite4VdbeAddOp2(v, OP_Integer, pCol->isPrimKey, 6); sqlite4VdbeAddOp2(v, OP_ResultRow, 1, 6); } } }else if( sqlite4_stricmp(zLeft, "index_info")==0 && zRight ){ Index *pIdx; Table *pTab; if( sqlite4ReadSchema(pParse) ) goto pragma_out; pIdx = sqlite4FindIndex(db, zRight, zDb); if( pIdx ){ int i; pTab = pIdx->pTable; |
︙ | ︙ | |||
375 376 377 378 379 380 381 | assert( pTab->nCol>cnum ); sqlite4VdbeAddOp4(v, OP_String8, 0, 3, 0, pTab->aCol[cnum].zName, 0); sqlite4VdbeAddOp2(v, OP_ResultRow, 1, 3); } } }else | | | 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | assert( pTab->nCol>cnum ); sqlite4VdbeAddOp4(v, OP_String8, 0, 3, 0, pTab->aCol[cnum].zName, 0); sqlite4VdbeAddOp2(v, OP_ResultRow, 1, 3); } } }else if( sqlite4_stricmp(zLeft, "index_list")==0 && zRight ){ Index *pIdx; Table *pTab; if( sqlite4ReadSchema(pParse) ) goto pragma_out; pTab = sqlite4FindTable(db, zRight, zDb); if( pTab ){ v = sqlite4GetVdbe(pParse); pIdx = pTab->pIndex; |
︙ | ︙ | |||
402 403 404 405 406 407 408 | ++i; pIdx = pIdx->pNext; } } } }else | | | | | 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | ++i; pIdx = pIdx->pNext; } } } }else if( sqlite4_stricmp(zLeft, "database_list")==0 ){ int i; if( sqlite4ReadSchema(pParse) ) goto pragma_out; sqlite4VdbeSetNumCols(v, 3); pParse->nMem = 3; sqlite4VdbeSetColName(v, 0, COLNAME_NAME, "seq", SQLITE4_STATIC); sqlite4VdbeSetColName(v, 1, COLNAME_NAME, "name", SQLITE4_STATIC); sqlite4VdbeSetColName(v, 2, COLNAME_NAME, "file", SQLITE4_STATIC); for(i=0; i<db->nDb; i++){ if( db->aDb[i].pKV==0 ) continue; assert( db->aDb[i].zName!=0 ); sqlite4VdbeAddOp2(v, OP_Integer, i, 1); sqlite4VdbeAddOp4(v, OP_String8, 0, 2, 0, db->aDb[i].zName, 0); sqlite4VdbeAddOp4(v, OP_String8, 0, 3, 0, "filename", 0); sqlite4VdbeAddOp2(v, OP_ResultRow, 1, 3); } }else if( sqlite4_stricmp(zLeft, "collation_list")==0 ){ int i = 0; HashElem *p; sqlite4VdbeSetNumCols(v, 2); pParse->nMem = 2; sqlite4VdbeSetColName(v, 0, COLNAME_NAME, "seq", SQLITE4_STATIC); sqlite4VdbeSetColName(v, 1, COLNAME_NAME, "name", SQLITE4_STATIC); for(p=sqliteHashFirst(&db->aCollSeq); p; p=sqliteHashNext(p)){ CollSeq *pColl = (CollSeq *)sqliteHashData(p); sqlite4VdbeAddOp2(v, OP_Integer, i++, 1); sqlite4VdbeAddOp4(v, OP_String8, 0, 2, 0, pColl->zName, 0); sqlite4VdbeAddOp2(v, OP_ResultRow, 1, 2); } }else #endif /* SQLITE4_OMIT_SCHEMA_PRAGMAS */ #ifndef SQLITE4_OMIT_FOREIGN_KEY if( sqlite4_stricmp(zLeft, "foreign_key_list")==0 && zRight ){ FKey *pFK; Table *pTab; if( sqlite4ReadSchema(pParse) ) goto pragma_out; pTab = sqlite4FindTable(db, zRight, zDb); if( pTab ){ v = sqlite4GetVdbe(pParse); pFK = pTab->pFKey; |
︙ | ︙ | |||
484 485 486 487 488 489 490 | } } } }else #endif /* !defined(SQLITE4_OMIT_FOREIGN_KEY) */ #ifndef NDEBUG | | | | 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 | } } } }else #endif /* !defined(SQLITE4_OMIT_FOREIGN_KEY) */ #ifndef NDEBUG if( sqlite4_stricmp(zLeft, "parser_trace")==0 ){ if( zRight ){ if( sqlite4GetBoolean(zRight) ){ sqlite4ParserTrace(stderr, "parser: "); }else{ sqlite4ParserTrace(0, 0); } } }else #endif /* Reinstall the LIKE and GLOB functions. The variant of LIKE ** used will be case sensitive or not depending on the RHS. */ if( sqlite4_stricmp(zLeft, "case_sensitive_like")==0 ){ if( zRight ){ sqlite4RegisterLikeFunctions(db, sqlite4GetBoolean(zRight)); } }else #ifndef SQLITE4_INTEGRITY_CHECK_ERROR_MAX # define SQLITE4_INTEGRITY_CHECK_ERROR_MAX 100 |
︙ | ︙ | |||
532 533 534 535 536 537 538 | ** the main database has not been initialized and/or created when ATTACH ** is executed, this is done before the ATTACH operation. ** ** In the second form this pragma sets the text encoding to be used in ** new database files created using this database handle. It is only ** useful if invoked immediately after the main database i */ | | | 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | ** the main database has not been initialized and/or created when ATTACH ** is executed, this is done before the ATTACH operation. ** ** In the second form this pragma sets the text encoding to be used in ** new database files created using this database handle. It is only ** useful if invoked immediately after the main database i */ if( sqlite4_stricmp(zLeft, "encoding")==0 ){ static const struct EncName { char *zName; u8 enc; } encnames[] = { { "UTF8", SQLITE4_UTF8 }, { "UTF-8", SQLITE4_UTF8 }, /* Must be element [1] */ { "UTF-16le", SQLITE4_UTF16LE }, /* Must be element [2] */ |
︙ | ︙ | |||
569 570 571 572 573 574 575 | ** already exists, it will be created to use the new encoding value. */ if( !(DbHasProperty(db, 0, DB_SchemaLoaded)) || DbHasProperty(db, 0, DB_Empty) ){ for(pEnc=&encnames[0]; pEnc->zName; pEnc++){ | | | | | | 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 | ** already exists, it will be created to use the new encoding value. */ if( !(DbHasProperty(db, 0, DB_SchemaLoaded)) || DbHasProperty(db, 0, DB_Empty) ){ for(pEnc=&encnames[0]; pEnc->zName; pEnc++){ if( 0==sqlite4_stricmp(zRight, pEnc->zName) ){ ENC(pParse->db) = pEnc->enc ? pEnc->enc : SQLITE4_UTF16NATIVE; break; } } if( !pEnc->zName ){ sqlite4ErrorMsg(pParse, "unsupported encoding: %s", zRight); } } } }else #endif /* SQLITE4_OMIT_UTF16 */ #ifndef SQLITE4_OMIT_COMPILEOPTION_DIAGS /* ** PRAGMA compile_options ** ** Return the names of all compile-time options used in this build, ** one option per row. */ if( sqlite4_stricmp(zLeft, "compile_options")==0 ){ int i = 0; const char *zOpt; sqlite4VdbeSetNumCols(v, 1); pParse->nMem = 1; sqlite4VdbeSetColName(v, 0, COLNAME_NAME, "compile_option", SQLITE4_STATIC); while( (zOpt = sqlite4_compileoption_get(i++))!=0 ){ sqlite4VdbeAddOp4(v, OP_String8, 0, 1, 0, zOpt, 0); sqlite4VdbeAddOp2(v, OP_ResultRow, 1, 1); } }else #endif /* SQLITE4_OMIT_COMPILEOPTION_DIAGS */ #ifdef SQLITE4_DEBUG /* ** PRAGMA kvdump ** ** Print an ascii rendering of the complete content of the database file. */ if( sqlite4_stricmp(zLeft, "kvdump")==0 ){ sqlite4KVStoreDump(db->aDb[0].pKV); }else #endif /* SQLITE4_OMIT_COMPILEOPTION_DIAGS */ /* ** PRAGMA integrity_check ** ** Check that for each table, the content of any auxilliary indexes are ** consistent with the primary key index. */ if( sqlite4_stricmp(zLeft, "integrity_check")==0 ){ const int baseCsr = 1; /* Base cursor for OpenAllIndexes() call */ const int regErrcnt = 1; /* Register containing error count */ const int regErrstr = 2; /* Register containing error string */ const int regTmp = 3; /* Register for tmp use */ const int regRowcnt1 = 4; /* Register containing row count (from PK) */ const int regRowcnt2 = 5; /* Register containing error count */ |
︙ | ︙ | |||
781 782 783 784 785 786 787 | /* ** PRAGMA shrink_memory ** ** This pragma attempts to free as much memory as possible from the ** current database connection. */ | | | 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 | /* ** PRAGMA shrink_memory ** ** This pragma attempts to free as much memory as possible from the ** current database connection. */ if( sqlite4_stricmp(zLeft, "shrink_memory")==0 ){ sqlite4_db_release_memory(db); }else {/* Empty ELSE clause */} pragma_out: sqlite4DbFree(db, zLeft); sqlite4DbFree(db, zRight); } #endif /* SQLITE4_OMIT_PRAGMA */ |
Changes to src/resolve.c.
︙ | ︙ | |||
105 106 107 108 109 110 111 | ** Return FALSE if the USING clause is NULL or if it does not contain ** zCol. */ static int nameInUsingClause(IdList *pUsing, const char *zCol){ if( pUsing ){ int k; for(k=0; k<pUsing->nId; k++){ | | | | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | ** Return FALSE if the USING clause is NULL or if it does not contain ** zCol. */ static int nameInUsingClause(IdList *pUsing, const char *zCol){ if( pUsing ){ int k; for(k=0; k<pUsing->nId; k++){ if( sqlite4_stricmp(pUsing->a[k].zName, zCol)==0 ) return 1; } } return 0; } /* ** Return true if table pTab has an implicit primary key, and zCol points ** to a column name that resolves to the implicit primary key (i.e. "rowid"). */ int isRowidReference(Table *pTab, const char *zCol){ int ret = 0; if( 0==sqlite4_stricmp(zCol, "ROWID") ){ /* If the call to FindPrimaryKey() returns NULL, then pTab must be a ** sub-select or a view. Neither of these have an IPK. */ Index *pPk = sqlite4FindPrimaryKey(pTab, 0); if( pPk && pPk->aiColumn[0]==-1 ) ret = 1; } return ret; } |
︙ | ︙ | |||
198 199 200 201 202 203 204 | pTab = pItem->pTab; assert( pTab!=0 && pTab->zName!=0 ); iDb = sqlite4SchemaToIndex(db, pTab->pSchema); assert( pTab->nCol>0 ); if( zTab ){ if( pItem->zAlias ){ char *zTabName = pItem->zAlias; | | | | | | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | pTab = pItem->pTab; assert( pTab!=0 && pTab->zName!=0 ); iDb = sqlite4SchemaToIndex(db, pTab->pSchema); assert( pTab->nCol>0 ); if( zTab ){ if( pItem->zAlias ){ char *zTabName = pItem->zAlias; if( sqlite4_stricmp(zTabName, zTab)!=0 ) continue; }else{ char *zTabName = pTab->zName; if( NEVER(zTabName==0) || sqlite4_stricmp(zTabName, zTab)!=0 ){ continue; } if( zDb!=0 && sqlite4_stricmp(db->aDb[iDb].zName, zDb)!=0 ){ continue; } } } if( 0==(cntTab++) ){ pExpr->iTable = pItem->iCursor; pExpr->pTab = pTab; pSchema = pTab->pSchema; pMatch = pItem; } for(j=0, pCol=pTab->aCol; j<pTab->nCol; j++, pCol++){ if( sqlite4_stricmp(pCol->zName, zCol)==0 ){ /* If there has been exactly one prior match and this match ** is for the right-hand table of a NATURAL JOIN or is in a ** USING clause, then skip this match. */ if( cnt==1 ){ if( pItem->jointype & JT_NATURAL ) continue; if( nameInUsingClause(pItem->pUsing, zCol) ) continue; |
︙ | ︙ | |||
245 246 247 248 249 250 251 | /* If we have not already resolved the name, then maybe ** it is a new.* or old.* trigger argument reference */ if( zDb==0 && zTab!=0 && cnt==0 && pParse->pTriggerTab!=0 ){ int op = pParse->eTriggerOp; Table *pTab = 0; assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT ); | | | | | 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | /* If we have not already resolved the name, then maybe ** it is a new.* or old.* trigger argument reference */ if( zDb==0 && zTab!=0 && cnt==0 && pParse->pTriggerTab!=0 ){ int op = pParse->eTriggerOp; Table *pTab = 0; assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT ); if( op!=TK_DELETE && sqlite4_stricmp("new",zTab) == 0 ){ pExpr->iTable = 1; pTab = pParse->pTriggerTab; }else if( op!=TK_INSERT && sqlite4_stricmp("old",zTab)==0 ){ pExpr->iTable = 0; pTab = pParse->pTriggerTab; } if( pTab ){ int iCol; pSchema = pTab->pSchema; cntTab++; for(iCol=0; iCol<pTab->nCol; iCol++){ Column *pCol = &pTab->aCol[iCol]; if( sqlite4_stricmp(pCol->zName, zCol)==0 ){ break; } } if( iCol>=pTab->nCol && isRowidReference(pTab, zCol) ){ iCol = -1; /* IMP: R-44911-55124 */ } if( iCol<pTab->nCol ){ |
︙ | ︙ | |||
311 312 313 314 315 316 317 | ** forms the result set entry ("a+b" in the example) and return immediately. ** Note that the expression in the result set should have already been ** resolved by the time the WHERE clause is resolved. */ if( cnt==0 && (pEList = pNC->pEList)!=0 && zTab==0 ){ for(j=0; j<pEList->nExpr; j++){ char *zAs = pEList->a[j].zName; | | | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | ** forms the result set entry ("a+b" in the example) and return immediately. ** Note that the expression in the result set should have already been ** resolved by the time the WHERE clause is resolved. */ if( cnt==0 && (pEList = pNC->pEList)!=0 && zTab==0 ){ for(j=0; j<pEList->nExpr; j++){ char *zAs = pEList->a[j].zName; if( zAs!=0 && sqlite4_stricmp(zAs, zCol)==0 ){ Expr *pOrig; assert( pExpr->pLeft==0 && pExpr->pRight==0 ); assert( pExpr->x.pList==0 ); assert( pExpr->x.pSelect==0 ); pOrig = pEList->a[j].pExpr; if( !pNC->allowAgg && ExprHasProperty(pOrig, EP_Agg) ){ sqlite4ErrorMsg(pParse, "misuse of aliased aggregate %s", zAs); |
︙ | ︙ | |||
447 448 449 450 451 452 453 | sqlite4ErrorMsg(pParse, "first argument xxx must be a table name"); return; } zLhs = pExpr->u.zToken; for(i=0; i<pSrc->nSrc; i++){ pItem = &pSrc->a[i]; | | | | 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | sqlite4ErrorMsg(pParse, "first argument xxx must be a table name"); return; } zLhs = pExpr->u.zToken; for(i=0; i<pSrc->nSrc; i++){ pItem = &pSrc->a[i]; if( pItem->zAlias && sqlite4_stricmp(zLhs, pItem->zAlias)==0 ) break; if( pItem->zAlias==0 && sqlite4_stricmp(zLhs, pItem->zName)==0 ) break; } if( i==pSrc->nSrc ){ sqlite4ErrorMsg(pParse, "no such table: %s", zLhs); return; } pExpr->op = TK_NULL; |
︙ | ︙ | |||
476 477 478 479 480 481 482 | sqlite4ErrorMsg(pParse, "lhs of MATCH operator must be a table name"); return; } zLhs = pLeft->u.zToken; for(i=0; i<pSrc->nSrc; i++){ pItem = &pSrc->a[i]; | | | | 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 | sqlite4ErrorMsg(pParse, "lhs of MATCH operator must be a table name"); return; } zLhs = pLeft->u.zToken; for(i=0; i<pSrc->nSrc; i++){ pItem = &pSrc->a[i]; if( pItem->zAlias && sqlite4_stricmp(zLhs, pItem->zAlias)==0 ) break; if( pItem->zAlias==0 && sqlite4_stricmp(zLhs, pItem->zName)==0 ) break; } if( i==pSrc->nSrc ){ sqlite4ErrorMsg(pParse, "no such table: %s", zLhs); return; } |
︙ | ︙ | |||
717 718 719 720 721 722 723 | UNUSED_PARAMETER(pParse); if( pE->op==TK_ID ){ char *zCol = pE->u.zToken; for(i=0; i<pEList->nExpr; i++){ char *zAs = pEList->a[i].zName; | | | 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 | UNUSED_PARAMETER(pParse); if( pE->op==TK_ID ){ char *zCol = pE->u.zToken; for(i=0; i<pEList->nExpr; i++){ char *zAs = pEList->a[i].zName; if( zAs!=0 && sqlite4_stricmp(zAs, zCol)==0 ){ return i+1; } } } return 0; } |
︙ | ︙ |
Changes to src/select.c.
︙ | ︙ | |||
148 149 150 151 152 153 154 | apAll[0] = pA; apAll[1] = pB; apAll[2] = pC; for(i=0; i<3 && apAll[i]; i++){ p = apAll[i]; for(j=0; j<ArraySize(aKeyword); j++){ if( p->n==aKeyword[j].nChar | | | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | apAll[0] = pA; apAll[1] = pB; apAll[2] = pC; for(i=0; i<3 && apAll[i]; i++){ p = apAll[i]; for(j=0; j<ArraySize(aKeyword); j++){ if( p->n==aKeyword[j].nChar && sqlite4_strnicmp((char*)p->z, &zKeyText[aKeyword[j].i], p->n)==0 ){ jointype |= aKeyword[j].code; break; } } testcase( j==0 || j==1 || j==2 || j==3 || j==4 || j==5 || j==6 ); if( j>=ArraySize(aKeyword) ){ jointype |= JT_ERROR; |
︙ | ︙ | |||
185 186 187 188 189 190 191 | /* ** Return the index of a column in a table. Return -1 if the column ** is not contained in the table. */ static int columnIndex(Table *pTab, const char *zCol){ int i; for(i=0; i<pTab->nCol; i++){ | | | 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | /* ** Return the index of a column in a table. Return -1 if the column ** is not contained in the table. */ static int columnIndex(Table *pTab, const char *zCol){ int i; for(i=0; i<pTab->nCol; i++){ if( sqlite4_stricmp(pTab->aCol[i].zName, zCol)==0 ) return i; } return -1; } /* ** Search the first N tables in pSrc, from left to right, looking for a ** table that has a column named zCol. |
︙ | ︙ | |||
1321 1322 1323 1324 1325 1326 1327 | } /* Make sure the column name is unique. If the name is not unique, ** append a integer to the name so that it becomes unique. */ nName = sqlite4Strlen30(zName); for(j=cnt=0; j<i; j++){ | | | 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 | } /* Make sure the column name is unique. If the name is not unique, ** append a integer to the name so that it becomes unique. */ nName = sqlite4Strlen30(zName); for(j=cnt=0; j<i; j++){ if( sqlite4_stricmp(aCol[j].zName, zName)==0 ){ char *zNewName; zName[nName] = 0; zNewName = sqlite4MPrintf(db, "%s:%d", zName, ++cnt); sqlite4DbFree(db, zName); zName = zNewName; j = -1; if( zName==0 ) break; |
︙ | ︙ | |||
3119 3120 3121 3122 3123 3124 3125 | pExpr = pEList->a[0].pExpr; if( pExpr->op!=TK_AGG_FUNCTION ) return 0; if( NEVER(ExprHasProperty(pExpr, EP_xIsSelect)) ) return 0; pEList = pExpr->x.pList; if( pEList==0 || pEList->nExpr!=1 ) return 0; if( pEList->a[0].pExpr->op!=TK_AGG_COLUMN ) return WHERE_ORDERBY_NORMAL; assert( !ExprHasProperty(pExpr, EP_IntValue) ); | | | | | 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 | pExpr = pEList->a[0].pExpr; if( pExpr->op!=TK_AGG_FUNCTION ) return 0; if( NEVER(ExprHasProperty(pExpr, EP_xIsSelect)) ) return 0; pEList = pExpr->x.pList; if( pEList==0 || pEList->nExpr!=1 ) return 0; if( pEList->a[0].pExpr->op!=TK_AGG_COLUMN ) return WHERE_ORDERBY_NORMAL; assert( !ExprHasProperty(pExpr, EP_IntValue) ); if( sqlite4_stricmp(pExpr->u.zToken,"min")==0 ){ return WHERE_ORDERBY_MIN; }else if( sqlite4_stricmp(pExpr->u.zToken,"max")==0 ){ return WHERE_ORDERBY_MAX; } return WHERE_ORDERBY_NORMAL; } /* ** If the source-list item passed as an argument was augmented with an ** INDEXED BY clause, then try to locate the specified index. If there ** was such a clause and the named index cannot be found, return ** SQLITE4_ERROR and leave an error in pParse. Otherwise, populate ** pFrom->pIndex and return SQLITE4_OK. */ int sqlite4IndexedByLookup(Parse *pParse, SrcListItem *pFrom){ if( pFrom->pTab && pFrom->zIndex ){ Table *pTab = pFrom->pTab; char *zIndex = pFrom->zIndex; Index *pIdx; for(pIdx=pTab->pIndex; pIdx && sqlite4_stricmp(pIdx->zName, zIndex); pIdx=pIdx->pNext ); if( !pIdx ){ sqlite4ErrorMsg(pParse, "no such index: %s", zIndex, 0); pParse->checkSchema = 1; return SQLITE4_ERROR; } |
︙ | ︙ | |||
3317 3318 3319 3320 3321 3322 3323 | for(i=0, pFrom=pTabList->a; i<pTabList->nSrc; i++, pFrom++){ Table *pTab = pFrom->pTab; char *zTabName = pFrom->zAlias; if( zTabName==0 ){ zTabName = pTab->zName; } if( db->mallocFailed ) break; | | | 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 | for(i=0, pFrom=pTabList->a; i<pTabList->nSrc; i++, pFrom++){ Table *pTab = pFrom->pTab; char *zTabName = pFrom->zAlias; if( zTabName==0 ){ zTabName = pTab->zName; } if( db->mallocFailed ) break; if( zTName && sqlite4_stricmp(zTName, zTabName)!=0 ){ continue; } tableSeen = 1; for(j=0; j<pTab->nCol; j++){ Expr *pExpr, *pRight; char *zName = pTab->aCol[j].zName; char *zColname; /* The computed column name */ |
︙ | ︙ |
Changes to src/sqliteInt.h.
︙ | ︙ | |||
2551 2552 2553 2554 2555 2556 2557 | # define sqlite4Tolower(x) tolower((unsigned char)(x)) #endif /* ** Internal function prototypes */ int sqlite4Strlen30(const char*); | < < | 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 | # define sqlite4Tolower(x) tolower((unsigned char)(x)) #endif /* ** Internal function prototypes */ int sqlite4Strlen30(const char*); int sqlite4MallocInit(sqlite4_env*); void sqlite4MallocEnd(sqlite4_env*); void *sqlite4Malloc(sqlite4_env*, int); void *sqlite4MallocZero(sqlite4_env*, int); void *sqlite4DbMallocZero(sqlite4*, int); void *sqlite4DbMallocRaw(sqlite4*, int); |
︙ | ︙ |
Changes to src/trigger.c.
︙ | ︙ | |||
53 54 55 56 57 58 59 | } if( pTmpSchema!=pTab->pSchema ){ HashElem *p; for(p=sqliteHashFirst(&pTmpSchema->trigHash); p; p=sqliteHashNext(p)){ Trigger *pTrig = (Trigger *)sqliteHashData(p); if( pTrig->pTabSchema==pTab->pSchema | | | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | } if( pTmpSchema!=pTab->pSchema ){ HashElem *p; for(p=sqliteHashFirst(&pTmpSchema->trigHash); p; p=sqliteHashNext(p)){ Trigger *pTrig = (Trigger *)sqliteHashData(p); if( pTrig->pTabSchema==pTab->pSchema && 0==sqlite4_stricmp(pTrig->table, pTab->zName) ){ pTrig->pNext = (pList ? pList : pTab->pTrigger); pList = pTrig; } } } |
︙ | ︙ | |||
186 187 188 189 190 191 192 | assert( !db->init.busy ); sqlite4CodeVerifySchema(pParse, iDb); } goto trigger_cleanup; } /* Do not create a trigger on a system table */ | | | 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | assert( !db->init.busy ); sqlite4CodeVerifySchema(pParse, iDb); } goto trigger_cleanup; } /* Do not create a trigger on a system table */ if( sqlite4_strnicmp(pTab->zName, "sqlite_", 7)==0 ){ sqlite4ErrorMsg(pParse, "cannot create trigger on system table"); pParse->nErr++; goto trigger_cleanup; } /* INSTEAD of triggers are only for views and views only support INSTEAD ** of triggers. |
︙ | ︙ | |||
498 499 500 501 502 503 504 | assert( pName->nSrc==1 ); zDb = pName->a[0].zDatabase; zName = pName->a[0].zName; nName = sqlite4Strlen30(zName); for(i=OMIT_TEMPDB; i<db->nDb; i++){ int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */ | | | 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 | assert( pName->nSrc==1 ); zDb = pName->a[0].zDatabase; zName = pName->a[0].zName; nName = sqlite4Strlen30(zName); for(i=OMIT_TEMPDB; i<db->nDb; i++){ int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */ if( zDb && sqlite4_stricmp(db->aDb[j].zName, zDb) ) continue; pTrigger = sqlite4HashFind(&(db->aDb[j].pSchema->trigHash), zName, nName); if( pTrigger ) break; } if( !pTrigger ){ if( !noErr ){ sqlite4ErrorMsg(pParse, "no such trigger: %S", pName, 0); }else{ |
︙ | ︙ |
Changes to src/update.c.
︙ | ︙ | |||
208 209 210 211 212 213 214 | /* Resolve any names in the expression for this assignment */ if( sqlite4ResolveExprNames(&sNC, pChanges->a[i].pExpr) ){ goto update_cleanup; } /* Resolve the column name on the left of the assignment */ for(j=0; j<pTab->nCol; j++){ | | | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | /* Resolve any names in the expression for this assignment */ if( sqlite4ResolveExprNames(&sNC, pChanges->a[i].pExpr) ){ goto update_cleanup; } /* Resolve the column name on the left of the assignment */ for(j=0; j<pTab->nCol; j++){ if( sqlite4_stricmp(pTab->aCol[j].zName, pChanges->a[i].zName)==0 ) break; } if( j==pTab->nCol ){ sqlite4ErrorMsg(pParse, "no such column: %s", pChanges->a[i].zName); pParse->checkSchema = 1; goto update_cleanup; } aXRef[j] = i; |
︙ | ︙ |
Changes to src/vdbe.c.
︙ | ︙ | |||
2446 2447 2448 2449 2450 2451 2452 | ** commit or rollback to. This block sets variable pSave to point ** to the Savepoint object and iSave to the kvstore layer transaction ** number. For example, to commit or rollback the top level transaction ** iSave==2. */ iSave = db->nSavepoint+1; for(pSave=db->pSavepoint; pSave; pSave=pSave->pNext){ if( zSave ){ | | | 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 | ** commit or rollback to. This block sets variable pSave to point ** to the Savepoint object and iSave to the kvstore layer transaction ** number. For example, to commit or rollback the top level transaction ** iSave==2. */ iSave = db->nSavepoint+1; for(pSave=db->pSavepoint; pSave; pSave=pSave->pNext){ if( zSave ){ if( pSave->zName && 0==sqlite4_stricmp(zSave, pSave->zName) ) break; }else{ if( pSave->pNext==0 ) break; } iSave--; } if( pSave==0 ){ |
︙ | ︙ |
Changes to src/where.c.
︙ | ︙ | |||
768 769 770 771 772 773 774 | Expr *pExpr /* Test this expression */ ){ ExprList *pList; if( pExpr->op!=TK_FUNCTION ){ return 0; } | | | 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 | Expr *pExpr /* Test this expression */ ){ ExprList *pList; if( pExpr->op!=TK_FUNCTION ){ return 0; } if( sqlite4_stricmp(pExpr->u.zToken,"match")!=0 ){ return 0; } pList = pExpr->x.pList; if( pList->nExpr!=2 ){ return 0; } if( pList->a[1].pExpr->op != TK_COLUMN ){ |
︙ | ︙ | |||
1454 1455 1456 1457 1458 1459 1460 | Expr *p = pList->a[i].pExpr; if( p->op==TK_COLUMN && p->iColumn==pIdx->aiColumn[iCol] && p->iTable==iBase ){ CollSeq *pColl = sqlite4ExprCollSeq(pParse, p); assert( pColl || p->iColumn==-1 ); | | | 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 | Expr *p = pList->a[i].pExpr; if( p->op==TK_COLUMN && p->iColumn==pIdx->aiColumn[iCol] && p->iTable==iBase ){ CollSeq *pColl = sqlite4ExprCollSeq(pParse, p); assert( pColl || p->iColumn==-1 ); if( 0==pColl || 0==sqlite4_stricmp(pColl->zName, zColl) ){ return i; } } } return -1; } |
︙ | ︙ |
Changes to test/test_main.c.
︙ | ︙ | |||
1704 1705 1706 1707 1708 1709 1710 | ** The following routine is a user-defined SQL function whose purpose ** is to test the sqlite_set_result() API. */ static void testFunc(sqlite4_context *context, int argc, sqlite4_value **argv){ while( argc>=2 ){ const char *zArg0 = (char*)sqlite4_value_text(argv[0]); if( zArg0 ){ | | | | | | | | 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 | ** The following routine is a user-defined SQL function whose purpose ** is to test the sqlite_set_result() API. */ static void testFunc(sqlite4_context *context, int argc, sqlite4_value **argv){ while( argc>=2 ){ const char *zArg0 = (char*)sqlite4_value_text(argv[0]); if( zArg0 ){ if( 0==sqlite4_stricmp(zArg0, "int") ){ sqlite4_result_int(context, sqlite4_value_int(argv[1])); }else if( sqlite4_stricmp(zArg0,"int64")==0 ){ sqlite4_result_int64(context, sqlite4_value_int64(argv[1])); }else if( sqlite4_stricmp(zArg0,"string")==0 ){ sqlite4_result_text(context, (char*)sqlite4_value_text(argv[1]), -1, SQLITE4_TRANSIENT); }else if( sqlite4_stricmp(zArg0,"double")==0 ){ sqlite4_result_double(context, sqlite4_value_double(argv[1])); }else if( sqlite4_stricmp(zArg0,"null")==0 ){ sqlite4_result_null(context); }else if( sqlite4_stricmp(zArg0,"value")==0 ){ sqlite4_result_value(context, argv[sqlite4_value_int(argv[1])]); }else{ goto error_out; } }else{ goto error_out; } |
︙ | ︙ |
Changes to test/test_utf.c.
︙ | ︙ | |||
99 100 101 102 103 104 105 | { "UTF16BE", SQLITE4_UTF16BE }, { "UTF16", SQLITE4_UTF16 }, { 0, 0 } }; struct EncName *pEnc; char *z = Tcl_GetString(pObj); for(pEnc=&encnames[0]; pEnc->zName; pEnc++){ | | | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | { "UTF16BE", SQLITE4_UTF16BE }, { "UTF16", SQLITE4_UTF16 }, { 0, 0 } }; struct EncName *pEnc; char *z = Tcl_GetString(pObj); for(pEnc=&encnames[0]; pEnc->zName; pEnc++){ if( 0==sqlite4_stricmp(z, pEnc->zName) ){ break; } } if( !pEnc->enc ){ Tcl_AppendResult(interp, "No such encoding: ", z, 0); } if( pEnc->enc==SQLITE4_UTF16 ){ |
︙ | ︙ |
Changes to tool/mkkeywordhash.c.
︙ | ︙ | |||
572 573 574 575 576 577 578 | printf(" int h, i;\n"); printf(" if( n<2 ) return TK_ID;\n"); printf(" h = ((charMap(z[0])*4) ^\n" " (charMap(z[n-1])*3) ^\n" " n) %% %d;\n", bestSize); printf(" for(i=((int)aHash[h])-1; i>=0; i=((int)aNext[i])-1){\n"); printf(" if( aLen[i]==n &&" | | | 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 | printf(" int h, i;\n"); printf(" if( n<2 ) return TK_ID;\n"); printf(" h = ((charMap(z[0])*4) ^\n" " (charMap(z[n-1])*3) ^\n" " n) %% %d;\n", bestSize); printf(" for(i=((int)aHash[h])-1; i>=0; i=((int)aNext[i])-1){\n"); printf(" if( aLen[i]==n &&" " sqlite4_strnicmp(&zText[aOffset[i]],z,n)==0 ){\n"); for(i=0; i<nKeyword; i++){ printf(" testcase( i==%d ); /* %s */\n", i, aKeywordTable[i].zOrigName); } printf(" return aCode[i];\n"); printf(" }\n"); printf(" }\n"); |
︙ | ︙ |