Branch Coverage

sqlite3.c
Criterion Covered Total %
branch 10480 34026 30.8


line true false branch
20499 45047 108595 if( wsdStat.nowValue[op]>wsdStat.mxValue[op] ){
20529 644 77958 if( newValue>wsdStat.mxValue[op] ){
20545 11 0 if( op<0 || op>=ArraySize(wsdStat.nowValue) ){
0 11 if( op<0 || op>=ArraySize(wsdStat.nowValue) ){
20551 3 8 pMutex = statMutex[op] ? sqlite3Pcache1Mutex() : sqlite3MallocMutex();
20555 0 11 if( resetFlag ){
20569 11 0 if( rc==0 ){
20581 198 506 while( p ){
20594 2 251 if( pHighwater ) *pHighwater = db->lookaside.nSlot - nInit;
20618 0 2 if( resetFlag ){
20620 0 0 if( p ){
20621 0 0 while( p->pNext ) p = p->pNext;
20640 0 6 if( resetFlag ){
20656 4 2 for(i=0; inDb; i++){
20658 2 2 if( pBt ){
20661 0 2 if( op==SQLITE_DBSTATUS_CACHE_USED_SHARED ){
20684 4 2 for(i=0; inDb; i++){
20686 4 0 if( ALWAYS(pSchema!=0) ){
20700 0 4 for(p=sqliteHashFirst(&pSchema->trigHash); p; p=sqliteHashNext(p)){
20703 6 4 for(p=sqliteHashFirst(&pSchema->tblHash); p; p=sqliteHashNext(p)){
20726 0 2 for(pVdbe=db->pVdbe; pVdbe; pVdbe=pVdbe->pNext){
20754 12 6 for(i=0; inDb; i++){
20755 6 6 if( db->aDb[i].pBt ){
20773 0 0 *pCurrent = db->nDeferredImmCons>0 || db->nDeferredCons>0;
0 0 *pCurrent = db->nDeferredImmCons>0 || db->nDeferredCons>0;
20914 0 0 while( N-- ){
20915 0 0 if( !sqlite3Isdigit(*zDate) ){
20921 0 0 if( val<(int)min || val>(int)max || (nextC!=0 && nextC!=*zDate) ){
0 0 if( val<(int)min || val>(int)max || (nextC!=0 && nextC!=*zDate) ){
0 0 if( val<(int)min || val>(int)max || (nextC!=0 && nextC!=*zDate) ){
0 0 if( val<(int)min || val>(int)max || (nextC!=0 && nextC!=*zDate) ){
20924 0 0 *va_arg(ap,int*) = val;
20928 0 0 }while( nextC );
20954 0 0 while( sqlite3Isspace(*zDate) ){ zDate++; }
20957 0 0 if( c=='-' ){
20959 0 0 }else if( c=='+' ){
20961 0 0 }else if( c=='Z' || c=='z' ){
0 0 }else if( c=='Z' || c=='z' ){
20968 0 0 if( getDigits(zDate, "20b:20e", &nHr, &nMn)!=2 ){
20974 0 0 while( sqlite3Isspace(*zDate) ){ zDate++; }
20989 0 0 if( getDigits(zDate, "20c:20e", &h, &m)!=2 ){
20993 0 0 if( *zDate==':' ){
20995 0 0 if( getDigits(zDate, "20e", &s)!=1 ){
20999 0 0 if( *zDate=='.' && sqlite3Isdigit(zDate[1]) ){
0 0 if( *zDate=='.' && sqlite3Isdigit(zDate[1]) ){
21002 0 0 while( sqlite3Isdigit(*zDate) ){
21018 0 0 if( parseTimezone(zDate, p) ) return 1;
21040 0 0 if( p->validJD ) return;
21041 0 0 if( p->validYMD ){
21050 0 0 if( Y<-4713 || Y>9999 || p->rawS ){
0 0 if( Y<-4713 || Y>9999 || p->rawS ){
0 0 if( Y<-4713 || Y>9999 || p->rawS ){
21054 0 0 if( M<=2 ){
21064 0 0 if( p->validHMS ){
21066 0 0 if( p->validTZ ){
21090 0 0 if( zDate[0]=='-' ){
21096 0 0 if( getDigits(zDate, "40f-21a-21d", &Y, &M, &D)!=3 ){
21100 0 0 while( sqlite3Isspace(*zDate) || 'T'==*(u8*)zDate ){ zDate++; }
0 0 while( sqlite3Isspace(*zDate) || 'T'==*(u8*)zDate ){ zDate++; }
21101 0 0 if( parseHhMmSs(zDate, p)==0 ){
21103 0 0 }else if( *zDate==0 ){
21110 0 0 p->Y = neg ? -Y : Y;
21113 0 0 if( p->validTZ ){
21126 0 0 if( p->iJD>0 ){
21143 0 0 if( r>=0.0 && r<5373484.5 ){
0 0 if( r>=0.0 && r<5373484.5 ){
21171 0 0 if( parseYyyyMmDd(zDate,p)==0 ){
21173 0 0 }else if( parseHhMmSs(zDate, p)==0 ){
21175 0 0 }else if( sqlite3StrICmp(zDate,"now")==0 && sqlite3NotPureFunc(context) ){
0 0 }else if( sqlite3StrICmp(zDate,"now")==0 && sqlite3NotPureFunc(context) ){
21177 0 0 }else if( sqlite3AtoF(zDate, &r, sqlite3Strlen30(zDate), SQLITE_UTF8) ){
21199 0 0 return iJD>=0 && iJD<=INT_464269060799999;
0 0 return iJD>=0 && iJD<=INT_464269060799999;
21207 0 0 if( p->validYMD ) return;
21208 0 0 if( !p->validJD ){
21212 0 0 }else if( !validJulianDay(p->iJD) ){
21225 0 0 p->M = E<14 ? E-1 : E-13;
21226 0 0 p->Y = p->M>2 ? C - 4716 : C - 4715;
21236 0 0 if( p->validHMS ) return;
21309 0 0 if( sqlite3GlobalConfig.bLocaltimeFault ) pX = 0;
21311 0 0 if( pX ) *pTm = *pX;
21352 0 0 if( x.Y<1971 || x.Y>=2038 ){
0 0 if( x.Y<1971 || x.Y>=2038 ){
21372 0 0 if( osLocaltime(&t, &sLocal) ){
21458 0 0 if( sqlite3_stricmp(z, "localtime")==0 && sqlite3NotPureFunc(pCtx) ){
0 0 if( sqlite3_stricmp(z, "localtime")==0 && sqlite3NotPureFunc(pCtx) ){
21473 0 0 if( sqlite3_stricmp(z, "unixepoch")==0 && p->rawS ){
0 0 if( sqlite3_stricmp(z, "unixepoch")==0 && p->rawS ){
21475 0 0 if( r>=0.0 && r<464269060800000.0 ){
0 0 if( r>=0.0 && r<464269060800000.0 ){
21484 0 0 else if( sqlite3_stricmp(z, "utc")==0 && sqlite3NotPureFunc(pCtx) ){
0 0 else if( sqlite3_stricmp(z, "utc")==0 && sqlite3NotPureFunc(pCtx) ){
21485 0 0 if( p->tzSet==0 ){
21489 0 0 if( rc==SQLITE_OK ){
21510 0 0 if( sqlite3_strnicmp(z, "weekday ", 8)==0
21511 0 0 && sqlite3AtoF(&z[8], &r, sqlite3Strlen30(&z[8]), SQLITE_UTF8)
21512 0 0 && (n=(int)r)==r && n>=0 && r<7 ){
0 0 && (n=(int)r)==r && n>=0 && r<7 ){
0 0 && (n=(int)r)==r && n>=0 && r<7 ){
21519 0 0 if( Z>n ) Z -= 7;
21533 0 0 if( sqlite3_strnicmp(z, "start of ", 9)!=0 ) break;
21534 0 0 if( !p->validJD && !p->validYMD && !p->validHMS ) break;
0 0 if( !p->validJD && !p->validYMD && !p->validHMS ) break;
0 0 if( !p->validJD && !p->validYMD && !p->validHMS ) break;
21543 0 0 if( sqlite3_stricmp(z,"month")==0 ){
21546 0 0 }else if( sqlite3_stricmp(z,"year")==0 ){
21550 0 0 }else if( sqlite3_stricmp(z,"day")==0 ){
21569 0 0 for(n=1; z[n] && z[n]!=':' && !sqlite3Isspace(z[n]); n++){}
0 0 for(n=1; z[n] && z[n]!=':' && !sqlite3Isspace(z[n]); n++){}
0 0 for(n=1; z[n] && z[n]!=':' && !sqlite3Isspace(z[n]); n++){}
21570 0 0 if( !sqlite3AtoF(z, &r, n, SQLITE_UTF8) ){
21574 0 0 if( z[n]==':' ){
21583 0 0 if( !sqlite3Isdigit(*z2) ) z2++;
21585 0 0 if( parseHhMmSs(z2, &tx) ) break;
21590 0 0 if( z[0]=='-' ) tx.iJD = -tx.iJD;
21601 0 0 while( sqlite3Isspace(*z) ) z++;
21603 0 0 if( n>10 || n<3 ) break;
0 0 if( n>10 || n<3 ) break;
21604 0 0 if( sqlite3UpperToLower[(u8)z[n-1]]=='s' ) n--;
21607 0 0 rRounder = r<0 ? -0.5 : +0.5;
21608 0 0 for(i=0; i
21609 0 0 if( aXformType[i].nName==n
21610 0 0 && sqlite3_strnicmp(aXformType[i].zName, z, n)==0
21611 0 0 && r>-aXformType[i].rLimit && r
0 0 && r>-aXformType[i].rLimit && r
21618 0 0 x = p->M>0 ? (p->M-1)/12 : (p->M-12)/12;
21669 0 0 if( argc==0 ){
21672 0 0 if( (eType = sqlite3_value_type(argv[0]))==SQLITE_FLOAT
21673 0 0 || eType==SQLITE_INTEGER ){
21677 0 0 if( !z || parseDateOrTime(context, (char*)z, p) ){
0 0 if( !z || parseDateOrTime(context, (char*)z, p) ){
21681 0 0 for(i=1; i
21684 0 0 if( z==0 || parseModifier(context, (char*)z, n, p) ) return 1;
0 0 if( z==0 || parseModifier(context, (char*)z, n, p) ) return 1;
21687 0 0 if( p->isError || !validJulianDay(p->iJD) ) return 1;
0 0 if( p->isError || !validJulianDay(p->iJD) ) return 1;
21708 0 0 if( isDate(context, argc, argv, &x)==0 ){
21725 0 0 if( isDate(context, argc, argv, &x)==0 ){
21745 0 0 if( isDate(context, argc, argv, &x)==0 ){
21764 0 0 if( isDate(context, argc, argv, &x)==0 ){
21803 0 0 if( argc==0 ) return;
21805 0 0 if( zFmt==0 || isDate(context, argc-1, argv+1, &x) ) return;
0 0 if( zFmt==0 || isDate(context, argc-1, argv+1, &x) ) return;
21807 0 0 for(i=0, n=1; zFmt[i]; i++, n++){
21808 0 0 if( zFmt[i]=='%' ){
21844 0 0 if( n
21846 0 0 }else if( n>(u64)db->aLimit[SQLITE_LIMIT_LENGTH] ){
21851 0 0 if( z==0 ){
21858 0 0 for(i=j=0; zFmt[i]; i++){
21859 0 0 if( zFmt[i]!='%' ){
21867 0 0 if( s>59.999 ) s = 59.999;
21882 0 0 if( zFmt[i]=='W' ){
21920 0 0 sqlite3_result_text(context, z, -1,
22121 1058 1787 if( pId->pMethods ){
22139 216 0 return flags ? id->pMethods->xSync(id, flags) : SQLITE_OK;
22166 1034 265 if( id->pMethods==0 ) return SQLITE_NOTFOUND;
22187 528 191 if( id->pMethods ) (void)id->pMethods->xFileControl(id, op, pArg);
22192 0 0 return (xSectorSize ? xSectorSize(id) : SQLITE_DEFAULT_SECTOR_SIZE);
22305 6 0 return pVfs->xGetLastError ? pVfs->xGetLastError(pVfs, 0, 0) : 0;
22315 12 0 if( pVfs->iVersion>=2 && pVfs->xCurrentTimeInt64 ){
12 0 if( pVfs->iVersion>=2 && pVfs->xCurrentTimeInt64 ){
22335 0 0 if( pFile ){
22337 0 0 if( rc!=SQLITE_OK ){
22361 0 95 if( p==0 ) return SQLITE_NOMEM_BKPT;
22383 0 348 if( rc ) return 0;
22389 348 0 for(pVfs = vfsList; pVfs; pVfs=pVfs->pNext){
22390 343 5 if( zVfs==0 ) break;
22391 5 0 if( strcmp(zVfs, pVfs->zName)==0 ) break;
22402 380 0 if( pVfs==0 ){
22404 0 380 }else if( vfsList==pVfs ){
22406 285 95 }else if( vfsList ){
22408 285 285 while( p->pNext && p->pNext!=pVfs ){
285 0 while( p->pNext && p->pNext!=pVfs ){
22411 0 285 if( p->pNext==pVfs ){
22426 0 380 if( rc ) return rc;
22435 285 95 if( makeDflt || vfsList==0 ){
0 285 if( makeDflt || vfsList==0 ){
22454 0 0 if( rc ) return rc;
22540 0 1823 if( wsdHooks.xBenignBegin ){
22546 0 1823 if( wsdHooks.xBenignEnd ){
22759 75040 0 if( p ){
22832 2726 0 if( p ){
26466 0 0 if( rc ) return -1;
26470 0 0 if( n<0 ){
26476 0 0 mem0.nearlyFull = (n>0 && n<=nUsed);
0 0 mem0.nearlyFull = (n>0 && n<=nUsed);
26479 0 0 if( excess>0 ) sqlite3_release_memory((int)(excess & 0x7fffffff));
26483 0 0 if( n<0 ) n = 0;
26492 95 0 if( sqlite3GlobalConfig.m.xMalloc==0 ){
26497 0 95 if( sqlite3GlobalConfig.pPage==0 || sqlite3GlobalConfig.szPage<512
0 0 if( sqlite3GlobalConfig.pPage==0 || sqlite3GlobalConfig.szPage<512
26498 0 0 || sqlite3GlobalConfig.nPage<=0 ){
26503 0 95 if( rc!=SQLITE_OK ) memset(&mem0, 0, sizeof(mem0));
26520 0 0 if( sqlite3GlobalConfig.m.xShutdown ){
26550 2726 0 if( mem0.alarmThreshold<=0 ) return;
26581 0 75040 if( mem0.alarmThreshold>0 ){
26583 0 0 if( nUsed >= mem0.alarmThreshold - nFull ){
26597 75040 0 if( p ){
26611 75040 0 if( n==0 || n>=0x7fffff00 ){
0 75040 if( n==0 || n>=0x7fffff00 ){
26618 75040 0 }else if( sqlite3GlobalConfig.bMemstat ){
26636 0 11023 if( sqlite3_initialize() ) return 0;
26638 11023 0 return n<=0 ? 0 : sqlite3Malloc(n);
26642 0 461 if( sqlite3_initialize() ) return 0;
26652 156484 12869 return SQLITE_WITHIN(p, db->lookaside.pStart, db->lookaside.pEnd);
122047 34437 return SQLITE_WITHIN(p, db->lookaside.pStart, db->lookaside.pEnd);
26668 28950 101 if( db==0 || !isLookaside(db,p) ){
4404 24546 if( db==0 || !isLookaside(db,p) ){
26687 0 16 return p ? sqlite3GlobalConfig.m.xSize(p) : 0;
26694 24257 74680 if( p==0 ) return; /* IMP: R-49053-54554 */
26697 74680 0 if( sqlite3GlobalConfig.bMemstat ){
26724 130524 5040 if( db ){
26725 46 130478 if( db->pnBytesFreed ){
26729 92902 37576 if( isLookaside(db, p) ){
26748 59005 81735 if( p ) sqlite3DbFreeNN(db, p);
26759 599 2740 if( pOld==0 ){
26762 0 2740 if( nBytes==0 ){
26766 0 2740 if( nBytes>=0x7fffff00 ){
26775 14 2726 if( nOld==nNew ){
26777 2726 0 }else if( sqlite3GlobalConfig.bMemstat ){
26781 2726 0 if( nDiff>0 && sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED) >=
2726 0 if( nDiff>0 && sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED) >=
26786 0 2726 if( pNew==0 && mem0.alarmThreshold>0 ){
0 0 if( pNew==0 && mem0.alarmThreshold>0 ){
26790 2726 0 if( pNew ){
26808 0 294 if( sqlite3_initialize() ) return 0;
26810 0 294 if( n<0 ) n = 0; /* IMP: R-26507-47431 */
26815 0 3025 if( sqlite3_initialize() ) return 0;
26826 2834 0 if( p ){
26840 19069 0 if( p ) memset(p, 0, (size_t)n);
26852 0 36969 if( !p ) sqlite3OomFault(db);
26882 45664 3451 if( db ) return sqlite3DbMallocRawNN(db, n);
26893 95680 34193 if( db->lookaside.bDisable==0 ){
26895 161 95519 if( n>db->lookaside.sz ){
26897 82227 13292 }else if( (pBuf = db->lookaside.pFree)!=0 ){
26901 10677 2615 }else if( (pBuf = db->lookaside.pInit)!=0 ){
26908 0 34193 }else if( db->mallocFailed ){
26931 13696 7248 if( p==0 ) return sqlite3DbMallocRawNN(db, n);
26933 4585 2663 if( isLookaside(db,p) && n<=db->lookaside.sz ) return p;
4571 14 if( isLookaside(db,p) && n<=db->lookaside.sz ) return p;
26940 2677 0 if( db->mallocFailed==0 ){
26941 14 2663 if( isLookaside(db, p) ){
26943 14 0 if( pNew ){
26952 0 2663 if( !pNew ){
26969 0 7792 if( !pNew ){
26985 732 1524 if( z==0 ){
26990 1524 0 if( zNew ){
26998 94 20242 if( z==0 ){
27003 20242 0 if( zNew ){
27017 0 2695 while( sqlite3Isspace(zStart[0]) ) zStart++;
27019 4259 0 while( ALWAYS(n>0) && sqlite3Isspace(zStart[n-1]) ) n--;
1564 2695 while( ALWAYS(n>0) && sqlite3Isspace(zStart[n-1]) ) n--;
27038 0 0 if( db->mallocFailed==0 && db->bBenignMalloc==0 ){
0 0 if( db->mallocFailed==0 && db->bBenignMalloc==0 ){
27040 0 0 if( db->nVdbeExec>0 ){
27055 0 0 if( db->mallocFailed && db->nVdbeExec==0 ){
0 0 if( db->mallocFailed && db->nVdbeExec==0 ){
27091 45135 0 if( db->mallocFailed || rc==SQLITE_IOERR_NOMEM ){
0 45135 if( db->mallocFailed || rc==SQLITE_IOERR_NOMEM ){
27221 0 30 if( (*cnt)<=0 ) return '0';
27244 0 0 if( p->nArg<=p->nUsed ) return 0;
27248 0 0 if( p->nArg<=p->nUsed ) return 0.0;
27252 0 0 if( p->nArg<=p->nUsed ) return 0;
27313 0 4206 if( (pAccum->printfFlags & SQLITE_PRINTF_SQLFUNC)!=0 ){
27314 0 0 pArgList = va_arg(ap, PrintfArguments*);
27319 8118 1267 for(; (c=(*fmt))!=0; ++fmt){
27320 7350 768 if( c!='%' ){
27325 71507 2939 do{ fmt++; }while( *fmt && *fmt != '%' );
67096 4411 do{ fmt++; }while( *fmt && *fmt != '%' );
27328 2939 4411 if( *fmt==0 ) break;
27330 0 5179 if( (c=(*++fmt))==0 ){
27349 2 5179 }while( !done && (c=(*++fmt))!=0 );
2 0 }while( !done && (c=(*++fmt))!=0 );
27351 0 5179 if( c=='*' ){
27352 0 0 if( bArgList ){
27355 0 0 width = va_arg(ap,int);
27357 0 0 if( width<0 ){
27359 0 0 width = width >= -2147483647 ? -width : 0;
27364 4947 232 while( c>='0' && c<='9' ){
0 4947 while( c>='0' && c<='9' ){
27379 232 4947 if( c=='.' ){
27381 230 2 if( c=='*' ){
27382 0 230 if( bArgList ){
27385 230 0 precision = va_arg(ap,int);
27388 0 230 if( precision<0 ){
27389 0 0 precision = precision >= -2147483647 ? -precision : -1;
27393 6 0 while( c>='0' && c<='9' ){
4 2 while( c>='0' && c<='9' ){
27412 333 4846 if( c=='l' ){
27415 333 0 if( c=='l' ){
27425 17475 0 for(idx=0; idx
27426 5179 12296 if( c==fmtinfo[idx].fmttype ){
27460 929 33 if( infop->flags & FLAG_SIGNED ){
27462 0 929 if( bArgList ){
27464 333 596 }else if( flag_long ){
27465 333 0 if( flag_long==2 ){
27466 333 0 v = va_arg(ap,i64) ;
27468 0 0 v = va_arg(ap,long int);
27471 113 483 v = va_arg(ap,int);
27473 0 929 if( v<0 ){
27474 0 0 if( v==SMALLEST_INT64 ){
27485 0 33 if( bArgList ){
27487 0 33 }else if( flag_long ){
27488 0 0 if( flag_long==2 ){
27489 0 0 longvalue = va_arg(ap,u64);
27491 0 0 longvalue = va_arg(ap,unsigned long int);
27494 33 0 longvalue = va_arg(ap,unsigned int);
27498 46 916 if( longvalue==0 ) flag_alternateform = 0;
27499 0 962 if( flag_zeropad && precision
0 0 if( flag_zeropad && precision
27502 962 0 if( precision
27508 0 0 if( zOut==0 ){
27515 0 962 if( xtype==etORDINAL ){
27518 0 0 if( x>=4 || (longvalue/10)%10==1 ){
0 0 if( x>=4 || (longvalue/10)%10==1 ){
27530 40 962 }while( longvalue>0 );
27533 0 962 while( precision>length ){
27537 0 962 if( cThousand ){
27541 0 0 for(idx=0; nn>0; idx++){
27544 0 0 if( ix==0 ){
27551 0 962 if( prefix ) *(--bufpt) = prefix; /* Add sign */
27552 0 962 if( flag_alternateform && infop->prefix ){ /* Add "0" or "0x" */
0 0 if( flag_alternateform && infop->prefix ){ /* Add "0" or "0x" */
27556 0 0 for(; (x=(*pre))!=0; pre++) *(--bufpt) = x;
27563 0 2 if( bArgList ){
27566 2 0 realvalue = va_arg(ap,double);
27571 0 2 if( precision<0 ) precision = 6; /* Set default precision */
27572 0 2 if( realvalue<0.0 ){
27578 2 0 if( xtype==etGENERIC && precision>0 ) precision--;
2 0 if( xtype==etGENERIC && precision>0 ) precision--;
27580 28 2 for(idx=precision&0xfff, rounder=0.5; idx>0; idx--, rounder*=0.1){}
27581 0 2 if( xtype==etFLOAT ) realvalue += rounder;
27584 0 2 if( sqlite3IsNaN((double)realvalue) ){
27589 2 0 if( realvalue>0.0 ){
27591 0 2 while( realvalue>=1e100*scale && exp<=350 ){ scale *= 1e100;exp+=100;}
0 0 while( realvalue>=1e100*scale && exp<=350 ){ scale *= 1e100;exp+=100;}
27592 0 2 while( realvalue>=1e10*scale && exp<=350 ){ scale *= 1e10; exp+=10; }
0 0 while( realvalue>=1e10*scale && exp<=350 ){ scale *= 1e10; exp+=10; }
27593 12 2 while( realvalue>=10.0*scale && exp<=350 ){ scale *= 10.0; exp++; }
12 0 while( realvalue>=10.0*scale && exp<=350 ){ scale *= 10.0; exp++; }
27595 0 2 while( realvalue<1e-8 ){ realvalue *= 1e8; exp-=8; }
27596 0 2 while( realvalue<1.0 ){ realvalue *= 10.0; exp--; }
27597 0 2 if( exp>350 ){
27601 0 0 length = 3+(prefix!=0);
27610 2 0 if( xtype!=etFLOAT ){
27612 0 2 if( realvalue>=10.0 ){ realvalue *= 0.1; exp++; }
27614 2 0 if( xtype==etGENERIC ){
27616 2 0 if( exp<-4 || exp>precision ){
0 2 if( exp<-4 || exp>precision ){
27625 0 2 if( xtype==etEXP ){
27630 0 2 if( MAX(e2,0)+(i64)precision+(i64)width > etBUFSIZE - 15 ){
27633 0 0 if( bufpt==0 ){
27642 0 2 if( prefix ){
27646 0 2 if( e2<0 ){
27649 14 2 for(; e2>=0; e2--){
27654 2 0 if( flag_dp ){
27659 0 2 for(e2++; e2<0; precision--, e2++){
27664 16 2 while( (precision--)>0 ){
27668 2 0 if( flag_rtz && flag_dp ){
2 0 if( flag_rtz && flag_dp ){
27669 14 2 while( bufpt[-1]=='0' ) *(--bufpt) = 0;
27671 0 2 if( bufpt[-1]=='.' ){
27672 0 0 if( flag_altform2 ){
27680 0 2 if( xtype==etEXP ){
27682 0 0 if( exp<0 ){
27687 0 0 if( exp>=100 ){
27704 0 2 if( flag_zeropad && !flag_leftjustify && length < width){
0 0 if( flag_zeropad && !flag_leftjustify && length < width){
0 0 if( flag_zeropad && !flag_leftjustify && length < width){
27707 0 0 for(i=width; i>=nPad; i--){
27711 0 0 while( nPad-- ) bufpt[i++] = '0';
27717 0 0 if( !bArgList ){
27718 0 0 *(va_arg(ap,int*)) = pAccum->nChar;
27728 0 0 if( bArgList ){
27731 0 0 if( bufpt ){
27733 0 0 if( (c&0xc0)==0xc0 ){
27734 0 0 while( length<4 && (bufpt[0]&0xc0)==0x80 ){
0 0 while( length<4 && (bufpt[0]&0xc0)==0x80 ){
27742 0 0 unsigned int ch = va_arg(ap,unsigned int);
27743 0 0 if( ch<0x00080 ){
27746 0 0 }else if( ch<0x00800 ){
27750 0 0 }else if( ch<0x10000 ){
27763 0 0 if( precision>1 ){
27765 0 0 if( width>1 && !flag_leftjustify ){
0 0 if( width>1 && !flag_leftjustify ){
27769 0 0 while( precision-- > 1 ){
27778 0 2222 if( bArgList ){
27782 2222 0 bufpt = va_arg(ap,char*);
27784 1 2221 if( bufpt==0 ){
27786 14 2207 }else if( xtype==etDYNSTRING ){
27787 14 0 if( pAccum->nChar==0
27788 14 0 && pAccum->mxAlloc
27789 14 0 && width==0
27790 14 0 && precision<0
27791 14 0 && pAccum->accError==0
27806 220 1988 if( precision>=0 ){
27807 0 220 if( flag_altform2 ){
27811 0 0 while( precision-- > 0 && z[0] ){
0 0 while( precision-- > 0 && z[0] ){
27812 0 0 SQLITE_SKIP_UTF8(z);
0 0 SQLITE_SKIP_UTF8(z);
27816 10566 220 for(length=0; length
10566 0 for(length=0; length
27822 0 4189 if( flag_altform2 && width>0 ){
0 0 if( flag_altform2 && width>0 ){
27825 0 0 while( ii>=0 ) if( (bufpt[ii--] & 0xc0)==0x80 ) width++;
0 0 while( ii>=0 ) if( (bufpt[ii--] & 0xc0)==0x80 ) width++;
27834 194 1787 char q = ((xtype==etSQLESCAPE3)?'"':'\''); /* Quote character */
27837 0 1981 if( bArgList ){
27840 1503 478 escarg = va_arg(ap,char*);
27843 33 1948 if( isnull ) escarg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)");
33 0 if( isnull ) escarg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)");
27850 26611 10 for(i=n=0; k!=0 && (ch=escarg[i])!=0; i++, k--){
24640 1971 for(i=n=0; k!=0 && (ch=escarg[i])!=0; i++, k--){
27851 134 24506 if( ch==q ) n++;
27852 0 24640 if( flag_altform2 && (ch&0xc0)==0xc0 ){
0 0 if( flag_altform2 && (ch&0xc0)==0xc0 ){
27853 0 0 while( (escarg[i+1]&0xc0)==0x80 ){ i++; }
27856 1948 33 needQuote = !isnull && xtype==etSQLESCAPE2;
1160 788 needQuote = !isnull && xtype==etSQLESCAPE2;
27858 85 1896 if( n>etBUFSIZE ){
27860 0 85 if( bufpt==0 ){
27868 1160 821 if( needQuote ) bufpt[j++] = q;
27870 24640 1981 for(i=0; i
27872 134 24506 if( ch==q ) bufpt[j++] = ch;
27874 1160 821 if( needQuote ) bufpt[j++] = q;
27881 0 12 if( (pAccum->printfFlags & SQLITE_PRINTF_INTERNAL)==0 ) return;
27882 12 0 pToken = va_arg(ap, Token*);
27884 12 0 if( pToken && pToken->n ){
12 0 if( pToken && pToken->n ){
27894 0 0 if( (pAccum->printfFlags & SQLITE_PRINTF_INTERNAL)==0 ) return;
27895 0 0 pSrc = va_arg(ap, SrcList*);
27896 0 0 k = va_arg(ap, int);
27900 0 0 if( pItem->zDatabase ){
27922 0 5179 if( width>0 ){
27923 0 0 if( !flag_leftjustify ) sqlite3_str_appendchar(pAccum, width, ' ');
27925 0 0 if( flag_leftjustify ) sqlite3_str_appendchar(pAccum, width, ' ');
27930 85 5094 if( zExtra ){
27947 0 870 if( p->accError ){
27952 0 870 if( p->mxAlloc==0 ){
27957 214 656 char *zOld = isMalloced(p) ? p->zText : 0;
27960 870 0 if( szNew+p->nChar<=p->mxAlloc ){
27965 0 870 if( szNew > p->mxAlloc ){
27972 780 90 if( p->db ){
27977 870 0 if( zNew ){
27979 656 214 if( !isMalloced(p) && p->nChar>0 ) memcpy(zNew, p->zText, p->nChar);
628 28 if( !isMalloced(p) && p->nChar>0 ) memcpy(zNew, p->zText, p->nChar);
27997 0 0 if( p->nChar+(i64)N >= p->nAlloc && (N = sqlite3StrAccumEnlarge(p, N))<=0 ){
0 0 if( p->nChar+(i64)N >= p->nAlloc && (N = sqlite3StrAccumEnlarge(p, N))<=0 ){
28000 0 0 while( (N--)>0 ) p->zText[p->nChar++] = c;
28013 870 0 if( N>0 ){
28028 870 11817 if( p->nChar+N >= p->nAlloc ){
28030 11763 54 }else if( N ){
28054 3073 0 if( zText ){
28064 3743 0 if( p->zText ){
28066 3743 0 if( p->mxAlloc>0 && !isMalloced(p) ){
3073 670 if( p->mxAlloc>0 && !isMalloced(p) ){
28087 2 0 if( p!=0 && p!=&sqlite3OomStr ){
2 0 if( p!=0 && p!=&sqlite3OomStr ){
28098 0 0 return p ? p->accError : SQLITE_NOMEM;
28103 0 0 return p ? p->nChar : 0;
28108 0 0 if( p==0 || p->nChar==0 ) return 0;
0 0 if( p==0 || p->nChar==0 ) return 0;
28117 0 0 if( isMalloced(p) ){
28153 2 0 if( p ){
28154 2 0 sqlite3StrAccumInit(p, 0, 0, 0,
28176 0 1433 if( acc.accError==SQLITE_NOMEM ){
28211 0 2268 if( sqlite3_initialize() ) return 0;
28227 0 2198 if( sqlite3_initialize() ) return 0;
28250 0 485 if( n<=0 ) return zBuf;
28301 0 60 if( sqlite3GlobalConfig.xLog ){
29094 0 980 if( sqlite3_initialize() ) return;
29102 959 21 if( N<=0 || pBuf==0 ){
0 959 if( N<=0 || pBuf==0 ){
29117 86 873 if( !wsdPrng.isInit ){
29123 22016 86 for(i=0; i<256; i++){
29126 22016 86 for(i=0; i<256; i++){
29144 2877 959 }while( --N );
29628 84 9 if( c>=0xc0 ){
29630 126 84 while( (*(*pz) & 0xc0)==0x80 ){
29633 84 0 if( c<0x80
29634 84 0 || (c&0xFFFFF800)==0xD800
29635 0 84 || (c&0xFFFFFFFE)==0xFFFE ){ c = 0xFFFD; }
29681 0 0 if( pMem->enc!=SQLITE_UTF8 && desiredEnc!=SQLITE_UTF8 ){
0 0 if( pMem->enc!=SQLITE_UTF8 && desiredEnc!=SQLITE_UTF8 ){
29685 0 0 if( rc!=SQLITE_OK ){
29691 0 0 while( zIn
29702 0 0 if( desiredEnc==SQLITE_UTF8 ){
29728 0 0 if( !zOut ){
29733 0 0 if( pMem->enc==SQLITE_UTF8 ){
29734 0 0 if( desiredEnc==SQLITE_UTF16LE ){
29736 0 0 while( zIn
29737 0 0 READ_UTF8(zIn, zTerm, c);
0 0 READ_UTF8(zIn, zTerm, c);
0 0 READ_UTF8(zIn, zTerm, c);
0 0 READ_UTF8(zIn, zTerm, c);
0 0 READ_UTF8(zIn, zTerm, c);
0 0 READ_UTF8(zIn, zTerm, c);
29738 0 0 WRITE_UTF16LE(z, c);
29743 0 0 while( zIn
29744 0 0 READ_UTF8(zIn, zTerm, c);
0 0 READ_UTF8(zIn, zTerm, c);
0 0 READ_UTF8(zIn, zTerm, c);
0 0 READ_UTF8(zIn, zTerm, c);
0 0 READ_UTF8(zIn, zTerm, c);
0 0 READ_UTF8(zIn, zTerm, c);
29745 0 0 WRITE_UTF16BE(z, c);
29752 0 0 if( pMem->enc==SQLITE_UTF16LE ){
29754 0 0 while( zIn
29755 0 0 READ_UTF16LE(zIn, zIn
0 0 READ_UTF16LE(zIn, zIn
0 0 READ_UTF16LE(zIn, zIn
29756 0 0 WRITE_UTF8(z, c);
0 0 WRITE_UTF8(z, c);
0 0 WRITE_UTF8(z, c);
29760 0 0 while( zIn
29761 0 0 READ_UTF16BE(zIn, zIn
0 0 READ_UTF16BE(zIn, zIn
0 0 READ_UTF16BE(zIn, zIn
29762 0 0 WRITE_UTF8(z, c);
0 0 WRITE_UTF8(z, c);
0 0 WRITE_UTF8(z, c);
29805 0 0 if( pMem->n>1 ){
29808 0 0 if( b1==0xFE && b2==0xFF ){
0 0 if( b1==0xFE && b2==0xFF ){
29811 0 0 if( b1==0xFF && b2==0xFE ){
0 0 if( b1==0xFF && b2==0xFE ){
29816 0 0 if( bom ){
29818 0 0 if( rc==SQLITE_OK ){
29842 602 0 if( nByte>=0 ){
29848 31740 0 while( *z!=0 && z
31138 602 while( *z!=0 && z
29849 16 31122 SQLITE_SKIP_UTF8(z);
24 16 SQLITE_SKIP_UTF8(z);
29898 0 0 if( db->mallocFailed ){
29924 0 0 while( n
29925 0 0 READ_UTF16LE(z, 1, c);
0 0 READ_UTF16LE(z, 1, c);
30036 0 948 return xCallback ? xCallback(iTest) : SQLITE_OK;
30096 176 66157 if( z==0 ) return 0;
30108 188 2079 if( (pCol->colFlags & COLFLAG_HASTYPE)==0 ) return zDflt;
30118 668 12 if( db->pErr ) sqlite3ValueSetNull(db->pErr);
30130 12648 12 if( err_code || db->pErr ) sqlite3ErrorFinish(db, err_code);
668 11980 if( err_code || db->pErr ) sqlite3ErrorFinish(db, err_code);
30138 0 761 if( rc==SQLITE_IOERR_NOMEM ) return;
30140 755 6 if( rc==SQLITE_CANTOPEN || rc==SQLITE_IOERR ){
0 755 if( rc==SQLITE_CANTOPEN || rc==SQLITE_IOERR ){
30170 23 25 if( zFormat==0 ){
30172 23 2 }else if( db->pErr || (db->pErr = sqlite3ValueNew(db))!=0 ){
23 0 }else if( db->pErr || (db->pErr = sqlite3ValueNew(db))!=0 ){
30206 1 10 if( db->suppressErr ){
30236 0 16967 if( z==0 ) return;
30238 13590 3377 if( !sqlite3Isquote(quote) ) return;
30239 6 3371 if( quote=='[' ) quote = ']';
30242 3517 34202 if( z[i]==quote ){
30243 140 3377 if( z[i+1]==quote ){
30278 0 6455 if( zLeft==0 ){
30279 0 0 return zRight ? -1 : 0;
30280 0 6455 }else if( zRight==0 ){
30292 422507 170564 if( c || *a==0 ) break;
394933 27574 if( c || *a==0 ) break;
30300 33 970 if( zLeft==0 ){
30301 33 0 return zRight ? -1 : 0;
30302 0 970 }else if( zRight==0 ){
30307 4837 652 while( N-- > 0 && *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }
4837 0 while( N-- > 0 && *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }
4519 318 while( N-- > 0 && *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }
30308 318 652 return N<0 ? 0 : UpperToLower[*a] - UpperToLower[*b];
30341 7888 971 if( E & 1 ) r *= x;
30343 2170 6689 if( E==0 ) break;
30390 2519 0 if( enc==SQLITE_UTF8 ){
30396 0 0 for(i=3-enc; i
0 0 for(i=3-enc; i
30403 2519 0 while( z
0 2519 while( z
30404 0 2519 if( z>=zEnd ) return 0;
30407 4 2515 if( *z=='-' ){
30410 0 2515 }else if( *z=='+' ){
30415 4848 321 while( z
2650 2198 while( z
2650 0 while( z
30422 2198 321 while( z
0 2198 while( z
30423 321 2198 if( z>=zEnd ) goto do_atof_calc;
30426 2170 28 if( *z=='.' ){
30430 32436 2169 while( z
32435 1 while( z
30431 32435 0 if( s<((LARGEST_INT64-9)/10) ){
30438 2169 29 if( z>=zEnd ) goto do_atof_calc;
30441 28 1 if( *z=='e' || *z=='E' ){
0 28 if( *z=='e' || *z=='E' ){
30448 0 1 if( z>=zEnd ) goto do_atof_calc; /*PREVENTS-HARMLESS-OVERREAD*/
30451 1 0 if( *z=='-' ){
30454 0 0 }else if( *z=='+' ){
30458 2 1 while( z
2 0 while( z
30459 2 0 e = e<10000 ? (e*10 + (*z - '0')) : 10000;
30466 52 1 while( z
24 28 while( z
30471 2170 349 if( e<0 ) {
30478 28 2491 if( s==0 ) {
30480 0 28 result = sign<0 ? -(double)0 : (double)0;
30488 2170 321 while( e>0 ){ /*OPTIMIZATION-IF-TRUE*/
30489 0 2170 if( esign>0 ){
30490 0 0 if( s>=(LARGEST_INT64/10) ) break; /*OPTIMIZATION-IF-FALSE*/
30493 2170 0 if( s%10!=0 ) break; /*OPTIMIZATION-IF-FALSE*/
30500 4 2487 s = sign<0 ? -s : s;
30502 321 2170 if( e==0 ){ /*OPTIMIZATION-IF-TRUE*/
30506 0 2170 if( e>307 ){ /*OPTIMIZATION-IF-TRUE*/
30507 0 0 if( e<342 ){ /*OPTIMIZATION-IF-TRUE*/
30509 0 0 if( esign<0 ){
30517 0 0 if( esign<0 ){
30529 2170 0 if( esign<0 ){
30542 2491 28 return z==zEnd && nDigits>0 && eValid && nonNum==0;
2491 0 return z==zEnd && nDigits>0 && eValid && nonNum==0;
2491 0 return z==zEnd && nDigits>0 && eValid && nonNum==0;
2491 0 return z==zEnd && nDigits>0 && eValid && nonNum==0;
30567 0 0 for(i=0; c==0 && i<18; i++){
0 0 for(i=0; c==0 && i<18; i++){
30570 0 0 if( c==0 ){
30605 582 0 if( enc==SQLITE_UTF8 ){
30610 0 0 for(i=3-enc; i
0 0 for(i=3-enc; i
30615 582 0 while( zNum
0 582 while( zNum
30616 582 0 if( zNum
30617 4 578 if( *zNum=='-' ){
30620 0 578 }else if( *zNum=='+' ){
30625 813 0 while( zNum
231 582 while( zNum
30626 842 347 for(i=0; &zNum[i]='0' && c<='9'; i+=incr){
607 235 for(i=0; &zNum[i]='0' && c<='9'; i+=incr){
607 0 for(i=0; &zNum[i]='0' && c<='9'; i+=incr){
30632 0 582 if( u>LARGEST_INT64 ){
30637 0 0 *pNum = neg ? SMALLEST_INT64 : LARGEST_INT64;
30638 4 578 }else if( neg ){
30644 231 351 if( (i==0 && zStart==zNum) /* No digits */
231 0 if( (i==0 && zStart==zNum) /* No digits */
30645 0 582 || nonNum /* UTF16 with high-order bytes non-zero */
30648 235 347 }else if( &zNum[i]
30651 235 231 if( !sqlite3Isspace(zNum[jj]) ){
30656 231 0 }while( &zNum[jj]
30658 582 0 if( i<19*incr ){
30664 0 0 c = i>19*incr ? 1 : compare2pow63(zNum, incr);
30665 0 0 if( c<0 ){
30670 0 0 *pNum = neg ? SMALLEST_INT64 : LARGEST_INT64;
30671 0 0 if( c>0 ){
30678 0 0 return neg ? rc : 3;
30698 0 12 if( z[0]=='0'
30699 0 0 && (z[1]=='x' || z[1]=='X')
0 0 && (z[1]=='x' || z[1]=='X')
30703 0 0 for(i=2; z[i]=='0'; i++){}
30704 0 0 for(k=i; sqlite3Isxdigit(z[k]); k++){
30708 0 0 return (z[k]==0 && k-i<=16) ? 0 : 2;
0 0 return (z[k]==0 && k-i<=16) ? 0 : 2;
30730 0 1743 if( zNum[0]=='-' ){
30733 0 1743 }else if( zNum[0]=='+' ){
30737 29 1714 else if( zNum[0]=='0'
30738 29 0 && (zNum[1]=='x' || zNum[1]=='X')
0 29 && (zNum[1]=='x' || zNum[1]=='X')
30739 0 0 && sqlite3Isxdigit(zNum[2])
30743 0 0 while( zNum[0]=='0' ) zNum++;
30744 0 0 for(i=0; sqlite3Isxdigit(zNum[i]) && i<8; i++){
0 0 for(i=0; sqlite3Isxdigit(zNum[i]) && i<8; i++){
30747 0 0 if( (u&0x80000000)==0 && sqlite3Isxdigit(zNum[i])==0 ){
0 0 if( (u&0x80000000)==0 && sqlite3Isxdigit(zNum[i])==0 ){
30755 0 1743 if( !sqlite3Isdigit(zNum[0]) ) return 0;
30756 29 1743 while( zNum[0]=='0' ) zNum++;
30757 3969 0 for(i=0; i<11 && (c = zNum[i] - '0')>=0 && c<=9; i++){
2226 1743 for(i=0; i<11 && (c = zNum[i] - '0')>=0 && c<=9; i++){
2226 0 for(i=0; i<11 && (c = zNum[i] - '0')>=0 && c<=9; i++){
30767 0 1743 if( i>10 ){
30771 12 1731 if( v-neg>2147483647 ){
30774 0 1731 if( neg ){
30787 619 0 if( z ) sqlite3GetInt32(z, &x);
30823 0 13 if( v & (((u64)0xff000000)<<32) ){
30826 0 0 for(i=7; i>=0; i--){
30836 26 13 }while( v!=0 );
30839 39 13 for(i=0, j=n-1; j>=0; j--, i++){
30845 1825 1981 if( v<=0x7f ){
30849 1968 13 if( v<=0x3fff ){
30879 2638 380 if (!(a&0x80))
30888 380 0 if (!(b&0x80))
30905 0 0 if (!(a&0x80))
30921 0 0 if (!(b&0x80))
30945 0 0 if (!(a&0x80))
30967 0 0 if (!(b&0x80))
30983 0 0 if (!(a&0x80))
31000 0 0 if (!(b&0x80))
31065 186 7 if (!(b&0x80))
31079 7 0 if (!(a&0x80))
31106 0 0 if( (v64 & SQLITE_MAX_U32)!=v64 ){
31170 145 4795 for(i=1; (v >>= 7)!=0; i++){ assert( i<10 ); }
31244 0 0 if( zBlob ){
31245 0 0 for(i=0; i
31282 0 8788 if( db==0 ){
31287 0 8788 if( magic!=SQLITE_MAGIC_OPEN ){
31288 0 0 if( sqlite3SafetyCheckSickOrOk(db) ){
31300 1123 12 if( magic!=SQLITE_MAGIC_SICK &&
6 1117 if( magic!=SQLITE_MAGIC_SICK &&
31301 0 6 magic!=SQLITE_MAGIC_OPEN &&
31379 186 0 if( x>=0 ) return x;
31380 0 0 if( x==(int)0x80000000 ) return 0x7fffffff;
31433 2041 1804 if( a>=b ){
31434 1516 525 if( a>b+49 ) return a;
31435 3 522 if( a>b+31 ) return a+1;
31438 1593 211 if( b>a+49 ) return b;
31439 76 135 if( b>a+31 ) return b+1;
31451 95 3097 if( x<8 ){
31452 36 59 if( x<2 ) return 0;
31453 95 59 while( x<8 ){ y -= 10; x <<= 1; }
31476 0 43 if( x<=1 ) return 0;
31477 43 0 if( x<=2000000000 ) return sqlite3LogEst((u64)x);
31560 8 22 if( pIn==0 || pIn[1]+nInt > pIn[0] ){
0 8 if( pIn==0 || pIn[1]+nInt > pIn[0] ){
31562 0 22 int nAlloc = (pIn ? pIn[0]*2 : 10) + nInt;
31564 0 22 if( pOut==0 ) return pIn;
31565 22 0 if( pIn==0 ) pOut[1] = 2;
31587 3 32 if( pIn==0 ) return 0;
31591 32 8 if( pIn[i]==iVal ) return (char*)&pIn[i+2];
31593 8 0 }while( i
31603 13 12 if( pIn==0 ) return 0;
31608 7 7 if( strncmp(z,zName,nName)==0 && z[nName]==0 ) return pIn[i];
7 0 if( strncmp(z,zName,nName)==0 && z[nName]==0 ) return pIn[i];
31610 2 5 }while( i
31659 13108 2906 while( elem ){
31673 352575 34554 while( (c = (unsigned char)*z++)!=0 ){ /*OPTIMIZATION-IF-TRUE*/
31707 12136 6113 if( pEntry ){
31708 5702 6434 pHead = pEntry->count ? pEntry->chain : 0;
31714 5702 12547 if( pHead ){
31717 5666 36 if( pHead->prev ){ pHead->prev->next = pNew; }
31722 10828 1719 if( pH->first ){ pH->first->prev = pNew; }
31740 12 504 if( new_size*sizeof(struct _ht)>SQLITE_MALLOC_SOFT_LIMIT ){
31743 0 516 if( new_size==pH->htsize ) return 0;
31758 0 516 if( new_ht==0 ) return 0;
31763 5016 516 for(elem=pH->first, pH->first=0; elem; elem = next_elem){
31786 29022 26276 if( pH->ht ){ /*OPTIMIZATION-IF-TRUE*/
31797 15333 39965 if( pHash ) *pHash = h;
31798 110786 41929 while( count-- ){
31800 13369 97417 if( sqlite3StrICmp(elem->pKey,pKey)==0 ){
31851 0 21 if( elem->prev ){
31856 7 14 if( elem->next ){
31859 0 21 if( pH->ht ){
31861 0 0 if( pEntry->chain==elem ){
31869 14 7 if( pH->count==0 ){
31916 2029 13304 if( elem->data ){
31918 21 2008 if( data==0 ){
31926 71 13233 if( data==0 ) return 0;
31928 0 13233 if( new_elem==0 ) return data;
31932 7120 6113 if( pH->count>=10 && pH->count > 2*pH->htsize ){
516 6604 if( pH->count>=10 && pH->count > 2*pH->htsize ){
31933 516 0 if( rehash(pH, pH->count*2) ){
31938 7120 6113 insertElement(pH, pH->ht ? &pH->ht[h] : 0, new_elem);
32876 74 0 return osGeteuid() ? 0 : osFchown(fd,uid,gid);
32897 0 0 if( zName==0 ){
32902 0 0 for(i=0; i
32903 0 0 if( aSyscall[i].pDefault ){
32911 0 0 for(i=0; i
32912 0 0 if( strcmp(zName, aSyscall[i].zName)==0 ){
32913 0 0 if( aSyscall[i].pDefault==0 ){
32917 0 0 if( pNewFunc==0 ) pNewFunc = aSyscall[i].pDefault;
32938 0 0 for(i=0; i
32939 0 0 if( strcmp(zName, aSyscall[i].zName)==0 ) return aSyscall[i].pCurrent;
32954 0 0 if( zName ){
32955 0 0 for(i=0; i
32956 0 0 if( strcmp(zName, aSyscall[i].zName)==0 ) break;
32959 0 0 for(i++; i
32960 0 0 if( aSyscall[i].pCurrent!=0 ) return aSyscall[i].zName;
32993 74 267 mode_t m2 = m ? m : SQLITE_DEFAULT_FILE_PERMISSIONS;
33000 9 332 if( fd<0 ){
33001 0 9 if( errno==EINTR ) continue;
33004 332 0 if( fd>=SQLITE_MINIMUM_FILE_DESCRIPTOR ) break;
33009 0 0 if( osOpen("/dev/null", f, m)<0 ) break;
33011 332 9 if( fd>=0 ){
33012 74 258 if( m!=0 ){
33014 74 0 if( osFstat(fd, &statbuf)==0
33015 74 0 && statbuf.st_size==0
33016 0 74 && (statbuf.st_mode&0777)!=m
33165 0 0 do{ rc = osFtruncate(h,sz); }while( rc<0 && errno==EINTR );
0 0 do{ rc = osFtruncate(h,sz); }while( rc<0 && errno==EINTR );
33581 0 6 if( zPath==0 ) zPath = "";
33604 0 330 if( osClose(h) ){
33605 0 0 unixLogErrorAtLine(SQLITE_IOERR_CLOSE, "close",
33626 0 324 for(p=pInode->pUnused; p; p=pNext){
33644 98 0 if( ALWAYS(pInode) ){
33646 89 9 if( pInode->nRef==0 ){
33651 0 89 if( pInode->pPrev ){
33658 0 89 if( pInode->pNext ){
33694 0 100 if( rc!=0 ){
33736 9 91 while( pInode && memcmp(&fileId, &pInode->fileId, sizeof(fileId)) ){
0 9 while( pInode && memcmp(&fileId, &pInode->fileId, sizeof(fileId)) ){
33739 91 9 if( pInode==0 ){
33741 0 91 if( pInode==0 ){
33746 91 0 if( sqlite3GlobalConfig.bCoreMutex ){
33748 0 91 if( pInode->pLockMutex==0 ){
33757 0 91 if( inodeList ) inodeList->pPrev = pInode;
33776 0 302 || (u64)buf.st_ino!=pFile->pInode->fileId.ino);
33795 74 198 if( pFile->ctrlFlags & UNIXFILE_NOLOCK ) return;
33798 0 198 if( rc!=0 ){
33802 0 198 if( buf.st_nlink==0 ){
33806 0 198 if( buf.st_nlink>1 ){
33810 0 198 if( fileHasMoved(pFile) ){
33835 65 87 if( pFile->pInode->eFileLock>SHARED_LOCK ){
33842 87 65 if( !reserved && !pFile->pInode->bProcessLock ){
87 0 if( !reserved && !pFile->pInode->bProcessLock ){
33848 0 87 if( osFcntl(pFile->h, F_GETLK, &lock) ){
33851 87 0 } else if( lock.l_type!=F_UNLCK ){
33925 0 1429 if( (pFile->ctrlFlags & (UNIXFILE_EXCL|UNIXFILE_RDONLY))==UNIXFILE_EXCL ){
33926 0 0 if( pInode->bProcessLock==0 ){
33934 0 0 if( rc<0 ) return rc;
34026 0 639 if( pFile->eFileLock>=eFileLock ){
34049 156 483 if( (pFile->eFileLock!=pInode->eFileLock &&
130 26 if( (pFile->eFileLock!=pInode->eFileLock &&
34050 65 65 (pInode->eFileLock>=PENDING_LOCK || eFileLock>SHARED_LOCK))
34060 301 247 if( eFileLock==SHARED_LOCK &&
301 0 if( eFileLock==SHARED_LOCK &&
34061 65 236 (pInode->eFileLock==SHARED_LOCK || pInode->eFileLock==RESERVED_LOCK) ){
34078 247 236 if( eFileLock==SHARED_LOCK
34079 79 168 || (eFileLock==EXCLUSIVE_LOCK && pFile->eFileLock
79 0 || (eFileLock==EXCLUSIVE_LOCK && pFile->eFileLock
34083 1 314 if( unixFileLock(pFile, &lock) ){
34086 0 1 if( rc!=SQLITE_BUSY ){
34097 235 247 if( eFileLock==SHARED_LOCK ){
34105 0 235 if( unixFileLock(pFile, &lock) ){
34114 0 235 if( unixFileLock(pFile, &lock) && rc==SQLITE_OK ){
0 0 if( unixFileLock(pFile, &lock) && rc==SQLITE_OK ){
34120 0 235 if( rc ){
34121 0 0 if( rc!=SQLITE_BUSY ){
34130 79 168 }else if( eFileLock==EXCLUSIVE_LOCK && pInode->nShared>1 ){
0 79 }else if( eFileLock==EXCLUSIVE_LOCK && pInode->nShared>1 ){
34143 168 79 if( eFileLock==RESERVED_LOCK ){
34151 87 160 if( unixFileLock(pFile, &lock) ){
34154 0 87 if( rc!=SQLITE_BUSY ){
34178 395 87 if( rc==SQLITE_OK ){
34181 0 87 }else if( eFileLock==EXCLUSIVE_LOCK ){
34232 198 381 if( pFile->eFileLock<=eFileLock ){
34238 81 300 if( pFile->eFileLock>SHARED_LOCK ){
34262 81 0 if( eFileLock==SHARED_LOCK ){
34311 0 81 if( unixFileLock(pFile, &lock) ){
34328 81 0 if( unixFileLock(pFile, &lock)==0 ){
34336 300 81 if( eFileLock==NO_LOCK ){
34342 235 65 if( pInode->nShared==0 ){
34346 235 0 if( unixFileLock(pFile, &lock)==0 ){
34362 235 65 if( pInode->nLock==0 ) closePendingFds(pFile);
34367 381 0 if( rc==SQLITE_OK ){
34407 172 0 if( pFile->h>=0 ){
34453 0 98 if( pInode->nLock ){
34600 0 0 if( pFile->eFileLock > NO_LOCK ){
34613 0 0 if( rc<0 ){
34616 0 0 if( EEXIST == tErrno ){
34620 0 0 if( rc!=SQLITE_BUSY ){
34652 0 0 if( pFile->eFileLock==eFileLock ){
34659 0 0 if( eFileLock==SHARED_LOCK ){
34667 0 0 if( rc<0 ){
34669 0 0 if( tErrno==ENOENT ){
35617 0 518 if( newOffset<0 ){
35623 361 157 if( got==cnt ) break;
35624 0 157 if( got<0 ){
35625 0 0 if( errno==EINTR ){ got = 1; continue; }
35629 0 157 }else if( got>0 ){
35635 0 157 }while( got>0 );
35671 0 518 if( offsetmmapSize ){
35672 0 0 if( offset+amt <= pFile->mmapSize ){
35686 361 157 if( got==amt ){
35688 0 157 }else if( got<0 ){
35729 0 624 if( iSeek<0 ){
35734 0 624 }while( rc<0 && errno==EINTR );
0 0 }while( rc<0 && errno==EINTR );
35740 0 624 if( rc<0 ) *piErrno = errno;
35820 0 624 while( (wrote = seekAndWrite(pFile, offset, pBuf, amt))0 ){
0 0 while( (wrote = seekAndWrite(pFile, offset, pBuf, amt))0 ){
35828 0 624 if( amt>wrote ){
35829 0 0 if( wrote<0 && pFile->lastErrno!=ENOSPC ){
0 0 if( wrote<0 && pFile->lastErrno!=ENOSPC ){
35998 1152 0 for(ii=(int)strlen(zDirname); ii>0 && zDirname[ii]!='/'; ii--);
1080 72 for(ii=(int)strlen(zDirname); ii>0 && zDirname[ii]!='/'; ii--);
35999 72 0 if( ii>0 ){
36002 0 0 if( zDirname[0]!='/' ) zDirname[0] = '.';
36010 72 0 if( fd>=0 ) return SQLITE_OK;
36050 0 216 if( rc ){
36059 72 144 if( pFile->ctrlFlags & UNIXFILE_DIRSYNC ){
36064 72 0 if( rc==SQLITE_OK ){
36090 0 0 if( pFile->szChunk>0 ){
36095 0 0 if( rc ){
36117 0 0 if( nBytemmapSize ){
36135 0 306 if( rc!=0 ){
36147 0 306 if( *pSize==1 ) *pSize = 0;
36168 0 24 if( pFile->szChunk>0 ){
36172 0 0 if( osFstat(pFile->h, &buf) ){
36177 0 0 if( nSize>(i64)buf.st_size ){
36203 0 0 for(/*no-op*/; iWrite
36204 0 0 if( iWrite>=nSize ) iWrite = nSize - 1;
36206 0 0 if( nWrite!=1 ) return SQLITE_IOERR_WRITE;
36213 0 24 if( pFile->mmapSizeMax>0 && nByte>pFile->mmapSize ){
0 0 if( pFile->mmapSizeMax>0 && nByte>pFile->mmapSize ){
36215 0 0 if( pFile->szChunk<=0 ){
36216 0 0 if( robust_ftruncate(pFile->h, nByte) ){
36237 0 0 if( *pArg<0 ){
36239 0 0 }else if( (*pArg)==0 ){
36303 0 0 if( zTFile ){
36323 0 304 if( newLimit>sqlite3GlobalConfig.mxMmap ){
36335 304 0 if( newLimit>=0 && newLimit!=pFile->mmapSizeMax && pFile->nFetchOut==0 ){
0 304 if( newLimit>=0 && newLimit!=pFile->mmapSizeMax && pFile->nFetchOut==0 ){
0 0 if( newLimit>=0 && newLimit!=pFile->mmapSizeMax && pFile->nFetchOut==0 ){
36337 0 0 if( pFile->mmapSize>0 ){
36378 100 745 if( pFd->sectorSize==0 ){
36391 100 0 if( pFd->ctrlFlags & UNIXFILE_PSOW ){
36633 0 0 if( pShmNode->hShm>=0 ){
36640 0 0 rc = (rc!=(-1)) ? SQLITE_OK : SQLITE_BUSY;
36694 0 0 if( pgsz
36707 0 0 if( p && ALWAYS(p->nRef==0) ){
0 0 if( p && ALWAYS(p->nRef==0) ){
36712 0 0 for(i=0; inRegion; i+=nShmPerMap){
36713 0 0 if( p->hShm>=0 ){
36720 0 0 if( p->hShm>=0 ){
36764 0 0 if( osFcntl(pShmNode->hShm, F_GETLK, &lock)!=0 ) {
36766 0 0 }else if( lock.l_type==F_UNLCK ){
36767 0 0 if( pShmNode->isReadonly ){
36777 0 0 if( rc==SQLITE_OK && robust_ftruncate(pShmNode->hShm, 3) ){
0 0 if( rc==SQLITE_OK && robust_ftruncate(pShmNode->hShm, 3) ){
36781 0 0 }else if( lock.l_type==F_WRLCK ){
36785 0 0 if( rc==SQLITE_OK ){
36837 0 0 if( p==0 ) return SQLITE_NOMEM_BKPT;
36848 0 0 if( pShmNode==0 ){
36858 0 0 if( osFstat(pDbFd->h, &sStat) ){
36869 0 0 if( pShmNode==0 ){
36886 0 0 if( sqlite3GlobalConfig.bCoreMutex ){
36888 0 0 if( pShmNode->pShmMutex==0 ){
36894 0 0 if( pInode->bProcessLock==0 ){
36895 0 0 if( 0==sqlite3_uri_boolean(pDbFd->zPath, "readonly_shm", 0) ){
36898 0 0 if( pShmNode->hShm<0 ){
36900 0 0 if( pShmNode->hShm<0 ){
36914 0 0 if( rc!=SQLITE_OK && rc!=SQLITE_READONLY_CANTINIT ) goto shm_open_err;
0 0 if( rc!=SQLITE_OK && rc!=SQLITE_READONLY_CANTINIT ) goto shm_open_err;
36982 0 0 if( pDbFd->pShm==0 ){
36984 0 0 if( rc!=SQLITE_OK ) return rc;
36990 0 0 if( pShmNode->isUnlocked ){
36992 0 0 if( rc!=SQLITE_OK ) goto shmpage_out;
37003 0 0 if( pShmNode->nRegion
37010 0 0 if( pShmNode->hShm>=0 ){
37015 0 0 if( osFstat(pShmNode->hShm, &sStat) ){
37020 0 0 if( sStat.st_size
37024 0 0 if( !bExtend ){
37041 0 0 for(iPg=(sStat.st_size/pgsz); iPg<(nByte/pgsz); iPg++){
37043 0 0 if( seekAndWriteFd(pShmNode->hShm, iPg*pgsz + pgsz-1,"",1,&x)!=1 ){
37057 0 0 if( !apNew ){
37062 0 0 while( pShmNode->nRegion
37066 0 0 if( pShmNode->hShm>=0 ){
37067 0 0 pMem = osMmap(0, nMap,
37071 0 0 if( pMem==MAP_FAILED ){
37077 0 0 if( pMem==0 ){
37084 0 0 for(i=0; i
37092 0 0 if( pShmNode->nRegion>iRegion ){
37097 0 0 if( pShmNode->isReadonly && rc==SQLITE_OK ) rc = SQLITE_READONLY;
0 0 if( pShmNode->isReadonly && rc==SQLITE_OK ) rc = SQLITE_READONLY;
37138 0 0 if( flags & SQLITE_SHM_UNLOCK ){
37142 0 0 for(pX=pShmNode->pFirst; pX; pX=pX->pNext){
37143 0 0 if( pX==p ) continue;
37149 0 0 if( (mask & allMask)==0 ){
37156 0 0 if( rc==SQLITE_OK ){
37160 0 0 }else if( flags & SQLITE_SHM_SHARED ){
37167 0 0 for(pX=pShmNode->pFirst; pX; pX=pX->pNext){
37168 0 0 if( (pX->exclMask & mask)!=0 ){
37176 0 0 if( rc==SQLITE_OK ){
37177 0 0 if( (allShared & mask)==0 ){
37185 0 0 if( rc==SQLITE_OK ){
37192 0 0 for(pX=pShmNode->pFirst; pX; pX=pX->pNext){
37193 0 0 if( (pX->exclMask & mask)!=0 || (pX->sharedMask & mask)!=0 ){
0 0 if( (pX->exclMask & mask)!=0 || (pX->sharedMask & mask)!=0 ){
37202 0 0 if( rc==SQLITE_OK ){
37204 0 0 if( rc==SQLITE_OK ){
37252 0 0 if( p==0 ) return SQLITE_OK;
37261 0 0 for(pp=&pShmNode->pFirst; (*pp)!=p; pp = &(*pp)->pNext){}
37275 0 0 if( pShmNode->nRef==0 ){
37276 0 0 if( deleteFlag && pShmNode->hShm>=0 ){
0 0 if( deleteFlag && pShmNode->hShm>=0 ){
37300 0 172 if( pFd->pMapRegion ){
37345 0 0 if( pOrig ){
37355 0 0 if( nReuse!=nOrig ){
37375 0 0 if( pNew==MAP_FAILED || pNew==0 ){
0 0 if( pNew==MAP_FAILED || pNew==0 ){
37381 0 0 if( pNew==0 ){
37385 0 0 if( pNew==MAP_FAILED ){
37418 0 0 if( pFd->nFetchOut>0 ) return SQLITE_OK;
37420 0 0 if( nMap<0 ){
37422 0 0 if( osFstat(pFd->h, &statbuf) ){
37427 0 0 if( nMap>pFd->mmapSizeMax ){
37432 0 0 if( nMap!=pFd->mmapSize ){
37459 0 0 if( pFd->mmapSizeMax>0 ){
37460 0 0 if( pFd->pMapRegion==0 ){
37462 0 0 if( rc!=SQLITE_OK ) return rc;
37464 0 0 if( pFd->mmapSize >= iOff+nAmt ){
37496 0 0 if( p ){
37837 8 166 if( sqlite3_uri_boolean(((ctrlFlags & UNIXFILE_URI) ? zFilename : 0),
174 0 if( sqlite3_uri_boolean(((ctrlFlags & UNIXFILE_URI) ? zFilename : 0),
37841 0 174 if( strcmp(pVfs->zName,"unix-excl")==0 ){
37853 74 100 if( ctrlFlags & UNIXFILE_NOLOCK ){
37865 100 74 if( pLockingStyle == &posixIoMethods
37872 0 100 if( rc!=SQLITE_OK ){
37925 0 74 else if( pLockingStyle == &dotlockIoMethods ){
37934 0 0 if( zLockFile==0 ){
37975 0 174 if( rc!=SQLITE_OK ){
37976 0 0 if( h>=0 ) robust_close(pNew, h, __LINE__);
38002 0 0 if( !azDirs[0] ) azDirs[0] = getenv("SQLITE_TMPDIR");
38003 0 0 if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR");
38005 0 0 if( zDir!=0
38006 0 0 && osStat(zDir, &buf)==0
38007 0 0 && S_ISDIR(buf.st_mode)
38008 0 0 && osAccess(zDir, 03)==0
38012 0 0 if( i>=sizeof(azDirs)/sizeof(azDirs[0]) ) break;
38035 0 0 if( zDir==0 ) return SQLITE_IOERR_GETTEMPPATH;
38043 0 0 if( zBuf[nBuf-2]!=0 || (iLimit++)>10 ) return SQLITE_ERROR;
0 0 if( zBuf[nBuf-2]!=0 || (iLimit++)>10 ) return SQLITE_ERROR;
38044 0 0 }while( osAccess(zBuf,0)==0 );
38094 9 97 if( inodeList!=0 && 0==osStat(zPath, &sStat) ){
9 0 if( inodeList!=0 && 0==osStat(zPath, &sStat) ){
38098 9 0 while( pInode && (pInode->fileId.dev!=sStat.st_dev
0 9 while( pInode && (pInode->fileId.dev!=sStat.st_dev
38099 0 9 || pInode->fileId.ino!=(u64)sStat.st_ino) ){
38102 9 0 if( pInode ){
38106 0 9 for(pp=&pInode->pUnused; *pp && (*pp)->flags!=flags; pp=&((*pp)->pNext));
0 0 for(pp=&pInode->pUnused; *pp && (*pp)->flags!=flags; pp=&((*pp)->pNext));
38108 0 9 if( pUnused ){
38130 74 0 if( 0==osStat(zFile, &sStat) ){
38172 74 106 if( flags & (SQLITE_OPEN_WAL|SQLITE_OPEN_MAIN_JOURNAL) ){
38189 518 74 while( zPath[nDb]!='-' ){
38194 518 0 if( nDb==0 || zPath[nDb]=='.' ) return SQLITE_OK;
0 518 if( nDb==0 || zPath[nDb]=='.' ) return SQLITE_OK;
38201 0 106 }else if( flags & SQLITE_OPEN_DELETEONCLOSE ){
38203 12 94 }else if( flags & SQLITE_OPEN_URI ){
38209 0 12 if( z ){
38269 168 12 int isNewJrnl = (isCreate && (
168 0 int isNewJrnl = (isCreate && (
38271 94 74 || eType==SQLITE_OPEN_MAIN_JOURNAL
38272 0 94 || eType==SQLITE_OPEN_WAL
38312 21 159 if( randomnessPid!=osGetpid(0) ){
38318 106 74 if( eType==SQLITE_OPEN_MAIN_DB ){
38321 0 106 if( pUnused ){
38325 0 106 if( !pUnused ){
38336 0 74 }else if( !zName ){
38340 0 0 if( rc!=SQLITE_OK ){
38354 6 174 if( isReadonly ) openFlags |= O_RDONLY;
38355 174 6 if( isReadWrite ) openFlags |= O_RDWR;
38356 168 12 if( isCreate ) openFlags |= O_CREAT;
38357 0 180 if( isExclusive ) openFlags |= (O_EXCL|O_NOFOLLOW);
38360 180 0 if( fd<0 ){
38365 0 180 if( rc!=SQLITE_OK ){
38373 6 174 if( fd<0 ){
38374 0 6 if( isNewJrnl && errno==EACCES && osAccess(zName, F_OK) ){
0 0 if( isNewJrnl && errno==EACCES && osAccess(zName, F_OK) ){
0 0 if( isNewJrnl && errno==EACCES && osAccess(zName, F_OK) ){
38378 6 0 }else if( errno!=EISDIR && isReadWrite ){
3 3 }else if( errno!=EISDIR && isReadWrite ){
38388 6 174 if( fd<0 ){
38390 6 0 if( rc==SQLITE_OK ) rc = rc2;
38398 74 100 if( flags & (SQLITE_OPEN_WAL|SQLITE_OPEN_MAIN_JOURNAL) ){
38403 100 74 if( pOutFlags ){
38407 100 74 if( p->pPreallocatedUnused ){
38412 0 174 if( isDelete ){
38446 0 174 if( isDelete ) ctrlFlags |= UNIXFILE_DELETE;
38447 3 171 if( isReadonly ) ctrlFlags |= UNIXFILE_RDONLY;
38449 74 100 if( noLock ) ctrlFlags |= UNIXFILE_NOLOCK;
38450 74 100 if( isNewJrnl ) ctrlFlags |= UNIXFILE_DIRSYNC;
38451 8 166 if( flags & SQLITE_OPEN_URI ) ctrlFlags |= UNIXFILE_URI;
38492 6 174 if( rc!=SQLITE_OK ){
38511 0 74 if( osUnlink(zPath)==(-1) ){
38512 0 0 if( errno==ENOENT
38524 0 74 if( (dirSync & 1)!=0 ){
38527 0 0 if( rc==SQLITE_OK ){
38528 0 0 if( full_fsync(fd,0,0) ){
38565 600 0 if( flags==SQLITE_ACCESS_EXISTS ){
38567 152 448 *pResOut = (0==osStat(zPath, &buf) && buf.st_size>0);
152 0 *pResOut = (0==osStat(zPath, &buf) && buf.st_size>0);
38584 82 24 if( zPath[0]!='/' ){
38585 0 82 if( osGetcwd(zOut, nOut-2)==0 ){
38591 0 106 if( (iOff+nPath+1)>nOut ){
38641 56 50 if( osLstat(zIn, &buf)!=0 ){
38642 0 56 if( errno!=ENOENT ){
38649 0 106 if( bLink ){
38650 0 0 if( zDel==0 ){
38652 0 0 if( zDel==0 ) rc = SQLITE_NOMEM_BKPT;
38653 0 0 }else if( ++nLink>SQLITE_MAX_SYMLINKS ){
38657 0 0 if( rc==SQLITE_OK ){
38659 0 0 if( nByte<0 ){
38662 0 0 if( zDel[0]!='/' ){
38664 0 0 for(n = sqlite3Strlen30(zIn); n>0 && zIn[n-1]!='/'; n--);
0 0 for(n = sqlite3Strlen30(zIn); n>0 && zIn[n-1]!='/'; n--);
38665 0 0 if( nByte+n+1>nOut ){
38681 106 0 if( rc==SQLITE_OK && zIn!=zOut ){
106 0 if( rc==SQLITE_OK && zIn!=zOut ){
38684 106 0 if( bLink==0 ) break;
38686 0 0 }while( rc==SQLITE_OK );
38717 0 0 if( zErr ){
38781 0 86 if( fd<0 ){
38789 0 86 do{ got = osRead(fd, zBuf, nBuf); }while( got<0 && errno==EINTR );
0 0 do{ got = osRead(fd, zBuf, nBuf); }while( got<0 && errno==EINTR );
40187 380 95 for(i=0; i<(sizeof(aVfs)/sizeof(sqlite3_vfs)); i++){
47254 962 0 if( p ){
47268 449 1159 if( i>=p->iSize ) return 0;
47269 0 1159 while( p->iDivisor ){
47273 0 0 if (!p) {
47277 1159 0 if( p->iSize<=BITVEC_NBIT ){
47281 0 0 while( p->u.aHash[h] ){
47282 0 0 if( p->u.aHash[h]==i ) return 1;
47289 1 28 return p!=0 && sqlite3BitvecTestNotNull(p,i);
0 1 return p!=0 && sqlite3BitvecTestNotNull(p,i);
47306 0 1158 if( p==0 ) return SQLITE_OK;
47310 0 1158 while((p->iSize > BITVEC_NBIT) && p->iDivisor) {
0 0 while((p->iSize > BITVEC_NBIT) && p->iDivisor) {
47313 0 0 if( p->u.apSub[bin]==0 ){
47315 0 0 if( p->u.apSub[bin]==0 ) return SQLITE_NOMEM_BKPT;
47319 1158 0 if( p->iSize<=BITVEC_NBIT ){
47327 0 0 if( !p->u.aHash[h] ){
47328 0 0 if (p->nSet<(BITVEC_NINT-1)) {
47337 0 0 if( p->u.aHash[h]==i ) return SQLITE_OK;
47339 0 0 if( h>=BITVEC_NINT ) h = 0;
47340 0 0 } while( p->u.aHash[h] );
47345 0 0 if( p->nSet>=BITVEC_MXHASH ){
47349 0 0 if( aiValues==0 ){
47356 0 0 for(j=0; j
47357 0 0 if( aiValues[j] ) rc |= sqlite3BitvecSet(p, aiValues[j]);
47376 0 0 if( p==0 ) return;
47379 0 0 while( p->iDivisor ){
47383 0 0 if (!p) {
47387 0 0 if( p->iSize<=BITVEC_NBIT ){
47395 0 0 for(j=0; j
47396 0 0 if( aiValues[j] && aiValues[j]!=(i+1) ){
0 0 if( aiValues[j] && aiValues[j]!=(i+1) ){
47399 0 0 while( p->u.aHash[h] ){
47401 0 0 if( h>=BITVEC_NINT ) h = 0;
47413 3394 962 if( p==0 ) return;
47414 0 962 if( p->iDivisor ){
47416 0 0 for(i=0; i
47484 0 0 if( pBitvec==0 || pV==0 || pTmpSpace==0 ) goto bitvec_end;
0 0 if( pBitvec==0 || pV==0 || pTmpSpace==0 ) goto bitvec_end;
0 0 if( pBitvec==0 || pV==0 || pTmpSpace==0 ) goto bitvec_end;
47492 0 0 while( (op = aOp[pc])!=0 ){
47493 0 0 switch( op ){
47510 0 0 if( (--aOp[pc+1]) > 0 ) nx = 0;
47513 0 0 if( (op & 1)!=0 ){
47515 0 0 if( op!=5 ){
47516 0 0 if( sqlite3BitvecSet(pBitvec, i+1) ) goto bitvec_end;
47532 0 0 for(i=1; i<=sz; i++){
47533 0 0 if( (TESTBIT(pV,i))!=sqlite3BitvecTest(pBitvec,i) ){
47713 6928 1442 if( addRemove & PCACHE_DIRTYLIST_REMOVE ){
47718 1625 5303 if( p->pSynced==pPage ){
47722 4987 1941 if( pPage->pDirtyNext ){
47728 3547 3381 if( pPage->pDirtyPrev ){
47738 1415 1966 if( p->pDirty==0 ){ /*OPTIMIZATION-IF-TRUE*/
47744 6928 1442 if( addRemove & PCACHE_DIRTYLIST_ADD ){
47747 5513 1415 if( pPage->pDirtyNext ){
47752 156 1259 if( p->bPurgeable ){
47764 1923 5005 if( !p->pSynced
47765 1078 845 && 0==(pPage->flags&PGHDR_NEED_SYNC) /*OPTIMIZATION-IF-FALSE*/
47778 502 3346 if( p->pCache->bPurgeable ){
47790 291 476 if( p->szCache>=0 ){
47808 95 0 if( sqlite3GlobalConfig.pcache2.xInit==0 ){
47817 0 0 if( sqlite3GlobalConfig.pcache2.xShutdown ){
47868 291 291 if( pCache->szPage ){
47874 0 291 if( pNew==0 ) return SQLITE_NOMEM_BKPT;
47876 0 291 if( pCache->pCache ){
47957 0 0 if( pCache->eCreate==2 ) return 0;
47959 0 0 if( sqlite3PcachePagecount(pCache)>pCache->szSpill ){
47969 0 0 for(pPg=pCache->pSynced;
47970 0 0 pPg && (pPg->nRef || (pPg->flags&PGHDR_NEED_SYNC));
0 0 pPg && (pPg->nRef || (pPg->flags&PGHDR_NEED_SYNC));
47974 0 0 if( !pPg ){
47975 0 0 for(pPg=pCache->pDirtyTail; pPg && pPg->nRef; pPg=pPg->pDirtyPrev);
0 0 for(pPg=pCache->pDirtyTail; pPg && pPg->nRef; pPg=pPg->pDirtyPrev);
47977 0 0 if( pPg ){
47989 0 0 if( rc!=SQLITE_OK && rc!=SQLITE_BUSY ){
0 0 if( rc!=SQLITE_OK && rc!=SQLITE_BUSY ){
47995 0 0 return *ppPage==0 ? SQLITE_NOMEM_BKPT : SQLITE_OK;
48043 573 9081 if( !pPgHdr->pPage ){
48059 8107 979 if( (--p->nRef)==0 ){
48060 2621 5486 if( p->flags&PGHDR_CLEAN ){
48086 0 0 if( p->flags&PGHDR_DIRTY ){
48100 1442 172 if( p->flags & (PGHDR_CLEAN|PGHDR_DONT_WRITE) ){ /*OPTIMIZATION-IF-FALSE*/
48102 1442 0 if( p->flags & PGHDR_CLEAN ){
48125 1227 215 if( p->nRef==0 ){
48136 1373 869 while( (p = pCache->pDirty)!=0 ){
48147 409 238 for(p=pCache->pDirty; p; p=p->pDirtyNext){
48158 152 72 for(p=pCache->pDirty; p; p=p->pDirtyNext){
48175 0 0 if( (p->flags&PGHDR_DIRTY) && (p->flags&PGHDR_NEED_SYNC) ){
0 0 if( (p->flags&PGHDR_DIRTY) && (p->flags&PGHDR_NEED_SYNC) ){
48190 1335 291 if( pCache->pCache ){
48194 478 1335 for(p=pCache->pDirty; p; p=pNext){
48201 69 409 if( p->pgno>pgno ){
48206 313 1022 if( pgno==0 && pCache->nRefSum ){
5 308 if( pgno==0 && pCache->nRefSum ){
48209 5 0 if( ALWAYS(pPage1) ){ /* Page 1 is always available in cache, because
48244 53 28 if( pA->pgnopgno ){
48248 53 0 if( pA==0 ){
48256 27 1 if( pB==0 ){
48280 152 72 while( pIn ){
48284 224 0 for(i=0; ALWAYS(i
48285 152 72 if( a[i]==0 ){
48293 0 152 if( NEVER(i==N_SORT_BUCKET-1) ){
48301 2232 72 for(i=1; i
48302 2160 72 if( a[i]==0 ) continue;
48303 8 64 p = p ? pcacheMergeDirtyList(p, a[i]) : a[i];
48313 152 72 for(p=pCache->pDirty; p; p=p->pDirtyNext){
48371 0 0 if( mxPage ){
48372 0 0 if( mxPage<0 ){
48378 0 0 if( resszSpill ) res = p->szSpill;
48404 0 0 for(pDirty=pCache->pDirty; pDirty; pDirty=pDirty->pDirtyNext) nDirty++;
48405 0 0 return nCache ? (int)(((i64)nDirty * 100) / nCache) : 0;
48685 95 0 if( pcache1.isInit ){
48687 95 0 if( pBuf==0 ) sz = n = 0;
48688 95 0 if( n==0 ) sz = 0;
48692 95 0 pcache1.nReserve = n>90 ? 10 : (n/10 + 1);
48696 0 95 while( n-- ){
48713 0 226 if( pcache1.nInitPage==0 ) return 0;
48715 142 84 if( pCache->nMax<3 ) return 0;
48717 84 0 if( pcache1.nInitPage>0 ){
48722 0 84 if( szBulk > pCache->szAlloc*(i64)pCache->nMax ){
48727 84 0 if( zBulk ){
48738 1596 84 }while( --nBulk );
48755 0 836 if( nByte<=pcache1.szSlot ){
48758 0 0 if( p ){
48768 836 0 if( p==0 ){
48774 836 0 if( p ){
48791 297 832 if( p==0 ) return;
48792 832 0 if( SQLITE_WITHIN(p, pcache1.pStart, pcache1.pEnd) ){
0 832 if( SQLITE_WITHIN(p, pcache1.pStart, pcache1.pEnd) ){
48845 464 109 if( pCache->pFree || (pCache->nPage==0 && pcache1InitBulk(pCache)) ){
226 238 if( pCache->pFree || (pCache->nPage==0 && pcache1InitBulk(pCache)) ){
84 142 if( pCache->pFree || (pCache->nPage==0 && pcache1InitBulk(pCache)) ){
48858 0 380 if( benignMalloc ){ sqlite3BeginBenignMalloc(); }
48871 0 380 if( benignMalloc ){ sqlite3EndBenignMalloc(); }
48875 0 380 if( pPg==0 ) return 0;
48893 189 380 if( p->isBulkLocal ){
48939 0 80 if( pcache1.nSlot && (pCache->szPage+pCache->szExtra)<=pcache1.szSlot ){
0 0 if( pcache1.nSlot && (pCache->szPage+pCache->szExtra)<=pcache1.szSlot ){
48963 291 0 if( nNew<256 ){
48968 0 291 if( p->nHash ){ sqlite3BeginBenignMalloc(); }
48970 0 291 if( p->nHash ){ sqlite3EndBenignMalloc(); }
48972 291 0 if( apNew ){
48973 0 291 for(i=0; inHash; i++){
48976 0 0 while( (pPage = pNext)!=0 ){
49027 0 0 for(pp=&pCache->apHash[h]; (*pp)!=pPage; pp=&(*pp)->pNext);
49031 0 0 if( freeFlag ) pcache1FreePage(pPage);
49042 0 608 while( pGroup->nPurgeable>pGroup->nMaxPage
49043 0 0 && (p=pGroup->lru.pLruPrev)->isAnchor==0
49050 565 43 if( pCache->nPage==0 && pCache->pBulk ){
82 483 if( pCache->nPage==0 && pCache->pBulk ){
49072 240 0 if( pCache->iMaxKey - iLimit < pCache->nHash ){
49091 569 572 while( (pPage = *pp)!=0 ){
49092 569 0 if( pPage->iKey>=iLimit ){
49095 189 380 if( PAGE_IS_UNPINNED(pPage) ) pcache1PinPage(pPage);
49102 240 332 if( h==iStop ) break;
49149 95 0 if( pcache1.separateCache
49150 95 0 && sqlite3GlobalConfig.nPage!=0
49151 95 0 && sqlite3GlobalConfig.pPage==0
49191 291 0 if( pCache ){
49192 291 0 if( pcache1.separateCache ){
49198 291 0 if( pGroup->lru.isAnchor==0 ){
49209 138 153 if( bPurgeable ){
49219 0 291 if( pCache->nHash==0 ){
49234 319 448 if( pCache->bPurgeable ){
49253 0 0 if( pCache->bPurgeable ){
49300 72 501 if( createFlag==1 && (
72 0 if( createFlag==1 && (
49302 72 0 || nPinned>=pCache->n90pct
49303 0 72 || (pcache1UnderMemoryPressure(pCache) && pCache->nRecyclable
0 0 || (pcache1UnderMemoryPressure(pCache) && pCache->nRecyclable
49308 0 573 if( pCache->nPage>=pCache->nHash ) pcache1ResizeHash(pCache);
49312 193 380 if( pCache->bPurgeable
49313 8 185 && !pGroup->lru.pLruPrev->isAnchor
49314 8 0 && ((pCache->nPage+1>=pCache->nMax) || pcache1UnderMemoryPressure(pCache))
0 8 && ((pCache->nPage+1>=pCache->nMax) || pcache1UnderMemoryPressure(pCache))
49322 0 0 if( pOther->szAlloc != pCache->szAlloc ){
49333 573 0 if( !pPage ){
49337 573 0 if( pPage ){
49347 573 0 if( iKey>pCache->iMaxKey ){
49423 8513 573 while( pPage && pPage->iKey!=iKey ){ pPage = pPage->pNext; }
0 8513 while( pPage && pPage->iKey!=iKey ){ pPage = pPage->pNext; }
49429 8513 573 if( pPage ){
49430 309 8204 if( PAGE_IS_UNPINNED(pPage) ){
49435 573 0 }else if( createFlag ){
49507 502 0 if( reuseUnlikely || pGroup->nPurgeable>pGroup->nMaxPage ){
0 502 if( reuseUnlikely || pGroup->nPurgeable>pGroup->nMaxPage ){
49541 0 0 while( (*pp)!=pPage ){
49550 0 0 if( iNew>pCache->iMaxKey ){
49567 240 1095 if( iLimit<=pCache->iMaxKey ){
49584 0 289 if( pCache->nPage ) pcache1TruncateUnsafe(pCache, 0);
49826 9 0 if( p ){
49849 0 11 for(pChunk=p->pChunk; pChunk; pChunk = pNextChunk){
49881 0 12 if( p->nFresh==0 ){ /*OPTIMIZATION-IF-FALSE*/
49886 0 0 if( pNew==0 ){
49912 0 12 if( pEntry==0 ) return;
49916 6 6 if( pLast ){
49917 0 6 if( rowid<=pLast->v ){ /*OPTIMIZATION-IF-FALSE*/
49947 0 0 if( pA->v<=pB->v ){
49948 0 0 if( pA->vv ) pTail = pTail->pRight = pA;
49950 0 0 if( pA==0 ){
49957 0 0 if( pB==0 ){
49975 0 0 while( pIn ){
49978 0 0 for(i=0; aBucket[i]; i++){
49986 0 0 for(i=1; i
49987 0 0 if( aBucket[i]==0 ) continue;
49988 0 0 pIn = pIn ? rowSetEntryMerge(pIn, aBucket[i]) : aBucket[i];
50005 0 0 if( pIn->pLeft ){
50012 0 0 if( pIn->pRight ){
50040 0 0 if( *ppList==0 ){ /*OPTIMIZATION-IF-TRUE*/
50044 0 0 if( iDepth>1 ){ /*OPTIMIZATION-IF-TRUE*/
50050 0 0 if( p==0 ){ /*OPTIMIZATION-IF-FALSE*/
50079 0 0 for(iDepth=1; pList; iDepth++){
50107 4 0 if( (p->rsFlags & ROWSET_NEXT)==0 ){ /*OPTIMIZATION-IF-FALSE*/
50108 0 4 if( (p->rsFlags & ROWSET_SORTED)==0 ){ /*OPTIMIZATION-IF-FALSE*/
50115 2 2 if( p->pEntry ){
50118 2 0 if( p->pEntry==0 ){ /*OPTIMIZATION-IF-TRUE*/
50145 6 6 if( iBatch!=pRowSet->iBatch ){ /*OPTIMIZATION-IF-FALSE*/
50147 0 6 if( p ){
50149 0 0 if( (pRowSet->rsFlags & ROWSET_SORTED)==0 ){ /*OPTIMIZATION-IF-FALSE*/
50153 0 0 for(pTree = pRowSet->pForest; pTree; pTree=pTree->pRight){
50155 0 0 if( pTree->pLeft==0 ){
50165 0 0 if( pTree==0 ){
50167 0 0 if( pTree ){
50183 0 12 for(pTree = pRowSet->pForest; pTree; pTree=pTree->pRight){
50185 0 0 while( p ){
50186 0 0 if( p->v
50188 0 0 }else if( p->v>iRowid ){
51423 5 600 if( pPager->errCode ){
51426 0 600 }else if( USEFETCH(pPager)
51452 3 2 for(i=0; inSavepoint; i++){
51454 3 0 if( p->nOrig>=pgno && 0==sqlite3BitvecTestNotNull(p->pInSavepoint, pgno) ){
1 2 if( p->nOrig>=pgno && 0==sqlite3BitvecTestNotNull(p->pInSavepoint, pgno) ){
51480 274 0 if( rc==SQLITE_OK ){
51517 481 229 if( isOpen(pPager->fd) ){
51519 481 0 rc = pPager->noLock ? SQLITE_OK : sqlite3OsUnlock(pPager->fd, eLock);
51520 481 0 if( pPager->eLock!=UNKNOWN_LOCK ){
51542 1871 639 if( pPager->eLockeLock==UNKNOWN_LOCK ){
0 1871 if( pPager->eLockeLock==UNKNOWN_LOCK ){
51543 639 0 rc = pPager->noLock ? SQLITE_OK : sqlite3OsLock(pPager->fd, eLock);
51544 460 179 if( rc==SQLITE_OK && (pPager->eLock!=UNKNOWN_LOCK||eLock==EXCLUSIVE_LOCK) ){
0 460 if( rc==SQLITE_OK && (pPager->eLock!=UNKNOWN_LOCK||eLock==EXCLUSIVE_LOCK) ){
0 0 if( rc==SQLITE_OK && (pPager->eLock!=UNKNOWN_LOCK||eLock==EXCLUSIVE_LOCK) ){
51685 62 0 if( SQLITE_OK!=(rc = sqlite3OsFileSize(pJrnl, &szJ))
51686 62 0 || szJ<16
51687 62 0 || SQLITE_OK!=(rc = read32bits(pJrnl, szJ-16, &len))
51688 36 26 || len>=nMaster
51689 36 0 || len>szJ-16
51690 0 36 || len==0
51691 0 0 || SQLITE_OK!=(rc = read32bits(pJrnl, szJ-12, &cksum))
51692 0 0 || SQLITE_OK!=(rc = sqlite3OsRead(pJrnl, aMagic, 8, szJ-8))
51693 0 0 || memcmp(aMagic, aJournalMagic, 8)
51694 0 0 || SQLITE_OK!=(rc = sqlite3OsRead(pJrnl, zMaster, len, szJ-16-len))
51700 0 0 for(u=0; u
51703 0 0 if( cksum ){
51734 103 990 if( c ){
51768 0 0 if( pPager->journalOff ){
51772 0 0 if( doTruncate || iLimit==0 ){
0 0 if( doTruncate || iLimit==0 ){
51778 0 0 if( rc==SQLITE_OK && !pPager->noSync ){
0 0 if( rc==SQLITE_OK && !pPager->noSync ){
51788 0 0 if( rc==SQLITE_OK && iLimit>0 ){
0 0 if( rc==SQLITE_OK && iLimit>0 ){
51791 0 0 if( rc==SQLITE_OK && sz>iLimit ){
0 0 if( rc==SQLITE_OK && sz>iLimit ){
51823 959 0 if( nHeader>JOURNAL_HDR_SZ(pPager) ){
51831 0 959 for(ii=0; iinSavepoint; ii++){
51832 0 0 if( pPager->aSavepoint[ii].iHdrOffset==0 ){
51860 74 885 if( pPager->noSync || (pPager->journalMode==PAGER_JOURNALMODE_MEMORY)
74 0 if( pPager->noSync || (pPager->journalMode==PAGER_JOURNALMODE_MEMORY)
51861 0 74 || (sqlite3OsDeviceCharacteristics(pPager->fd)&SQLITE_IOCAP_SAFE_APPEND)
51905 1918 0 for(nWrite=0; rc==SQLITE_OK&&nWrite
959 959 for(nWrite=0; rc==SQLITE_OK&&nWrite
51950 31 31 if( pPager->journalOff+JOURNAL_HDR_SZ(pPager) > journalSize ){
51960 31 0 if( isHot || iHdrOff!=pPager->journalHdr ){
0 31 if( isHot || iHdrOff!=pPager->journalHdr ){
51962 0 0 if( rc ){
51965 0 0 if( memcmp(aMagic, aJournalMagic, sizeof(aMagic))!=0 ){
51974 31 0 if( SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+8, pNRec))
51975 31 0 || SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+12, &pPager->cksumInit))
51976 0 31 || SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+16, pDbSize))
51981 31 0 if( pPager->journalOff==0 ){
51986 31 0 if( SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+20, &iSectorSize))
51987 0 31 || SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+24, &iPageSize))
51996 0 31 if( iPageSize==0 ){
52005 31 0 if( iPageSize<512 || iSectorSize<32
31 0 if( iPageSize<512 || iSectorSize<32
52006 31 0 || iPageSize>SQLITE_MAX_PAGE_SIZE || iSectorSize>MAX_SECTOR_SIZE
31 0 || iPageSize>SQLITE_MAX_PAGE_SIZE || iSectorSize>MAX_SECTOR_SIZE
52007 31 0 || ((iPageSize-1)&iPageSize)!=0 || ((iSectorSize-1)&iSectorSize)!=0
0 31 || ((iPageSize-1)&iPageSize)!=0 || ((iSectorSize-1)&iSectorSize)!=0
52067 0 72 if( !zMaster
52068 0 0 || pPager->journalMode==PAGER_JOURNALMODE_MEMORY
52069 0 0 || !isOpen(pPager->jfd)
52077 0 0 for(nMaster=0; zMaster[nMaster]; nMaster++){
52085 0 0 if( pPager->fullSync ){
52093 0 0 if( (0 != (rc = write32bits(pPager->jfd, iHdrOff, PAGER_MJ_PGNO(pPager))))
52094 0 0 || (0 != (rc = sqlite3OsWrite(pPager->jfd, zMaster, nMaster, iHdrOff+4)))
52095 0 0 || (0 != (rc = write32bits(pPager->jfd, iHdrOff+4+nMaster, nMaster)))
52096 0 0 || (0 != (rc = write32bits(pPager->jfd, iHdrOff+4+nMaster+4, cksum)))
52097 0 0 || (0 != (rc = sqlite3OsWrite(pPager->jfd, aJournalMagic, 8,
52114 0 0 if( SQLITE_OK==(rc = sqlite3OsFileSize(pPager->jfd, &jrnlSize))
52115 0 0 && jrnlSize>pPager->journalOff
52145 1 3357 for(ii=0; iinSavepoint; ii++){
52148 2647 710 if( !pPager->exclusiveMode || sqlite3JournalIsInMemory(pPager->sjfd) ){
1 2646 if( !pPager->exclusiveMode || sqlite3JournalIsInMemory(pPager->sjfd) ){
52166 1 1456 for(ii=0; iinSavepoint; ii++){
52168 1 0 if( pgno<=p->nOrig ){
52205 0 2322 if( pagerUseWal(pPager) ){
52209 591 1731 }else if( !pPager->exclusiveMode ){
52211 400 191 int iDc = isOpen(pPager->fd)?sqlite3OsDeviceCharacteristics(pPager->fd):0;
52224 0 591 if( 0==(iDc & SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN)
52225 0 0 || 1!=(pPager->journalMode & 5)
52236 0 591 if( rc!=SQLITE_OK && pPager->eState==PAGER_ERROR ){
0 0 if( rc!=SQLITE_OK && pPager->eState==PAGER_ERROR ){
52255 5 2317 if( pPager->errCode ){
52256 0 5 if( pPager->tempFile==0 ){
52263 0 5 if( USEFETCH(pPager) ) sqlite3OsUnfetch(pPager->fd, 0, 0);
52300 992 0 if( rc2==SQLITE_FULL || rc2==SQLITE_IOERR ){
0 992 if( rc2==SQLITE_FULL || rc2==SQLITE_IOERR ){
52327 153 1094 if( pPager->tempFile==0 ) return 1;
52328 47 1047 if( !bCommit ) return 0;
52329 1047 0 if( !isOpen(pPager->fd) ) return 0;
52405 338 997 if( pPager->eStateeLock
300 38 if( pPager->eStateeLock
52413 959 76 if( isOpen(pPager->jfd) ){
52417 885 74 if( sqlite3JournalIsInMemory(pPager->jfd) ){
52420 0 74 }else if( pPager->journalMode==PAGER_JOURNALMODE_TRUNCATE ){
52421 0 0 if( pPager->journalOff==0 ){
52425 0 0 if( rc==SQLITE_OK && pPager->fullSync ){
0 0 if( rc==SQLITE_OK && pPager->fullSync ){
52435 74 0 }else if( pPager->journalMode==PAGER_JOURNALMODE_PERSIST
52436 0 74 || (pPager->exclusiveMode && pPager->journalMode!=PAGER_JOURNALMODE_WAL)
0 0 || (pPager->exclusiveMode && pPager->journalMode!=PAGER_JOURNALMODE_WAL)
52438 0 0 rc = zeroJournalHdr(pPager, hasMaster||pPager->tempFile);
0 0 rc = zeroJournalHdr(pPager, hasMaster||pPager->tempFile);
52453 74 0 if( bDelete ){
52473 1035 0 if( rc==SQLITE_OK ){
52474 319 716 if( MEMDB || pagerFlushOnCommit(pPager, bCommit) ){
81 238 if( MEMDB || pagerFlushOnCommit(pPager, bCommit) ){
52482 0 1035 if( pagerUseWal(pPager) ){
52489 1035 0 }else if( rc==SQLITE_OK && bCommit && pPager->dbFileSize>pPager->dbSize ){
948 87 }else if( rc==SQLITE_OK && bCommit && pPager->dbFileSize>pPager->dbSize ){
0 948 }else if( rc==SQLITE_OK && bCommit && pPager->dbFileSize>pPager->dbSize ){
52500 1035 0 if( rc==SQLITE_OK && bCommit ){
948 87 if( rc==SQLITE_OK && bCommit ){
52502 948 0 if( rc==SQLITE_NOTFOUND ) rc = SQLITE_OK;
52505 119 916 if( !pPager->exclusiveMode
52506 0 119 && (!pagerUseWal(pPager) || sqlite3WalExclusiveMode(pPager->pWal, 0))
0 0 && (!pagerUseWal(pPager) || sqlite3WalExclusiveMode(pPager->pWal, 0))
52514 1035 0 return (rc==SQLITE_OK?rc2:rc);
52535 2162 5 if( pPager->eState!=PAGER_ERROR && pPager->eState!=PAGER_OPEN ){
2064 98 if( pPager->eState!=PAGER_ERROR && pPager->eState!=PAGER_OPEN ){
52537 0 2064 if( pPager->eState>=PAGER_WRITER_LOCKED ){
52541 338 1726 }else if( !pPager->exclusiveMode ){
52571 23640 1182 while( i>0 ){
52687 28 1 jfd = isMainJrnl ? pPager->jfd : pPager->sjfd;
52689 0 29 if( rc!=SQLITE_OK ) return rc;
52691 0 29 if( rc!=SQLITE_OK ) return rc;
52699 29 0 if( pgno==0 || pgno==PAGER_MJ_PGNO(pPager) ){
0 29 if( pgno==0 || pgno==PAGER_MJ_PGNO(pPager) ){
52703 29 0 if( pgno>(Pgno)pPager->dbSize || sqlite3BitvecTest(pDone, pgno) ){
0 29 if( pgno>(Pgno)pPager->dbSize || sqlite3BitvecTest(pDone, pgno) ){
52706 28 1 if( isMainJrnl ){
52708 0 28 if( rc ) return rc;
52709 28 0 if( !isSavepnt && pager_cksum(pPager, (u8*)aData)!=cksum ){
0 28 if( !isSavepnt && pager_cksum(pPager, (u8*)aData)!=cksum ){
52717 1 28 if( pDone && (rc = sqlite3BitvecSet(pDone, pgno))!=SQLITE_OK ){
0 1 if( pDone && (rc = sqlite3BitvecSet(pDone, pgno))!=SQLITE_OK ){
52723 1 28 if( pgno==1 && pPager->nReserve!=((u8*)aData)[20] ){
0 1 if( pgno==1 && pPager->nReserve!=((u8*)aData)[20] ){
52763 0 29 if( pagerUseWal(pPager) ){
52774 28 1 if( isMainJrnl ){
52775 2 26 isSynced = pPager->noSync || (*pOffset <= pPager->journalHdr);
0 2 isSynced = pPager->noSync || (*pOffset <= pPager->journalHdr);
52777 1 0 isSynced = (pPg==0 || 0==(pPg->flags & PGHDR_NEED_SYNC));
0 1 isSynced = (pPg==0 || 0==(pPg->flags & PGHDR_NEED_SYNC));
52779 2 27 if( isOpen(pPager->fd)
52780 2 0 && (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN)
0 2 && (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN)
52781 0 0 && isSynced
52802 0 0 if( pgno>pPager->dbFileSize ){
52805 0 0 if( pPager->pBackup ){
52815 1 28 }else if( !isMainJrnl && pPg==0 ){
0 1 }else if( !isMainJrnl && pPg==0 ){
52838 0 0 if( rc!=SQLITE_OK ) return rc;
52841 29 0 if( pPg ){
52860 1 28 if( pgno==1 ){
52932 0 0 if( !pMaster ){
52938 0 0 if( rc!=SQLITE_OK ) goto delmaster_out;
52946 0 0 if( rc!=SQLITE_OK ) goto delmaster_out;
52949 0 0 if( !zMasterJournal ){
52955 0 0 if( rc!=SQLITE_OK ) goto delmaster_out;
52959 0 0 while( (zJournal-zMasterJournal)
52962 0 0 if( rc!=SQLITE_OK ){
52965 0 0 if( exists ){
52973 0 0 if( rc!=SQLITE_OK ){
52979 0 0 if( rc!=SQLITE_OK ){
52983 0 0 c = zMasterPtr[0]!=0 && strcmp(zMasterPtr, zMaster)==0;
0 0 c = zMasterPtr[0]!=0 && strcmp(zMasterPtr, zMaster)==0;
52984 0 0 if( c ){
52997 0 0 if( pMaster ){
53031 2 29 if( isOpen(pPager->fd)
53032 2 0 && (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN)
0 2 && (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN)
53040 0 0 if( rc==SQLITE_OK && currentSize!=newSize ){
0 0 if( rc==SQLITE_OK && currentSize!=newSize ){
53041 0 0 if( currentSize>newSize ){
53043 0 0 }else if( (currentSize+szPage)<=newSize ){
53050 0 0 if( rc==SQLITE_OK ){
53064 0 0 if( iRet<32 ){
53066 0 0 }else if( iRet>MAX_SECTOR_SIZE ){
53099 199 220 if( pPager->tempFile
53100 199 0 || (sqlite3OsDeviceCharacteristics(pPager->fd) &
53187 0 31 if( rc!=SQLITE_OK ){
53204 31 0 if( rc==SQLITE_OK && zMaster[0] ){
0 31 if( rc==SQLITE_OK && zMaster[0] ){
53208 31 0 if( rc!=SQLITE_OK || !res ){
31 0 if( rc!=SQLITE_OK || !res ){
53225 31 31 if( rc!=SQLITE_OK ){
53226 31 0 if( rc==SQLITE_DONE ){
53237 29 2 if( nRec==0xffffffff ){
53256 7 24 if( nRec==0 && !isHot &&
7 0 if( nRec==0 && !isHot &&
7 0 if( nRec==0 && !isHot &&
53264 31 0 if( pPager->journalOff==JOURNAL_HDR_SZ(pPager) ){
53266 0 31 if( rc!=SQLITE_OK ){
53275 28 31 for(u=0; u
53276 0 28 if( needPagerReset ){
53281 28 0 if( rc==SQLITE_OK ){
53284 0 0 if( rc==SQLITE_DONE ){
53287 0 0 }else if( rc==SQLITE_IOERR_SHORT_READ ){
53310 31 0 if( rc==SQLITE_OK ){
53333 31 0 if( rc==SQLITE_OK ){
53338 31 0 if( rc==SQLITE_OK
53339 31 0 && (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN)
0 31 && (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN)
53343 31 0 if( rc==SQLITE_OK ){
53347 31 0 if( rc==SQLITE_OK && zMaster[0] && res ){
0 31 if( rc==SQLITE_OK && zMaster[0] && res ){
0 0 if( rc==SQLITE_OK && zMaster[0] && res ){
53354 0 31 if( isHot && nPlayback ){
0 0 if( isHot && nPlayback ){
53390 0 75 if( pagerUseWal(pPager) ){
53392 0 0 if( rc ) return rc;
53394 0 75 if( iFrame ){
53401 0 75 if( rc==SQLITE_IOERR_SHORT_READ ){
53406 43 32 if( pPg->pgno==1 ){
53407 0 43 if( rc ){
53479 0 0 if( pPg ){
53480 0 0 if( sqlite3PcachePageRefcount(pPg)==1 ){
53484 0 0 if( rc==SQLITE_OK ){
53521 0 0 while( pList && rc==SQLITE_OK ){
0 0 while( pList && rc==SQLITE_OK ){
53559 0 0 if( isCommit ){
53566 0 0 for(p=pList; (*ppNext = p)!=0; p=p->pDirty){
53567 0 0 if( p->pgno<=nTruncate ){
53578 0 0 if( pList->pgno==1 ) pager_write_changecounter(pList);
53582 0 0 if( rc==SQLITE_OK && pPager->pBackup ){
0 0 if( rc==SQLITE_OK && pPager->pBackup ){
53583 0 0 for(p=pList; p; p=p->pDirty){
53621 0 0 if( rc!=SQLITE_OK || changed ){
0 0 if( rc!=SQLITE_OK || changed ){
53623 0 0 if( USEFETCH(pPager) ) sqlite3OsUnfetch(pPager->fd, 0, 0);
53659 300 0 if( nPage==0 && ALWAYS(isOpen(pPager->fd)) ){
300 0 if( nPage==0 && ALWAYS(isOpen(pPager->fd)) ){
53662 0 300 if( rc!=SQLITE_OK ){
53672 0 300 if( nPage>pPager->mxPgno ){
53704 300 0 if( !pPager->tempFile ){
53709 300 0 if( rc==SQLITE_OK ){
53710 0 300 if( isWal ){
53714 0 0 if( rc ) return rc;
53715 0 0 if( nPage==0 ){
53721 0 300 }else if( pPager->journalMode==PAGER_JOURNALMODE_WAL ){
53776 1 0 if( pSavepoint ){
53778 0 1 if( !pDone ){
53786 1 0 pPager->dbSize = pSavepoint ? pSavepoint->nOrig : pPager->dbOrigSize;
53789 0 1 if( !pSavepoint && pagerUseWal(pPager) ){
0 0 if( !pSavepoint && pagerUseWal(pPager) ){
53808 1 0 if( pSavepoint && !pagerUseWal(pPager) ){
1 0 if( pSavepoint && !pagerUseWal(pPager) ){
53809 0 1 iHdrOff = pSavepoint->iHdrOffset ? pSavepoint->iHdrOffset : szJ;
53811 1 0 while( rc==SQLITE_OK && pPager->journalOff
0 1 while( rc==SQLITE_OK && pPager->journalOff
53824 1 0 while( rc==SQLITE_OK && pPager->journalOff
0 1 while( rc==SQLITE_OK && pPager->journalOff
53836 0 0 if( nJRec==0
53837 0 0 && pPager->journalHdr+JOURNAL_HDR_SZ(pPager)==pPager->journalOff
53841 0 0 for(ii=0; rc==SQLITE_OK && iijournalOff
0 0 for(ii=0; rc==SQLITE_OK && iijournalOff
0 0 for(ii=0; rc==SQLITE_OK && iijournalOff
53852 1 0 if( pSavepoint ){
53856 0 1 if( pagerUseWal(pPager) ){
53859 2 0 for(ii=pSavepoint->iSubRec; rc==SQLITE_OK && iinSubRec; ii++){
1 1 for(ii=pSavepoint->iSubRec; rc==SQLITE_OK && iinSubRec; ii++){
53867 1 0 if( rc==SQLITE_OK ){
53896 304 663 if( isOpen(fd) && fd->pMethods->iVersion>=3 ){
304 0 if( isOpen(fd) && fd->pMethods->iVersion>=3 ){
53978 13 0 if( pPager->tempFile ){
53987 13 0 if( pPager->noSync ){
53989 0 0 }else if( pgFlags & PAGER_FULLFSYNC ){
53995 0 13 if( pPager->fullSync ){
53998 0 13 if( (pgFlags & PAGER_CKPT_FULLFSYNC) && !pPager->noSync ){
0 0 if( (pgFlags & PAGER_CKPT_FULLFSYNC) && !pPager->noSync ){
54001 13 0 if( pgFlags & PAGER_CACHESPILL ){
54131 205 471 if( (pPager->memDb==0 || pPager->dbSize==0)
160 45 if( (pPager->memDb==0 || pPager->dbSize==0)
54132 614 17 && sqlite3PcacheRefCount(pPager->pPCache)==0
54133 348 266 && pageSize && pageSize!=(u32)pPager->pageSize
291 57 && pageSize && pageSize!=(u32)pPager->pageSize
54138 191 100 if( pPager->eState>PAGER_OPEN && isOpen(pPager->fd) ){
0 191 if( pPager->eState>PAGER_OPEN && isOpen(pPager->fd) ){
54141 291 0 if( rc==SQLITE_OK ){
54143 0 291 if( !pNew ) rc = SQLITE_NOMEM_BKPT;
54146 291 0 if( rc==SQLITE_OK ){
54150 291 0 if( rc==SQLITE_OK ){
54161 676 0 if( rc==SQLITE_OK ){
54162 353 323 if( nReserve<0 ) nReserve = pPager->nReserve;
54191 0 0 if( mxPage>0 ){
54248 100 191 if( isOpen(pPager->fd) ){
54251 75 25 if( rc==SQLITE_IOERR_SHORT_READ ){
54301 27 1334 }while( rc==SQLITE_BUSY && pPager->xBusyHandler(pPager->pBusyHandlerArg) );
25 2 }while( rc==SQLITE_BUSY && pPager->xBusyHandler(pPager->pBusyHandlerArg) );
54383 0 0 if( !pPager->noSync ){
54386 0 0 if( rc==SQLITE_OK ){
54411 0 0 if( pPager->pMmapFreelist ){
54419 0 0 if( p==0 ){
54463 0 289 for(p=pPager->pMmapFreelist; p; p=pNext){
54478 386 172 if( pPager->tempFile ) return SQLITE_OK;
54479 68 104 if( pPager->dbSize==0 ) return SQLITE_OK;
54482 0 104 if( rc==SQLITE_NOTFOUND ){
54487 104 0 }else if( rc==SQLITE_OK && bHasMoved ){
0 104 }else if( rc==SQLITE_OK && bHasMoved ){
54521 289 0 if( db && 0==(db->flags & SQLITE_NoCkptOnClose)
289 0 if( db && 0==(db->flags & SQLITE_NoCkptOnClose)
54522 289 0 && SQLITE_OK==databaseIsUnmoved(pPager)
54531 153 136 if( MEMDB ){
54545 0 136 if( isOpen(pPager->jfd) ){
54631 0 72 if( rc!=SQLITE_OK ) return rc;
54633 72 0 if( !pPager->noSync ){
54635 72 0 if( isOpen(pPager->jfd) && pPager->journalMode!=PAGER_JOURNALMODE_MEMORY ){
72 0 if( isOpen(pPager->jfd) && pPager->journalMode!=PAGER_JOURNALMODE_MEMORY ){
54639 72 0 if( 0==(iDc&SQLITE_IOCAP_SAFE_APPEND) ){
54671 0 72 if( rc==SQLITE_OK && 0==memcmp(aMagic, aJournalMagic, 8) ){
0 0 if( rc==SQLITE_OK && 0==memcmp(aMagic, aJournalMagic, 8) ){
54675 72 0 if( rc!=SQLITE_OK && rc!=SQLITE_IOERR_SHORT_READ ){
0 72 if( rc!=SQLITE_OK && rc!=SQLITE_IOERR_SHORT_READ ){
54690 72 0 if( pPager->fullSync && 0==(iDc&SQLITE_IOCAP_SEQUENTIAL) ){
72 0 if( pPager->fullSync && 0==(iDc&SQLITE_IOCAP_SEQUENTIAL) ){
54694 0 72 if( rc!=SQLITE_OK ) return rc;
54700 0 72 if( rc!=SQLITE_OK ) return rc;
54702 72 0 if( 0==(iDc&SQLITE_IOCAP_SEQUENTIAL) ){
54706 0 72 (pPager->syncFlags==SQLITE_SYNC_FULL?SQLITE_SYNC_DATAONLY:0)
54708 0 72 if( rc!=SQLITE_OK ) return rc;
54712 0 72 if( newHdr && 0==(iDc&SQLITE_IOCAP_SAFE_APPEND) ){
0 0 if( newHdr && 0==(iDc&SQLITE_IOCAP_SAFE_APPEND) ){
54715 0 0 if( rc!=SQLITE_OK ) return rc;
54777 0 72 if( !isOpen(pPager->fd) ){
54786 72 0 if( rc==SQLITE_OK
54787 24 48 && pPager->dbHintSizedbSize
54788 0 24 && (pList->pDirty || pList->pgno>pPager->dbHintSize)
0 0 && (pList->pDirty || pList->pgno>pPager->dbHintSize)
54795 224 0 while( rc==SQLITE_OK && pList ){
152 72 while( rc==SQLITE_OK && pList ){
54806 152 0 if( pgno<=pPager->dbSize && 0==(pList->flags&PGHDR_DONT_WRITE) ){
151 1 if( pgno<=pPager->dbSize && 0==(pList->flags&PGHDR_DONT_WRITE) ){
54811 72 79 if( pList->pgno==1 ) pager_write_changecounter(pList);
54823 72 79 if( pgno==1 ){
54826 44 107 if( pgno>pPager->dbFileSize ){
54858 1 0 if( !isOpen(pPager->sjfd) ){
54863 0 1 if( pPager->journalMode==PAGER_JOURNALMODE_MEMORY || pPager->subjInMemory ){
0 0 if( pPager->journalMode==PAGER_JOURNALMODE_MEMORY || pPager->subjInMemory ){
54885 1 0 if( pPager->journalMode!=PAGER_JOURNALMODE_OFF ){
54899 1 0 if( rc==SQLITE_OK ){
54912 1 0 if( rc==SQLITE_OK ){
54917 1 0 if( rc==SQLITE_OK ){
54925 1 2 if( subjRequiresPage(pPg) ){
54974 0 0 if( NEVER(pPager->errCode) ) return SQLITE_OK;
54978 0 0 if( pPager->doNotSpill
54979 0 0 && ((pPager->doNotSpill & (SPILLFLAG_ROLLBACK|SPILLFLAG_OFF))!=0
54980 0 0 || (pPg->flags & PGHDR_NEED_SYNC)!=0)
54987 0 0 if( pagerUseWal(pPager) ){
54990 0 0 if( rc==SQLITE_OK ){
55003 0 0 if( pPg->flags&PGHDR_NEED_SYNC
55004 0 0 || pPager->eState==PAGER_WRITER_CACHEMOD
55010 0 0 if( rc==SQLITE_OK ){
55017 0 0 if( rc==SQLITE_OK ){
55030 0 0 if( !MEMDB ){
55033 0 0 while( rc==SQLITE_OK && pList ){
0 0 while( rc==SQLITE_OK && pList ){
55035 0 0 if( pList->nRef==0 ){
55114 153 144 if( flags & PAGER_MEMORY ){
55116 153 0 if( zFilename && zFilename[0] ){
153 0 if( zFilename && zFilename[0] ){
55118 0 153 if( zPathname==0 ) return SQLITE_NOMEM_BKPT;
55129 109 188 if( zFilename && zFilename[0] ){
106 3 if( zFilename && zFilename[0] ){
55133 0 106 if( zPathname==0 ){
55140 10 106 while( *z ){
55146 106 0 if( rc==SQLITE_OK && nPathname+8>pVfs->mxPathname ){
0 106 if( rc==SQLITE_OK && nPathname+8>pVfs->mxPathname ){
55155 0 106 if( rc!=SQLITE_OK ){
55185 0 297 if( !pPtr ){
55198 259 38 if( zPathname ){
55202 106 153 if( nUri ) memcpy(&pPager->zFilename[nPathname+1], zUri, nUri);
55219 109 188 if( zFilename && zFilename[0] ){
106 3 if( zFilename && zFilename[0] ){
55236 100 6 if( rc==SQLITE_OK ){
55238 97 3 if( !readOnly ){
55241 0 97 if( szPageDfltsectorSize ){
55242 0 0 if( pPager->sectorSize>SQLITE_MAX_DEFAULT_PAGE_SIZE ){
55263 100 0 if( (iDc & SQLITE_IOCAP_IMMUTABLE)!=0
55264 0 100 || sqlite3_uri_boolean(zFilename, "immutable", 0) ){
55291 291 6 if( rc==SQLITE_OK ){
55298 291 6 if( rc==SQLITE_OK ){
55301 138 153 rc = sqlite3PcacheOpen(szPageDflt, nExtra, !memDb,
55307 6 291 if( rc!=SQLITE_OK ){
55337 100 191 if( pPager->noSync ){
55355 5 286 if( !useJournal ){
55357 153 133 }else if( memDb || memJM ){
55419 300 0 if( !jrnlOpen ){
55422 300 0 if( rc==SQLITE_OK && exists ){
152 148 if( rc==SQLITE_OK && exists ){
55434 152 0 if( rc==SQLITE_OK && !locked ){
0 152 if( rc==SQLITE_OK && !locked ){
55439 0 0 if( rc==SQLITE_OK ){
55448 0 0 if( nPage==0 && !jrnlOpen ){
0 0 if( nPage==0 && !jrnlOpen ){
55450 0 0 if( pagerLockDb(pPager, RESERVED_LOCK)==SQLITE_OK ){
55452 0 0 if( !pPager->exclusiveMode ) pagerUnlockDb(pPager, SHARED_LOCK);
55462 0 0 if( !jrnlOpen ){
55466 0 0 if( rc==SQLITE_OK ){
55469 0 0 if( rc==SQLITE_IOERR_SHORT_READ ){
55472 0 0 if( !jrnlOpen ){
55476 0 0 }else if( rc==SQLITE_CANTOPEN ){
55536 2033 0 if( !pagerUseWal(pPager) && pPager->eState==PAGER_OPEN ){
302 1731 if( !pagerUseWal(pPager) && pPager->eState==PAGER_OPEN ){
55543 2 300 if( rc!=SQLITE_OK ){
55551 300 0 if( pPager->eLock<=SHARED_LOCK ){
55554 0 300 if( rc!=SQLITE_OK ){
55557 0 300 if( bHotJournal ){
55558 0 0 if( pPager->readOnly ){
55579 0 0 if( rc!=SQLITE_OK ){
55596 0 0 if( !isOpen(pPager->jfd) ){
55601 0 0 if( rc==SQLITE_OK && bExists ){
0 0 if( rc==SQLITE_OK && bExists ){
55607 0 0 if( rc==SQLITE_OK && fout&SQLITE_OPEN_READONLY ){
0 0 if( rc==SQLITE_OK && fout&SQLITE_OPEN_READONLY ){
55622 0 0 if( isOpen(pPager->jfd) ){
55625 0 0 if( rc==SQLITE_OK ){
55629 0 0 }else if( !pPager->exclusiveMode ){
55633 0 0 if( rc!=SQLITE_OK ){
55660 300 0 if( !pPager->tempFile && pPager->hasHeldSharedLock ){
251 49 if( !pPager->tempFile && pPager->hasHeldSharedLock ){
55681 10 241 if( rc!=SQLITE_OK ){
55682 0 10 if( rc!=SQLITE_IOERR_SHORT_READ ){
55688 11 240 if( memcmp(pPager->dbFileVers, dbFileVers, sizeof(dbFileVers))!=0 ){
55697 0 11 if( USEFETCH(pPager) ){
55712 0 2031 if( pagerUseWal(pPager) ){
55717 300 1731 if( pPager->tempFile==0 && pPager->eState==PAGER_OPEN && rc==SQLITE_OK ){
300 0 if( pPager->tempFile==0 && pPager->eState==PAGER_OPEN && rc==SQLITE_OK ){
300 0 if( pPager->tempFile==0 && pPager->eState==PAGER_OPEN && rc==SQLITE_OK ){
55722 2 2031 if( rc!=SQLITE_OK ){
55742 2031 44 if( sqlite3PcacheRefCount(pPager->pPCache)==0 ){
55821 0 9052 if( pgno==0 ) return SQLITE_CORRUPT_BKPT;
55823 0 9052 if( pBase==0 ){
55826 0 0 if( rc!=SQLITE_OK ) goto pager_acquire_err;
55827 0 0 if( pBase==0 ){
55838 8479 573 if( pPg->pPager && !noContent ){
8478 1 if( pPg->pPager && !noContent ){
55852 574 0 if( pgno>PAGER_MAX_PGNO || pgno==PAGER_MJ_PGNO(pPager) ){
0 574 if( pgno>PAGER_MAX_PGNO || pgno==PAGER_MJ_PGNO(pPager) ){
55860 120 454 if( !isOpen(pPager->fd) || pPager->dbSize
76 44 if( !isOpen(pPager->fd) || pPager->dbSize
1 75 if( !isOpen(pPager->fd) || pPager->dbSize
55861 0 499 if( pgno>pPager->mxPgno ){
55865 301 198 if( noContent ){
55873 1 300 if( pgno<=pPager->dbOrigSize ){
55887 0 75 if( rc!=SQLITE_OK ){
55897 0 0 if( pPg ){
55922 0 0 && (pPager->eState==PAGER_READER || (flags & PAGER_GET_READONLY))
0 0 && (pPager->eState==PAGER_READER || (flags & PAGER_GET_READONLY))
0 0 && (pPager->eState==PAGER_READER || (flags & PAGER_GET_READONLY))
55934 0 0 if( pgno<=1 && pgno==0 ){
0 0 if( pgno<=1 && pgno==0 ){
55942 0 0 if( bMmapOk && pagerUseWal(pPager) ){
0 0 if( bMmapOk && pagerUseWal(pPager) ){
55944 0 0 if( rc!=SQLITE_OK ){
55949 0 0 if( bMmapOk && iFrame==0 ){
0 0 if( bMmapOk && iFrame==0 ){
55954 0 0 if( rc==SQLITE_OK && pData ){
0 0 if( rc==SQLITE_OK && pData ){
55955 0 0 if( pPager->eState>PAGER_READER || pPager->tempFile ){
0 0 if( pPager->eState>PAGER_READER || pPager->tempFile ){
55958 0 0 if( pPg==0 ){
55963 0 0 if( pPg ){
55969 0 0 if( rc!=SQLITE_OK ){
56022 0 29 if( pPage==0 ) return 0;
56041 0 6982 if( pPg->flags & PGHDR_MMAP ){
56051 386 0 if( pPg ) sqlite3PagerUnrefNotNull(pPg);
56097 0 964 if( NEVER(pPager->errCode) ) return pPager->errCode;
56099 964 0 if( !pagerUseWal(pPager) && pPager->journalMode!=PAGER_JOURNALMODE_OFF ){
959 5 if( !pagerUseWal(pPager) && pPager->journalMode!=PAGER_JOURNALMODE_OFF ){
56101 0 959 if( pPager->pInJournal==0 ){
56106 959 0 if( !isOpen(pPager->jfd) ){
56107 690 269 if( pPager->journalMode==PAGER_JOURNALMODE_MEMORY ){
56113 195 74 if( pPager->tempFile ){
56124 269 0 if( rc==SQLITE_OK ){
56137 959 0 if( rc==SQLITE_OK ){
56147 0 964 if( rc!=SQLITE_OK ){
56178 0 1149 if( pPager->errCode ) return pPager->errCode;
56182 1149 0 if( ALWAYS(pPager->eState==PAGER_READER) ){
56185 0 1149 if( pagerUseWal(pPager) ){
56189 0 0 if( pPager->exclusiveMode && sqlite3WalExclusiveMode(pPager->pWal, -1) ){
0 0 if( pPager->exclusiveMode && sqlite3WalExclusiveMode(pPager->pWal, -1) ){
56191 0 0 if( rc!=SQLITE_OK ){
56210 997 152 if( rc==SQLITE_OK && exFlag ){
10 987 if( rc==SQLITE_OK && exFlag ){
56215 997 152 if( rc==SQLITE_OK ){
56270 0 1154 if( rc!=SQLITE_OK ) return rc;
56272 0 1154 if( rc!=SQLITE_OK ) return rc;
56274 0 1154 if( rc!=SQLITE_OK ) return rc;
56327 964 650 if( pPager->eState==PAGER_WRITER_LOCKED ){
56329 0 964 if( rc!=SQLITE_OK ) return rc;
56342 1604 10 if( pPager->pInJournal!=0
56343 1603 1 && sqlite3BitvecTestNotNull(pPager->pInJournal, pPg->pgno)==0
56346 1154 449 if( pPg->pgno<=pPager->dbOrigSize ){
56348 0 1154 if( rc!=SQLITE_OK ){
56352 449 0 if( pPager->eState!=PAGER_WRITER_DBMOD ){
56371 0 1614 if( pPager->nSavepoint>0 ){
56376 459 1155 if( pPager->dbSizepgno ){
56418 0 0 if( pPg->pgno>nPageCount ){
56420 0 0 }else if( (pg1+nPagePerSector-1)>nPageCount ){
56429 0 0 for(ii=0; ii
0 0 for(ii=0; ii
56432 0 0 if( pg==pPg->pgno || !sqlite3BitvecTest(pPager->pInJournal, pg) ){
0 0 if( pg==pPg->pgno || !sqlite3BitvecTest(pPager->pInJournal, pg) ){
56433 0 0 if( pg!=PAGER_MJ_PGNO(pPager) ){
56435 0 0 if( rc==SQLITE_OK ){
56437 0 0 if( pPage->flags&PGHDR_NEED_SYNC ){
56443 0 0 }else if( (pPage = sqlite3PagerLookup(pPager, pg))!=0 ){
56444 0 0 if( pPage->flags&PGHDR_NEED_SYNC ){
56457 0 0 if( rc==SQLITE_OK && needSync ){
0 0 if( rc==SQLITE_OK && needSync ){
56459 0 0 for(ii=0; ii
56461 0 0 if( pPage ){
56492 3730 1614 if( (pPg->flags & PGHDR_WRITEABLE)!=0 && pPager->dbSize>=pPg->pgno ){
3730 0 if( (pPg->flags & PGHDR_WRITEABLE)!=0 && pPager->dbSize>=pPg->pgno ){
56493 3 3727 if( pPager->nSavepoint ) return subjournalPageIfRequired(pPg);
56495 0 1614 }else if( pPager->errCode ){
56497 0 1614 }else if( pPager->sectorSize > (u32)pPager->pageSize ){
56538 1 0 if( !pPager->tempFile && (pPg->flags&PGHDR_DIRTY) && pPager->nSavepoint==0 ){
1 0 if( !pPager->tempFile && (pPg->flags&PGHDR_DIRTY) && pPager->nSavepoint==0 ){
1 0 if( !pPager->tempFile && (pPg->flags&PGHDR_DIRTY) && pPager->nSavepoint==0 ){
56596 72 0 if( !pPager->changeCountDone && ALWAYS(pPager->dbSize>0) ){
72 0 if( !pPager->changeCountDone && ALWAYS(pPager->dbSize>0) ){
56610 72 0 if( !DIRECT_MODE && ALWAYS(rc==SQLITE_OK) ){
56614 72 0 if( rc==SQLITE_OK ){
56657 72 0 if( rc==SQLITE_NOTFOUND ) rc = SQLITE_OK;
56658 72 0 if( rc==SQLITE_OK && !pPager->noSync ){
72 0 if( rc==SQLITE_OK && !pPager->noSync ){
56679 1024 0 if( rc==SQLITE_OK ){
56685 1024 0 if( 0==pagerUseWal(pPager) ){
56733 0 948 if( NEVER(pPager->errCode) ) return pPager->errCode;
56736 0 948 if( sqlite3FaultSim(400) ) return SQLITE_IOERR;
56742 20 928 if( pPager->eState
56746 856 72 if( 0==pagerFlushOnCommit(pPager, 1) ){
56753 0 72 if( pagerUseWal(pPager) ){
56756 0 0 if( pList==0 ){
56764 0 0 if( ALWAYS(pList) ){
56768 0 0 if( rc==SQLITE_OK ){
56845 0 72 if( rc!=SQLITE_OK ) goto commit_phase_one_exit;
56852 0 72 if( rc!=SQLITE_OK ) goto commit_phase_one_exit;
56866 0 72 if( rc!=SQLITE_OK ) goto commit_phase_one_exit;
56898 0 72 if( rc!=SQLITE_OK ){
56910 0 72 if( pPager->dbSize>pPager->dbFileSize ){
56914 0 0 if( rc!=SQLITE_OK ) goto commit_phase_one_exit;
56918 72 0 if( !noSync ){
56926 928 0 if( rc==SQLITE_OK && !pagerUseWal(pPager) ){
928 0 if( rc==SQLITE_OK && !pagerUseWal(pPager) ){
56954 0 948 if( NEVER(pPager->errCode) ) return pPager->errCode;
56973 20 928 if( pPager->eState==PAGER_WRITER_LOCKED
56974 13 7 && pPager->exclusiveMode
56975 0 13 && pPager->journalMode==PAGER_JOURNALMODE_PERSIST
57023 0 49 if( pPager->eState==PAGER_ERROR ) return pPager->errCode;
57024 0 49 if( pPager->eState<=PAGER_READER ) return SQLITE_OK;
57026 0 49 if( pagerUseWal(pPager) ){
57030 0 0 if( rc==SQLITE_OK ) rc = rc2;
57031 31 18 }else if( !isOpen(pPager->jfd) || pPager->eState==PAGER_WRITER_LOCKED ){
0 31 }else if( !isOpen(pPager->jfd) || pPager->eState==PAGER_WRITER_LOCKED ){
57034 5 13 if( !MEMDB && eState>PAGER_WRITER_LOCKED ){
5 0 if( !MEMDB && eState>PAGER_WRITER_LOCKED ){
57143 0 6 if( reset ){
57182 0 1 if( !aNew ){
57189 1 1 for(ii=nCurrent; ii
57191 1 0 if( isOpen(pPager->jfd) && pPager->journalOff>0 ){
1 0 if( isOpen(pPager->jfd) && pPager->journalOff>0 ){
57198 0 1 if( !aNew[ii].pInSavepoint ){
57201 0 1 if( pagerUseWal(pPager) ){
57214 1 3415 if( nSavepoint>pPager->nSavepoint && pPager->useJournal ){
1 0 if( nSavepoint>pPager->nSavepoint && pPager->useJournal ){
57262 1 0 if( rc==SQLITE_OK && iSavepointnSavepoint ){
1 0 if( rc==SQLITE_OK && iSavepointnSavepoint ){
57271 0 1 for(ii=nNew; iinSavepoint; ii++){
57278 0 1 if( op==SAVEPOINT_RELEASE ){
57279 0 0 if( nNew==0 && isOpen(pPager->sjfd) ){
0 0 if( nNew==0 && isOpen(pPager->sjfd) ){
57281 0 0 if( sqlite3JournalIsInMemory(pPager->sjfd) ){
57293 1 0 else if( pagerUseWal(pPager) || isOpen(pPager->jfd) ){
1 0 else if( pagerUseWal(pPager) || isOpen(pPager->jfd) ){
57294 1 0 PagerSavepoint *pSavepoint = (nNew==0)?0:&pPager->aSavepoint[nNew-1];
57329 1993 0 return (nullIfMemDb && pPager->memDb) ? "" : pPager->zFilename;
180 1813 return (nullIfMemDb && pPager->memDb) ? "" : pPager->zFilename;
57366 0 0 return pPager->pWal ? sqlite3WalFile(pPager->pWal) : pPager->jfd;
57467 0 0 if( pPager->tempFile ){
57469 0 0 if( rc ) return rc;
57490 0 0 if( (pPg->flags & PGHDR_DIRTY)!=0
57491 0 0 && SQLITE_OK!=(rc = subjournalPageIfRequired(pPg))
57507 0 0 if( (pPg->flags&PGHDR_NEED_SYNC) && !isCommit ){
0 0 if( (pPg->flags&PGHDR_NEED_SYNC) && !isCommit ){
57522 0 0 if( pPgOld ){
57524 0 0 if( pPager->tempFile ){
57541 0 0 if( pPager->tempFile && pPgOld ){
0 0 if( pPager->tempFile && pPgOld ){
57546 0 0 if( needSyncPgno ){
57563 0 0 if( rc!=SQLITE_OK ){
57564 0 0 if( needSyncPgno<=pPager->dbOrigSize ){
57624 5 0 if( eMode>=0 && !pPager->tempFile && !sqlite3WalHeapMemory(pPager->pWal) ){
0 5 if( eMode>=0 && !pPager->tempFile && !sqlite3WalHeapMemory(pPager->pWal) ){
0 0 if( eMode>=0 && !pPager->tempFile && !sqlite3WalHeapMemory(pPager->pWal) ){
57670 0 0 if( MEMDB ){
57672 0 0 if( eMode!=PAGER_JOURNALMODE_MEMORY && eMode!=PAGER_JOURNALMODE_OFF ){
0 0 if( eMode!=PAGER_JOURNALMODE_MEMORY && eMode!=PAGER_JOURNALMODE_OFF ){
57677 0 0 if( eMode!=eOld ){
57695 0 0 if( !pPager->exclusiveMode && (eOld & 5)==1 && (eMode & 1)==0 ){
0 0 if( !pPager->exclusiveMode && (eOld & 5)==1 && (eMode & 1)==0 ){
0 0 if( !pPager->exclusiveMode && (eOld & 5)==1 && (eMode & 1)==0 ){
57706 0 0 if( pPager->eLock>=RESERVED_LOCK ){
57712 0 0 if( state==PAGER_OPEN ){
57715 0 0 if( pPager->eState==PAGER_READER ){
57719 0 0 if( rc==SQLITE_OK ){
57722 0 0 if( rc==SQLITE_OK && state==PAGER_READER ){
0 0 if( rc==SQLITE_OK && state==PAGER_READER ){
57724 0 0 }else if( state==PAGER_OPEN ){
57729 0 0 }else if( eMode==PAGER_JOURNALMODE_OFF ){
57752 0 0 if( pPager->eState>=PAGER_WRITER_CACHEMOD ) return 0;
57753 0 0 if( NEVER(isOpen(pPager->jfd) && pPager->journalOff>0) ) return 0;
0 0 if( NEVER(isOpen(pPager->jfd) && pPager->journalOff>0) ) return 0;
57764 0 0 if( iLimit>=-1 ){
57787 0 0 if( pPager->tempFile==0 ) pager_reset(pPager);
57808 0 0 if( pPager->pWal ){
57809 0 0 rc = sqlite3WalCheckpoint(pPager->pWal, db, eMode,
57830 0 0 if( pPager->noLock ) return 0;
57831 0 0 return pPager->exclusiveMode || (pMethods->iVersion>=2 && pMethods->xShmMap);
0 0 return pPager->exclusiveMode || (pMethods->iVersion>=2 && pMethods->xShmMap);
0 0 return pPager->exclusiveMode || (pMethods->iVersion>=2 && pMethods->xShmMap);
57843 0 0 if( rc!=SQLITE_OK ){
57869 0 0 if( pPager->exclusiveMode ){
57876 0 0 if( rc==SQLITE_OK ){
57915 0 0 if( !pPager->tempFile && !pPager->pWal ){
0 0 if( !pPager->tempFile && !pPager->pWal ){
57916 0 0 if( !sqlite3PagerWalSupported(pPager) ) return SQLITE_CANTOPEN;
57922 0 0 if( rc==SQLITE_OK ){
57951 0 0 if( !pPager->pWal ){
57954 0 0 if( rc==SQLITE_OK ){
57959 0 0 if( rc==SQLITE_OK && logexists ){
0 0 if( rc==SQLITE_OK && logexists ){
57967 0 0 if( rc==SQLITE_OK && pPager->pWal ){
0 0 if( rc==SQLITE_OK && pPager->pWal ){
57969 0 0 if( rc==SQLITE_OK ){
57974 0 0 if( rc && !pPager->exclusiveMode ) pagerUnlockDb(pPager, SHARED_LOCK);
0 0 if( rc && !pPager->exclusiveMode ) pagerUnlockDb(pPager, SHARED_LOCK);
58650 0 0 if( pWal->nWiData<=iPage ){
58654 0 0 if( !apNew ){
58666 0 0 if( pWal->exclusiveMode==WAL_HEAPMEMORY_MODE ){
58668 0 0 if( !pWal->apWiData[iPage] ) rc = SQLITE_NOMEM_BKPT;
58675 0 0 if( (rc&0xff)==SQLITE_READONLY ){
58677 0 0 if( rc==SQLITE_READONLY ){
58692 0 0 if( pWal->nWiData<=iPage || (*ppPage = pWal->apWiData[iPage])==0 ){
0 0 if( pWal->nWiData<=iPage || (*ppPage = pWal->apWiData[iPage])==0 ){
58746 0 0 if( aIn ){
58756 0 0 if( nativeCksum ){
58760 0 0 }while( aData
58766 0 0 }while( aData
58774 0 0 if( pWal->exclusiveMode!=WAL_HEAPMEMORY_MODE ){
58822 0 0 if( pWal->iReCksum==0 ){
58856 0 0 if( memcmp(&pWal->hdr.aSalt, &aFrame[8], 8)!=0 ){
58863 0 0 if( pgno==0 ){
58875 0 0 if( aCksum[0]!=sqlite3Get4byte(&aFrame[16])
58876 0 0 || aCksum[1]!=sqlite3Get4byte(&aFrame[20])
58922 0 0 if( pWal->exclusiveMode ) return SQLITE_OK;
58931 0 0 if( pWal->exclusiveMode ) return;
58938 0 0 if( pWal->exclusiveMode ) return SQLITE_OK;
58947 0 0 if( pWal->exclusiveMode ) return;
59004 0 0 if( rc==SQLITE_OK ){
59006 0 0 if( iHash==0 ){
59039 0 0 if( iHash==0 ){
59068 0 0 if( pWal->hdr.mxFrame==0 ) return;
59083 0 0 for(i=0; i
59084 0 0 if( sLoc.aHash[i]>iLimit ){
59126 0 0 if( rc==SQLITE_OK ){
59137 0 0 if( idx==1 ){
59149 0 0 if( sLoc.aPgno[idx] ){
59156 0 0 for(iKey=walHash(iPage); sLoc.aHash[iKey]; iKey=walNextHash(iKey)){
59157 0 0 if( (nCollide--)==0 ) return SQLITE_CORRUPT_BKPT;
59225 0 0 if( rc==SQLITE_OK ){
59227 0 0 if( rc!=SQLITE_OK ){
59231 0 0 if( rc ){
59240 0 0 if( rc!=SQLITE_OK ){
59244 0 0 if( nSize>WAL_HDRSIZE ){
59258 0 0 if( rc!=SQLITE_OK ){
59269 0 0 if( (magic&0xFFFFFFFE)!=WAL_MAGIC
59270 0 0 || szPage&(szPage-1)
59271 0 0 || szPage>SQLITE_MAX_PAGE_SIZE
59272 0 0 || szPage<512
59285 0 0 if( pWal->hdr.aFrameCksum[0]!=sqlite3Get4byte(&aBuf[24])
59286 0 0 || pWal->hdr.aFrameCksum[1]!=sqlite3Get4byte(&aBuf[28])
59294 0 0 if( version!=WAL_MAX_VERSION ){
59302 0 0 if( !aFrame ){
59310 0 0 for(iOffset=WAL_HDRSIZE; (iOffset+szFrame)<=nSize; iOffset+=szFrame){
59317 0 0 if( rc!=SQLITE_OK ) break;
59319 0 0 if( !isValid ) break;
59321 0 0 if( rc!=SQLITE_OK ) break;
59324 0 0 if( nTruncate ){
59339 0 0 if( rc==SQLITE_OK ){
59354 0 0 for(i=1; iaReadMark[i] = READMARK_NOT_USED;
59355 0 0 if( pWal->hdr.mxFrame ) pInfo->aReadMark[1] = pWal->hdr.mxFrame;
59362 0 0 if( pWal->hdr.nPage ){
59381 0 0 if( pWal->exclusiveMode==WAL_HEAPMEMORY_MODE || pWal->bShmUnreliable ){
0 0 if( pWal->exclusiveMode==WAL_HEAPMEMORY_MODE || pWal->bShmUnreliable ){
59383 0 0 for(i=0; inWiData; i++){
59388 0 0 if( pWal->exclusiveMode!=WAL_HEAPMEMORY_MODE ){
59442 0 0 if( !pRet ){
59454 0 0 pRet->exclusiveMode = (bNoShm ? WAL_HEAPMEMORY_MODE: WAL_NORMAL_MODE);
59459 0 0 if( rc==SQLITE_OK && flags&SQLITE_OPEN_READONLY ){
0 0 if( rc==SQLITE_OK && flags&SQLITE_OPEN_READONLY ){
59463 0 0 if( rc!=SQLITE_OK ){
59469 0 0 if( iDC & SQLITE_IOCAP_SEQUENTIAL ){ pRet->syncHeader = 0; }
59470 0 0 if( iDC & SQLITE_IOCAP_POWERSAFE_OVERWRITE ){
59483 0 0 if( pWal ) pWal->mxWalSize = iLimit;
59507 0 0 for(i=p->nSegment-1; i>=0; i--){
59509 0 0 while( pSegment->iNextnEntry ){
59511 0 0 if( iPg>iMin ){
59512 0 0 if( iPg
59564 0 0 while( iRight
0 0 while( iRight
59568 0 0 if( (iLeft
59569 0 0 && (iRight>=nRight || aContent[aLeft[iLeft]]
0 0 && (iRight>=nRight || aContent[aLeft[iLeft]]
59578 0 0 if( iLeft
0 0 if( iLeft
59628 0 0 for(iList=0; iList
59631 0 0 for(iSub=0; iList & (1<
59643 0 0 for(iSub++; iSub
59644 0 0 if( nList & (1<
59707 0 0 if( !p ){
59716 0 0 aTmp = (ht_slot *)sqlite3_malloc64(
59719 0 0 if( !aTmp ){
59723 0 0 for(i=walFramePage(nBackfill+1); rc==SQLITE_OK && i
0 0 for(i=walFramePage(nBackfill+1); rc==SQLITE_OK && i
59727 0 0 if( rc==SQLITE_OK ){
59733 0 0 if( (i+1)==nSegment ){
59741 0 0 for(j=0; j
59753 0 0 if( rc!=SQLITE_OK ){
59777 0 0 }while( xBusy && rc==SQLITE_BUSY && xBusy(pBusyArg) );
0 0 }while( xBusy && rc==SQLITE_BUSY && xBusy(pBusyArg) );
0 0 }while( xBusy && rc==SQLITE_BUSY && xBusy(pBusyArg) );
59818 0 0 for(i=2; iaReadMark[i] = READMARK_NOT_USED;
59876 0 0 if( pInfo->nBackfillhdr.mxFrame ){
59889 0 0 for(i=1; i
59899 0 0 if( mxSafeFrame>y ){
59902 0 0 if( rc==SQLITE_OK ){
59903 0 0 pInfo->aReadMark[i] = (i==1 ? mxSafeFrame : READMARK_NOT_USED);
59905 0 0 }else if( rc==SQLITE_BUSY ){
59915 0 0 if( pInfo->nBackfill
59920 0 0 if( pIter
59921 0 0 && (rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(0),1))==SQLITE_OK
59933 0 0 if( rc==SQLITE_OK ){
59937 0 0 if( rc==SQLITE_OK && nSize
0 0 if( rc==SQLITE_OK && nSize
59944 0 0 while( rc==SQLITE_OK && 0==walIteratorNext(pIter, &iDbpage, &iFrame) ){
0 0 while( rc==SQLITE_OK && 0==walIteratorNext(pIter, &iDbpage, &iFrame) ){
59947 0 0 if( db->u1.isInterrupted ){
59948 0 0 rc = db->mallocFailed ? SQLITE_NOMEM_BKPT : SQLITE_INTERRUPT;
59951 0 0 if( iFrame<=nBackfill || iFrame>mxSafeFrame || iDbpage>mxPage ){
0 0 if( iFrame<=nBackfill || iFrame>mxSafeFrame || iDbpage>mxPage ){
0 0 if( iFrame<=nBackfill || iFrame>mxSafeFrame || iDbpage>mxPage ){
59957 0 0 if( rc!=SQLITE_OK ) break;
59961 0 0 if( rc!=SQLITE_OK ) break;
59965 0 0 if( rc==SQLITE_OK ){
59966 0 0 if( mxSafeFrame==walIndexHdr(pWal)->mxFrame ){
59970 0 0 if( rc==SQLITE_OK ){
59974 0 0 if( rc==SQLITE_OK ){
59983 0 0 if( rc==SQLITE_BUSY ){
59995 0 0 if( rc==SQLITE_OK && eMode!=SQLITE_CHECKPOINT_PASSIVE ){
0 0 if( rc==SQLITE_OK && eMode!=SQLITE_CHECKPOINT_PASSIVE ){
59997 0 0 if( pInfo->nBackfillhdr.mxFrame ){
59999 0 0 }else if( eMode>=SQLITE_CHECKPOINT_RESTART ){
60004 0 0 if( rc==SQLITE_OK ){
60005 0 0 if( eMode==SQLITE_CHECKPOINT_TRUNCATE ){
60041 0 0 if( rx==SQLITE_OK && (sz > nMax ) ){
0 0 if( rx==SQLITE_OK && (sz > nMax ) ){
60045 0 0 if( rx ){
60061 0 289 if( pWal ){
60072 0 0 if( zBuf!=0
60073 0 0 && SQLITE_OK==(rc = sqlite3OsLock(pWal->pDbFd, SQLITE_LOCK_EXCLUSIVE))
60075 0 0 if( pWal->exclusiveMode==WAL_NORMAL_MODE ){
60081 0 0 if( rc==SQLITE_OK ){
60086 0 0 if( bPersist!=1 ){
60091 0 0 }else if( pWal->mxWalSize>=0 ){
60105 0 0 if( isDelete ){
60157 0 0 if( memcmp(&h1, &h2, sizeof(h1))!=0 ){
60160 0 0 if( h1.isInit==0 ){
60164 0 0 if( aCksum[0]!=h1.aCksum[0] || aCksum[1]!=h1.aCksum[1] ){
0 0 if( aCksum[0]!=h1.aCksum[0] || aCksum[1]!=h1.aCksum[1] ){
60168 0 0 if( memcmp(&pWal->hdr, &h1, sizeof(WalIndexHdr)) ){
60208 0 0 if( rc!=SQLITE_OK ){
60210 0 0 if( rc==SQLITE_READONLY_CANTINIT ){
60238 0 0 badHdr = (page0 ? walIndexTryHdr(pWal, pChanged) : 1);
60244 0 0 if( badHdr ){
60245 0 0 if( pWal->bShmUnreliable==0 && (pWal->readOnly & WAL_SHM_RDONLY) ){
0 0 if( pWal->bShmUnreliable==0 && (pWal->readOnly & WAL_SHM_RDONLY) ){
60246 0 0 if( SQLITE_OK==(rc = walLockShared(pWal, WAL_WRITE_LOCK)) ){
60250 0 0 }else if( SQLITE_OK==(rc = walLockExclusive(pWal, WAL_WRITE_LOCK, 1)) ){
60252 0 0 if( SQLITE_OK==(rc = walIndexPage(pWal, 0, &page0)) ){
60254 0 0 if( badHdr ){
60272 0 0 if( badHdr==0 && pWal->hdr.iVersion!=WALINDEX_MAX_VERSION ){
0 0 if( badHdr==0 && pWal->hdr.iVersion!=WALINDEX_MAX_VERSION ){
60275 0 0 if( pWal->bShmUnreliable ){
60276 0 0 if( rc!=SQLITE_OK ){
60283 0 0 if( rc==SQLITE_IOERR_SHORT_READ ) rc = WAL_RETRY;
60337 0 0 if( rc!=SQLITE_OK ){
60338 0 0 if( rc==SQLITE_BUSY ) rc = WAL_RETRY;
60367 0 0 if( rc!=SQLITE_READONLY_CANTINIT ){
60368 0 0 rc = (rc==SQLITE_READONLY ? WAL_RETRY : rc);
60382 0 0 if( rc!=SQLITE_OK ){
60385 0 0 if( szWal
60393 0 0 rc = (pWal->hdr.mxFrame==0 ? SQLITE_OK : WAL_RETRY);
60399 0 0 if( rc!=SQLITE_OK ){
60402 0 0 if( memcmp(&pWal->hdr.aSalt, &aBuf[16], 8) ){
60413 0 0 if( aFrame==0 ){
60425 0 0 for(iOffset=walFrameOffset(pWal->hdr.mxFrame+1, pWal->hdr.szPage);
60434 0 0 if( rc!=SQLITE_OK ) break;
60435 0 0 if( !walDecodeFrame(pWal, &pgno, &nTruncate, aData, aFrame) ) break;
60440 0 0 if( nTruncate ){
60450 0 0 if( rc!=SQLITE_OK ){
60452 0 0 for(i=0; inWiData; i++){
60543 0 0 if( cnt>5 ){
60545 0 0 if( cnt>100 ){
60549 0 0 if( cnt>=10 ) nDelay = (cnt-9)*(cnt-9)*39;
60553 0 0 if( !useWal ){
60555 0 0 if( pWal->bShmUnreliable==0 ){
60558 0 0 if( rc==SQLITE_BUSY ){
60567 0 0 if( pWal->apWiData[0]==0 ){
60576 0 0 }else if( SQLITE_OK==(rc = walLockShared(pWal, WAL_RECOVER_LOCK)) ){
60579 0 0 }else if( rc==SQLITE_BUSY ){
60583 0 0 if( rc!=SQLITE_OK ){
60586 0 0 else if( pWal->bShmUnreliable ){
60594 0 0 if( !useWal && pInfo->nBackfill==pWal->hdr.mxFrame
0 0 if( !useWal && pInfo->nBackfill==pWal->hdr.mxFrame
60604 0 0 if( rc==SQLITE_OK ){
60605 0 0 if( memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr)) ){
60624 0 0 }else if( rc!=SQLITE_BUSY ){
60642 0 0 for(i=1; i
60644 0 0 if( mxReadMark<=thisMark && thisMark<=mxFrame ){
0 0 if( mxReadMark<=thisMark && thisMark<=mxFrame ){
60650 0 0 if( (pWal->readOnly & WAL_SHM_RDONLY)==0
60651 0 0 && (mxReadMark
0 0 && (mxReadMark
60653 0 0 for(i=1; i
60655 0 0 if( rc==SQLITE_OK ){
60660 0 0 }else if( rc!=SQLITE_BUSY ){
60665 0 0 if( mxI==0 ){
60667 0 0 return rc==SQLITE_BUSY ? WAL_RETRY : SQLITE_READONLY_CANTINIT;
60671 0 0 if( rc ){
60672 0 0 return rc==SQLITE_BUSY ? WAL_RETRY : rc;
60710 0 0 if( AtomicLoad(pInfo->aReadMark+mxI)!=mxReadMark
60711 0 0 || memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr))
60826 0 0 }while( rc==WAL_RETRY );
60905 0 0 if( pWal->readLock>=0 ){
60938 0 0 if( iLast==0 || (pWal->readLock==0 && pWal->bShmUnreliable==0) ){
0 0 if( iLast==0 || (pWal->readLock==0 && pWal->bShmUnreliable==0) ){
0 0 if( iLast==0 || (pWal->readLock==0 && pWal->bShmUnreliable==0) ){
60969 0 0 for(iHash=walFramePage(iLast); iHash>=iMinHash; iHash--){
60976 0 0 if( rc!=SQLITE_OK ){
60980 0 0 for(iKey=walHash(pgno); sLoc.aHash[iKey]; iKey=walNextHash(iKey)){
60982 0 0 if( iFrame<=iLast && iFrame>=pWal->minFrame
0 0 if( iFrame<=iLast && iFrame>=pWal->minFrame
60983 0 0 && sLoc.aPgno[sLoc.aHash[iKey]]==pgno ){
60987 0 0 if( (nCollide--)==0 ){
60991 0 0 if( iRead ) break;
61042 0 300 if( pWal && ALWAYS(pWal->readLock>=0) ){
0 0 if( pWal && ALWAYS(pWal->readLock>=0) ){
61070 0 0 if( pWal->readOnly ){
61078 0 0 if( rc ){
61087 0 0 if( memcmp(&pWal->hdr, (void *)walIndexHdr(pWal), sizeof(WalIndexHdr))!=0 ){
61101 0 0 if( pWal->writeLock ){
61124 0 0 if( ALWAYS(pWal->writeLock) ){
61133 0 0 for(iFrame=pWal->hdr.mxFrame+1;
61134 0 0 ALWAYS(rc==SQLITE_OK) && iFrame<=iMax;
61151 0 0 if( iMax!=pWal->hdr.mxFrame ) walCleanupHash(pWal);
61182 0 0 if( aWalData[3]!=pWal->nCkpt ){
61191 0 0 if( aWalData[0]hdr.mxFrame ){
61217 0 0 if( pWal->readLock==0 ){
61220 0 0 if( pInfo->nBackfill>0 ){
61224 0 0 if( rc==SQLITE_OK ){
61236 0 0 }else if( rc!=SQLITE_BUSY ){
61246 0 0 }while( rc==WAL_RETRY );
61283 0 0 if( iOffsetiSyncPoint && iOffset+iAmt>=p->iSyncPoint ){
0 0 if( iOffsetiSyncPoint && iOffset+iAmt>=p->iSyncPoint ){
61286 0 0 if( rc ) return rc;
61292 0 0 if( iAmt==0 || rc ) return rc;
0 0 if( iAmt==0 || rc ) return rc;
61317 0 0 if( rc ) return rc;
61340 0 0 if( aBuf==0 ) return SQLITE_NOMEM_BKPT;
61348 0 0 if( pWal->iReCksum==1 ){
61359 0 0 for(; rc==SQLITE_OK && iRead<=iLast; iRead++){
0 0 for(; rc==SQLITE_OK && iRead<=iLast; iRead++){
61362 0 0 if( rc==SQLITE_OK ){
61414 0 0 if( memcmp(&pWal->hdr, (void *)pLive, sizeof(WalIndexHdr))!=0 ){
61421 0 0 if( SQLITE_OK!=(rc = walRestartLog(pWal)) ){
61430 0 0 if( iFrame==0 ){
61438 0 0 if( pWal->nCkpt==0 ) sqlite3_randomness(8, pWal->hdr.aSalt);
61452 0 0 if( rc!=SQLITE_OK ){
61463 0 0 if( pWal->syncHeader ){
61465 0 0 if( rc ) return rc;
61480 0 0 for(p=pList; p; p=p->pDirty){
61487 0 0 if( iFirst && (p->pDirty || isCommit==0) ){
0 0 if( iFirst && (p->pDirty || isCommit==0) ){
0 0 if( iFirst && (p->pDirty || isCommit==0) ){
61491 0 0 if( iWrite>=iFirst ){
61494 0 0 if( pWal->iReCksum==0 || iWriteiReCksum ){
0 0 if( pWal->iReCksum==0 || iWriteiReCksum ){
61503 0 0 if( rc ) return rc;
61511 0 0 nDbSize = (isCommit && p->pDirty==0) ? nTruncate : 0;
0 0 nDbSize = (isCommit && p->pDirty==0) ? nTruncate : 0;
61513 0 0 if( rc ) return rc;
61520 0 0 if( isCommit && pWal->iReCksum ){
0 0 if( isCommit && pWal->iReCksum ){
61522 0 0 if( rc ) return rc;
61539 0 0 if( isCommit && WAL_SYNC_FLAGS(sync_flags)!=0 ){
0 0 if( isCommit && WAL_SYNC_FLAGS(sync_flags)!=0 ){
61541 0 0 if( pWal->padToSectorBoundary ){
61546 0 0 while( iOffset
61548 0 0 if( rc ) return rc;
61553 0 0 if( bSync ){
61563 0 0 if( isCommit && pWal->truncateOnCommit && pWal->mxWalSize>=0 ){
0 0 if( isCommit && pWal->truncateOnCommit && pWal->mxWalSize>=0 ){
0 0 if( isCommit && pWal->truncateOnCommit && pWal->mxWalSize>=0 ){
61565 0 0 if( walFrameOffset(iFrame+nExtra+1, szPage)>pWal->mxWalSize ){
61578 0 0 for(p=pList; p && rc==SQLITE_OK; p=p->pDirty){
0 0 for(p=pList; p && rc==SQLITE_OK; p=p->pDirty){
61579 0 0 if( (p->flags & PGHDR_WAL_APPEND)==0 ) continue;
61583 0 0 while( rc==SQLITE_OK && nExtra>0 ){
0 0 while( rc==SQLITE_OK && nExtra>0 ){
61589 0 0 if( rc==SQLITE_OK ){
61595 0 0 if( isCommit ){
61600 0 0 if( isCommit ){
61644 0 0 if( pWal->readOnly ) return SQLITE_READONLY;
61650 0 0 if( rc ){
61672 0 0 if( eMode!=SQLITE_CHECKPOINT_PASSIVE ){
61674 0 0 if( rc==SQLITE_OK ){
61676 0 0 }else if( rc==SQLITE_BUSY ){
61684 0 0 if( rc==SQLITE_OK ){
61686 0 0 if( isChanged && pWal->pDbFd->pMethods->iVersion>=3 ){
0 0 if( isChanged && pWal->pDbFd->pMethods->iVersion>=3 ){
61692 0 0 if( rc==SQLITE_OK ){
61694 0 0 if( pWal->hdr.mxFrame && walPagesize(pWal)!=nBuf ){
0 0 if( pWal->hdr.mxFrame && walPagesize(pWal)!=nBuf ){
61701 0 0 if( rc==SQLITE_OK || rc==SQLITE_BUSY ){
0 0 if( rc==SQLITE_OK || rc==SQLITE_BUSY ){
61702 0 0 if( pnLog ) *pnLog = (int)pWal->hdr.mxFrame;
61703 0 0 if( pnCkpt ) *pnCkpt = (int)(walCkptInfo(pWal)->nBackfill);
61707 0 0 if( isChanged ){
61722 0 0 return (rc==SQLITE_OK && eMode!=eMode2 ? SQLITE_BUSY : rc);
0 0 return (rc==SQLITE_OK && eMode!=eMode2 ? SQLITE_BUSY : rc);
61732 0 3028 if( pWal ){
61777 0 0 if( op==0 ){
61778 0 0 if( pWal->exclusiveMode!=WAL_NORMAL_MODE ){
61780 0 0 if( walLockShared(pWal, WAL_READ_LOCK(pWal->readLock))!=SQLITE_OK ){
61788 0 0 }else if( op>0 ){
61806 0 0 return (pWal && pWal->exclusiveMode==WAL_HEAPMEMORY_MODE );
0 0 return (pWal && pWal->exclusiveMode==WAL_HEAPMEMORY_MODE );
62907 12265 6041 for(i=0; inDb; i++){
62909 8940 3325 if( p ){
63229 10139 0 if( !p->sharable ){
63236 0 0 if( pBt->pWriter!=p && (pBt->btsFlags & BTS_EXCLUSIVE)!=0 ){
0 0 if( pBt->pWriter!=p && (pBt->btsFlags & BTS_EXCLUSIVE)!=0 ){
63241 0 0 for(pIter=pBt->pLock; pIter; pIter=pIter->pNext){
63253 0 0 if( pIter->pBtree!=p && pIter->iTable==iTab && pIter->eLock!=eLock ){
0 0 if( pIter->pBtree!=p && pIter->iTable==iTab && pIter->eLock!=eLock ){
0 0 if( pIter->pBtree!=p && pIter->iTable==iTab && pIter->eLock!=eLock ){
63255 0 0 if( eLock==WRITE_LOCK ){
63305 0 0 for(pIter=pBt->pLock; pIter; pIter=pIter->pNext){
63306 0 0 if( pIter->iTable==iTable && pIter->pBtree==p ){
0 0 if( pIter->iTable==iTable && pIter->pBtree==p ){
63315 0 0 if( !pLock ){
63317 0 0 if( !pLock ){
63331 0 0 if( eLock>pLock->eLock ){
63356 0 1879 while( *ppIter ){
63360 0 0 if( pLock->pBtree==p ){
63363 0 0 if( pLock->iTable!=1 ){
63372 997 882 if( pBt->pWriter==p ){
63375 0 882 }else if( pBt->nTransaction==2 ){
63394 0 98 if( pBt->pWriter==p ){
63398 0 0 for(pLock=pBt->pLock; pLock; pLock=pLock->pNext){
63448 0 0 for(p=pBt->pCursor; p; p=p->pNext){
63474 3673 14 if( pBtree->hasIncrblobCur==0 ) return;
63477 28 14 for(p=pBtree->pBt->pCursor; p; p=p->pNext){
63478 14 14 if( (p->curFlags & BTCF_Incrblob)!=0 ){
63480 7 7 if( p->pgnoRoot==pgnoRoot && (isClearTable || p->info.nKey==iRow) ){
7 0 if( p->pgnoRoot==pgnoRoot && (isClearTable || p->info.nKey==iRow) ){
7 0 if( p->pgnoRoot==pgnoRoot && (isClearTable || p->info.nKey==iRow) ){
63529 1 0 if( !pBt->pHasContent ){
63532 0 1 if( !pBt->pHasContent ){
63536 1 0 if( rc==SQLITE_OK && pgno<=sqlite3BitvecSize(pBt->pHasContent) ){
1 0 if( rc==SQLITE_OK && pgno<=sqlite3BitvecSize(pBt->pHasContent) ){
63551 0 1 return (p && (pgno>sqlite3BitvecSize(p) || sqlite3BitvecTest(p, pgno)));
0 0 return (p && (pgno>sqlite3BitvecSize(p) || sqlite3BitvecTest(p, pgno)));
0 0 return (p && (pgno>sqlite3BitvecSize(p) || sqlite3BitvecTest(p, pgno)));
63568 5043 382 if( pCur->iPage>=0 ){
63569 1432 5043 for(i=0; iiPage; i++){
63596 68 0 if( pCur->curIntKey ){
63604 0 0 if( pKey ){
63606 0 0 if( rc==SQLITE_OK ){
63633 0 52 if( pCur->eState==CURSOR_SKIPNEXT ){
63640 52 0 if( rc==SQLITE_OK ){
63677 225 638 for(p=pBt->pCursor; p; p=p->pNext){
63678 115 110 if( p!=pExcept && (0==iRoot || p->pgnoRoot==iRoot) ) break;
115 0 if( p!=pExcept && (0==iRoot || p->pgnoRoot==iRoot) ) break;
5 110 if( p!=pExcept && (0==iRoot || p->pgnoRoot==iRoot) ) break;
63680 110 638 if( p ) return saveCursorsOnList(p, iRoot, pExcept);
63681 0 638 if( pExcept ) pExcept->curFlags &= ~BTCF_Multiple;
63696 122 0 if( p!=pExcept && (0==iRoot || p->pgnoRoot==iRoot) ){
122 0 if( p!=pExcept && (0==iRoot || p->pgnoRoot==iRoot) ){
122 0 if( p!=pExcept && (0==iRoot || p->pgnoRoot==iRoot) ){
63697 70 52 if( p->eState==CURSOR_VALID || p->eState==CURSOR_SKIPNEXT ){
0 70 if( p->eState==CURSOR_VALID || p->eState==CURSOR_SKIPNEXT ){
63699 0 52 if( SQLITE_OK!=rc ){
63708 12 110 }while( p );
63737 0 16 if( pKey ){
63740 0 0 if( pIdxKey==0 ) return SQLITE_NOMEM_BKPT;
63742 0 0 if( pIdxKey->nField==0 ){
63751 0 16 if( pIdxKey ){
63769 0 16 if( pCur->eState==CURSOR_FAULT ){
63774 16 0 if( rc==SQLITE_OK ){
63779 16 0 if( pCur->skipNext && pCur->eState==CURSOR_VALID ){
8 8 if( pCur->skipNext && pCur->eState==CURSOR_VALID ){
63840 0 0 rc = restoreCursorPosition(pCur);
63841 0 0 if( rc ){
63845 0 0 if( pCur->eState!=CURSOR_VALID ){
63888 0 0 if( pgno<2 ) return 0;
63892 0 0 if( ret==PENDING_BYTE_PAGE(pBt) ){
63915 0 0 if( *pRC ) return;
63922 0 0 if( key==0 ){
63928 0 0 if( rc!=SQLITE_OK ){
63933 0 0 if( offset<0 ){
63940 0 0 if( eType!=pPtrmap[offset] || get4byte(&pPtrmap[offset+1])!=parent ){
0 0 if( eType!=pPtrmap[offset] || get4byte(&pPtrmap[offset+1])!=parent ){
63943 0 0 if( rc==SQLITE_OK ){
63971 0 0 if( rc!=0 ){
63977 0 0 if( offset<0 ){
63984 0 0 if( pPgno ) *pPgno = get4byte(&pPtrmap[offset+1]);
63987 0 0 if( *pEType<1 || *pEType>5 ) return SQLITE_CORRUPT_PGNO(iPtrmap);
0 0 if( *pEType<1 || *pEType>5 ) return SQLITE_CORRUPT_PGNO(iPtrmap);
64042 0 31 if( surplus <= maxLocal ){
64103 123 10209 if( nPayload>=0x80 ){
64108 31 123 }while( (*pIter)>=0x80 && pIter
31 0 }while( (*pIter)>=0x80 && pIter
64119 5365 4967 if( iKey>=0x80 ){
64124 5365 0 if( (*pIter)<0x80 ) break;
64125 0 0 if( pIter>=pEnd ){
64138 10301 31 if( nPayload<=pPage->maxLocal ){
64143 0 10301 if( pInfo->nSize<4 ) pInfo->nSize = 4;
64162 0 305 if( nPayload>=0x80 ){
64167 0 0 }while( *(pIter)>=0x80 && pIter
0 0 }while( *(pIter)>=0x80 && pIter
64175 305 0 if( nPayload<=pPage->maxLocal ){
64180 0 305 if( pInfo->nSize<4 ) pInfo->nSize = 4;
64221 0 22 if( nSize>=0x80 ){
64226 0 0 }while( *(pIter)>=0x80 && pIter
0 0 }while( *(pIter)>=0x80 && pIter
64229 22 0 if( pPage->intKey ){
64234 6 22 while( (*pIter++)&0x80 && pIter
6 0 while( (*pIter++)&0x80 && pIter
64238 22 0 if( nSize<=pPage->maxLocal ){
64240 0 22 if( nSize<4 ) nSize = 4;
64246 0 0 if( nSize>pPage->maxLocal ){
64271 0 0 while( (*pIter++)&0x80 && pIter
0 0 while( (*pIter++)&0x80 && pIter
64293 0 0 if( *pRC ) return;
64296 0 0 if( info.nLocal
64350 0 0 if( (int)data[hdr+7]<=nMaxFrag ){
64352 0 0 if( iFree ){
64365 0 0 if( 0==iFree2 || (data[iFree2]==0 && data[iFree2+1]==0) ){
0 0 if( 0==iFree2 || (data[iFree2]==0 && data[iFree2+1]==0) ){
0 0 if( 0==iFree2 || (data[iFree2]==0 && data[iFree2+1]==0) ){
64371 0 0 if( top>=iFree ){
64374 0 0 if( iFree2 ){
64384 0 0 for(pAddr=&data[cellOffset]; pAddr
64386 0 0 if( pc
64387 0 0 else if( pc
64396 0 0 for(i=0; i
64405 0 0 if( pciCellLast ){
0 0 if( pciCellLast ){
64411 0 0 if( cbrkusableSize ){
0 0 if( cbrkusableSize ){
64418 0 0 if( temp==0 ){
64420 0 0 if( cbrk==pc ) continue;
64431 0 0 if( data[hdr+7]+cbrk-iCellFirst!=pPage->nFree ){
64467 89 0 while( pc<=usableSize-4 ){
64472 30 59 if( (x = size - nByte)>=0 ){
64475 0 30 if( size+pc > usableSize ){
64478 30 0 }else if( x<4 ){
64481 0 30 if( aData[hdr+7]>57 ) return 0;
64496 59 0 if( pc
64498 0 59 if( pc ){
64543 0 3491 if( gap>top ){
64544 0 0 if( top==0 && pPage->pBt->usableSize==65536 ){
0 0 if( top==0 && pPage->pBt->usableSize==65536 ){
64558 3402 89 if( (data[hdr+2] || data[hdr+1]) && gap+2<=top ){
0 3402 if( (data[hdr+2] || data[hdr+1]) && gap+2<=top ){
89 0 if( (data[hdr+2] || data[hdr+1]) && gap+2<=top ){
64560 30 59 if( pSpace ){
64564 0 59 }else if( rc ){
64573 0 3461 if( gap+2+nByte>top ){
64576 0 0 if( rc ) return rc;
64631 234 2 if( data[iPtr+1]==0 && data[iPtr]==0 ){
234 0 if( data[iPtr+1]==0 && data[iPtr]==0 ){
64634 0 2 while( (iFreeBlk = get2byte(&data[iPtr]))
64635 0 0 if( iFreeBlk
64636 0 0 if( iFreeBlk==0 ) break;
64641 0 2 if( iFreeBlk>pPage->pBt->usableSize-4 ){
64652 2 0 if( iFreeBlk && iEnd+3>=iFreeBlk ){
2 0 if( iFreeBlk && iEnd+3>=iFreeBlk ){
64654 0 2 if( iEnd>iFreeBlk ) return SQLITE_CORRUPT_PAGE(pPage);
64656 0 2 if( iEnd > pPage->pBt->usableSize ){
64667 0 2 if( iPtr>hdr+1 ){
64669 0 0 if( iPtrEnd+3>=iStart ){
64670 0 0 if( iPtrEnd>iStart ) return SQLITE_CORRUPT_PAGE(pPage);
64676 0 2 if( nFrag>data[hdr+7] ) return SQLITE_CORRUPT_PAGE(pPage);
64680 178 58 if( iStart<=x ){
64684 178 0 if( iStart
0 178 if( iStart
64691 0 236 if( pPage->pBt->btsFlags & BTS_FAST_SECURE ){
64724 483 43 if( flagByte==(PTF_LEAFDATA | PTF_INTKEY) ){
64732 481 2 if( pPage->leaf ){
64742 43 0 }else if( flagByte==PTF_ZERODATA ){
64797 0 84 if( decodeFlags(pPage, data[hdr]) ){
64815 0 84 if( pPage->nCell>MX_CELL(pBt) ){
64835 0 84 if( pBt->db->flags & SQLITE_CellSizeCk ){
64839 0 0 if( !pPage->leaf ) iCellLast--;
64840 0 0 for(i=0; inCell; i++){
64844 0 0 if( pciCellLast ){
0 0 if( pciCellLast ){
64849 0 0 if( pc+sz>usableSize ){
64853 0 0 if( !pPage->leaf ) iCellLast++;
64862 0 84 if( pc>0 ){
64864 0 0 if( pc
64871 0 0 if( pc>iCellLast ){
64878 0 0 if( next<=pc+size+3 ) break;
64881 0 0 if( next>0 ){
64885 0 0 if( pc+size>(unsigned int)usableSize ){
64898 0 84 if( nFree>usableSize ){
64921 0 442 if( pBt->btsFlags & BTS_FAST_SECURE ){
64925 2 440 first = hdr + ((flags&PTF_LEAF)==0 ? 12 : 8);
64949 567 1898 if( pgno!=pPage->pgno ){
64954 237 330 pPage->hdrOffset = pgno==1 ? 100 : 0;
64983 5 2384 if( rc ) return rc;
64997 0 0 if( pDbPage ){
65043 0 6528 if( pgno>btreePagecount(pBt) ){
65048 0 6528 if( rc ){
65052 81 6447 if( (*ppPage)->isInit==0 ){
65055 0 81 if( rc!=SQLITE_OK ){
65065 1452 5076 if( pCur && ((*ppPage)->nCell<1 || (*ppPage)->intKey!=pCur->curIntKey) ){
1452 0 if( pCur && ((*ppPage)->nCell<1 || (*ppPage)->intKey!=pCur->curIntKey) ){
0 1452 if( pCur && ((*ppPage)->nCell<1 || (*ppPage)->intKey!=pCur->curIntKey) ){
65073 0 0 if( pCur ){
65098 105 615 if( pPage ) releasePageNotNull(pPage);
65127 303 0 if( rc==SQLITE_OK ){
65128 0 303 if( sqlite3PagerPageRefcount((*ppPage)->pDbPage)>1 ){
65153 29 0 if( pPage->isInit ){
65156 1 28 if( sqlite3PagerPageRefcount(pData)>1 ){
65216 262 35 const int isTempDb = zFilename==0 || zFilename[0]==0;
3 259 const int isTempDb = zFilename==0 || zFilename[0]==0;
65224 109 153 const int isMemdb = (zFilename && strcmp(zFilename, ":memory:")==0)
65225 38 106 || (isTempDb && sqlite3TempInMemory(db))
38 0 || (isTempDb && sqlite3TempInMemory(db))
65226 262 35 || (vfsFlags & SQLITE_OPEN_MEMORY)!=0;
0 144 || (vfsFlags & SQLITE_OPEN_MEMORY)!=0;
65240 153 144 if( isMemdb ){
65243 262 35 if( (vfsFlags & SQLITE_OPEN_MAIN_DB)!=0 && (isMemdb || isTempDb) ){
109 153 if( (vfsFlags & SQLITE_OPEN_MAIN_DB)!=0 && (isMemdb || isTempDb) ){
3 106 if( (vfsFlags & SQLITE_OPEN_MAIN_DB)!=0 && (isMemdb || isTempDb) ){
65247 0 297 if( !p ){
65262 259 38 if( isTempDb==0 && (isMemdb==0 || (vfsFlags&SQLITE_OPEN_URI)!=0) ){
153 106 if( isTempDb==0 && (isMemdb==0 || (vfsFlags&SQLITE_OPEN_URI)!=0) ){
0 153 if( isTempDb==0 && (isMemdb==0 || (vfsFlags&SQLITE_OPEN_URI)!=0) ){
65263 0 106 if( vfsFlags & SQLITE_OPEN_SHAREDCACHE ){
65270 0 0 if( !zFullPathname ){
65274 0 0 if( isMemdb ){
65279 0 0 if( rc ){
65291 0 0 for(pBt=GLOBAL(BtShared*,sqlite3SharedCacheList); pBt; pBt=pBt->pNext){
65293 0 0 if( 0==strcmp(zFullPathname, sqlite3PagerFilename(pBt->pPager, 0))
65294 0 0 && sqlite3PagerVfs(pBt->pPager)==pVfs ){
65296 0 0 for(iDb=db->nDb-1; iDb>=0; iDb--){
65298 0 0 if( pExisting && pExisting->pBt==pBt ){
0 0 if( pExisting && pExisting->pBt==pBt ){
65326 297 0 if( pBt==0 ){
65339 0 297 if( pBt==0 ){
65345 291 6 if( rc==SQLITE_OK ){
65349 6 291 if( rc!=SQLITE_OK ){
65359 5 286 if( sqlite3PagerIsreadonly(pBt->pPager) ) pBt->btsFlags |= BTS_READ_ONLY;
65369 25 266 if( pBt->pageSize<512 || pBt->pageSize>SQLITE_MAX_PAGE_SIZE
25 0 if( pBt->pageSize<512 || pBt->pageSize>SQLITE_MAX_PAGE_SIZE
65370 0 25 || ((pBt->pageSize-1)&pBt->pageSize)!=0 ){
65379 231 35 if( zFilename && !isMemdb ){
78 153 if( zFilename && !isMemdb ){
65397 0 291 if( rc ) goto btree_open_out;
65405 0 291 if( p->sharable ){
65428 0 291 if( p->sharable ){
65431 0 0 for(i=0; inDb; i++){
65432 0 0 if( (pSib = db->aDb[i].pBt)!=0 && pSib->sharable ){
0 0 if( (pSib = db->aDb[i].pBt)!=0 && pSib->sharable ){
65433 0 0 while( pSib->pPrev ){ pSib = pSib->pPrev; }
65434 0 0 if( (uptr)p->pBt<(uptr)pSib->pBt ){
65439 0 0 while( pSib->pNext && (uptr)pSib->pNext->pBt<(uptr)p->pBt ){
0 0 while( pSib->pNext && (uptr)pSib->pNext->pBt<(uptr)p->pBt ){
65444 0 0 if( p->pNext ){
65457 6 291 if( rc!=SQLITE_OK ){
65458 6 0 if( pBt && pBt->pPager ){
0 6 if( pBt && pBt->pPager ){
65471 291 0 if( sqlite3BtreeSchema(p, 0, 0)==0 ){
65476 100 191 if( pFile->pMethods ){
65504 0 0 if( pBt->nRef<=0 ){
65505 0 0 if( GLOBAL(BtShared*,sqlite3SharedCacheList)==pBt ){
65509 0 0 while( ALWAYS(pList) && pList->pNext!=pBt ){
0 0 while( ALWAYS(pList) && pList->pNext!=pBt ){
65512 0 0 if( ALWAYS(pList) ){
65534 165 3604 if( !pBt->pTmpSpace ){
65552 165 0 if( pBt->pTmpSpace ){
65563 163 128 if( pBt->pTmpSpace ){
65581 5 289 while( pCur ){
65584 5 0 if( pTmp->pBtree==p ){
65601 0 289 if( !p->sharable || removeFromSharingList(pBt) ){
0 0 if( !p->sharable || removeFromSharingList(pBt) ){
65609 254 35 if( pBt->xFreeSchema && pBt->pSchema ){
254 0 if( pBt->xFreeSchema && pBt->pSchema ){
65620 0 289 if( p->pPrev ) p->pPrev->pNext = p->pNext;
65621 0 289 if( p->pNext ) p->pNext->pPrev = p->pPrev;
65729 2 32 if( pBt->btsFlags & BTS_PAGESIZE_FIXED ){
65733 32 0 if( nReserve<0 ){
65737 2 30 if( pageSize>=512 && pageSize<=SQLITE_MAX_PAGE_SIZE &&
2 0 if( pageSize>=512 && pageSize<=SQLITE_MAX_PAGE_SIZE &&
2 0 if( pageSize>=512 && pageSize<=SQLITE_MAX_PAGE_SIZE &&
65746 0 32 if( iFix ) pBt->btsFlags |= BTS_PAGESIZE_FIXED;
65830 0 10 if( p==0 ) return 0;
65834 5 5 if( newFlag>=0 ){
65858 0 0 if( (pBt->btsFlags & BTS_PAGESIZE_FIXED)!=0 && (av ?1:0)!=pBt->autoVacuum ){
0 0 if( (pBt->btsFlags & BTS_PAGESIZE_FIXED)!=0 && (av ?1:0)!=pBt->autoVacuum ){
65880 0 0 (!p->pBt->autoVacuum)?BTREE_AUTOVACUUM_NONE:
65881 0 0 (!p->pBt->incrVacuum)?BTREE_AUTOVACUUM_FULL:
65939 2 2031 if( rc!=SQLITE_OK ) return rc;
65941 0 2031 if( rc!=SQLITE_OK ) return rc;
65948 1707 324 if( nPage==0 || memcmp(24+(u8*)pPage1->aData, 92+(u8*)pPage1->aData,4)!=0 ){
0 1707 if( nPage==0 || memcmp(24+(u8*)pPage1->aData, 92+(u8*)pPage1->aData,4)!=0 ){
65951 0 2031 if( (pBt->db->flags & SQLITE_ResetDatabase)!=0 ){
65954 1707 324 if( nPage>0 ){
65962 0 1707 if( memcmp(page1, zMagicHeader, 16)!=0 ){
65974 0 1707 if( page1[18]>2 ){
65977 0 1707 if( page1[19]>2 ){
65989 0 1707 if( page1[19]==2 && (pBt->btsFlags & BTS_NO_WAL)==0 ){
0 0 if( page1[19]==2 && (pBt->btsFlags & BTS_NO_WAL)==0 ){
65992 0 0 if( rc!=SQLITE_OK ){
65996 0 0 if( isOpen==0 ){
66013 0 1707 if( memcmp(&page1[21], "\100\040\040",3)!=0 ){
66022 1707 0 if( ((pageSize-1)&pageSize)!=0
66023 1707 0 || pageSize>SQLITE_MAX_PAGE_SIZE
66024 1707 0 || pageSize<=256
66037 0 1707 if( (u32)pageSize!=pBt->pageSize ){
66052 1707 0 if( sqlite3WritableSchema(pBt->db)==0 && nPage>nPageFile ){
0 1707 if( sqlite3WritableSchema(pBt->db)==0 && nPage>nPageFile ){
66059 0 1707 if( usableSize<480 ){
66087 2031 0 if( pBt->maxLocal>127 ){
66138 2614 5287 if( pBt->inTransaction==TRANS_NONE && pBt->pPage1!=0 ){
2031 583 if( pBt->inTransaction==TRANS_NONE && pBt->pPage1!=0 ){
66158 843 155 if( pBt->nPage>0 ){
66165 0 155 if( rc ) return rc;
66251 2134 2797 if( p->inTrans==TRANS_WRITE || (p->inTrans==TRANS_READ && !wrflag) ){
246 1888 if( p->inTrans==TRANS_WRITE || (p->inTrans==TRANS_READ && !wrflag) ){
0 246 if( p->inTrans==TRANS_WRITE || (p->inTrans==TRANS_READ && !wrflag) ){
66256 0 1888 if( (p->db->flags & SQLITE_ResetDatabase)
66257 0 0 && sqlite3PagerIsreadonly(pBt->pPager)==0
66263 4 1884 if( (pBt->btsFlags & BTS_READ_ONLY)!=0 && wrflag ){
2 2 if( (pBt->btsFlags & BTS_READ_ONLY)!=0 && wrflag ){
66275 1004 882 if( (wrflag && pBt->inTransaction==TRANS_WRITE)
1004 0 if( (wrflag && pBt->inTransaction==TRANS_WRITE)
66276 0 1886 || (pBt->btsFlags & BTS_PENDING)!=0
66279 10 1876 }else if( wrflag>1 ){
66281 0 10 for(pIter=pBt->pLock; pIter; pIter=pIter->pNext){
66282 0 0 if( pIter->pBtree!=p ){
66288 0 1886 if( pBlock ){
66300 0 1886 if( SQLITE_OK!=rc ) goto trans_begun;
66303 356 1530 if( pBt->nPage==0 ) pBt->btsFlags |= BTS_INITIALLY_EMPTY;
66312 2033 2031 while( pBt->pPage1==0 && SQLITE_OK==(rc = lockBtree(pBt)) );
2031 2 while( pBt->pPage1==0 && SQLITE_OK==(rc = lockBtree(pBt)) );
66314 2031 2 if( rc==SQLITE_OK && wrflag ){
1149 882 if( rc==SQLITE_OK && wrflag ){
66315 0 1149 if( (pBt->btsFlags & BTS_READ_ONLY)!=0 ){
66319 997 152 if( rc==SQLITE_OK ){
66321 0 152 }else if( rc==SQLITE_BUSY_SNAPSHOT && pBt->inTransaction==TRANS_NONE ){
0 0 }else if( rc==SQLITE_BUSY_SNAPSHOT && pBt->inTransaction==TRANS_NONE ){
66330 154 1879 if( rc!=SQLITE_OK ){
66334 154 1879 btreeInvokeBusyHandler(pBt) );
66337 1879 7 if( rc==SQLITE_OK ){
66338 1879 0 if( p->inTrans==TRANS_NONE ){
66341 0 1879 if( p->sharable ){
66349 997 882 p->inTrans = (wrflag?TRANS_WRITE:TRANS_READ);
66350 1879 0 if( p->inTrans>pBt->inTransaction ){
66353 997 882 if( wrflag ){
66359 10 987 if( wrflag>1 ) pBt->btsFlags |= BTS_EXCLUSIVE;
66368 0 997 if( pBt->nPage!=get4byte(&pPage1->aData[28]) ){
66370 0 0 if( rc==SQLITE_OK ){
66378 4922 9 if( rc==SQLITE_OK ){
66379 4744 178 if( pSchemaVersion ){
66382 3416 1506 if( wrflag ){
66411 0 0 rc = pPage->isInit ? SQLITE_OK : btreeInitPage(pPage);
66412 0 0 if( rc!=SQLITE_OK ) return rc;
66415 0 0 for(i=0; i
66420 0 0 if( !pPage->leaf ){
66426 0 0 if( !pPage->leaf ){
66451 0 0 if( eType==PTRMAP_OVERFLOW2 ){
66453 0 0 if( get4byte(pPage->aData)!=iFrom ){
66462 0 0 rc = pPage->isInit ? SQLITE_OK : btreeInitPage(pPage);
66463 0 0 if( rc ) return rc;
66466 0 0 for(i=0; i
66468 0 0 if( eType==PTRMAP_OVERFLOW1 ){
66471 0 0 if( info.nLocal
66472 0 0 if( pCell+info.nSize > pPage->aData+pPage->pBt->usableSize ){
66475 0 0 if( iFrom==get4byte(pCell+info.nSize-4) ){
66481 0 0 if( get4byte(pCell)==iFrom ){
66488 0 0 if( i==nCell ){
66526 0 0 if( iDbPage<3 ) return SQLITE_CORRUPT_BKPT;
66532 0 0 if( rc!=SQLITE_OK ){
66545 0 0 if( eType==PTRMAP_BTREE || eType==PTRMAP_ROOTPAGE ){
0 0 if( eType==PTRMAP_BTREE || eType==PTRMAP_ROOTPAGE ){
66547 0 0 if( rc!=SQLITE_OK ){
66552 0 0 if( nextOvfl!=0 ){
66554 0 0 if( rc!=SQLITE_OK ){
66564 0 0 if( eType!=PTRMAP_ROOTPAGE ){
66566 0 0 if( rc!=SQLITE_OK ){
66570 0 0 if( rc!=SQLITE_OK ){
66576 0 0 if( rc==SQLITE_OK ){
66610 0 0 if( !PTRMAP_ISPAGE(pBt, iLastPg) && iLastPg!=PENDING_BYTE_PAGE(pBt) ){
0 0 if( !PTRMAP_ISPAGE(pBt, iLastPg) && iLastPg!=PENDING_BYTE_PAGE(pBt) ){
66615 0 0 if( nFreeList==0 ){
66620 0 0 if( rc!=SQLITE_OK ){
66623 0 0 if( eType==PTRMAP_ROOTPAGE ){
66627 0 0 if( eType==PTRMAP_FREEPAGE ){
66628 0 0 if( bCommit==0 ){
66637 0 0 if( rc!=SQLITE_OK ){
66650 0 0 if( rc!=SQLITE_OK ){
66661 0 0 if( bCommit==0 ){
66668 0 0 if( rc!=SQLITE_OK ){
66673 0 0 }while( bCommit && iFreePg>nFin );
0 0 }while( bCommit && iFreePg>nFin );
66678 0 0 if( rc!=SQLITE_OK ){
66684 0 0 if( bCommit==0 ){
66687 0 0 }while( iLastPg==PENDING_BYTE_PAGE(pBt) || PTRMAP_ISPAGE(pBt, iLastPg) );
0 0 }while( iLastPg==PENDING_BYTE_PAGE(pBt) || PTRMAP_ISPAGE(pBt, iLastPg) );
66707 0 0 if( nOrig>PENDING_BYTE_PAGE(pBt) && nFin
0 0 if( nOrig>PENDING_BYTE_PAGE(pBt) && nFin
66710 0 0 while( PTRMAP_ISPAGE(pBt, nFin) || nFin==PENDING_BYTE_PAGE(pBt) ){
0 0 while( PTRMAP_ISPAGE(pBt, nFin) || nFin==PENDING_BYTE_PAGE(pBt) ){
66731 0 0 if( !pBt->autoVacuum ){
66738 0 0 if( nOrig
66740 0 0 }else if( nFree>0 ){
66742 0 0 if( rc==SQLITE_OK ){
66746 0 0 if( rc==SQLITE_OK ){
66775 0 0 if( !pBt->incrVacuum ){
66782 0 0 if( PTRMAP_ISPAGE(pBt, nOrig) || nOrig==PENDING_BYTE_PAGE(pBt) ){
0 0 if( PTRMAP_ISPAGE(pBt, nOrig) || nOrig==PENDING_BYTE_PAGE(pBt) ){
66792 0 0 if( nFin>nOrig ) return SQLITE_CORRUPT_BKPT;
66793 0 0 if( nFin
66796 0 0 for(iFree=nOrig; iFree>nFin && rc==SQLITE_OK; iFree--){
0 0 for(iFree=nOrig; iFree>nFin && rc==SQLITE_OK; iFree--){
66799 0 0 if( (rc==SQLITE_DONE || rc==SQLITE_OK) && nFree>0 ){
0 0 if( (rc==SQLITE_DONE || rc==SQLITE_OK) && nFree>0 ){
0 0 if( (rc==SQLITE_DONE || rc==SQLITE_OK) && nFree>0 ){
66807 0 0 if( rc!=SQLITE_OK ){
66848 944 1507 if( p->inTrans==TRANS_WRITE ){
66852 0 944 if( pBt->autoVacuum ){
66854 0 0 if( rc!=SQLITE_OK ){
66859 0 944 if( pBt->bDoTruncate ){
66881 1977 581 if( p->inTrans>TRANS_NONE && db->nVdbeRead>1 ){
98 1879 if( p->inTrans>TRANS_NONE && db->nVdbeRead>1 ){
66892 1879 581 if( p->inTrans!=TRANS_NONE ){
66895 1879 0 if( 0==pBt->nTransaction ){
66937 529 1926 if( p->inTrans==TRANS_NONE ) return SQLITE_OK;
66944 948 978 if( p->inTrans==TRANS_WRITE ){
66950 0 948 if( rc!=SQLITE_OK && bCleanup==0 ){
0 0 if( rc!=SQLITE_OK && bCleanup==0 ){
66971 169 0 if( rc==SQLITE_OK ){
67009 29 1 if( pBtree ){
67011 0 29 for(p=pBtree->pBt->pCursor; p; p=p->pNext){
67012 0 0 if( writeOnly && (p->curFlags & BTCF_WriteFlag)==0 ){
0 0 if( writeOnly && (p->curFlags & BTCF_WriteFlag)==0 ){
67013 0 0 if( p->eState==CURSOR_VALID || p->eState==CURSOR_SKIPNEXT ){
0 0 if( p->eState==CURSOR_VALID || p->eState==CURSOR_SKIPNEXT ){
67015 0 0 if( rc!=SQLITE_OK ){
67051 604 28 if( tripCode==SQLITE_OK ){
67053 0 604 if( rc ) writeOnly = 0;
67057 28 604 if( tripCode ){
67060 0 28 if( rc2!=SQLITE_OK ) rc = rc2;
67064 49 583 if( p->inTrans==TRANS_WRITE ){
67069 0 49 if( rc2!=SQLITE_OK ){
67076 44 5 if( btreeGetPage(pBt, 1, &pPage1, 0)==SQLITE_OK ){
67079 5 39 if( nPage==0 ) sqlite3PagerPagecount(pBt->pPager, &nPage);
67145 3 3 if( p && p->inTrans==TRANS_WRITE ){
1 2 if( p && p->inTrans==TRANS_WRITE ){
67150 1 0 if( op==SAVEPOINT_ROLLBACK ){
67153 1 0 if( rc==SQLITE_OK ){
67156 1 0 if( rc==SQLITE_OK ){
67157 0 1 if( iSavepoint<0 && (pBt->btsFlags & BTS_INITIALLY_EMPTY)!=0 ){
0 0 if( iSavepoint<0 && (pBt->btsFlags & BTS_INITIALLY_EMPTY)!=0 ){
67244 3769 1518 if( wrFlag ){
67246 0 3769 if( pBt->pTmpSpace==0 ) return SQLITE_NOMEM_BKPT;
67248 997 4290 if( iTable==1 && btreePagecount(pBt)==0 ){
167 830 if( iTable==1 && btreePagecount(pBt)==0 ){
67261 3769 1518 pCur->curPagerFlags = wrFlag ? 0 : PAGER_GET_READONLY;
67264 646 5287 for(pX=pBt->pCursor; pX; pX=pX->pNext){
67265 432 214 if( pX->pgnoRoot==(Pgno)iTable ){
67283 0 5287 if( iTable<1 ){
67323 5287 0 if( pBtree ){
67327 5066 221 if( pBt->pCursor==pCur ){
67332 221 6 if( pPrev->pNext==pCur ){
67337 6 0 }while( ALWAYS(pPrev) );
67375 10163 805 if( pCur->info.nSize==0 ){
67481 0 0 if( pBt->autoVacuum ){
67486 0 0 while( PTRMAP_ISPAGE(pBt, iGuess) || iGuess==PENDING_BYTE_PAGE(pBt) ){
0 0 while( PTRMAP_ISPAGE(pBt, iGuess) || iGuess==PENDING_BYTE_PAGE(pBt) ){
67490 0 0 if( iGuess<=btreePagecount(pBt) ){
67492 0 0 if( rc==SQLITE_OK && eType==PTRMAP_OVERFLOW2 && pgno==ovfl ){
0 0 if( rc==SQLITE_OK && eType==PTRMAP_OVERFLOW2 && pgno==ovfl ){
0 0 if( rc==SQLITE_OK && eType==PTRMAP_OVERFLOW2 && pgno==ovfl ){
67501 0 0 if( rc==SQLITE_OK ){
67502 0 0 rc = btreeGetPage(pBt, ovfl, &pPage, (ppPage==0) ? PAGER_GET_READONLY : 0);
67504 0 0 if( rc==SQLITE_OK ){
67510 0 0 if( ppPage ){
67515 0 0 return (rc==SQLITE_DONE ? SQLITE_OK : rc);
67536 0 69 if( eOp ){
67539 0 0 if( rc!=SQLITE_OK ){
67606 0 21 if( (uptr)(aPayload - pPage->aData) > (pBt->usableSize - pCur->info.nLocal) ){
67616 21 0 if( offsetinfo.nLocal ){
67618 6 15 if( a+offset>pCur->info.nLocal ){
67630 21 0 if( rc==SQLITE_OK && amt>0 ){
6 15 if( rc==SQLITE_OK && amt>0 ){
67643 6 0 if( (pCur->curFlags & BTCF_ValidOvfl)==0 ){
67645 0 6 if( pCur->aOverflow==0
67646 0 0 || nOvfl*(int)sizeof(Pgno) > sqlite3MallocSize(pCur->aOverflow)
67651 0 6 if( aNew==0 ){
67664 0 0 if( pCur->aOverflow[offset/ovflSize] ){
67672 48 0 while( nextPage ){
67679 0 48 if( offset>=ovflSize ){
67688 0 0 if( pCur->aOverflow[iIdx+1] ){
67699 42 6 if( a + offset > ovflSize ){
67735 48 0 rc = sqlite3PagerGet(pBt->pPager, nextPage, &pDbPage,
67738 48 0 if( rc==SQLITE_OK ){
67747 6 42 if( amt==0 ) return rc;
67750 0 42 if( rc ) break;
67755 15 0 if( rc==SQLITE_OK && amt>0 ){
0 15 if( rc==SQLITE_OK && amt>0 ){
67800 0 0 if ( pCur->eState==CURSOR_INVALID ){
67805 0 0 return rc ? rc : accessPayload(pCur, offset, amt, pBuf, 0);
67808 15 0 if( pCur->eState==CURSOR_VALID ){
67850 0 7600 if( amt>(int)(pCur->pPage->aDataEnd - pCur->info.pPayload) ){
67896 0 1452 if( pCur->iPage>=(BTCURSOR_MAX_DEPTH-1) ){
67990 508 5210 if( pCur->iPage>=0 ){
67991 0 508 if( pCur->iPage ){
67993 0 0 while( --pCur->iPage ){
67999 167 5043 }else if( pCur->pgnoRoot==0 ){
68004 0 5043 if( pCur->eState>=CURSOR_REQUIRESEEK ){
68005 0 0 if( pCur->eState==CURSOR_FAULT ){
68013 0 5043 if( rc!=SQLITE_OK ){
68034 5551 0 if( pRoot->isInit==0 || (pCur->pKeyInfo==0)!=pRoot->intKey ){
0 5551 if( pRoot->isInit==0 || (pCur->pKeyInfo==0)!=pRoot->intKey ){
68044 4801 750 if( pRoot->nCell>0 ){
68046 0 750 }else if( !pRoot->leaf ){
68048 0 0 if( pRoot->pgno!=1 ) return SQLITE_CORRUPT_BKPT;
68073 831 0 while( rc==SQLITE_OK && !(pPage = pCur->pPage)->leaf ){
12 819 while( rc==SQLITE_OK && !(pPage = pCur->pPage)->leaf ){
68098 1436 2775 while( !(pPage = pCur->pPage)->leaf ){
68102 0 1436 if( rc ) return rc;
68120 807 239 if( rc==SQLITE_OK ){
68124 239 0 }else if( rc==SQLITE_EMPTY ){
68142 0 0 if( ALWAYS(pCur->eState==CURSOR_VALID) ){
68160 2 3084 if( CURSOR_VALID==pCur->eState && (pCur->curFlags & BTCF_AtLast)!=0 ){
1 1 if( CURSOR_VALID==pCur->eState && (pCur->curFlags & BTCF_AtLast)!=0 ){
68175 2775 310 if( rc==SQLITE_OK ){
68179 2775 0 if( rc==SQLITE_OK ){
68184 310 0 }else if( rc==SQLITE_EMPTY ){
68240 4141 184 if( pIdxKey==0
68241 2949 1192 && pCur->eState==CURSOR_VALID && (pCur->curFlags & BTCF_ValidNKey)!=0
2943 6 && pCur->eState==CURSOR_VALID && (pCur->curFlags & BTCF_ValidNKey)!=0
68243 0 2943 if( pCur->info.nKey==intKey ){
68247 2770 173 if( pCur->info.nKey
68248 2770 0 if( (pCur->curFlags & BTCF_AtLast)!=0 ){
68256 0 0 if( pCur->info.nKey+1==intKey && !pCur->skipNext ){
0 0 if( pCur->info.nKey+1==intKey && !pCur->skipNext ){
68259 0 0 if( rc==SQLITE_OK ){
68261 0 0 if( pCur->info.nKey==intKey ){
68264 0 0 }else if( rc==SQLITE_DONE ){
68273 184 1371 if( pIdxKey ){
68285 352 1203 if( rc ){
68286 352 0 if( rc==SQLITE_EMPTY ){
68318 1052 151 if( xRecordCompare==0 ){
68322 3018 0 if( pPage->intKeyLeaf ){
68323 39 3018 while( 0x80 <= *(pCell++) ){
68324 0 39 if( pCell>=pPage->aDataEnd ){
68330 2053 965 if( nCellKey
68332 154 1899 if( lwr>upr ){ c = -1; break; }
68333 68 897 }else if( nCellKey>intKey ){
68335 1 67 if( lwr>upr ){ c = +1; break; }
68339 0 897 if( !pPage->leaf ){
68367 332 0 if( nCell<=pPage->max1bytePayload ){
68373 0 0 }else if( !(pCell[1] & 0x80)
68374 0 0 && (nCell = ((nCell&0x7f)<<7) + pCell[1])<=pPage->maxLocal
68398 0 0 if( nCell<2 ){
68403 0 0 if( pCellKey==0 ){
68410 0 0 if( rc ){
68421 304 28 if( c<0 ){
68423 25 3 }else if( c>0 ){
68430 0 3 if( pIdxKey->errCode ) rc = SQLITE_CORRUPT_BKPT;
68433 148 181 if( lwr>upr ) break;
68440 303 0 if( pPage->leaf ){
68448 0 0 if( lwr>=pPage->nCell ){
68455 0 0 if( rc ) break;
68494 0 0 if( NEVER(pCur->eState!=CURSOR_VALID) ) return -1;
68495 0 0 if( NEVER(pCur->pPage->leaf==0) ) return -1;
68498 0 0 for(i=0; iiPage; i++){
68531 16 607 if( pCur->eState!=CURSOR_VALID ){
68533 16 0 rc = restoreCursorPosition(pCur);
68534 0 16 if( rc!=SQLITE_OK ){
68537 8 8 if( CURSOR_INVALID==pCur->eState ){
68540 8 0 if( pCur->skipNext ){
68543 1 7 if( pCur->skipNext>0 ){
68553 0 614 if( !pPage->isInit ){
68571 613 1 if( idx>=pPage->nCell ){
68572 4 609 if( !pPage->leaf ){
68574 0 4 if( rc ) return rc;
68578 597 16 if( pCur->iPage==0 ){
68584 4 12 }while( pCur->ix>=pPage->nCell );
68585 12 0 if( pPage->intKey ){
68591 1 0 if( pPage->leaf ){
68605 16 6265 if( pCur->eState!=CURSOR_VALID ) return btreeNext(pCur);
68607 607 5658 if( (++pCur->ix)>=pPage->nCell ){
68611 5650 8 if( pPage->leaf ){
68646 0 58 if( pCur->eState!=CURSOR_VALID ){
68647 0 0 rc = restoreCursorPosition(pCur);
68648 0 0 if( rc!=SQLITE_OK ){
68651 0 0 if( CURSOR_INVALID==pCur->eState ){
68654 0 0 if( pCur->skipNext ){
68657 0 0 if( pCur->skipNext<0 ){
68667 0 58 if( !pPage->leaf ){
68670 0 0 if( rc ) return rc;
68673 58 0 while( pCur->ix==0 ){
68674 58 0 if( pCur->iPage==0 ){
68685 0 0 if( pPage->intKey && !pPage->leaf ){
0 0 if( pPage->intKey && !pPage->leaf ){
68700 231 0 if( pCur->eState!=CURSOR_VALID
68701 173 58 || pCur->ix==0
68702 0 173 || pCur->pPage->leaf==0
68755 0 302 if( n>=mxPage ){
68758 2 300 if( n>0 ){
68769 0 2 if( eMode==BTALLOC_EXACT ){
68770 0 0 if( nearby<=mxPage ){
68775 0 0 if( rc ) return rc;
68776 0 0 if( eType==PTRMAP_FREEPAGE ){
68780 0 2 }else if( eMode==BTALLOC_LE ){
68789 0 2 if( rc ) return rc;
68799 0 2 if( pPrevTrunk ){
68811 2 0 if( iTrunk>mxPage || nSearch++ > n ){
0 2 if( iTrunk>mxPage || nSearch++ > n ){
68816 0 2 if( rc ){
68825 1 1 if( k==0 && !searchList ){
1 0 if( k==0 && !searchList ){
68831 0 1 if( rc ){
68839 0 1 }else if( k>(u32)(pBt->usableSize/4 - 2) ){
68844 0 1 }else if( searchList
68845 0 0 && (nearby==iTrunk || (iTrunk
0 0 && (nearby==iTrunk || (iTrunk
0 0 && (nearby==iTrunk || (iTrunk
68854 0 0 if( rc ){
68857 0 0 if( k==0 ){
68858 0 0 if( !pPrevTrunk ){
68862 0 0 if( rc!=SQLITE_OK ){
68874 0 0 if( iNewTrunk>mxPage ){
68880 0 0 if( rc!=SQLITE_OK ){
68884 0 0 if( rc!=SQLITE_OK ){
68892 0 0 if( !pPrevTrunk ){
68897 0 0 if( rc ){
68906 1 0 }else if( k>0 ){
68911 1 0 if( nearby>0 ){
68914 0 1 if( eMode==BTALLOC_LE ){
68915 0 0 for(i=0; i
68917 0 0 if( iPage<=nearby ){
68925 0 1 for(i=1; i
68927 0 0 if( d2
68939 0 1 if( iPage>mxPage ){
68944 0 1 if( !searchList
68945 0 0 || (iPage==nearby || (iPage
0 0 || (iPage==nearby || (iPage
0 0 || (iPage==nearby || (iPage
68953 0 1 if( rc ) goto end_allocate_page;
68954 0 1 if( closest
68960 1 0 if( rc==SQLITE_OK ){
68962 0 1 if( rc!=SQLITE_OK ){
68972 0 2 }while( searchList );
68995 0 300 if( rc ) return rc;
68997 0 300 if( pBt->nPage==PENDING_BYTE_PAGE(pBt) ) pBt->nPage++;
69000 0 300 if( pBt->autoVacuum && PTRMAP_ISPAGE(pBt, pBt->nPage) ){
0 0 if( pBt->autoVacuum && PTRMAP_ISPAGE(pBt, pBt->nPage) ){
69009 0 0 if( rc==SQLITE_OK ){
69013 0 0 if( rc ) return rc;
69015 0 0 if( pBt->nPage==PENDING_BYTE_PAGE(pBt) ){ pBt->nPage++; }
69023 0 300 if( rc ) return rc;
69025 0 300 if( rc!=SQLITE_OK ){
69066 0 5 if( iPage<2 ) return SQLITE_CORRUPT_BKPT;
69067 5 0 if( pMemPage ){
69076 0 5 if( rc ) goto freepage_out;
69080 0 5 if( pBt->btsFlags & BTS_SECURE_DELETE ){
69084 0 0 if( (!pPage && ((rc = btreeGetPage(pBt, iPage, &pPage, 0))!=0) )
0 0 if( (!pPage && ((rc = btreeGetPage(pBt, iPage, &pPage, 0))!=0) )
69085 0 0 || ((rc = sqlite3PagerWrite(pPage->pDbPage))!=0)
69095 0 5 if( ISAUTOVACUUM ){
69097 0 0 if( rc ) goto freepage_out;
69107 1 4 if( nFree!=0 ){
69112 0 1 if( rc!=SQLITE_OK ){
69118 0 1 if( nLeaf > (u32)pBt->usableSize/4 - 2 ){
69122 1 0 if( nLeaf < (u32)pBt->usableSize/4 - 8 ){
69143 1 0 if( rc==SQLITE_OK ){
69146 1 0 if( pPage && (pBt->btsFlags & BTS_SECURE_DELETE)==0 ){
1 0 if( pPage && (pBt->btsFlags & BTS_SECURE_DELETE)==0 ){
69162 0 4 if( pPage==0 && SQLITE_OK!=(rc = btreeGetPage(pBt, iPage, &pPage, 0)) ){
0 0 if( pPage==0 && SQLITE_OK!=(rc = btreeGetPage(pBt, iPage, &pPage, 0)) ){
69166 0 4 if( rc!=SQLITE_OK ){
69175 5 0 if( pPage ){
69183 5 0 if( (*pRC)==SQLITE_OK ){
69205 474 0 if( pInfo->nLocal==pInfo->nPayload ){
69210 0 0 if( pCell + pInfo->nSize > pPage->aDataEnd ){
69222 0 0 while( nOvfl-- ){
69225 0 0 if( ovflPgno<2 || ovflPgno>btreePagecount(pBt) ){
0 0 if( ovflPgno<2 || ovflPgno>btreePagecount(pBt) ){
69231 0 0 if( nOvfl ){
69233 0 0 if( rc ) return rc;
69236 0 0 if( ( pOvfl || ((pOvfl = btreePageLookup(pBt, ovflPgno))!=0) )
0 0 if( ( pOvfl || ((pOvfl = btreePageLookup(pBt, ovflPgno))!=0) )
69237 0 0 && sqlite3PagerPageRefcount(pOvfl->pDbPage)!=1
69254 0 0 if( pOvfl ){
69257 0 0 if( rc ) return rc;
69301 3636 63 if( pPage->intKey ){
69306 3602 34 nHeader += putVarint32(&pCell[nHeader], nPayload);
69312 63 0 nHeader += putVarint32(&pCell[nHeader], nPayload);
69317 3693 6 if( nPayload<=pPage->maxLocal ){
69323 0 3693 if( n<4 ) n = 4;
69339 6 0 if( n > pPage->maxLocal ) n = mn;
69373 48 6 if( n>spaceLeft ) n = spaceLeft;
69384 54 0 if( nSrc>=n ){
69386 0 0 }else if( nSrc>0 ){
69393 6 48 if( nPayload<=0 ) break;
69398 48 0 if( spaceLeft==0 ){
69402 0 48 if( pBt->autoVacuum ){
69406 0 0 PTRMAP_ISPAGE(pBt, pgnoOvfl) || pgnoOvfl==PENDING_BYTE_PAGE(pBt)
69407 0 0 );
69422 0 48 if( pBt->autoVacuum && rc==SQLITE_OK ){
0 0 if( pBt->autoVacuum && rc==SQLITE_OK ){
69423 0 0 u8 eType = (pgnoPtrmap?PTRMAP_OVERFLOW2:PTRMAP_OVERFLOW1);
69425 0 0 if( rc ){
69430 0 48 if( rc ){
69472 0 236 if( *pRC ) return;
69483 0 236 if( pc+sz > pPage->pBt->usableSize ){
69488 0 236 if( rc ){
69493 139 97 if( pPage->nCell==0 ){
69547 3497 0 if( pPage->nOverflow || sz+2>pPage->nFree ){
6 3491 if( pPage->nOverflow || sz+2>pPage->nFree ){
69548 0 6 if( pTemp ){
69552 0 6 if( iChild ){
69572 0 3491 if( rc!=SQLITE_OK ){
69580 0 3491 if( rc ){ *pRC = rc; return; }
69588 6 3485 if( iChild ){
69596 6 3485 if( (++data[pPage->hdrOffset+4])==0 ) data[pPage->hdrOffset+3]++;
69599 0 3491 if( pPage->pBt->autoVacuum ){
69627 0 0 while( N>0 ){
69629 0 0 if( p->szCell[idx]==0 ){
69651 0 0 if( p->szCell[N] ) return p->szCell[N];
69687 6 6 for(i=0; i
69689 3 3 if( SQLITE_WITHIN(pCell,aData,pEnd) ){
0 3 if( SQLITE_WITHIN(pCell,aData,pEnd) ){
69695 0 6 if( pData < pCellptr ) return SQLITE_CORRUPT_BKPT;
69751 0 0 for(i=iFirst; i
69755 0 0 if( (aData[1]==0 && aData[2]==0) || (pSlot = pageFindSlot(pPg,sz,&rc))==0 ){
0 0 if( (aData[1]==0 && aData[2]==0) || (pSlot = pageFindSlot(pPg,sz,&rc))==0 ){
0 0 if( (aData[1]==0 && aData[2]==0) || (pSlot = pageFindSlot(pPg,sz,&rc))==0 ){
69756 0 0 if( (pData - pBegin)
69798 0 0 for(i=iFirst; i
69800 0 0 if( SQLITE_WITHIN(pCell, pStart, pEnd) ){
0 0 if( SQLITE_WITHIN(pCell, pStart, pEnd) ){
69806 0 0 if( pFree!=(pCell + sz) ){
69807 0 0 if( pFree ){
69813 0 0 if( pFree+sz>pEnd ) return 0;
69821 0 0 if( pFree ){
69863 0 0 if( iOld
69868 0 0 if( iNewEnd < iOldEnd ){
69873 0 0 if( pData
69876 0 0 if( iNew
69881 0 0 if( pageInsertArray(
69889 0 0 for(i=0; inOverflow; i++){
69891 0 0 if( iCell>=0 && iCell
0 0 if( iCell>=0 && iCell
69895 0 0 if( pageInsertArray(
69904 0 0 if( pageInsertArray(
69985 0 6 if( NEVER(pPage->nCell==0) ) return SQLITE_CORRUPT_BKPT;
69993 6 0 if( rc==SQLITE_OK ){
70004 0 6 if( NEVER(rc) ) return rc;
70016 0 6 if( ISAUTOVACUUM ){
70018 0 0 if( szCell>pNew->minLocal ){
70038 0 6 while( (*(pCell++)&0x80) && pCell
0 0 while( (*(pCell++)&0x80) && pCell
70040 6 6 while( ((*(pOut++) = *(pCell++))&0x80) && pCell
6 0 while( ((*(pOut++) = *(pCell++))&0x80) && pCell
70043 6 0 if( rc==SQLITE_OK ){
70119 2 0 if( (*pRC)==SQLITE_OK ){
70124 0 2 int const iToHdr = ((pTo->pgno==1) ? 100 : 0);
70145 0 2 if( rc!=SQLITE_OK ){
70153 0 2 if( ISAUTOVACUUM ){
70254 0 0 if( !aOvflSpace ){
70270 0 0 if( i<2 ){
70274 0 0 if( iParentIdx==0 ){
70276 0 0 }else if( iParentIdx==i ){
70284 0 0 if( (i+nxDiv-pParent->nOverflow)==pParent->nCell ){
70292 0 0 if( rc ){
70297 0 0 if( (i--)==0 ) break;
70299 0 0 if( pParent->nOverflow && i+nxDiv==pParent->aiOvfl[0] ){
0 0 if( pParent->nOverflow && i+nxDiv==pParent->aiOvfl[0] ){
70321 0 0 if( pBt->btsFlags & BTS_FAST_SECURE ){
70325 0 0 if( (iOff+szNew[i])>(int)pBt->usableSize ){
70352 0 0 if( b.apCell==0 ){
70379 0 0 for(i=0; i
70390 0 0 if( pOld->aData[0]!=apOld[0]->aData[0] ){
70413 0 0 if( pOld->nOverflow>0 ){
70415 0 0 for(j=0; j
70420 0 0 for(k=0; knOverflow; k++){
70427 0 0 while( piCell
70435 0 0 if( i
0 0 if( i
70448 0 0 if( !pOld->leaf ){
70456 0 0 while( b.szCell[b.nCell]<4 ){
70486 0 0 for(i=0; i
70489 0 0 for(j=0; jnOverflow; j++){
70495 0 0 for(i=0; i
70497 0 0 while( szNew[i]>usableSpace ){
70498 0 0 if( i+1>=k ){
70500 0 0 if( k>NB+2 ){ rc = SQLITE_CORRUPT_BKPT; goto balance_cleanup; }
70506 0 0 if( !leafData ){
70507 0 0 if( cntNew[i]
70516 0 0 while( cntNew[i]
70518 0 0 if( szNew[i]+sz>usableSpace ) break;
70521 0 0 if( !leafData ){
70522 0 0 if( cntNew[i]
70530 0 0 if( cntNew[i]>=b.nCell ){
70532 0 0 }else if( cntNew[i] <= (i>0 ? cntNew[i-1] : 0) ){
0 0 }else if( cntNew[i] <= (i>0 ? cntNew[i-1] : 0) ){
70549 0 0 for(i=k-1; i>0; i--){
70562 0 0 if( szRight!=0
70563 0 0 && (bBulk || szRight+b.szCell[d]+2 > szLeft-(b.szCell[r]+(i==k-1?0:2)))){
0 0 && (bBulk || szRight+b.szCell[d]+2 > szLeft-(b.szCell[r]+(i==k-1?0:2)))){
0 0 && (bBulk || szRight+b.szCell[d]+2 > szLeft-(b.szCell[r]+(i==k-1?0:2)))){
70571 0 0 }while( r>=0 );
70574 0 0 if( cntNew[i-1] <= (i>1 ? cntNew[i-2] : 0) ){
0 0 if( cntNew[i-1] <= (i>1 ? cntNew[i-2] : 0) ){
70598 0 0 for(i=0; i
70600 0 0 if( i
70605 0 0 if( rc ) goto balance_cleanup;
70608 0 0 rc = allocateBtreePage(pBt, &pNew, &pgno, (bBulk ? 1 : pgno), 0);
70609 0 0 if( rc ) goto balance_cleanup;
70616 0 0 if( ISAUTOVACUUM ){
70618 0 0 if( rc!=SQLITE_OK ){
70637 0 0 for(i=0; i
70640 0 0 for(j=0; j
70641 0 0 if( aPgno[j]==aPgno[i] ){
70654 0 0 for(i=0; i
70656 0 0 for(j=1; j
70657 0 0 if( aPgOrder[j]
70661 0 0 if( iBest!=i ){
70662 0 0 if( iBest>i ){
70689 0 0 if( (pageFlags & PTF_LEAF)==0 && nOld!=nNew ){
0 0 if( (pageFlags & PTF_LEAF)==0 && nOld!=nNew ){
70690 0 0 MemPage *pOld = (nNew>nOld ? apNew : apOld)[nOld-1];
70710 0 0 if( ISAUTOVACUUM ){
70718 0 0 for(i=0; i
70720 0 0 if( i==cntOldNext ){
70721 0 0 MemPage *pOld = (++iOld)
70725 0 0 if( i==cntNew[iNew] ){
70727 0 0 if( !leafData ) continue;
70736 0 0 if( iOld>=nNew
70737 0 0 || pNew->pgno!=aPgno[iOld]
70738 0 0 || !SQLITE_WITHIN(pCell,aOld,&aOld[usableSize])
0 0 || !SQLITE_WITHIN(pCell,aOld,&aOld[usableSize])
70740 0 0 if( !leafCorrection ){
70743 0 0 if( cachedCellSize(&b,i)>pNew->minLocal ){
70746 0 0 if( rc ) goto balance_cleanup;
70752 0 0 for(i=0; i
70764 0 0 if( !pNew->leaf ){
70766 0 0 }else if( leafData ){
70791 0 0 if( b.szCell[j]==4 ){
70800 0 0 if( rc!=SQLITE_OK ) goto balance_cleanup;
70826 0 0 for(i=1-nNew; i
70829 0 0 if( abDone[iPg] ) continue; /* Skip pages already processed */
70830 0 0 if( i>=0 /* On the upwards pass, or... */
70831 0 0 || cntOld[iPg-1]>=cntNew[iPg-1] /* Condition (1) is true */
70845 0 0 if( iPg==0 ){
70849 0 0 iOld = iPg
70855 0 0 if( rc ) goto balance_cleanup;
70869 0 0 if( isRoot && pParent->nCell==0 && pParent->hdrOffset<=apNew[0]->nFree ){
0 0 if( isRoot && pParent->nCell==0 && pParent->hdrOffset<=apNew[0]->nFree ){
0 0 if( isRoot && pParent->nCell==0 && pParent->hdrOffset<=apNew[0]->nFree ){
70894 0 0 }else if( ISAUTOVACUUM && !leafCorrection ){
0 0 }else if( ISAUTOVACUUM && !leafCorrection ){
70898 0 0 for(i=0; i
70910 0 0 for(i=nNew; i
70930 0 0 for(i=0; i
70933 0 0 for(i=0; i
70974 2 0 if( rc==SQLITE_OK ){
70977 0 2 if( ISAUTOVACUUM ){
70981 0 2 if( rc ){
71030 26 6 if( iPage==0 ){
71031 2 24 if( pPage->nOverflow ){
71040 2 0 if( rc==SQLITE_OK ){
71051 0 6 }else if( pPage->nOverflow==0 && pPage->nFree<=nMin ){
0 0 }else if( pPage->nOverflow==0 && pPage->nFree<=nMin ){
71058 6 0 if( rc==SQLITE_OK ){
71060 6 0 if( pPage->intKeyLeaf
71061 6 0 && pPage->nOverflow==1
71062 6 0 && pPage->aiOvfl[0]==pPage->nCell
71063 6 0 && pParent->pgno!=1
71064 6 0 && pParent->nCell==iIdx
71105 0 0 if( pFree ){
71128 8 0 }while( rc==SQLITE_OK );
71130 0 24 if( pFree ){
71147 0 1 if( nData<=0 ){
71150 0 0 for(i=0; i
0 0 for(i=0; i
71151 0 0 if( i
71153 0 0 if( rc ) return rc;
71157 0 1 if( nData
71162 0 0 if( rc ) return rc;
71165 1 0 if( memcmp(pDest, ((u8*)pX->pData) + iOffset, iAmt)!=0 ){
71167 0 1 if( rc ) return rc;
71187 0 1 if( pCur->info.pPayload + pCur->info.nLocal > pPage->aDataEnd ){
71193 0 1 if( rc ) return rc;
71194 1 0 if( pCur->info.nLocal==nTotal ) return SQLITE_OK;
71205 0 0 if( rc ) return rc;
71206 0 0 if( sqlite3PagerPageRefcount(pPage->pDbPage)!=1 ){
71209 0 0 if( iOffset+ovflPageSize<(u32)nTotal ){
71218 0 0 if( rc ) return rc;
71220 0 0 }while( iOffset
71273 0 3700 if( pCur->eState==CURSOR_FAULT ){
71302 110 3590 if( pCur->curFlags & BTCF_Multiple ){
71304 0 110 if( rc ) return rc;
71307 3637 63 if( pCur->pKeyInfo==0 ){
71329 3006 631 if( (pCur->curFlags&BTCF_ValidNKey)!=0 && pX->nKey==pCur->info.nKey ){
236 2770 if( (pCur->curFlags&BTCF_ValidNKey)!=0 && pX->nKey==pCur->info.nKey ){
71333 217 19 if( pCur->info.nSize!=0
71334 1 216 && pCur->info.nPayload==(u32)pX->nData+pX->nZero
71340 3221 180 }else if( loc==0 ){
71346 0 3221 if( rc ) return rc;
71361 14 49 if( loc==0 && (flags & BTREE_SAVEPOSITION)==0 ){
14 0 if( loc==0 && (flags & BTREE_SAVEPOSITION)==0 ){
71362 14 0 if( pX->nMem ){
71376 0 14 if( rc ) return rc;
71383 0 63 if( loc==0 ){
71385 0 0 if( pCur->info.nKey==pX->nKey ){
71408 0 3699 if( rc ) goto end_insert;
71412 426 3273 if( loc==0 ){
71416 0 426 if( rc ){
71420 0 426 if( !pPage->leaf ){
71424 208 218 if( info.nSize==szNew && info.nLocal==info.nPayload
208 0 if( info.nSize==szNew && info.nLocal==info.nPayload
71425 0 208 && (!ISAUTOVACUUM || szNewminLocal)
0 0 && (!ISAUTOVACUUM || szNewminLocal)
71437 0 208 if( oldCell+szNew > pPage->aDataEnd ) return SQLITE_CORRUPT_BKPT;
71442 0 218 if( rc ) goto end_insert;
71443 3263 10 }else if( loc<0 && pPage->nCell>0 ){
2931 332 }else if( loc<0 && pPage->nCell>0 ){
71475 6 3485 if( pPage->nOverflow ){
71486 0 6 if( (flags & BTREE_SAVEPOSITION) && rc==SQLITE_OK ){
0 0 if( (flags & BTREE_SAVEPOSITION) && rc==SQLITE_OK ){
71488 0 0 if( pCur->pKeyInfo ){
71491 0 0 if( pCur->pKey==0 ){
71560 16 2 if( bPreserve ){
71561 16 0 if( !pPage->leaf
71562 16 0 || (pPage->nFree+cellSizePtr(pPage,pCell)+2)>(int)(pBt->usableSize*2/3)
71567 0 16 if( rc ) return rc;
71580 0 18 if( !pPage->leaf ){
71583 0 0 if( rc ) return rc;
71588 0 18 if( pCur->curFlags & BTCF_Multiple ){
71590 0 0 if( rc ) return rc;
71595 17 1 if( pCur->pKeyInfo==0 ){
71603 0 18 if( rc ) return rc;
71606 0 18 if( rc ) return rc;
71613 0 18 if( !pPage->leaf ){
71619 0 0 if( iCellDepthiPage-1 ){
71625 0 0 if( pCell<&pLeaf->aData[4] ) return SQLITE_CORRUPT_BKPT;
71631 0 0 if( rc==SQLITE_OK ){
71635 0 0 if( rc ) return rc;
71654 18 0 if( rc==SQLITE_OK && pCur->iPage>iCellDepth ){
0 18 if( rc==SQLITE_OK && pCur->iPage>iCellDepth ){
71657 0 0 while( pCur->iPage>iCellDepth ){
71664 18 0 if( rc==SQLITE_OK ){
71665 0 18 if( bSkipnext ){
71670 0 0 if( iCellIdx>=pPage->nCell ){
71678 16 2 if( bPreserve ){
71682 10 8 if( rc==SQLITE_EMPTY ) rc = SQLITE_OK;
71716 0 246 if( pBt->autoVacuum ){
71737 0 0 while( pgnoRoot==PTRMAP_PAGENO(pBt, pgnoRoot) ||
0 0 while( pgnoRoot==PTRMAP_PAGENO(pBt, pgnoRoot) ||
71749 0 0 if( rc!=SQLITE_OK ){
71753 0 0 if( pgnoMove!=pgnoRoot ){
71768 0 0 if( rc!=SQLITE_OK ){
71774 0 0 if( rc!=SQLITE_OK ){
71778 0 0 if( eType==PTRMAP_ROOTPAGE || eType==PTRMAP_FREEPAGE ){
0 0 if( eType==PTRMAP_ROOTPAGE || eType==PTRMAP_FREEPAGE ){
71781 0 0 if( rc!=SQLITE_OK ){
71791 0 0 if( rc!=SQLITE_OK ){
71795 0 0 if( rc!=SQLITE_OK ){
71799 0 0 if( rc!=SQLITE_OK ){
71809 0 0 if( rc ){
71820 0 0 if( NEVER(rc) ){
71827 0 246 if( rc ) return rc;
71831 203 43 if( createTabFlags & BTREE_INTKEY ){
71868 0 33 if( pgno>btreePagecount(pBt) ){
71872 0 33 if( rc ) return rc;
71873 0 33 if( pPage->bBusy ){
71879 30 33 for(i=0; inCell; i++){
71881 0 30 if( !pPage->leaf ){
71883 0 0 if( rc ) goto cleardatabasepage_out;
71886 0 30 if( rc ) goto cleardatabasepage_out;
71888 0 33 if( !pPage->leaf ){
71890 0 0 if( rc ) goto cleardatabasepage_out;
71891 28 5 }else if( pnChange ){
71896 0 33 if( freePageFlag ){
71898 33 0 }else if( (rc = sqlite3PagerWrite(pPage->pDbPage))==0 ){
71929 33 0 if( SQLITE_OK==rc ){
71979 0 5 if( rc ) return rc;
71981 0 5 if( rc ){
71992 0 5 if( pBt->autoVacuum ){
71996 0 0 if( iTable==maxRootPgno ){
72002 0 0 if( rc!=SQLITE_OK ){
72013 0 0 if( rc!=SQLITE_OK ){
72018 0 0 if( rc!=SQLITE_OK ){
72025 0 0 if( rc!=SQLITE_OK ){
72037 0 0 while( maxRootPgno==PENDING_BYTE_PAGE(pBt)
72038 0 0 || PTRMAP_ISPAGE(pBt, maxRootPgno) ){
72089 0 1150 if( idx==BTREE_DATA_VERSION ){
72120 515 0 if( rc==SQLITE_OK ){
72123 0 515 if( idx==BTREE_INCR_VACUUM ){
72148 6 4 if( rc==SQLITE_EMPTY ){
72156 4 0 while( rc==SQLITE_OK ){
72165 0 4 if( pPage->leaf || !pPage->intKey ){
0 0 if( pPage->leaf || !pPage->intKey ){
72179 4 0 if( pPage->leaf ){
72181 4 0 if( pCur->iPage==0 ){
72187 0 0 }while ( pCur->ix>=pCur->pPage->nCell );
72197 0 0 if( iIdx==pPage->nCell ){
72227 0 0 if( !pCheck->mxErr ) return;
72231 0 0 if( pCheck->errMsg.nChar ){
72234 0 0 if( pCheck->zPfx ){
72239 0 0 if( pCheck->errMsg.accError==SQLITE_NOMEM ){
72274 0 0 if( iPage>pCheck->nPage || iPage==0 ){
0 0 if( iPage>pCheck->nPage || iPage==0 ){
72278 0 0 if( getPageReferenced(pCheck, iPage) ){
72303 0 0 if( rc!=SQLITE_OK ){
72304 0 0 if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ) pCheck->mallocFailed = 1;
0 0 if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ) pCheck->mallocFailed = 1;
72309 0 0 if( ePtrmapType!=eType || iPtrmapParent!=iParent ){
0 0 if( ePtrmapType!=eType || iPtrmapParent!=iParent ){
72330 0 0 while( iPage!=0 && pCheck->mxErr ){
0 0 while( iPage!=0 && pCheck->mxErr ){
72333 0 0 if( checkRef(pCheck, iPage) ) break;
72335 0 0 if( sqlite3PagerGet(pCheck->pPager, (Pgno)iPage, &pOvflPage, 0) ){
72340 0 0 if( isFreeList ){
72343 0 0 if( pCheck->pBt->autoVacuum ){
72347 0 0 if( n>(int)pCheck->pBt->usableSize/4-2 ){
72352 0 0 for(i=0; i
72355 0 0 if( pCheck->pBt->autoVacuum ){
72370 0 0 if( pCheck->pBt->autoVacuum && N>0 ){
0 0 if( pCheck->pBt->autoVacuum && N>0 ){
72379 0 0 if( N && nErrAtStart==pCheck->nErr ){
0 0 if( N && nErrAtStart==pCheck->nErr ){
72380 0 0 checkAppendMsg(pCheck,
72413 0 0 while( (j = i/2)>0 && aHeap[j]>aHeap[i] ){
0 0 while( (j = i/2)>0 && aHeap[j]>aHeap[i] ){
72422 0 0 if( (x = aHeap[0])==0 ) return 0;
72428 0 0 while( (j = i*2)<=aHeap[0] ){
72429 0 0 if( aHeap[j]>aHeap[j+1] ) j++;
72430 0 0 if( aHeap[i]
72490 0 0 if( iPage==0 ) return 0;
72491 0 0 if( checkRef(pCheck, iPage) ) return 0;
72494 0 0 if( (rc = btreeGetPage(pBt, (Pgno)iPage, &pPage, 0))!=0 ){
72504 0 0 if( (rc = btreeInitPage(pPage))!=0 ){
72529 0 0 if( !pPage->leaf ){
72533 0 0 if( pBt->autoVacuum ){
72549 0 0 for(i=nCell-1; i>=0 && pCheck->mxErr; i--){
0 0 for(i=nCell-1; i>=0 && pCheck->mxErr; i--){
72557 0 0 if( pcusableSize-4 ){
0 0 if( pcusableSize-4 ){
72565 0 0 if( pc+info.nSize>usableSize ){
72572 0 0 if( pPage->intKey ){
72573 0 0 if( keyCanBeEqual ? (info.nKey > maxKey) : (info.nKey >= maxKey) ){
0 0 if( keyCanBeEqual ? (info.nKey > maxKey) : (info.nKey >= maxKey) ){
72581 0 0 if( info.nPayload>info.nLocal ){
72588 0 0 if( pBt->autoVacuum ){
72595 0 0 if( !pPage->leaf ){
72599 0 0 if( pBt->autoVacuum ){
72605 0 0 if( d2!=depth ){
72619 0 0 if( doCoverageCheck && pCheck->mxErr>0 ){
0 0 if( doCoverageCheck && pCheck->mxErr>0 ){
72623 0 0 if( !pPage->leaf ){
72626 0 0 for(i=nCell-1; i>=0; i--){
72640 0 0 while( i>0 ){
72672 0 0 while( btreeHeapPull(heap,&x) ){
72673 0 0 if( (prev&0xffff)>=(x>>16) ){
72688 0 0 if( heap[0]==0 && nFrag!=data[hdr+7] ){
0 0 if( heap[0]==0 && nFrag!=data[hdr+7] ){
72696 0 0 if( !doCoverageCheck ) pPage->isInit = savedIsInit;
72750 0 0 if( sCheck.nPage==0 ){
72755 0 0 if( !sCheck.aPgRef ){
72760 0 0 if( sCheck.heap==0 ){
72766 0 0 if( i<=sCheck.nPage ) setPageReferenced(&sCheck, i);
72778 0 0 if( pBt->autoVacuum ){
72781 0 0 for(i=0; (int)i
0 0 for(i=0; (int)i
72783 0 0 if( mx!=mxInHdr ){
72789 0 0 }else if( get4byte(&pBt->pPage1->aData[64])!=0 ){
72797 0 0 for(i=0; (int)i
0 0 for(i=0; (int)i
72799 0 0 if( aRoot[i]==0 ) continue;
72801 0 0 if( pBt->autoVacuum && aRoot[i]>1 ){
0 0 if( pBt->autoVacuum && aRoot[i]>1 ){
72811 0 0 for(i=1; i<=sCheck.nPage && sCheck.mxErr; i++){
0 0 for(i=1; i<=sCheck.nPage && sCheck.mxErr; i++){
72821 0 0 (PTRMAP_PAGENO(pBt, i)!=i || !pBt->autoVacuum) ){
72825 0 0 (PTRMAP_PAGENO(pBt, i)==i && pBt->autoVacuum) ){
72836 0 0 if( sCheck.mallocFailed ){
72841 0 0 if( sCheck.nErr==0 ) sqlite3_str_reset(&sCheck.errMsg);
72879 2625 1555 return (p && (p->inTrans==TRANS_WRITE));
996 1629 return (p && (p->inTrans==TRANS_WRITE));
72893 0 0 if( p ){
72896 0 0 if( pBt->inTransaction!=TRANS_NONE ){
72945 547 0 if( !pBt->pSchema && nBytes ){
256 291 if( !pBt->pSchema && nBytes ){
72978 0 15 if( p->sharable ){
72985 0 0 if( rc==SQLITE_OK ){
73011 0 0 rc = restoreCursorPosition(pCsr);
73012 0 0 if( rc!=SQLITE_OK ){
73016 0 0 if( pCsr->eState!=CURSOR_VALID ){
73038 0 0 if( (pCsr->curFlags & BTCF_WriteFlag)==0 ){
73074 0 0 if( iVersion==1 ) pBt->btsFlags |= BTS_NO_WAL;
73077 0 0 if( rc==SQLITE_OK ){
73079 0 0 if( aData[18]!=(u8)iVersion || aData[19]!=(u8)iVersion ){
0 0 if( aData[18]!=(u8)iVersion || aData[19]!=(u8)iVersion ){
73081 0 0 if( rc==SQLITE_OK ){
73083 0 0 if( rc==SQLITE_OK ){
73220 0 8 if( i==1 ){
73225 0 0 if( sqlite3OpenTempDatabase(&sParse) ){
73231 0 0 if( rc ){
73236 0 8 if( i<0 ){
73261 0 4 if( sqlite3BtreeIsInReadTrans(p) ){
73302 0 4 if( pSrcDb==pDestDb ){
73313 0 4 if( !p ){
73319 4 0 if( p ){
73327 4 0 if( 0==p->pSrc || 0==p->pDest
4 0 if( 0==p->pSrc || 0==p->pDest
73328 0 4 || checkReadTransaction(pDestDb, p->pDest)!=SQLITE_OK
73339 4 0 if( p ){
73354 0 4 return (rc!=SQLITE_OK && rc!=SQLITE_BUSY && ALWAYS(rc!=SQLITE_LOCKED));
0 0 return (rc!=SQLITE_OK && rc!=SQLITE_BUSY && ALWAYS(rc!=SQLITE_LOCKED));
0 0 return (rc!=SQLITE_OK && rc!=SQLITE_BUSY && ALWAYS(rc!=SQLITE_LOCKED));
73392 0 10 if( nSrcPgsz!=nDestPgsz && sqlite3PagerIsMemdb(pDestPager) ){
0 0 if( nSrcPgsz!=nDestPgsz && sqlite3PagerIsMemdb(pDestPager) ){
73420 20 0 for(iOff=iEnd-(i64)nSrcPgsz; rc==SQLITE_OK && iOff
10 10 for(iOff=iEnd-(i64)nSrcPgsz; rc==SQLITE_OK && iOff
73423 0 10 if( iDest==PENDING_BYTE_PAGE(p->pDest->pBt) ) continue;
73424 10 0 if( SQLITE_OK==(rc = sqlite3PagerGet(pDestPager, iDest, &pDestPg, 0))
73425 10 0 && SQLITE_OK==(rc = sqlite3PagerWrite(pDestPg))
73440 4 6 if( iOff==0 && bUpdate==0 ){
4 0 if( iOff==0 && bUpdate==0 ){
73461 0 0 if( rc==SQLITE_OK && iCurrent>iSize ){
0 0 if( rc==SQLITE_OK && iCurrent>iSize ){
73499 4 0 if( !isFatalError(rc) ){
73509 4 0 if( p->pDestDb && p->pSrc->pBt->inTransaction==TRANS_WRITE ){
0 4 if( p->pDestDb && p->pSrc->pBt->inTransaction==TRANS_WRITE ){
73519 4 0 if( rc==SQLITE_OK && 0==sqlite3BtreeIsInReadTrans(p->pSrc) ){
4 0 if( rc==SQLITE_OK && 0==sqlite3BtreeIsInReadTrans(p->pSrc) ){
73530 4 0 if( p->bDestLocked==0 && rc==SQLITE_OK && setDestPgsz(p)==SQLITE_NOMEM ){
4 0 if( p->bDestLocked==0 && rc==SQLITE_OK && setDestPgsz(p)==SQLITE_NOMEM ){
0 4 if( p->bDestLocked==0 && rc==SQLITE_OK && setDestPgsz(p)==SQLITE_NOMEM ){
73535 4 0 if( SQLITE_OK==rc && p->bDestLocked==0
4 0 if( SQLITE_OK==rc && p->bDestLocked==0
73536 4 0 && SQLITE_OK==(rc = sqlite3BtreeBeginTrans(p->pDest, 2,
73547 4 0 if( SQLITE_OK==rc && destMode==PAGER_JOURNALMODE_WAL && pgszSrc!=pgszDest ){
0 4 if( SQLITE_OK==rc && destMode==PAGER_JOURNALMODE_WAL && pgszSrc!=pgszDest ){
0 0 if( SQLITE_OK==rc && destMode==PAGER_JOURNALMODE_WAL && pgszSrc!=pgszDest ){
73556 0 14 for(ii=0; (nPage<0 || iiiNext<=(Pgno)nSrcPage && !rc; ii++){
0 0 for(ii=0; (nPage<0 || iiiNext<=(Pgno)nSrcPage && !rc; ii++){
10 4 for(ii=0; (nPage<0 || iiiNext<=(Pgno)nSrcPage && !rc; ii++){
10 0 for(ii=0; (nPage<0 || iiiNext<=(Pgno)nSrcPage && !rc; ii++){
73558 10 0 if( iSrcPg!=PENDING_BYTE_PAGE(p->pSrc->pBt) ){
73561 10 0 if( rc==SQLITE_OK ){
73568 4 0 if( rc==SQLITE_OK ){
73571 4 0 if( p->iNext>(Pgno)nSrcPage ){
73573 0 0 }else if( !p->isAttached ){
73583 4 0 if( rc==SQLITE_DONE ){
73584 0 4 if( nSrcPage==0 ){
73588 4 0 if( rc==SQLITE_OK || rc==SQLITE_DONE ){
4 0 if( rc==SQLITE_OK || rc==SQLITE_DONE ){
73591 4 0 if( rc==SQLITE_OK ){
73592 4 0 if( p->pDestDb ){
73595 0 4 if( destMode==PAGER_JOURNALMODE_WAL ){
73599 4 0 if( rc==SQLITE_OK ){
73615 0 4 if( pgszSrc
73618 0 0 if( nDestTruncate==(int)PENDING_BYTE_PAGE(p->pDest->pBt) ){
73626 0 4 if( pgszSrc
73657 0 0 for(iPg=nDestTruncate; rc==SQLITE_OK && iPg<=(Pgno)nDstPage; iPg++){
0 0 for(iPg=nDestTruncate; rc==SQLITE_OK && iPg<=(Pgno)nDstPage; iPg++){
73658 0 0 if( iPg!=PENDING_BYTE_PAGE(p->pDest->pBt) ){
73661 0 0 if( rc==SQLITE_OK ){
73667 0 0 if( rc==SQLITE_OK ){
73673 0 0 for(
73675 0 0 rc==SQLITE_OK && iOff
73681 0 0 if( rc==SQLITE_OK ){
73687 0 0 if( rc==SQLITE_OK ){
73692 0 0 if( rc==SQLITE_OK ){
73701 4 0 if( SQLITE_OK==rc
73702 4 0 && SQLITE_OK==(rc = sqlite3BtreeCommitPhaseTwo(p->pDest, 0))
73714 4 0 if( bCloseTrans ){
73721 0 4 if( rc==SQLITE_IOERR_NOMEM ){
73743 0 4 if( p==0 ) return SQLITE_OK;
73752 4 0 if( p->pDestDb ){
73755 0 4 if( p->isAttached ){
73757 0 0 while( *pp!=p ){
73767 0 4 rc = (p->rc==SQLITE_DONE) ? SQLITE_OK : p->rc;
73768 4 0 if( p->pDestDb ){
73775 4 0 if( p->pDestDb ){
73833 0 0 if( !isFatalError(p->rc) && iPageiNext ){
0 0 if( !isFatalError(p->rc) && iPageiNext ){
73844 0 0 if( rc!=SQLITE_OK ){
73848 0 0 }while( (p = p->pNext)!=0 );
73851 0 151 if( pBackup ) backupUpdate(pBackup, iPage, aData);
73867 0 1447 for(p=pBackup; p; p=p->pNext){
73891 0 0 if( pFd->pMethods ){
73894 0 0 if( rc==SQLITE_NOTFOUND ) rc = SQLITE_OK;
73895 0 0 if( rc ) goto copy_finished;
73923 0 0 if( rc==SQLITE_OK ){
74099 1366 504 if( !(pMem->flags&MEM_Str) || pMem->enc==desiredEnc ){
1366 0 if( !(pMem->flags&MEM_Str) || pMem->enc==desiredEnc ){
74139 4867 17031 if( n<32 ) n = 32;
74140 77 21821 if( pMem->szMalloc>0 && bPreserve && pMem->z==pMem->zMalloc ){
77 0 if( pMem->szMalloc>0 && bPreserve && pMem->z==pMem->zMalloc ){
29 48 if( pMem->szMalloc>0 && bPreserve && pMem->z==pMem->zMalloc ){
74144 48 21821 if( pMem->szMalloc>0 ) sqlite3DbFreeNN(pMem->db, pMem->zMalloc);
74147 0 21898 if( pMem->zMalloc==0 ){
74156 180 21718 if( bPreserve && pMem->z ){
180 0 if( bPreserve && pMem->z ){
74160 0 21898 if( (pMem->flags&MEM_Dyn)!=0 ){
74186 19984 5023 if( pMem->szMalloc
74200 0 209 if( sqlite3VdbeMemGrow(pMem, pMem->n+2, 1) ){
74218 120 679 if( (pMem->flags & (MEM_Str|MEM_Blob))!=0 ){
74219 0 120 if( ExpandBlob(pMem) ) return SQLITE_NOMEM;
0 0 if( ExpandBlob(pMem) ) return SQLITE_NOMEM;
74220 48 72 if( pMem->szMalloc==0 || pMem->z!=pMem->zMalloc ){
48 0 if( pMem->szMalloc==0 || pMem->z!=pMem->zMalloc ){
74222 0 120 if( rc ) return rc;
74247 0 0 if( nByte<=0 ){
74250 0 0 if( sqlite3VdbeMemGrow(pMem, nByte, 1) ){
74268 9012 89 if( (pMem->flags & (MEM_Term|MEM_Str))!=MEM_Str ){
74301 0 287 if( sqlite3VdbeMemClearAndResize(pMem, nByte) ){
74312 285 2 if( fg & MEM_Int ){
74322 4 283 if( bForce ) pMem->flags &= ~(MEM_Int|MEM_Real);
74351 115 71 if( pMem->szMalloc>0 ) sqlite3DbFreeNN(pMem->db, pMem->zMalloc);
74397 0 69 if( p->flags&MEM_Agg ){
74402 69 0 if( p->flags&MEM_Dyn ){
74418 58 367 if( VdbeMemDynamic(p) ){
74421 367 58 if( p->szMalloc ){
74440 4737 58 if( VdbeMemDynamic(p) || p->szMalloc ){
367 4370 if( VdbeMemDynamic(p) || p->szMalloc ){
74465 0 4 if( r<=(double)minInt ){
74467 0 4 }else if( r>=(double)maxInt ){
74496 2416 332 if( flags & MEM_Int ){
74498 0 332 }else if( flags & MEM_Real ){
74500 269 63 }else if( flags & (MEM_Str|MEM_Blob) ){
74523 226 24 if( pMem->flags & MEM_Real ){
74525 0 24 }else if( pMem->flags & MEM_Int ){
74527 24 0 }else if( pMem->flags & (MEM_Str|MEM_Blob) ){
74540 422 340 if( pMem->flags & MEM_Int ) return pMem->u.i!=0;
74541 128 212 if( pMem->flags & MEM_Null ) return ifNull;
74568 0 4 if( pMem->u.r==ix && ix>SMALLEST_INT64 && ix
0 0 if( pMem->u.r==ix && ix>SMALLEST_INT64 && ix
0 0 if( pMem->u.r==ix && ix>SMALLEST_INT64 && ix
74621 0 0 if( (pMem->flags & (MEM_Int|MEM_Real|MEM_Null))==0 ){
74626 0 0 if( rc==0 ){
74631 0 0 if( rc==1 && sqlite3RealSameAsInt(pMem->u.r, i) ){
0 0 if( rc==1 && sqlite3RealSameAsInt(pMem->u.r, i) ){
74652 0 1 if( pMem->flags & MEM_Null ) return;
74655 0 0 if( (pMem->flags & MEM_Blob)==0 ){
74658 0 0 if( pMem->flags & MEM_Str ) MemSetTypeFlag(pMem, MEM_Blob);
74714 11 4825 if( VdbeMemDynamic(pMem) ){
74732 0 1 if( n<0 ) n = 0;
74754 0 1090 if( VdbeMemDynamic(pMem) ){
74776 0 0 pMem->u.zPType = zPType ? zPType : "";
74780 0 0 pMem->xDel = xDestructor ? xDestructor : sqlite3NoopDestructor;
74790 220 0 if( !sqlite3IsNaN(val) ){
74822 0 9 if( p==0 ) return SQLITE_NOMEM;
74835 1646 898 if( p->flags & (MEM_Str|MEM_Blob) ){
74837 1 1645 if( p->flags & MEM_Zero ){
74896 0 2903 if( VdbeMemDynamic(pTo) ){ vdbeClrCopy(pTo,pFrom,srcType); return; }
74898 2240 663 if( (pFrom->flags&MEM_Static)==0 ){
74913 0 58 if( VdbeMemDynamic(pTo) ) vdbeMemClearExternAndSetNull(pTo);
74916 24 34 if( pTo->flags&(MEM_Str|MEM_Blob) ){
74917 14 10 if( 0==(pFrom->flags&MEM_Static) ){
74973 2616 12786 if( !z ){
74978 12786 0 if( pMem->db ){
74983 782 12004 flags = (enc==0?MEM_Blob:MEM_Str);
74984 11220 1566 if( nByte<0 ){
74986 11220 0 if( enc==SQLITE_UTF8 ){
74988 0 11220 if( nByte>iLimit ) nByte = iLimit+1;
74990 0 0 for(nByte=0; nByte<=iLimit && (z[nByte] | z[nByte+1]); nByte+=2){}
0 0 for(nByte=0; nByte<=iLimit && (z[nByte] | z[nByte+1]); nByte+=2){}
74999 10722 2064 if( xDel==SQLITE_TRANSIENT ){
75001 9699 1023 if( flags&MEM_Term ){
75002 9699 0 nAlloc += (enc==SQLITE_UTF8?1:2);
75004 0 10722 if( nByte>iLimit ){
75010 0 10722 if( sqlite3VdbeMemClearAndResize(pMem, MAX(nAlloc,32)) ){
75014 536 1528 }else if( xDel==SQLITE_DYNAMIC ){
75022 1468 60 flags |= ((xDel==SQLITE_STATIC)?MEM_Static:MEM_Dyn);
75027 12004 782 pMem->enc = (enc==0 ? SQLITE_UTF8 : enc);
75030 0 12786 if( pMem->enc!=SQLITE_UTF8 && sqlite3VdbeMemHandleBom(pMem) ){
0 0 if( pMem->enc!=SQLITE_UTF8 && sqlite3VdbeMemHandleBom(pMem) ){
75035 0 12786 if( nByte>iLimit ){
75065 6 0 if( SQLITE_OK==(rc = sqlite3VdbeMemClearAndResize(pMem, amt+1)) ){
75067 6 0 if( rc==SQLITE_OK ){
75096 529 6 if( offset+amt<=available ){
75118 66 283 if( pVal->flags & (MEM_Blob|MEM_Str) ){
75119 0 66 if( ExpandBlob(pVal) ) return 0;
0 0 if( ExpandBlob(pVal) ) return 0;
75121 0 66 if( pVal->enc != (enc & ~SQLITE_UTF16_ALIGNED) ){
75124 0 66 if( (enc & SQLITE_UTF16_ALIGNED)!=0 && 1==(1&SQLITE_PTR_TO_INT(pVal->z)) ){
0 0 if( (enc & SQLITE_UTF16_ALIGNED)!=0 && 1==(1&SQLITE_PTR_TO_INT(pVal->z)) ){
75126 0 0 if( sqlite3VdbeMemMakeWriteable(pVal)!=SQLITE_OK ){
75137 349 0 if( pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) ){
75156 17 6305 if( !pVal ) return 0;
75160 5923 382 if( (pVal->flags&(MEM_Str|MEM_Term))==(MEM_Str|MEM_Term) && pVal->enc==enc ){
5923 0 if( (pVal->flags&(MEM_Str|MEM_Term))==(MEM_Str|MEM_Term) && pVal->enc==enc ){
75164 33 349 if( pVal->flags&MEM_Null ){
75175 37 0 if( p ){
75376 0 0 while( (op = pExpr->op)==TK_UPLUS || op==TK_SPAN ) pExpr = pExpr->pLeft;
0 0 while( (op = pExpr->op)==TK_UPLUS || op==TK_SPAN ) pExpr = pExpr->pLeft;
75380 0 0 if( NEVER(op==TK_REGISTER) ) op = pExpr->op2;
75389 0 0 if( op==TK_CAST ){
75393 0 0 if( *ppVal ){
75403 0 0 if( op==TK_UMINUS
75404 0 0 && (pExpr->pLeft->op==TK_INTEGER || pExpr->pLeft->op==TK_FLOAT) ){
0 0 && (pExpr->pLeft->op==TK_INTEGER || pExpr->pLeft->op==TK_FLOAT) ){
75411 0 0 if( op==TK_STRING || op==TK_FLOAT || op==TK_INTEGER ){
0 0 if( op==TK_STRING || op==TK_FLOAT || op==TK_INTEGER ){
0 0 if( op==TK_STRING || op==TK_FLOAT || op==TK_INTEGER ){
75413 0 0 if( pVal==0 ) goto no_mem;
75414 0 0 if( ExprHasProperty(pExpr, EP_IntValue) ){
75418 0 0 if( zVal==0 ) goto no_mem;
75421 0 0 if( (op==TK_INTEGER || op==TK_FLOAT ) && affinity==SQLITE_AFF_BLOB ){
0 0 if( (op==TK_INTEGER || op==TK_FLOAT ) && affinity==SQLITE_AFF_BLOB ){
0 0 if( (op==TK_INTEGER || op==TK_FLOAT ) && affinity==SQLITE_AFF_BLOB ){
75426 0 0 if( pVal->flags & (MEM_Int|MEM_Real) ) pVal->flags &= ~MEM_Str;
75427 0 0 if( enc!=SQLITE_UTF8 ){
75430 0 0 }else if( op==TK_UMINUS ) {
75432 0 0 if( SQLITE_OK==valueFromExpr(db,pExpr->pLeft,enc,affinity,&pVal,pCtx)
75433 0 0 && pVal!=0
75436 0 0 if( pVal->flags & MEM_Real ){
75438 0 0 }else if( pVal->u.i==SMALLEST_INT64 ){
75446 0 0 }else if( op==TK_NULL ){
75448 0 0 if( pVal==0 ) goto no_mem;
75452 0 0 else if( op==TK_BLOB ){
75457 0 0 if( !pVal ) goto no_mem;
75470 0 0 else if( op==TK_TRUEFALSE ){
75511 0 2967 return pExpr ? valueFromExpr(db, pExpr, enc, affinity, ppVal, 0) : 0;
75789 101 0 if( v ) sqlite3VdbeMemSetStr((Mem *)v, z, n, enc, xDel);
75796 335 37 if( !v ) return;
75807 0 0 return valueToText(pVal, enc)!=0 ? pVal->n : 0;
75812 2520 505 if( (p->flags & MEM_Str)!=0 && pVal->enc==enc ){
2520 0 if( (p->flags & MEM_Str)!=0 && pVal->enc==enc ){
75815 505 0 if( (p->flags & MEM_Blob)!=0 ){
75816 0 505 if( p->flags & MEM_Zero ){
75822 0 0 if( p->flags & MEM_Null ) return 0;
75852 0 5429 if( p==0 ) return 0;
75855 1175 4254 if( db->pVdbe ){
75887 18 4384 if( p==0 ) return;
75889 7 4377 if( (prepFlags & SQLITE_PREPARE_SAVESQL)==0 ){
75957 43 5429 int nNew = (p->nOpAlloc ? p->nOpAlloc*2 : (int)(1024/sizeof(Op)));
75962 0 5472 if( nNew > p->db->aLimit[SQLITE_LIMIT_VDBE_OP] ){
75970 5472 0 if( pNew ){
75975 5472 0 return (pNew ? SQLITE_OK : SQLITE_NOMEM_BKPT);
76007 0 5472 if( growOpArray(p, 1) ) return 1;
76018 5472 55755 if( p->pParse->nOpAlloc<=i ){
76087 1168 240 for(i=0; (c = zTypes[i])!=0; i++){
76088 646 522 if( c=='s' ){
76089 466 180 const char *z = va_arg(ap, const char*);
76090 94 552 sqlite3VdbeAddOp4(p, z==0 ? OP_Null : OP_String8, 0, iDest+i, 0, z, 0);
76091 506 16 }else if( c=='i' ){
76092 302 204 sqlite3VdbeAddOp2(p, OP_Integer, va_arg(ap, int), iDest+i);
76133 2190 0 if( p4copy ) memcpy(p4copy, zP4, 8);
76144 1599 0 if( pParse->addrExplain==0 ) return 0;
76156 0 674 if( pParse->explain==2 ){
76168 0 0 if( bPush) pParse->addrExplain = iThis;
76191 468 230 for(j=0; jdb->nDb; j++) sqlite3VdbeUsesBtree(p, j);
76206 8539 0 if( p->db->mallocFailed==0 ){
76247 7728 1802 if( (i & (i-1))==0 ){
76251 9530 0 if( p->aLabel ){
76268 9530 0 if( p->aLabel ){
76487 19005 36874 if( pOp->opcode<=SQLITE_MX_JUMP_OPCODE ){
76492 3091 1193 if( pOp->p2!=0 ) p->readOnly = 0;
76530 17 0 if( pOp->p2>nMaxArgs ) nMaxArgs = pOp->p2;
76538 42 1 if( n>nMaxArgs ) nMaxArgs = n;
76543 2886 10551 if( pOp->p2<0 ){
76559 5429 50450 if( pOp==p->aOp ) break;
76659 0 19 if( p->nOp + nOp > p->pParse->nOpAlloc && growOpArray(p, nOp) ){
0 0 if( p->nOp + nOp > p->pParse->nOpAlloc && growOpArray(p, nOp) ){
76663 124 19 for(i=0; i
76668 25 99 if( (sqlite3OpcodeProperty[aOp->opcode] & OPFLG_JUMP)!=0 && aOp->p2>0 ){
25 0 if( (sqlite3OpcodeProperty[aOp->opcode] & OPFLG_JUMP)!=0 && aOp->p2>0 ){
76739 10728 0 if( p->nOp>0 ) p->aOp[p->nOp-1].p5 = p5;
76756 0 816 if( (pDef->funcFlags & SQLITE_FUNC_EPHEM)!=0 ){
76767 0 0 if( p->szMalloc ) sqlite3DbFree(db, p->zMalloc);
76790 617 0 if( db->pnBytesFreed==0 ) sqlite3KeyInfoUnref((KeyInfo*)p4);
76804 0 0 if( db->pnBytesFreed==0 ){
76812 77 0 if( db->pnBytesFreed==0 ) sqlite3VtabUnlock((VTable *)p4);
76824 5429 0 if( aOp ){
76826 55879 5429 for(pOp=&aOp[nOp-1]; pOp>=aOp; pOp--){
76827 7002 48877 if( pOp->p4type <= P4_FREE_IF_LE ) freeP4(db, pOp->p4type, pOp->p4.p);
76851 0 417 if( p->db->mallocFailed ) return 0;
76866 14 0 if( p->nOp>0 && p->aOp[p->nOp-1].opcode==op ){
0 14 if( p->nOp>0 && p->aOp[p->nOp-1].opcode==op ){
76896 1056 3313 if( pOp->p4type ){
76901 1056 3313 if( n<0 ){
76904 2809 504 if( n==0 ) n = sqlite3Strlen30(zP4);
76916 0 10101 if( db->mallocFailed ){
76917 0 0 if( n!=P4_VTAB ) freeP4(db, n, (void*)*(char**)&zP4);
76922 1513 8588 if( addr<0 ){
76926 6788 3313 if( n>=0 || pOp->p4type ){
1056 5732 if( n>=0 || pOp->p4type ){
76930 1056 4676 if( n==P4_INT32 ){
76935 4612 64 }else if( zP4!=0 ){
76939 77 4535 if( n==P4_VTAB ) sqlite3VtabLock((VTable*)zP4);
76956 0 3054 if( p->db->mallocFailed ){
76978 71 0 if( pKeyInfo ) sqlite3VdbeAppendP4(v, pKeyInfo, P4_KEYINFO);
77043 225 5469 if( addr<0 ){
77047 0 5694 if( p->db->mallocFailed ){
77243 0 0 for(j=0; jnKeyField; j++){
77245 0 0 const char *zColl = pColl ? pColl->zName : "";
77246 0 0 if( strcmp(zColl, "BINARY")==0 ) zColl = "B";
77247 0 0 sqlite3_str_appendf(&x, ",%s%s",
77290 0 0 if( pMem->flags & MEM_Str ){
77292 0 0 }else if( pMem->flags & MEM_Int ){
77294 0 0 }else if( pMem->flags & MEM_Real ){
77296 0 0 }else if( pMem->flags & MEM_Null ){
77316 0 0 for(i=1; i<=n; i++){
77338 0 0 if( zP4==0 ){
77362 2175 2802 if( i!=1 && sqlite3BtreeSharable(p->db->aDb[i].pBt) ){
0 2175 if( i!=1 && sqlite3BtreeSharable(p->db->aDb[i].pBt) ){
77394 16207 0 if( DbMaskAllZero(p->lockMask) ) return; /* The common case */
77398 0 0 for(i=0; i
77399 0 0 if( i!=1 && DbMaskTest(p->lockMask,i) && ALWAYS(aDb[i].pBt!=0) ){
0 0 if( i!=1 && DbMaskTest(p->lockMask,i) && ALWAYS(aDb[i].pBt!=0) ){
0 0 if( i!=1 && DbMaskTest(p->lockMask,i) && ALWAYS(aDb[i].pBt!=0) ){
77461 40799 12467 while( (N--)>0 ){
77476 14138 3824 if( p && N ){
8419 5719 if( p && N ){
77479 0 8419 if( db->pnBytesFreed ){
77481 0 0 if( p->szMalloc ) sqlite3DbFree(db, p->zMalloc);
77482 0 0 }while( (++p)
77504 21 51992 if( p->flags&(MEM_Agg|MEM_Dyn) ){
77506 21875 30117 }else if( p->szMalloc ){
77512 43594 8419 }while( (++p)
77554 0 0 for(i=0; inChildCsr; i++){
77592 0 0 int bListSubprogs = (p->explain==1 || (db->flags & SQLITE_TriggerEQP)!=0);
0 0 int bListSubprogs = (p->explain==1 || (db->flags & SQLITE_TriggerEQP)!=0);
77606 0 0 if( p->rc==SQLITE_NOMEM ){
77621 0 0 if( bListSubprogs ){
77628 0 0 if( pSub->flags&MEM_Blob ){
77634 0 0 for(i=0; i
77641 0 0 if( i>=nRow ){
77646 0 0 if( inOp ){
77655 0 0 for(j=0; i>=apSub[j]->nOp; j++){
77666 0 0 if( bListSubprogs && pOp->p4type==P4_SUBPROGRAM ){
0 0 if( bListSubprogs && pOp->p4type==P4_SUBPROGRAM ){
77669 0 0 for(j=0; j
77670 0 0 if( apSub[j]==pOp->p4.pProgram ) break;
77672 0 0 if( j==nSub ){
77674 0 0 if( p->rc!=SQLITE_OK ){
77685 0 0 if( p->explain<2 ) break;
77686 0 0 if( pOp->opcode==OP_Explain ) break;
77687 0 0 if( pOp->opcode==OP_Init && p->pc>1 ) break;
0 0 if( pOp->opcode==OP_Init && p->pc>1 ) break;
77690 0 0 if( rc==SQLITE_OK ){
77691 0 0 if( db->u1.isInterrupted ){
77697 0 0 if( p->explain==1 ){
77722 0 0 if( sqlite3VdbeMemClearAndResize(pMem, 100) ){ /* P4 */
77728 0 0 if( zP4!=pMem->z ){
77738 0 0 if( p->explain==1 ){
77739 0 0 if( sqlite3VdbeMemClearAndResize(pMem, 4) ){
77851 22042 922 if( pBuf==0 ){
77853 21716 326 if( nByte <= p->nFree ){
77951 1458 3971 if( nCursor==0 && nMem>0 ) nMem++; /* Space for aMem[0] even if not used */
561 897 if( nCursor==0 && nMem>0 ) nMem++; /* Space for aMem[0] even if not used */
77965 257 5172 p->usesStmtJournal = (u8)(pParse->isMultiWrite && pParse->mayAbort);
11 246 p->usesStmtJournal = (u8)(pParse->isMultiWrite && pParse->mayAbort);
77966 0 5429 if( pParse->explain && nMem<10 ){
0 0 if( pParse->explain && nMem<10 ){
77990 5429 312 if( x.nNeeded==0 ) break;
77993 312 0 }while( !db->mallocFailed );
77998 0 5429 if( db->mallocFailed ){
78021 206 5645 if( pCx==0 ){
78031 5 5282 if( pCx->isEphemeral ){
78032 5 0 if( pCx->pBtx ) sqlite3BtreeClose(pCx->pBtx);
78058 7100 0 if( p->apCsr ){
78060 6980 7100 for(i=0; inCursor; i++){
78062 4814 2166 if( pC ){
78105 0 7100 if( p->pFrame ){
78107 0 0 for(pFrame=p->pFrame; pFrame->pParent; pFrame=pFrame->pParent);
78114 7100 0 if( p->aMem ){
78117 0 7100 while( p->pDelFrame ){
78124 0 7100 if( p->pAuxData ) sqlite3VdbeDeleteAuxData(p->db, &p->pAuxData, -1, 0);
78138 4 1605 if( p->nResColumn ){
78145 0 1609 if( p->aColName==0 ) return;
78170 0 13448 if( p->db->mallocFailed ){
78216 5713 0 for(i=0; rc==SQLITE_OK && inDb; i++){
3841 1872 for(i=0; rc==SQLITE_OK && inDb; i++){
78218 952 2889 if( sqlite3BtreeIsInTrans(pBt) ){
78234 757 195 if( db->aDb[i].safety_level!=PAGER_SYNCHRONOUS_OFF
78235 77 680 && aMJNeeded[sqlite3PagerGetJournalMode(pPager)]
78236 77 0 && sqlite3PagerIsMemdb(pPager)==0
78245 0 1872 if( rc!=SQLITE_OK ){
78250 934 938 if( needXcommit && db->xCommitCallback ){
10 924 if( needXcommit && db->xCommitCallback ){
78252 4 6 if( rc ){
78266 146 1722 if( 0==sqlite3Strlen30(sqlite3BtreeGetFilename(db->aDb[0].pBt))
78267 146 0 || nTrans<=1
78269 5701 0 for(i=0; rc==SQLITE_OK && inDb; i++){
3833 1868 for(i=0; rc==SQLITE_OK && inDb; i++){
78271 2278 1555 if( pBt ){
78281 5701 0 for(i=0; rc==SQLITE_OK && inDb; i++){
3833 1868 for(i=0; rc==SQLITE_OK && inDb; i++){
78283 2278 1555 if( pBt ){
78287 1868 0 if( rc==SQLITE_OK ){
78310 0 0 if( zMaster==0 ) return SQLITE_NOMEM_BKPT;
78313 0 0 if( retryCount ){
78314 0 0 if( retryCount>100 ){
78318 0 0 }else if( retryCount==1 ){
78331 0 0 }while( rc==SQLITE_OK && res );
0 0 }while( rc==SQLITE_OK && res );
78332 0 0 if( rc==SQLITE_OK ){
78339 0 0 if( rc!=SQLITE_OK ){
78350 0 0 for(i=0; inDb; i++){
78352 0 0 if( sqlite3BtreeIsInTrans(pBt) ){
78354 0 0 if( zFile==0 ){
78360 0 0 if( rc!=SQLITE_OK ){
78372 0 0 if( 0==(sqlite3OsDeviceCharacteristics(pMaster)&SQLITE_IOCAP_SEQUENTIAL)
78373 0 0 && SQLITE_OK!=(rc = sqlite3OsSync(pMaster, SQLITE_SYNC_NORMAL))
78391 0 0 for(i=0; rc==SQLITE_OK && inDb; i++){
0 0 for(i=0; rc==SQLITE_OK && inDb; i++){
78393 0 0 if( pBt ){
78399 0 0 if( rc!=SQLITE_OK ){
78411 0 0 if( rc ){
78424 0 0 for(i=0; inDb; i++){
78426 0 0 if( pBt ){
78492 0 0 for(i=0; inDb; i++){
78495 0 0 if( pBt ){
78496 0 0 if( eOp==SAVEPOINT_ROLLBACK ){
78499 0 0 if( rc2==SQLITE_OK ){
78502 0 0 if( rc==SQLITE_OK ){
78510 0 0 if( rc==SQLITE_OK ){
78511 0 0 if( eOp==SAVEPOINT_ROLLBACK ){
78514 0 0 if( rc==SQLITE_OK ){
78522 0 0 if( eOp==SAVEPOINT_ROLLBACK ){
78529 0 9318 if( p->db->nStatement && p->iStatement ){
0 0 if( p->db->nStatement && p->iStatement ){
78549 2069 11171 if( (deferred && (db->nDeferredCons+db->nDeferredImmCons)>0)
2069 0 if( (deferred && (db->nDeferredCons+db->nDeferredImmCons)>0)
78550 11171 2069 || (!deferred && p->nFkConstraint>0)
1 11170 || (!deferred && p->nFkConstraint>0)
78594 4998 7100 if( p->magic!=VDBE_MAGIC_RUN ){
78597 0 7100 if( db->mallocFailed ){
78605 5355 1745 if( p->pc>=0 && p->bIsReader ){
4883 472 if( p->pc>=0 && p->bIsReader ){
78615 4883 0 isSpecialError = mrc==SQLITE_NOMEM || mrc==SQLITE_IOERR
78616 4883 0 || mrc==SQLITE_INTERRUPT || mrc==SQLITE_FULL;
4883 0 || mrc==SQLITE_INTERRUPT || mrc==SQLITE_FULL;
0 4883 || mrc==SQLITE_INTERRUPT || mrc==SQLITE_FULL;
78617 0 4883 if( isSpecialError ){
78630 0 0 if( !p->readOnly || mrc!=SQLITE_INTERRUPT ){
0 0 if( !p->readOnly || mrc!=SQLITE_INTERRUPT ){
78631 0 0 if( (mrc==SQLITE_NOMEM || mrc==SQLITE_FULL) && p->usesStmtJournal ){
0 0 if( (mrc==SQLITE_NOMEM || mrc==SQLITE_FULL) && p->usesStmtJournal ){
0 0 if( (mrc==SQLITE_NOMEM || mrc==SQLITE_FULL) && p->usesStmtJournal ){
78646 4845 38 if( p->rc==SQLITE_OK ){
78656 280 4603 if( !sqlite3VtabInSync(db)
173 107 if( !sqlite3VtabInSync(db)
78657 2196 2580 && db->autoCommit
78658 1891 305 && db->nVdbeWrite==(p->readOnly==0)
78660 19 1872 if( p->rc==SQLITE_OK || (p->errorAction==OE_Fail && !isSpecialError) ){
0 19 if( p->rc==SQLITE_OK || (p->errorAction==OE_Fail && !isSpecialError) ){
0 0 if( p->rc==SQLITE_OK || (p->errorAction==OE_Fail && !isSpecialError) ){
78662 0 1872 if( rc!=SQLITE_OK ){
78663 0 0 if( NEVER(p->readOnly) ){
78675 0 1872 if( rc==SQLITE_BUSY && p->readOnly ){
0 0 if( rc==SQLITE_BUSY && p->readOnly ){
78678 4 1868 }else if( rc!=SQLITE_OK ){
78693 2992 0 }else if( eStatementOp==0 ){
78694 20 2972 if( p->rc==SQLITE_OK || p->errorAction==OE_Fail ){
0 20 if( p->rc==SQLITE_OK || p->errorAction==OE_Fail ){
78696 20 0 }else if( p->errorAction==OE_Abort ){
78712 2992 1891 if( eStatementOp ){
78714 0 2992 if( rc ){
78715 0 0 if( p->rc==SQLITE_OK || (p->rc&0xff)==SQLITE_CONSTRAINT ){
0 0 if( p->rc==SQLITE_OK || (p->rc&0xff)==SQLITE_CONSTRAINT ){
78730 3081 1802 if( p->changeCntOn ){
78731 3081 0 if( eStatementOp!=SAVEPOINT_ROLLBACK ){
78744 5355 1745 if( p->pc>=0 ){
78746 3398 1957 if( !p->readOnly ) db->nVdbeWrite--;
78747 4883 472 if( p->bIsReader ) db->nVdbeRead--;
78754 0 7100 if( db->mallocFailed ){
78767 7 7093 return (p->rc==SQLITE_BUSY ? SQLITE_BUSY : SQLITE_OK);
78790 76 5329 if( p->zErrMsg ){
78793 14 62 if( db->pErr==0 ) db->pErr = sqlite3ValueNew(db);
78797 335 4994 }else if( db->pErr ){
78855 5355 1745 if( p->pc>=0 ){
78858 175 5180 if( p->runOnlyOnce ) p->expired = 1;
78859 0 1745 }else if( p->rc && p->expired ){
0 0 }else if( p->rc && p->expired ){
78864 0 0 sqlite3ErrorWithMsg(db, p->rc, p->zErrMsg ? "%s" : 0, p->zErrMsg);
78929 3399 2030 if( p->magic==VDBE_MAGIC_RUN || p->magic==VDBE_MAGIC_HALT ){
3399 0 if( p->magic==VDBE_MAGIC_RUN || p->magic==VDBE_MAGIC_HALT ){
78954 0 6 while( *pp ){
78956 0 0 if( (iOp<0)
78957 0 0 || (pAux->iAuxOp==iOp
78958 0 0 && pAux->iAuxArg>=0
78959 0 0 && (pAux->iAuxArg>31 || !(mask & MASKBIT32(pAux->iAuxArg))))
0 0 && (pAux->iAuxArg>31 || !(mask & MASKBIT32(pAux->iAuxArg))))
78962 0 0 if( pAux->xDeleteAux ){
78985 0 5429 for(pSub=p->pProgram; pSub; pSub=pNext){
78990 5429 0 if( p->magic!=VDBE_MAGIC_INIT ){
79022 101 5328 if( p->pPrev ){
79028 1110 4319 if( p->pNext ){
79050 0 236 if( rc ) return rc;
79051 0 236 if( res!=0 ) return SQLITE_CORRUPT_BKPT;
79074 0 0 if( isDifferentRow ) p->nullRow = 1;
79084 0 769 if( sqlite3BtreeCursorHasMoved(p->uc.pCursor) ){
79106 236 15733 if( p->deferredMoveto ){
79108 0 236 if( p->aAltMap && (iMap = p->aAltMap[1+*piCol])>0 ){
0 0 if( p->aAltMap && (iMap = p->aAltMap[1+*piCol])>0 ){
79115 0 15733 if( sqlite3BtreeCursorHasMoved(p->uc.pCursor) ){
79171 744 11001 if( flags&MEM_Null ){
79175 1874 9127 if( flags&MEM_Int ){
79180 101 1773 if( i<0 ){
79185 1642 232 if( u<=127 ){
79186 927 715 if( (i&1)==i && file_format>=4 ){
927 0 if( (i&1)==i && file_format>=4 ){
79194 70 162 if( u<=32767 ){ *pLen = 2; return 2; }
79195 0 162 if( u<=8388607 ){ *pLen = 3; return 3; }
79196 30 132 if( u<=2147483647 ){ *pLen = 4; return 4; }
79197 48 84 if( u<=MAX_6BYTE ){ *pLen = 6; return 5; }
79201 6162 2965 if( flags&MEM_Real ){
79208 1 2964 if( flags & MEM_Zero ){
79239 214 54 if( serial_type>=128 ){
79322 7853 3892 if( serial_type<=7 && serial_type>0 ){
7109 744 if( serial_type<=7 && serial_type>0 ){
79325 6162 947 if( serial_type==7 ){
79337 44122 7109 }while( i );
79342 2965 1671 if( serial_type>=12 ){
79346 2962 3 if( len>0 ) memcpy(buf, pMem->z, len);
79380 84 62958 if( serial_type==6 ){
79404 0 62958 pMem->flags = sqlite3IsNaN(pMem->u.r) ? MEM_Null : MEM_Real;
79520 0 129 if( !p ) return 0;
79548 20201 0 idx = getVarint32(aKey, szHdr);
79551 20211 0 while( idx
20211 0 while( idx
79554 20211 0 idx += getVarint32(&aKey[idx], serial_type);
79562 20201 10 if( (++u)>=p->nField ) break;
79721 1721 0 if( pMem1->enc==pColl->enc ){
79736 0 0 if( (v1==0 || v2==0) ){
0 0 if( (v1==0 || v2==0) ){
79737 0 0 if( prcErr ) *prcErr = SQLITE_NOMEM_BKPT;
79754 0 0 for(i=0; i
79755 0 0 if( z[i] ) return 0;
79777 0 197 if( (pB1->flags|pB2->flags) & MEM_Zero ){
79778 0 0 if( pB1->flags & pB2->flags & MEM_Zero ){
79780 0 0 }else if( pB1->flags & MEM_Zero ){
79781 0 0 if( !isAllZero(pB2->z, pB2->n) ) return -1;
79784 0 0 if( !isAllZero(pB1->z, pB1->n) ) return +1;
79789 4 193 if( c ) return c;
79801 0 0 if( x
79802 0 0 if( x>r ) return +1;
79840 18 1734 if( combined_flags&MEM_Null ){
79846 523 1211 if( combined_flags&(MEM_Int|MEM_Real) ){
79847 387 136 if( (f1 & f2 & MEM_Int)!=0 ){
79848 4 383 if( pMem1->u.i < pMem2->u.i ) return -1;
79849 208 175 if( pMem1->u.i > pMem2->u.i ) return +1;
79852 0 136 if( (f1 & f2 & MEM_Real)!=0 ){
79853 0 0 if( pMem1->u.r < pMem2->u.r ) return -1;
79854 0 0 if( pMem1->u.r > pMem2->u.r ) return +1;
79857 16 120 if( (f1&MEM_Int)!=0 ){
79858 0 16 if( (f2&MEM_Real)!=0 ){
79864 120 0 if( (f1&MEM_Real)!=0 ){
79865 0 120 if( (f2&MEM_Int)!=0 ){
79877 1211 0 if( combined_flags&MEM_Str ){
79878 0 1211 if( (f1 & MEM_Str)==0 ){
79881 0 1211 if( (f2 & MEM_Str)==0 ){
79895 1014 197 if( pColl ){
79987 35 35905 if( bSkip ){
79989 35 0 idx1 = 1 + getVarint32(&aKey1[1], s1);
79995 35905 0 idx1 = getVarint32(aKey1, szHdr1);
79997 0 35905 if( d1>(unsigned)nKey1 ){
80014 315 35644 if( pRhs->flags & MEM_Int ){
80017 0 315 if( serial_type>=10 ){
80019 8 307 }else if( serial_type==0 ){
80021 0 307 }else if( serial_type==7 ){
80027 61 246 if( lhs
80029 4 242 }else if( lhs>rhs ){
80036 34889 755 else if( pRhs->flags & MEM_Real ){
80038 0 34889 if( serial_type>=10 ){
80044 0 34889 }else if( serial_type==0 ){
80048 34889 0 if( serial_type==7 ){
80049 17419 17470 if( mem1.u.ru.r ){
80051 17470 0 }else if( mem1.u.r>pRhs->u.r ){
80061 713 42 else if( pRhs->flags & MEM_Str ){
80062 713 0 getVarint32(&aKey1[idx1], serial_type);
80064 6 707 if( serial_type<12 ){
80066 0 707 }else if( !(serial_type & 0x01) ){
80072 0 707 if( (d1+mem1.n) > (unsigned)nKey1 ){
80075 707 0 }else if( (pKeyInfo = pPKey2->pKeyInfo)->aColl[i] ){
80086 0 0 if( rc==0 ) rc = mem1.n - pRhs->n;
80092 0 42 else if( pRhs->flags & MEM_Blob ){
80094 0 0 getVarint32(&aKey1[idx1], serial_type);
80096 0 0 if( serial_type<12 || (serial_type & 0x01) ){
0 0 if( serial_type<12 || (serial_type & 0x01) ){
80102 0 0 if( (d1+nStr) > (unsigned)nKey1 ){
80105 0 0 }else if( pRhs->flags & MEM_Zero ){
80106 0 0 if( !isAllZero((const char*)&aKey1[d1],nStr) ){
80114 0 0 if( rc==0 ) rc = nStr - pRhs->n;
80125 35645 314 if( rc!=0 ){
80126 17451 18194 if( pPKey2->pKeyInfo->aSortOrder[i] ){
80135 295 19 if( i==pPKey2->nField ) break;
80139 19 0 }while( idx1<(unsigned)szHdr1 && d1<=(unsigned)nKey1 );
19 0 }while( idx1<(unsigned)szHdr1 && d1<=(unsigned)nKey1 );
80242 221 63 if( v>lhs ){
80244 1 62 }else if( v
80246 30 32 }else if( pPKey2->nField>1 ){
80277 13 0 getVarint32(&aKey1[1], serial_type);
80278 2 11 if( serial_type<12 ){
80280 0 11 }else if( !(serial_type & 0x01) ){
80288 0 11 if( (szHdr + nStr) > nKey1 ){
80295 10 1 if( res==0 ){
80297 4 6 if( res==0 ){
80298 0 4 if( pPKey2->nField>1 ){
80304 0 6 }else if( res>0 ){
80309 0 1 }else if( res>0 ){
80342 184 0 if( p->pKeyInfo->nAllField<=13 ){
80344 0 184 if( p->pKeyInfo->aSortOrder[0] ){
80351 147 37 if( (flags & MEM_Int) ){
80357 23 14 if( (flags & (MEM_Real|MEM_Null|MEM_Blob))==0 && p->pKeyInfo->aColl[0]==0 ){
15 8 if( (flags & (MEM_Real|MEM_Null|MEM_Blob))==0 && p->pKeyInfo->aColl[0]==0 ){
80394 0 257 if( rc ){
80399 257 0 (void)getVarint32((u8*)m.z, szHdr);
80404 257 0 if( unlikely(szHdr<3 || szHdr>(unsigned)m.n) ){
257 0 if( unlikely(szHdr<3 || szHdr>(unsigned)m.n) ){
80410 257 0 (void)getVarint32((u8*)&m.z[szHdr-1], typeRowid);
80419 257 0 if( unlikely(typeRowid<1 || typeRowid>9 || typeRowid==7) ){
257 0 if( unlikely(typeRowid<1 || typeRowid>9 || typeRowid==7) ){
257 0 if( unlikely(typeRowid<1 || typeRowid>9 || typeRowid==7) ){
80424 0 257 if( unlikely((u32)m.n
80470 272 0 if( nCellKey<=0 || nCellKey>0x7fffffff ){
0 272 if( nCellKey<=0 || nCellKey>0x7fffffff ){
80476 0 272 if( rc ){
80522 132 356 for(p = db->pVdbe; p; p=p->pNext){
80551 0 0 if( v ){
80554 0 0 if( 0==(pMem->flags & MEM_Null) ){
80556 0 0 if( pRet ){
80574 0 0 if( iVar>=32 ){
80594 0 0 if( pCtx->pVdbe->aOp[pCtx->iOp].opcode==OP_PureFunc ){
80610 0 365 if( pVtab->zErrMsg ){
80740 0 0 return p==0 || p->expired;
0 0 return p==0 || p->expired;
80750 0 15405 if( p->db==0 ){
80758 0 13345 if( p==0 ){
80780 6 0 if( db->xProfile ){
80783 0 6 if( db->mTrace & SQLITE_TRACE_PROFILE ){
80809 376 2060 if( pStmt==0 ){
80816 0 2060 if( vdbeSafety(v) ) return SQLITE_MISUSE_BKPT;
80818 0 2060 checkProfileCallback(db, v);
80836 64 1671 if( pStmt==0 ){
80842 0 1671 checkProfileCallback(db, v);
80863 0 0 for(i=0; inVar; i++){
80868 0 0 if( p->expmask ){
80882 512 0 if( p->flags & (MEM_Blob|MEM_Str) ){
80883 0 512 if( ExpandBlob(p)!=SQLITE_OK ){
0 0 if( ExpandBlob(p)!=SQLITE_OK ){
80888 511 1 return p->n ? p->z : 0;
80910 0 0 return ((pMem->flags & MEM_Subtype) ? pMem->eSubtype : 0);
80914 0 0 if( (p->flags&(MEM_TypeMask|MEM_Term|MEM_Subtype)) ==
80916 0 0 && zPType!=0
80917 0 0 && p->eSubtype=='p'
80918 0 0 && strcmp(p->u.zPType, zPType)==0
80990 0 0 if( pOrig==0 ) return 0;
80992 0 0 if( pNew==0 ) return 0;
80997 0 0 if( pNew->flags&(MEM_Str|MEM_Blob) ){
81000 0 0 if( sqlite3VdbeMemMakeWriteable(pNew)!=SQLITE_OK ){
81034 0 303 if( sqlite3VdbeMemSetStr(pCtx->pOut, z, n, enc, xDel)==SQLITE_TOOBIG ){
81044 0 0 if( xDel==0 ){
81046 0 0 }else if( xDel==SQLITE_TRANSIENT ){
81051 0 0 if( pCtx ) sqlite3_result_error_toobig(pCtx);
81072 0 0 if( n>0x7fffffff ){
81142 0 0 if( enc==SQLITE_UTF16 ) enc = SQLITE_UTF16NATIVE;
81143 0 0 if( n>0x7fffffff ){
81189 0 1 if( n>(u64)pOut->db->aLimit[SQLITE_LIMIT_LENGTH] ){
81196 0 0 pCtx->isError = errCode ? errCode : -1;
81200 0 0 if( pCtx->pOut->flags & MEM_Null ){
81230 4960 2400 for(i=0; inDb; i++){
81232 3028 1932 if( pBt ){
81237 0 3028 if( nEntry>0 && db->xWalCallback && rc==SQLITE_OK ){
0 0 if( nEntry>0 && db->xWalCallback && rc==SQLITE_OK ){
0 0 if( nEntry>0 && db->xWalCallback && rc==SQLITE_OK ){
81261 0 11325 if( p->magic!=VDBE_MAGIC_RUN ){
81291 0 11325 if( db->mallocFailed ){
81296 5356 5969 if( p->pc<=0 && p->expired ){
1 5355 if( p->pc<=0 && p->expired ){
81301 5355 5969 if( p->pc<0 ){
81306 4749 606 if( db->nVdbeActive==0 ){
81315 5347 8 if( (db->xProfile || (db->mTrace & SQLITE_TRACE_PROFILE)!=0)
0 5347 if( (db->xProfile || (db->mTrace & SQLITE_TRACE_PROFILE)!=0)
81316 6 2 && !db->init.busy && p->zSql ){
6 0 && !db->init.busy && p->zSql ){
81324 3398 1957 if( p->readOnly==0 ) db->nVdbeWrite++;
81325 4883 472 if( p->bIsReader ) db->nVdbeRead++;
81332 0 11324 if( p->explain ){
81344 4998 6326 if( rc!=SQLITE_ROW ) checkProfileCallback(db, p);
6 4992 if( rc!=SQLITE_ROW ) checkProfileCallback(db, p);
81347 4949 6375 if( rc==SQLITE_DONE && db->autoCommit ){
2400 2549 if( rc==SQLITE_DONE && db->autoCommit ){
81350 0 2400 if( p->rc!=SQLITE_OK ){
81356 0 11324 if( SQLITE_NOMEM==sqlite3ApiExit(p->db, p->rc) ){
81371 10616 709 if( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0
81372 4595 6021 && rc!=SQLITE_ROW
81373 50 4545 && rc!=SQLITE_DONE
81395 0 11324 if( vdbeSafetyNotNull(v) ){
81401 1 11324 while( (rc = sqlite3Step(v))==SQLITE_SCHEMA
81402 1 0 && cnt++ < SQLITE_MAX_SCHEMA_RETRY ){
81405 0 1 if( rc!=SQLITE_OK ){
81416 0 0 if( !db->mallocFailed ){
81426 0 1 if( savedPc>=0 ) v->doingRerun = 1;
81493 0 0 if( *piTime==0 ){
81495 0 0 if( rc ) *piTime = 0;
81507 71 115 if( nByte<=0 ){
81514 115 0 if( pMem->z ){
81530 186 468 if( (p->pMem->flags & MEM_Agg)==0 ){
81556 0 0 for(pAuxData=pCtx->pVdbe->pAuxData; pAuxData; pAuxData=pAuxData->pNextAux){
81557 0 0 if( pAuxData->iAuxArg==iArg && (pAuxData->iAuxOp==pCtx->iOp || iArg<0) ){
0 0 if( pAuxData->iAuxArg==iArg && (pAuxData->iAuxOp==pCtx->iOp || iArg<0) ){
0 0 if( pAuxData->iAuxArg==iArg && (pAuxData->iAuxOp==pCtx->iOp || iArg<0) ){
81591 0 0 for(pAuxData=pVdbe->pAuxData; pAuxData; pAuxData=pAuxData->pNextAux){
81592 0 0 if( pAuxData->iAuxArg==iArg && (pAuxData->iAuxOp==pCtx->iOp || iArg<0) ){
0 0 if( pAuxData->iAuxArg==iArg && (pAuxData->iAuxOp==pCtx->iOp || iArg<0) ){
0 0 if( pAuxData->iAuxArg==iArg && (pAuxData->iAuxOp==pCtx->iOp || iArg<0) ){
81596 0 0 if( pAuxData==0 ){
81598 0 0 if( !pAuxData ) goto failed;
81603 0 0 if( pCtx->isError==0 ) pCtx->isError = -1;
81604 0 0 }else if( pAuxData->xDeleteAux ){
81613 0 0 if( xDelete ){
81639 7113 4 return pVm ? pVm->nResColumn : 0;
81648 14 0 if( pVm==0 || pVm->pResultSet==0 ) return 0;
0 14 if( pVm==0 || pVm->pResultSet==0 ) return 0;
81700 0 8586 if( pVm==0 ) return (Mem*)columnNullValue();
81703 8580 6 if( pVm->pResultSet!=0 && inResColumn && i>=0 ){
8580 0 if( pVm->pResultSet!=0 && inResColumn && i>=0 ){
8580 0 if( pVm->pResultSet!=0 && inResColumn && i>=0 ){
81738 8586 0 if( p ){
81792 0 14 if( pOut->flags&MEM_Static ){
81849 2651 0 if( N=0 ){
2651 0 if( N=0 ){
81857 0 2651 if( db->mallocFailed ){
81975 0 2021 if( vdbeSafetyNotNull(p) ){
81979 2021 0 if( p->magic!=VDBE_MAGIC_RUN || p->pc>=0 ){
0 2021 if( p->magic!=VDBE_MAGIC_RUN || p->pc>=0 ){
81986 2021 0 if( i<1 || i>p->nVar ){
0 2021 if( i<1 || i>p->nVar ){
82007 0 2021 if( p->expmask!=0 && (p->expmask & (i>=31 ? 0x80000000 : (u32)1<
0 0 if( p->expmask!=0 && (p->expmask & (i>=31 ? 0x80000000 : (u32)1<
0 0 if( p->expmask!=0 && (p->expmask & (i>=31 ? 0x80000000 : (u32)1<
82029 1331 0 if( rc==SQLITE_OK ){
82030 1331 0 if( zData!=0 ){
82033 1331 0 if( rc==SQLITE_OK && encoding!=0 ){
1009 322 if( rc==SQLITE_OK && encoding!=0 ){
82036 0 1331 if( rc ){
82042 0 0 }else if( xDel!=SQLITE_STATIC && xDel!=SQLITE_TRANSIENT ){
0 0 }else if( xDel!=SQLITE_STATIC && xDel!=SQLITE_TRANSIENT ){
82072 0 0 if( nData>0x7fffffff ){
82082 2 0 if( rc==SQLITE_OK ){
82095 589 0 if( rc==SQLITE_OK ){
82120 0 0 if( rc==SQLITE_OK ){
82123 0 0 }else if( xDestructor ){
82146 0 0 if( nData>0x7fffffff ){
82149 0 0 if( enc==SQLITE_UTF16 ) enc = SQLITE_UTF16NATIVE;
82176 0 0 if( pValue->flags & MEM_Zero ){
82199 0 0 if( rc==SQLITE_OK ){
82209 0 0 if( n>(u64)p->db->aLimit[SQLITE_LIMIT_LENGTH] ){
82226 1249 7 return p ? p->nVar : 0;
82237 0 4 if( p==0 ) return 0;
82247 7 0 if( p==0 || zName==0 ) return 0;
0 7 if( p==0 || zName==0 ) return 0;
82264 0 1 for(i=0; inVar; i++){
82287 0 0 if( pFrom->nVar!=pTo->nVar ){
82291 0 0 if( pTo->expmask ){
82295 0 0 if( pFrom->expmask ){
82309 0 0 return pStmt ? ((Vdbe*)pStmt)->db : 0;
82317 0 0 return pStmt ? ((Vdbe*)pStmt)->readOnly : 1;
82325 0 0 return v!=0 && v->magic==VDBE_MAGIC_RUN && v->pc>=0;
0 0 return v!=0 && v->magic==VDBE_MAGIC_RUN && v->pc>=0;
0 0 return v!=0 && v->magic==VDBE_MAGIC_RUN && v->pc>=0;
82343 0 0 if( pStmt==0 ){
82366 0 6 if( op==SQLITE_STMTSTATUS_MEMUSED ){
82377 0 6 if( resetFlag ) pVdbe->aCounter[op] = 0;
82387 1385 0 return p ? p->zSql : 0;
82405 0 0 if( zSql ){
82716 110 10 while( zSql[0] ){
82719 10 100 if( tokenType==TK_VARIABLE ){
82773 0 14 if( db->nVdbeExec>1 ){
82774 0 0 while( *zRawSql ){
82776 0 0 while( *(zRawSql++)!='\n' && *zRawSql );
0 0 while( *(zRawSql++)!='\n' && *zRawSql );
82781 4 10 }else if( p->nVar==0 ){
82784 20 0 while( zRawSql[0] ){
82790 10 10 if( nToken==0 ) break;
82791 10 0 if( zRawSql[0]=='?' ){
82792 0 10 if( nToken>1 ){
82812 0 10 if( pVar->flags & MEM_Null ){
82814 0 10 }else if( pVar->flags & MEM_Int ){
82816 0 10 }else if( pVar->flags & MEM_Real ){
82818 10 0 }else if( pVar->flags & MEM_Str ){
82822 0 10 if( enc!=SQLITE_UTF8 ){
82826 0 0 if( SQLITE_NOMEM==sqlite3VdbeChangeEncoding(&utf8, SQLITE_UTF8) ){
82847 0 10 if( enc!=SQLITE_UTF8 ) sqlite3VdbeMemRelease(&utf8);
82849 0 0 }else if( pVar->flags & MEM_Zero ){
82859 0 0 for(i=0; i
82871 0 14 if( out.accError ) sqlite3_str_reset(&out);
83111 843 4802 Mem *pMem = iCur>0 ? &p->aMem[p->nMem-iCur] : p->aMem;
83115 5287 358 nByte =
83120 202 5443 if( p->apCsr[iCur] ){ /*OPTIMIZATION-IF-FALSE*/
83124 5645 0 if( SQLITE_OK==sqlite3VdbeMemClearAndResize(pMem, nByte) ){
83131 5287 358 if( eCurType==CURTYPE_BTREE ){
83160 28 299 if( sqlite3AtoF(pRec->z, &rValue, pRec->n, enc)==0 ) return;
83161 295 4 if( 0==sqlite3Atoi64(pRec->z, &iValue, pRec->n, enc) ){
83167 4 0 if( bTryForInt ) sqlite3VdbeIntegerAffinity(pRec);
83199 1653 1117 if( affinity>=SQLITE_AFF_NUMERIC ){
83202 848 805 if( (pRec->flags & MEM_Int)==0 ){ /*OPTIMIZATION-IF-FALSE*/
83203 848 0 if( (pRec->flags & MEM_Real)==0 ){
83204 233 615 if( pRec->flags & MEM_Str ) applyNumericAffinity(pRec,1);
83209 1117 0 }else if( affinity==SQLITE_AFF_TEXT ){
83215 39 1078 if( 0==(pRec->flags&MEM_Str) ){ /*OPTIMIZATION-IF-FALSE*/
83216 4 35 if( (pRec->flags&(MEM_Real|MEM_Int)) ){
83232 0 10 if( eType==SQLITE_TEXT ){
83261 0 2 if( sqlite3AtoF(pMem->z, &pMem->u.r, pMem->n, pMem->enc)==0 ){
83264 2 0 if( sqlite3Atoi64(pMem->z, &pMem->u.i, pMem->n, pMem->enc)==0 ){
83278 67 33 if( pMem->flags & (MEM_Int|MEM_Real) ){
83281 2 31 if( pMem->flags & (MEM_Str|MEM_Blob) ){
83541 9 14316 if( VdbeMemDynamic(pOut) ){ /*OPTIMIZATION-IF-FALSE*/
83586 0 11324 if( p->rc==SQLITE_NOMEM ){
83597 0 11324 if( db->u1.isInterrupted ) goto abort_due_to_interrupt;
83600 4014 7310 if( db->xProgress ){
83775 0 16493 if( db->u1.isInterrupted ) goto abort_due_to_interrupt;
83783 240 16253 if( nVmStep>=nProgressLimit && db->xProgress!=0 ){
240 0 if( nVmStep>=nProgressLimit && db->xProgress!=0 ){
83786 0 240 if( db->xProgress(db->pProgressArg) ){
83849 24 22 if( pOp->p2 ) goto jump_to_p2;
83912 81 0 if( (pIn3->flags & MEM_Null)==0 ) break;
83954 4736 4 if( pOp->p1==SQLITE_OK && p->pFrame ){
0 4736 if( pOp->p1==SQLITE_OK && p->pFrame ){
83961 0 0 if( pOp->p2==OE_Ignore ){
83978 4 4736 if( p->rc ){
83979 4 0 if( pOp->p5 ){
83987 3 1 if( pOp->p4.z ){
83997 0 4740 if( rc==SQLITE_BUSY ){
84002 5 4735 rc = p->rc ? SQLITE_ERROR : SQLITE_DONE;
84062 0 2514 if( encoding!=SQLITE_UTF8 ){
84065 0 0 if( SQLITE_OK!=sqlite3VdbeChangeEncoding(pOut, encoding) ) goto no_mem;
84070 0 0 if( pOp->p4type==P4_DYNAMIC ){
84079 0 2514 if( pOp->p1>db->aLimit[SQLITE_LIMIT_LENGTH] ){
84107 0 2709 if( pOp->p3>0 ){
84111 0 0 if( pIn3->u.i==pOp->p5 ) pOut->flags = MEM_Blob|MEM_Static|MEM_Term;
84135 0 1337 pOut->flags = nullFlag = pOp->p1 ? (MEM_Null|MEM_Cleared) : MEM_Null;
84140 718 1337 while( cnt>0 ){
84195 0 1970 if( sqlite3VdbeMemTooBig(pVar) ){
84237 0 86 Deephemeralize(pOut);
0 0 Deephemeralize(pOut);
84241 0 86 }while( --n );
84263 785 53 Deephemeralize(pOut);
0 785 Deephemeralize(pOut);
84268 838 0 if( (n--)==0 ) break;
84335 2002 4324 if( db->xProgress!=0
84336 80 1922 && nVmStep>=nProgressLimit
84337 0 80 && db->xProgress(db->pProgressArg)!=0
84347 0 6326 if( SQLITE_OK!=(rc = sqlite3VdbeCheckFk(p, 0)) ){
84380 9035 6326 for(i=0; ip2; i++){
84382 0 9035 Deephemeralize(&pMem[i]);
0 0 Deephemeralize(&pMem[i]);
84388 0 6326 if( db->mallocFailed ) goto no_mem;
84390 0 6326 if( db->mTrace & SQLITE_TRACE_ROW ){
84421 0 0 if( (pIn1->flags | pIn2->flags) & MEM_Null ){
84425 0 0 if( ExpandBlob(pIn1) || ExpandBlob(pIn2) ) goto no_mem;
0 0 if( ExpandBlob(pIn1) || ExpandBlob(pIn2) ) goto no_mem;
0 0 if( ExpandBlob(pIn1) || ExpandBlob(pIn2) ) goto no_mem;
0 0 if( ExpandBlob(pIn1) || ExpandBlob(pIn2) ) goto no_mem;
84426 0 0 Stringify(pIn1, encoding);
0 0 Stringify(pIn1, encoding);
84427 0 0 Stringify(pIn2, encoding);
0 0 Stringify(pIn2, encoding);
84429 0 0 if( nByte>db->aLimit[SQLITE_LIMIT_LENGTH] ){
84432 0 0 if( sqlite3VdbeMemGrow(pOut, (int)nByte+2, pOut==pIn2) ){
84436 0 0 if( pOut!=pIn2 ){
84507 19 31 if( (type1 & type2 & MEM_Int)!=0 ){
84512 0 19 case OP_Add: if( sqlite3AddInt64(&iB,iA) ) goto fp_math; break;
84513 0 0 case OP_Subtract: if( sqlite3SubInt64(&iB,iA) ) goto fp_math; break;
84514 0 0 case OP_Multiply: if( sqlite3MulInt64(&iB,iA) ) goto fp_math; break;
84516 0 0 if( iA==0 ) goto arithmetic_result_is_null;
84517 0 0 if( iA==-1 && iB==SMALLEST_INT64 ) goto fp_math;
0 0 if( iA==-1 && iB==SMALLEST_INT64 ) goto fp_math;
84522 0 0 if( iA==0 ) goto arithmetic_result_is_null;
84523 0 0 if( iA==-1 ) iA = 1;
84530 31 0 }else if( (flags & MEM_Null)!=0 ){
84543 0 0 if( rA==(double)0 ) goto arithmetic_result_is_null;
84550 0 0 if( iA==0 ) goto arithmetic_result_is_null;
84551 0 0 if( iA==-1 ) iA = 1;
84560 0 0 if( sqlite3IsNaN(rB) ){
84565 0 0 if( ((type1|type2)&MEM_Real)==0 && !bIntint ){
0 0 if( ((type1|type2)&MEM_Real)==0 && !bIntint ){
84594 0 17 if( pOp->p1 ){
84642 0 0 if( (pIn1->flags | pIn2->flags) & MEM_Null ){
84649 0 0 if( op==OP_BitAnd ){
84651 0 0 }else if( op==OP_BitOr ){
84653 0 0 }else if( iB!=0 ){
84657 0 0 if( iB<0 ){
84660 0 0 iB = iB>(-64) ? -iB : 64;
84663 0 0 if( iB>=64 ){
84664 0 0 iA = (iA>=0 || op==OP_ShiftLeft) ? 0 : -1;
0 0 iA = (iA>=0 || op==OP_ShiftLeft) ? 0 : -1;
84667 0 0 if( op==OP_ShiftLeft ){
84672 0 0 if( iA<0 ) uA |= ((((u64)0xffffffff)<<32)|0xffffffff) << (64-iB);
84707 121 90 if( (pIn1->flags & MEM_Int)==0 ){
84710 4 117 if( (pIn1->flags & MEM_Int)==0 ){
84711 4 0 if( pOp->p2==0 ){
84735 0 0 if( pIn1->flags & MEM_Int ){
84767 0 1 rc = ExpandBlob(pIn1);
84770 0 1 if( rc ) goto abort_due_to_error;
84886 21 1667 if( (flags1 | flags3)&MEM_Null ){
84888 0 21 if( pOp->p5 & SQLITE_NULLEQ ){
84896 0 0 if( (flags1&flags3&MEM_Null)!=0
84897 0 0 && (flags3&MEM_Cleared)==0
84908 0 21 if( pOp->p5 & SQLITE_STOREP2 ){
84916 0 21 if( pOp->p5 & SQLITE_JUMPIFNULL ){
84925 142 1525 if( affinity>=SQLITE_AFF_NUMERIC ){
84926 94 48 if( (flags1 | flags3)&MEM_Str ){
84927 94 0 if( (flags1 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
84937 0 94 if( (flags3 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
84943 142 0 if( (pIn1->flags & pIn3->flags & MEM_Int)!=0 ){
84944 35 107 if( pIn3->u.i > pIn1->u.i ){ res = +1; goto compare_op; }
84945 51 56 if( pIn3->u.i < pIn1->u.i ){ res = -1; goto compare_op; }
84949 922 603 }else if( affinity==SQLITE_AFF_TEXT ){
84950 0 922 if( (flags1 & MEM_Str)==0 && (flags1 & (MEM_Int|MEM_Real))!=0 ){
0 0 if( (flags1 & MEM_Str)==0 && (flags1 & (MEM_Int|MEM_Real))!=0 ){
84958 0 922 if( (flags3 & MEM_Str)==0 && (flags3 & (MEM_Int|MEM_Real))!=0 ){
0 0 if( (flags3 & MEM_Str)==0 && (flags3 & (MEM_Int|MEM_Real))!=0 ){
84978 668 999 if( res<0 ){ /* ne, eq, gt, le, lt, ge */
84981 665 334 }else if( res==0 ){
84995 0 1667 if( pOp->p5 & SQLITE_STOREP2 ){
84998 0 0 if( (pOp->p5 & SQLITE_KEEPNULL)!=0 ){
85012 0 0 if( (pOp->opcode==OP_Eq)==res2 ) break;
85020 558 1109 if( res2 ){
85040 0 0 if( iCompare!=0 ) goto jump_to_p2;
85096 227 0 if( (pOp->p5 & OPFLAG_PERMUTE)==0 ){
85122 227 200 for(i=0; i
85123 0 227 idx = aPermute ? aPermute[i] : i;
85132 27 200 if( iCompare ){
85133 0 27 if( bRev ) iCompare = -iCompare;
85147 27 200 if( iCompare<0 ){
85149 200 0 }else if( iCompare==0 ){
85184 0 0 if( pOp->opcode==OP_And ){
85192 0 0 if( v1==2 ){
85240 0 0 if( (pIn1->flags & MEM_Null)==0 ){
85259 0 0 if( (pIn1->flags & MEM_Null)==0 ){
85286 0 148 if( p->pFrame ){
85288 0 0 if( (p->pFrame->aOnce[iAddr/8] & (1<<(iAddr & 7)))!=0 ){
85294 2 146 if( p->aOp[0].p1==pOp->p1 ){
85314 177 263 if( c ) goto jump_to_p2;
85328 238 84 if( c ) goto jump_to_p2;
85340 81 428 if( (pIn1->flags & MEM_Null)!=0 ){
85354 375 95 if( (pIn1->flags & MEM_Null)==0 ){
85371 0 0 if( p->apCsr[pOp->p1]->nullRow ){
85456 0 15969 if( rc ) goto abort_due_to_error;
85469 11703 4266 if( pC->cacheStatus!=p->cacheCtr ){ /*OPTIMIZATION-IF-FALSE*/
85470 4638 7065 if( pC->nullRow ){
85471 4638 0 if( pC->eCurType==CURTYPE_PSEUDO ){
85493 0 7065 if( pC->payloadSize > (u32)db->aLimit[SQLITE_LIMIT_LENGTH] ){
85498 11703 0 pC->iHdrOffset = getVarint32(pC->aRow, aOffset[0]);
85502 0 11703 if( pC->szRow
85519 0 0 if( aOffset[0] > 98307 || aOffset[0] > pC->payloadSize ){
0 0 if( aOffset[0] > 98307 || aOffset[0] > pC->payloadSize ){
85546 1992 2274 if( pC->nHdrParsed<=p2 ){
85550 1992 0 if( pC->iHdrOffset
85552 0 1992 if( pC->aRow==0 ){
85555 0 0 if( rc!=SQLITE_OK ) goto abort_due_to_error;
85569 17029 193 if( (t = zHdr[0])<0x80 ){
85578 3542 13680 }while( i<=p2 && zHdr
3527 15 }while( i<=p2 && zHdr
85585 10864 2831 if( (zHdr>=zEndHdr && (zHdr>zEndHdr || offset64!=pC->payloadSize))
10864 0 if( (zHdr>=zEndHdr && (zHdr>zEndHdr || offset64!=pC->payloadSize))
10864 0 if( (zHdr>=zEndHdr && (zHdr>zEndHdr || offset64!=pC->payloadSize))
85586 0 13695 || (offset64 > pC->payloadSize)
85588 0 0 if( aOffset[0]==0 ){
85592 0 0 if( pC->aRow==0 ) sqlite3VdbeMemRelease(&sMem);
85599 0 13695 if( pC->aRow==0 ) sqlite3VdbeMemRelease(&sMem);
85608 15 13680 if( pC->nHdrParsed<=p2 ){
85609 0 15 if( pOp->p4type==P4_MEM ){
85627 0 15954 if( VdbeMemDynamic(pDest) ){
85631 15948 6 if( pC->szRow>=aOffset[p2+1] ){
85635 11285 4663 if( t<12 ){
85645 1705 2958 if( pDest->szMalloc < len+2 ){
85647 0 1705 if( sqlite3VdbeMemGrow(pDest, len+2, 0) ) goto no_mem;
85659 0 6 if( ((pOp->p5 & (OPFLAG_LENGTHARG|OPFLAG_TYPEOFARG))!=0
85660 0 0 && ((t>=12 && (t&1)==0) || (pOp->p5 & OPFLAG_TYPEOFARG)!=0))
0 0 && ((t>=12 && (t&1)==0) || (pOp->p5 & OPFLAG_TYPEOFARG)!=0))
0 0 && ((t>=12 && (t&1)==0) || (pOp->p5 & OPFLAG_TYPEOFARG)!=0))
85661 0 6 || (len = sqlite3VdbeSerialTypeLen(t))==0
85678 0 6 if( rc!=SQLITE_OK ) goto abort_due_to_error;
85690 0 0 if( aOp[0].p3>0 ){
85721 118 237 }while( zAffinity[0] );
85793 781 7347 if( zAffinity ){
85798 1513 781 }while( zAffinity[0] );
85822 1 11744 if( pRec->flags & MEM_Zero ){
85823 0 1 if( serial_type==0 ){
85832 0 1 }else if( nData ){
85833 0 0 if( sqlite3VdbeMemExpandBlob(pRec) ) goto no_mem;
85842 136 11609 nHdr += serial_type<=127 ? 1 : sqlite3VarintLen(serial_type);
85844 8128 3617 if( pRec==pData0 ) break;
85854 8128 0 if( nHdr<=126 ){
85861 0 0 if( nVarint
85870 4532 3596 if( nByte+nZero<=pOut->szMalloc ){
85877 0 3596 if( nByte+nZero>db->aLimit[SQLITE_LIMIT_LENGTH] ){
85880 0 3596 if( sqlite3VdbeMemClearAndResize(pOut, (int)nByte) ){
85887 8128 0 i = putVarint32(zNewRecord, nHdr);
85895 11609 136 i += putVarint32(&zNewRecord[i], serial_type); /* serial type */
85899 3617 8128 }while( (++pRec)<=pLast );
85906 1 8127 if( nZero ){
85931 0 10 if( rc ) goto abort_due_to_error;
85966 24 10 if( p1==SAVEPOINT_BEGIN ){
85967 0 24 if( db->nVdbeWrite>0 ){
85984 0 24 if( rc!=SQLITE_OK ) goto abort_due_to_error;
85989 24 0 if( pNew ){
85995 13 11 if( db->autoCommit ){
86014 12 0 for(
86016 2 10 pSavepoint && sqlite3StrICmp(pSavepoint->zName, zName);
86021 0 10 if( !pSavepoint ){
86024 0 10 }else if( db->nVdbeWrite>0 && p1==SAVEPOINT_RELEASE ){
0 0 }else if( db->nVdbeWrite>0 && p1==SAVEPOINT_RELEASE ){
86037 8 2 int isTransaction = pSavepoint->pNext==0 && db->isTransactionSavepoint;
7 1 int isTransaction = pSavepoint->pNext==0 && db->isTransactionSavepoint;
86038 7 3 if( isTransaction && p1==SAVEPOINT_RELEASE ){
7 0 if( isTransaction && p1==SAVEPOINT_RELEASE ){
86039 0 7 if( (rc = sqlite3VdbeCheckFk(p, 1))!=SQLITE_OK ){
86043 0 7 if( sqlite3VdbeHalt(p)==SQLITE_BUSY ){
86054 1 2 if( p1==SAVEPOINT_ROLLBACK ){
86056 2 1 for(ii=0; iinDb; ii++){
86060 0 2 if( rc!=SQLITE_OK ) goto abort_due_to_error;
86065 6 3 for(ii=0; iinDb; ii++){
86067 0 6 if( rc!=SQLITE_OK ){
86071 1 2 if( isSchemaChange ){
86080 2 10 while( db->pSavepoint!=pSavepoint ){
86091 9 1 if( p1==SAVEPOINT_RELEASE ){
86095 2 7 if( !isTransaction ){
86103 7 3 if( !isTransaction || p1==SAVEPOINT_ROLLBACK ){
0 7 if( !isTransaction || p1==SAVEPOINT_ROLLBACK ){
86105 0 3 if( rc!=SQLITE_OK ) goto abort_due_to_error;
86109 0 34 if( rc ) goto abort_due_to_error;
86134 218 20 if( desiredAutoCommit!=db->autoCommit ){
86135 28 190 if( iRollback ){
86139 84 106 }else if( desiredAutoCommit && db->nVdbeWrite>0 ){
0 84 }else if( desiredAutoCommit && db->nVdbeWrite>0 ){
86147 0 190 }else if( (rc = sqlite3VdbeCheckFk(p, 1))!=SQLITE_OK ){
86152 0 218 if( sqlite3VdbeHalt(p)==SQLITE_BUSY ){
86160 214 4 if( p->rc==SQLITE_OK ){
86167 0 20 sqlite3VdbeError(p,
86168 0 0 (!desiredAutoCommit)?"cannot start a transaction within a transaction":(
86220 3487 1333 if( pOp->p2 && (db->flags & SQLITE_QueryOnly)!=0 ){
0 3487 if( pOp->p2 && (db->flags & SQLITE_QueryOnly)!=0 ){
86226 4749 71 if( pBt ){
86230 9 4740 if( rc!=SQLITE_OK ){
86231 7 2 if( (rc&0xff)==SQLITE_BUSY ){
86239 3407 1333 if( pOp->p2 && p->usesStmtJournal
11 3396 if( pOp->p2 && p->usesStmtJournal
86240 11 0 && (db->autoCommit==0 || db->nVdbeRead>1)
0 11 && (db->autoCommit==0 || db->nVdbeRead>1)
86243 0 0 if( p->iStatement==0 ){
86250 0 0 if( rc==SQLITE_OK ){
86262 4229 582 if( pOp->p5
86263 4229 0 && (iMeta!=pOp->p3
86264 0 4229 || db->aDb[pOp->p1].pSchema->iGeneration!=pOp->p4.i)
86286 0 0 if( db->aDb[pOp->p1].pSchema->schema_cookie!=iMeta ){
86292 0 4811 if( rc ) goto abort_due_to_error;
86350 223 288 if( pOp->p2==BTREE_SCHEMA_VERSION ){
86354 144 144 }else if( pOp->p2==BTREE_FILE_FORMAT ){
86358 75 436 if( pOp->p1==1 ){
86364 0 511 if( rc ) goto abort_due_to_error;
86465 9 2 if( pCur && pCur->pgnoRoot==(u32)pOp->p2 ){
9 0 if( pCur && pCur->pgnoRoot==(u32)pOp->p2 ){
86479 0 5282 if( p->expired==1 ){
86493 3764 1518 if( pOp->opcode==OP_OpenWrite ){
86497 3237 527 if( pDb->pSchema->file_format < p->minWriteFileFormat ){
86503 6 5276 if( pOp->p5 & OPFLAG_P2ISREG ){
86518 193 5089 if( pOp->p4type==P4_KEYINFO ){
86523 5089 0 }else if( pOp->p4type==P4_INT32 ){
86530 0 5282 if( pCur==0 ) goto no_mem;
86554 0 5291 if( rc ) goto abort_due_to_error;
86574 0 0 if( pCx==0 ) goto no_mem;
86629 0 5 if( pCx==0 ) goto no_mem;
86634 5 0 if( rc==SQLITE_OK ){
86637 5 0 if( rc==SQLITE_OK ){
86643 5 0 if( (pCx->pKeyInfo = pKeyInfo = pOp->p4.pKeyInfo)!=0 ){
86647 5 0 if( rc==SQLITE_OK ){
86661 0 5 if( rc ) goto abort_due_to_error;
86682 0 160 if( pCx==0 ) goto no_mem;
86687 0 160 if( rc ) goto abort_due_to_error;
86703 59 174 if( (pC->seqCount++)==0 ){
86731 0 155 if( pCx==0 ) goto no_mem;
86891 0 120 if( pC->isTable ){
86900 0 0 if( (pIn3->flags & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
86907 0 0 if( (pIn3->flags & MEM_Int)==0 ){
86908 0 0 if( (pIn3->flags & MEM_Real)==0 ){
86922 0 0 if( pIn3->u.r<(double)iKey ){
86926 0 0 if( (oc & 0x0001)==(OP_SeekGT & 0x0001) ) oc--;
86931 0 0 else if( pIn3->u.r>(double)iKey ){
86935 0 0 if( (oc & 0x0001)==(OP_SeekLT & 0x0001) ) oc++;
86940 0 0 if( rc!=SQLITE_OK ){
86948 31 89 if( sqlite3BtreeCursorHasHint(pC->uc.pCursor, BTREE_SEEK_EQ) ){
86971 113 7 r.default_rc = ((1 & (oc - OP_SeekLT)) ? -1 : +1);
86983 0 120 if( rc!=SQLITE_OK ){
86986 31 89 if( eqOnly && r.eqSeen==0 ){
7 24 if( eqOnly && r.eqSeen==0 ){
86996 13 100 if( oc>=OP_SeekGE ){ assert( oc==OP_SeekGE || oc==OP_SeekGT );
86997 9 4 if( res<0 || (res==0 && oc==OP_SeekGT) ){
0 9 if( res<0 || (res==0 && oc==OP_SeekGT) ){
0 0 if( res<0 || (res==0 && oc==OP_SeekGT) ){
87000 1 3 if( rc!=SQLITE_OK ){
87001 1 0 if( rc==SQLITE_DONE ){
87013 100 0 if( res>0 || (res==0 && oc==OP_SeekLT) ){
0 100 if( res>0 || (res==0 && oc==OP_SeekLT) ){
0 0 if( res>0 || (res==0 && oc==OP_SeekLT) ){
87016 0 0 if( rc!=SQLITE_OK ){
87017 0 0 if( rc==SQLITE_DONE ){
87034 9 111 if( res ){
87036 24 87 }else if( eqOnly ){
87153 0 0 if( pC->seekHit ) break;
87183 50 0 if( pOp->p4.i>0 ){
87198 0 0 rc = ExpandBlob(pIn3);
87200 0 0 if( rc ) goto no_mem;
87202 0 0 if( pIdxKey==0 ) goto no_mem;
87207 48 2 if( pOp->opcode==OP_NoConflict ){
87211 82 44 for(ii=0; iinField; ii++){
87212 4 78 if( pIdxKey->aMem[ii].flags & MEM_Null ){
87219 0 50 if( pFree ) sqlite3DbFreeNN(db, pFree);
87220 0 50 if( rc!=SQLITE_OK ){
87228 2 48 if( pOp->opcode==OP_Found ){
87230 0 2 if( alreadyExists ) goto jump_to_p2;
87233 44 4 if( takeJump || !alreadyExists ) goto jump_to_p2;
3 41 if( takeJump || !alreadyExists ) goto jump_to_p2;
87292 0 443 if( (pIn3->flags & MEM_Int)==0 ){
87302 0 0 if( isNotInt ) goto jump_to_p2;
87328 198 470 if( res!=0 ){
87330 0 198 if( pOp->p2==0 ){
87336 0 470 if( rc ) goto abort_due_to_error;
87416 3058 0 if( !pC->useRandomRowid ){
87418 0 3058 if( rc!=SQLITE_OK ){
87421 285 2773 if( res ){
87426 0 2773 if( v>=MAX_ROWID ){
87435 192 2866 if( pOp->p3 ){
87438 0 192 if( p->pFrame ){
87439 0 0 for(pFrame=p->pFrame; pFrame->pParent; pFrame=pFrame->pParent);
87454 192 0 if( pMem->u.i==MAX_ROWID || pC->useRandomRowid ){
0 192 if( pMem->u.i==MAX_ROWID || pC->useRandomRowid ){
87458 0 192 if( vu.i+1 ){
87464 0 3058 if( pC->useRandomRowid ){
87477 0 0 && (res==0)
87478 0 0 && (++cnt<100));
0 0 && (++cnt<100));
87479 0 0 if( rc ) goto abort_due_to_error;
87480 0 0 if( res==0 ){
87558 3637 0 if( pOp->opcode==OP_Insert ){
87569 2981 656 if( pOp->p4type==P4_TABLE && HAS_UPDATE_HOOK(db) ){
60 2921 if( pOp->p4type==P4_TABLE && HAS_UPDATE_HOOK(db) ){
87593 2981 656 if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++;
87594 2977 660 if( pOp->p5 & OPFLAG_LASTROWID ) db->lastRowid = x.nKey;
87598 3015 622 seekResult = ((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0);
87599 1 3636 if( pData->flags & MEM_Zero ){
87612 0 3637 if( rc ) goto abort_due_to_error;
87613 60 3577 if( pTab ){
87616 0 60 db->xUpdateCallback(db->pUpdateArg,
87688 12 6 if( pOp->p4type==P4_TABLE && HAS_UPDATE_HOOK(db) ){
0 12 if( pOp->p4type==P4_TABLE && HAS_UPDATE_HOOK(db) ){
87693 0 0 if( (pOp->p5 & OPFLAG_SAVEPOSITION)!=0 && pC->isTable ){
0 0 if( (pOp->p5 & OPFLAG_SAVEPOSITION)!=0 && pC->isTable ){
87739 0 18 if( rc ) goto abort_due_to_error;
87742 12 6 if( opflags & OPFLAG_NCHANGE ){
87744 0 12 if( db->xUpdateCallback && HasRowid(pTab) ){
0 0 if( db->xUpdateCallback && HasRowid(pTab) ){
87794 0 1 if( rc ) goto abort_due_to_error;
87795 1 0 if( res ) goto jump_to_p2;
87820 0 4636 if( rc ) goto abort_due_to_error;
87885 0 0 if( n>(u32)db->aLimit[SQLITE_LIMIT_LENGTH] ){
87890 0 0 if( rc ) goto abort_due_to_error;
87891 0 0 if( !pOp->p3 ) Deephemeralize(pOut);
0 0 if( !pOp->p3 ) Deephemeralize(pOut);
0 0 if( !pOp->p3 ) Deephemeralize(pOut);
87918 0 524 if( pC->nullRow ){
87921 12 512 }else if( pC->deferredMoveto ){
87924 0 512 }else if( pC->eCurType==CURTYPE_VTAB ){
87931 0 0 if( rc ) goto abort_due_to_error;
87937 0 512 if( rc ) goto abort_due_to_error;
87938 0 512 if( pC->nullRow ){
87962 0 0 if( pC->eCurType==CURTYPE_BTREE ){
88010 2 26 if( pOp->opcode==OP_SeekEnd ){
88013 0 2 if( sqlite3BtreeCursorIsValidNN(pCrsr) ){
88021 0 28 if( rc ) goto abort_due_to_error;
88022 24 4 if( pOp->p2>0 ){
88024 24 0 if( res ) goto jump_to_p2;
88046 0 0 if( rc ) goto abort_due_to_error;
88047 0 0 if( res==0 ){
88049 0 0 if( ALWAYS(sz>=0) && sqlite3LogEst((u64)sz)p3 ) res = 1;
0 0 if( ALWAYS(sz>=0) && sqlite3LogEst((u64)sz)p3 ) res = 1;
88052 0 0 if( res ) goto jump_to_p2;
88116 160 1046 if( isSorter(pC) ){
88124 0 1046 if( pOp->p5 ) sqlite3BtreeSkipNext(pCrsr);
88129 0 1206 if( rc ) goto abort_due_to_error;
88133 271 935 if( res ) goto jump_to_p2;
88230 10342 784 if( rc==SQLITE_OK ){
88238 0 784 if( rc!=SQLITE_DONE ) goto abort_due_to_error;
88291 0 4703 if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++;
88294 0 4703 rc = ExpandBlob(pIn2);
88295 0 4703 if( rc ) goto abort_due_to_error;
88296 4640 63 if( pOp->opcode==OP_SorterInsert ){
88303 54 9 rc = sqlite3BtreeInsert(pC->uc.pCursor, &x,
88310 0 4703 if( rc) goto abort_due_to_error;
88342 0 0 if( rc ) goto abort_due_to_error;
88343 0 0 if( res==0 ){
88345 0 0 if( rc ) goto abort_due_to_error;
88403 0 257 if( NEVER(rc!=SQLITE_OK) ) goto abort_due_to_error;
88405 257 0 if( !pC->nullRow ){
88408 0 257 if( rc!=SQLITE_OK ){
88411 246 11 if( pOp->opcode==OP_DeferredSeek ){
88498 16 256 if( pOp->opcode
88518 257 15 if( (pOp->opcode&1)==(OP_IdxLT&1) ){
88526 0 272 if( rc ) goto abort_due_to_error;
88527 32 240 if( res>0 ) goto jump_to_p2;
88567 0 5 if( db->nVdbeRead > db->nVDestroy+1 ){
88578 0 5 if( rc ) goto abort_due_to_error;
88580 0 5 if( iMoved!=0 ){
88616 28 0 rc = sqlite3BtreeClearTable(
88619 28 0 if( pOp->p3 ){
88621 0 28 if( pOp->p3>0 ){
88627 0 28 if( rc ) goto abort_due_to_error;
88645 0 0 if( isSorter(pC) ){
88651 0 0 if( rc ) goto abort_due_to_error;
88679 0 241 if( rc ) goto abort_due_to_error;
88693 0 0 if( rc ) goto abort_due_to_error;
88727 0 218 if( pOp->p4.z==0 ){
88744 0 218 if( zSql==0 ){
88752 218 0 if( rc==SQLITE_OK ) rc = initData.rc;
88757 0 218 if( rc ){
88759 0 0 if( rc==SQLITE_NOMEM ){
88777 0 1 if( rc ) goto abort_due_to_error;
88867 0 0 if( nErr==0 ){
88869 0 0 }else if( z==0 ){
88893 2 0 if( (pIn1->flags & MEM_Blob)==0 ){
88894 0 2 if( sqlite3VdbeMemSetRowSet(pIn1) ) goto no_mem;
88914 4 5 if( (pIn1->flags & MEM_Blob)==0
88915 2 2 || sqlite3RowSetNext((RowSet*)pIn1->z, &val)==0
88964 7 9 if( (pIn1->flags & MEM_Blob)==0 ){
88965 0 7 if( sqlite3VdbeMemSetRowSet(pIn1) ) goto no_mem;
88970 12 4 if( iSet ){
88973 0 12 if( exists ) goto jump_to_p2;
88975 10 6 if( iSet>=0 ){
89024 0 0 if( pOp->p5 ){
89026 0 0 for(pFrame=p->pFrame; pFrame && pFrame->token!=t; pFrame=pFrame->pParent);
0 0 for(pFrame=p->pFrame; pFrame && pFrame->token!=t; pFrame=pFrame->pParent);
89027 0 0 if( pFrame ) break;
89030 0 0 if( p->nFrame>=db->aLimit[SQLITE_LIMIT_TRIGGER_DEPTH] ){
89040 0 0 if( (pRt->flags&MEM_Blob)==0 ){
89048 0 0 if( pProgram->nCsr==0 ) nMem++;
89054 0 0 if( !pFrame ){
89082 0 0 for(pMem=VdbeFrameMem(pFrame); pMem!=pEnd; pMem++){
89155 0 1 if( db->flags & SQLITE_DeferFKs ){
89157 0 1 }else if( pOp->p1 ){
89178 0 2 if( pOp->p1 ){
89180 0 0 if( db->nDeferredCons==0 && db->nDeferredImmCons==0 ) goto jump_to_p2;
0 0 if( db->nDeferredCons==0 && db->nDeferredImmCons==0 ) goto jump_to_p2;
89183 2 0 if( p->nFkConstraint==0 && db->nDeferredImmCons==0 ) goto jump_to_p2;
2 0 if( p->nFkConstraint==0 && db->nDeferredImmCons==0 ) goto jump_to_p2;
89203 0 192 if( p->pFrame ){
89204 0 0 for(pFrame=p->pFrame; pFrame->pParent; pFrame=pFrame->pParent);
89213 0 192 if( pIn1->u.iu.i){
89234 33 33 if( pIn1->u.i>0 ){
89267 0 0 if( x<=0 || sqlite3AddInt64(&x, pIn3->u.i>0?pIn3->u.i:0) ){
0 0 if( x<=0 || sqlite3AddInt64(&x, pIn3->u.i>0?pIn3->u.i:0) ){
89294 3 2 if( pIn1->u.i ){
89295 3 0 if( pIn1->u.i>0 ) pIn1->u.i--;
89310 58 0 if( pIn1->u.i>SMALLEST_INT64 ) pIn1->u.i--;
89312 58 0 if( pIn1->u.i==0 ) goto jump_to_p2;
89368 0 77 if( pCtx==0 ) goto no_mem;
89411 77 391 if( pCtx->pMem != pMem ){
89413 29 77 for(i=pCtx->argc-1; i>=0; i--) pCtx->argv[i] = &aMem[pOp->p2+i];
89428 0 468 if( pOp->p1 ){
89434 0 468 if( pCtx->isError ){
89435 0 0 if( pCtx->isError>0 ){
89439 0 0 if( pCtx->skipFlag ){
89442 0 0 if( i ) sqlite3VdbeMemSetInt64(&aMem[i], 1);
89448 0 0 if( rc ) goto abort_due_to_error;
89489 0 186 if( pOp->p3 ){
89498 0 186 if( rc ){
89504 0 186 if( sqlite3VdbeMemTooBig(pMem) ){
89536 0 0 if( rc ){
89537 0 0 if( rc!=SQLITE_BUSY ) goto abort_due_to_error;
89541 0 0 for(i=0, pMem = &aMem[pOp->p3]; i<3; i++, pMem++){
89585 0 0 if( eNew==PAGER_JOURNALMODE_QUERY ) eNew = eOld;
89586 0 0 if( !sqlite3PagerOkToChangeJournalMode(pPager) ) eNew = eOld;
89594 0 0 if( eNew==PAGER_JOURNALMODE_WAL
89595 0 0 && (sqlite3Strlen30(zFilename)==0 /* Temp file */
89596 0 0 || !sqlite3PagerWalSupported(pPager)) /* No shared-memory support */
89601 0 0 if( (eNew!=eOld)
89602 0 0 && (eOld==PAGER_JOURNALMODE_WAL || eNew==PAGER_JOURNALMODE_WAL)
0 0 && (eOld==PAGER_JOURNALMODE_WAL || eNew==PAGER_JOURNALMODE_WAL)
89604 0 0 if( !db->autoCommit || db->nVdbeRead>1 ){
0 0 if( !db->autoCommit || db->nVdbeRead>1 ){
89606 0 0 sqlite3VdbeError(p,
89613 0 0 if( eOld==PAGER_JOURNALMODE_WAL ){
89620 0 0 if( rc==SQLITE_OK ){
89623 0 0 }else if( eOld==PAGER_JOURNALMODE_MEMORY ){
89633 0 0 if( rc==SQLITE_OK ){
89634 0 0 rc = sqlite3BtreeSetVersion(pBt, (eNew==PAGER_JOURNALMODE_WAL ? 2 : 1));
89640 0 0 if( rc ) eNew = eOld;
89648 0 0 if( rc ) goto abort_due_to_error;
89662 0 0 if( rc ) goto abort_due_to_error;
89683 0 0 if( rc ){
89684 0 0 if( rc!=SQLITE_DONE ) goto abort_due_to_error;
89710 24 5 if( !pOp->p1 ){
89736 15 0 if( isWriteLock || 0==(db->flags&SQLITE_ReadUncommit) ){
15 0 if( isWriteLock || 0==(db->flags&SQLITE_ReadUncommit) ){
89742 0 15 if( rc ){
89743 0 0 if( (rc&0xFF)==SQLITE_LOCKED ){
89768 35 10 if( pVTab ) sqlite3VtabImportErrmsg(p, pVTab->pVtab);
89769 0 45 if( rc ) goto abort_due_to_error;
89794 10 0 if( zTab ){
89798 1 9 if( rc ) goto abort_due_to_error;
89813 0 0 if( rc ) goto abort_due_to_error;
89835 43 0 if( pVtab==0 || NEVER(pVtab->pModule==0) ){
0 43 if( pVtab==0 || NEVER(pVtab->pModule==0) ){
89842 0 43 if( rc ) goto abort_due_to_error;
89849 43 0 if( pCur ){
89912 60 43 for(i = 0; i
89917 0 43 if( rc ) goto abort_due_to_error;
89921 5 38 if( res ) goto jump_to_p2;
89952 0 96 if( pCur->nullRow ){
89962 0 96 if( pOp->p5 & OPFLAG_NOCHNG ){
89971 0 96 if( sContext.isError>0 ){
89979 0 96 if( sqlite3VdbeMemTooBig(pDest) ){
89982 0 96 if( rc ) goto abort_due_to_error;
90003 0 75 if( pCur->nullRow ){
90018 0 75 if( rc ) goto abort_due_to_error;
90021 37 38 if( !res ){
90054 0 0 if( rc ) goto abort_due_to_error;
90056 0 0 if( isLegacy==0 ) db->flags &= ~SQLITE_LegacyAlter;
90059 0 0 if( rc ) goto abort_due_to_error;
90105 0 35 if( db->mallocFailed ) goto no_mem;
90108 35 0 if( pVtab==0 || NEVER(pVtab->pModule==0) ){
0 35 if( pVtab==0 || NEVER(pVtab->pModule==0) ){
90115 35 0 if( ALWAYS(pModule->xUpdate) ){
90119 229 35 for(i=0; i
90129 35 0 if( rc==SQLITE_OK && pOp->p1 ){
35 0 if( rc==SQLITE_OK && pOp->p1 ){
90133 0 35 if( (rc&0xff)==SQLITE_CONSTRAINT && pOp->p4.pVtab->bConstraint ){
0 0 if( (rc&0xff)==SQLITE_CONSTRAINT && pOp->p4.pVtab->bConstraint ){
90134 0 0 if( pOp->p5==OE_Ignore ){
90137 0 0 p->errorAction = ((pOp->p5==OE_Replace) ? OE_Abort : pOp->p5);
90142 0 35 if( rc ) goto abort_due_to_error;
90177 0 0 if( pOp->p3 ){
90179 0 0 if( newMax < (unsigned)pOp->p3 ) newMax = (unsigned)pOp->p3;
90238 0 543 if( pCtx==0 ) goto no_mem;
90265 543 398 if( pCtx->pOut != pOut ){
90267 950 543 for(i=pCtx->argc-1; i>=0; i--) pCtx->argv[i] = &aMem[pOp->p2+i];
90282 6 935 if( pCtx->isError ){
90283 6 0 if( pCtx->isError>0 ){
90289 6 0 if( rc ) goto abort_due_to_error;
90293 292 643 if( pOut->flags & (MEM_Str|MEM_Blob) ){
90295 0 292 if( sqlite3VdbeMemTooBig(pOut) ) goto too_big;
90350 20 5335 if( (db->mTrace & (SQLITE_TRACE_STMT|SQLITE_TRACE_LEGACY))!=0
90351 20 0 && !p->doingRerun
90352 0 20 && (zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0
14 6 && (zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0
90355 14 0 if( db->mTrace & SQLITE_TRACE_LEGACY ){
90362 0 0 if( db->nVdbeExec>1 ){
90389 0 5355 if( pOp->p1>=sqlite3GlobalConfig.iOnceResetThreshold ){
90390 0 0 if( pOp->opcode==OP_Trace ) break;
90391 0 0 for(i=1; inOp; i++){
90392 0 0 if( p->aOp[i].opcode==OP_Once ) p->aOp[i].p1 = 0;
90500 0 33 if( db->mallocFailed ) rc = SQLITE_NOMEM_BKPT;
90502 6 27 if( p->zErrMsg==0 && rc!=SQLITE_IOERR_NOMEM ){
6 0 if( p->zErrMsg==0 && rc!=SQLITE_IOERR_NOMEM ){
90511 0 33 if( rc==SQLITE_IOERR_NOMEM ) sqlite3OomFault(db);
90513 0 33 if( resetSchemaOnFault>0 ){
90550 0 0 rc = db->mallocFailed ? SQLITE_NOMEM_BKPT : SQLITE_INTERRUPT;
90627 0 15 if( v->pc>4 ){
90634 15 0 if( rc==SQLITE_ROW ){
90636 15 0 u32 type = pC->nHdrParsed>p->iCol ? pC->aType[p->iCol] : 0;
90639 0 15 if( type<12 ){
90640 0 0 zErr = sqlite3MPrintf(p->db, "cannot open value of type %s",
90641 0 0 type==0?"null": type==7?"real": "integer"
90654 15 0 if( rc==SQLITE_ROW ){
90656 0 0 }else if( p->pStmt ){
90659 0 0 if( rc==SQLITE_OK ){
90712 0 15 if( !pBlob ) goto blob_open_out;
90719 15 0 if( pTab && IsVirtual(pTab) ){
0 15 if( pTab && IsVirtual(pTab) ){
90723 15 0 if( pTab && !HasRowid(pTab) ){
0 15 if( pTab && !HasRowid(pTab) ){
90728 15 0 if( pTab && pTab->pSelect ){
0 15 if( pTab && pTab->pSelect ){
90733 0 15 if( !pTab ){
90734 0 0 if( sParse.zErrMsg ){
90747 30 0 for(iCol=0; iColnCol; iCol++) {
90748 15 15 if( sqlite3StrICmp(pTab->aCol[iCol].zName, zColumn)==0 ){
90752 0 15 if( iCol==pTab->nCol ){
90763 0 15 if( wrFlag ){
90767 0 0 if( db->flags&SQLITE_ForeignKeys ){
90773 0 0 for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){
90775 0 0 for(j=0; jnCol; j++){
90776 0 0 if( pFKey->aCol[j].iFrom==iCol ){
90783 0 0 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
90785 0 0 for(j=0; jnKeyCol; j++){
90787 0 0 if( pIdx->aiColumn[j]==iCol || pIdx->aiColumn[j]==XN_EXPR ){
0 0 if( pIdx->aiColumn[j]==iCol || pIdx->aiColumn[j]==XN_EXPR ){
90792 0 0 if( zFault ){
90803 15 0 if( pBlob->pStmt ){
90844 15 0 if( db->mallocFailed==0 ){
90855 15 0 if( db->mallocFailed==0 ){
90860 0 15 if( wrFlag ) aOp[1].opcode = OP_OpenWrite;
90885 0 15 if( db->mallocFailed ){
90889 15 0 } while( (++nAttempt)
0 15 } while( (++nAttempt)
90892 15 0 if( rc==SQLITE_OK && db->mallocFailed==0 ){
15 0 if( rc==SQLITE_OK && db->mallocFailed==0 ){
90895 0 0 if( pBlob && pBlob->pStmt ) sqlite3VdbeFinalize((Vdbe *)pBlob->pStmt);
0 0 if( pBlob && pBlob->pStmt ) sqlite3VdbeFinalize((Vdbe *)pBlob->pStmt);
90898 0 15 sqlite3ErrorWithMsg(db, rc, (zErr ? "%s" : 0), zErr);
90915 15 349 if( p ){
90942 0 15 if( p==0 ) return SQLITE_MISUSE_BKPT;
90947 15 0 if( n<0 || iOffset<0 || ((sqlite3_int64)iOffset+n)>p->nByte ){
15 0 if( n<0 || iOffset<0 || ((sqlite3_int64)iOffset+n)>p->nByte ){
0 15 if( n<0 || iOffset<0 || ((sqlite3_int64)iOffset+n)>p->nByte ){
90950 0 15 }else if( v==0 ){
90987 0 15 if( rc==SQLITE_ABORT ){
91022 15 0 return (p && p->pStmt) ? p->nByte : 0;
15 0 return (p && p->pStmt) ? p->nByte : 0;
91040 0 0 if( p==0 ) return SQLITE_MISUSE_BKPT;
91044 0 0 if( p->pStmt==0 ){
91052 0 0 if( rc!=SQLITE_OK ){
91053 0 0 sqlite3ErrorWithMsg(db, rc, (zErr ? "%s" : 0), zErr);
91540 0 0 if( pReadr->aMap ) sqlite3OsUnfetch(pReadr->pFd, 0, pReadr->aMap);
91562 0 0 if( p->aMap ){
91574 0 0 if( iBuf==0 ){
91579 0 0 if( (p->iEof - p->iReadOff) > (i64)p->nBuffer ){
91589 0 0 if( rc!=SQLITE_OK ) return rc;
91593 0 0 if( nByte<=nAvail ){
91606 0 0 if( p->nAlloc
91609 0 0 while( nByte>nNew ) nNew = nNew*2;
91611 0 0 if( !aNew ) return SQLITE_NOMEM_BKPT;
91624 0 0 while( nRem>0 ){
91630 0 0 if( nRem>p->nBuffer ) nCopy = p->nBuffer;
91632 0 0 if( rc!=SQLITE_OK ) return rc;
91651 0 0 if( p->aMap ){
91655 0 0 if( iBuf && (p->nBuffer-iBuf)>=9 ){
0 0 if( iBuf && (p->nBuffer-iBuf)>=9 ){
91662 0 0 if( rc ) return rc;
91664 0 0 }while( (a[0]&0x80)!=0 );
91683 0 0 if( pFile->iEof<=(i64)(pTask->pSorter->db->nMaxSorterMmap) ){
91685 0 0 if( pFd->pMethods->iVersion>=3 ){
91708 0 0 if( sqlite3FaultSim(201) ) return SQLITE_IOERR_READ;
91709 0 0 if( pReadr->aMap ){
91718 0 0 if( rc==SQLITE_OK && pReadr->aMap==0 ){
0 0 if( rc==SQLITE_OK && pReadr->aMap==0 ){
91721 0 0 if( pReadr->aBuffer==0 ){
91723 0 0 if( pReadr->aBuffer==0 ) rc = SQLITE_NOMEM_BKPT;
91726 0 0 if( rc==SQLITE_OK && iBuf ){
0 0 if( rc==SQLITE_OK && iBuf ){
91728 0 0 if( (pReadr->iReadOff + nRead) > pReadr->iEof ){
91750 0 0 if( pReadr->iReadOff>=pReadr->iEof ){
91753 0 0 if( pIncr ){
91755 0 0 if( rc==SQLITE_OK && pIncr->bEof==0 ){
0 0 if( rc==SQLITE_OK && pIncr->bEof==0 ){
91763 0 0 if( bEof ){
91771 0 0 if( rc==SQLITE_OK ){
91774 0 0 if( rc==SQLITE_OK ){
91807 0 0 if( rc==SQLITE_OK ){
91814 0 0 if( rc==SQLITE_OK ){
91832 5 0 if( *pbKey2Cached==0 ){
91859 20195 15402 if( !*pbKey2Cached ){
91886 88 0 getVarint32(&p1[1], n1);
91887 88 0 getVarint32(&p2[1], n2);
91889 25 63 if( res==0 ){
91893 25 63 if( res==0 ){
91894 5 20 if( pTask->pSorter->pKeyInfo->nKeyField>1 ){
91900 0 63 if( pTask->pSorter->pKeyInfo->aSortOrder[0] ){
91929 86 194 if( s1==s2 ){
91935 86 0 for(i=0; i
91936 86 0 if( (res = v1[i] - v2[i])!=0 ){
91937 0 86 if( ((v1[0] ^ v2[0]) & 0x80)!=0 ){
91938 0 0 res = v1[0] & 0x80 ? -1 : +1;
91943 78 116 }else if( s1>7 && s2>7 ){
58 20 }else if( s1>7 && s2>7 ){
91946 116 20 if( s2>7 ){
91948 20 0 }else if( s1>7 ){
91955 116 20 if( res>0 ){
91956 0 116 if( *v1 & 0x80 ) res = -1;
91958 0 20 if( *v2 & 0x80 ) res = +1;
91962 0 280 if( res==0 ){
91963 0 0 if( pTask->pSorter->pKeyInfo->nKeyField>1 ){
91968 0 280 }else if( pTask->pSorter->pKeyInfo->aSortOrder[0] ){
92036 0 160 if( pSorter==0 ){
92042 5 155 if( nField && nWorker==0 ){
92050 160 160 for(i=0; inTask; i++){
92055 160 0 if( !sqlite3TempInMemory(db) ){
92061 160 0 if( mxCache<0 ){
92073 160 0 if( sqlite3GlobalConfig.bSmallMalloc==0 ){
92077 0 160 if( !pSorter->list.aMemory ) rc = SQLITE_NOMEM_BKPT;
92081 160 0 if( pKeyInfo->nAllField<13
92082 155 5 && (pKeyInfo->aColl[0]==0 || pKeyInfo->aColl[0]==db->pDfltColl)
139 16 && (pKeyInfo->aColl[0]==0 || pKeyInfo->aColl[0]==db->pDfltColl)
92098 0 160 for(p=pRecord; p; p=pNext){
92121 0 160 if( pTask->file.pFd ){
92124 0 160 if( pTask->file2.pFd ){
92244 0 0 while( N
92247 0 0 pNew = sqlite3FaultSim(100) ? 0 : (MergeEngine*)sqlite3MallocZero(nByte);
92248 0 0 if( pNew ){
92262 0 160 if( pMerger ){
92263 0 0 for(i=0; inTree; i++){
92275 0 0 if( pIncr ){
92304 160 160 for(i=0; inTask; i++){
92309 0 160 if( pSorter->list.aMemory==0 ){
92328 160 0 if( pSorter ){
92347 0 0 if( nByte<=(i64)(db->nMaxSorterMmap) && pFd->pMethods->iVersion>=3 ){
0 0 if( nByte<=(i64)(db->nMaxSorterMmap) && pFd->pMethods->iVersion>=3 ){
92371 0 0 if( sqlite3FaultSim(202) ) return SQLITE_IOERR_ACCESS;
92377 0 0 if( rc==SQLITE_OK ){
92380 0 0 if( nExtend>0 ){
92393 128 0 if( pTask->pUnpacked==0 ){
92395 0 128 if( pTask->pUnpacked==0 ) return SQLITE_NOMEM_BKPT;
92422 17582 18383 if( res<=0 ){
92426 2155 15427 if( p1==0 ){
92435 2357 16026 if( p2==0 ){
92449 73 55 if( p->typeMask==SORTER_TYPE_INTEGER ){
92451 29 26 }else if( p->typeMask==SORTER_TYPE_TEXT ){
92469 0 128 if( rc!=SQLITE_OK ) return rc;
92475 0 128 if( !aSlot ){
92479 4640 128 while( p ){
92481 4640 0 if( pList->aMemory ){
92482 128 4512 if( (u8*)p==pList->aMemory ){
92493 4467 4640 for(i=0; aSlot[i]; i++){
92502 8192 128 for(i=0; i<64; i++){
92503 8019 173 if( aSlot[i]==0 ) continue;
92504 45 128 p = p ? vdbeSorterMerge(pTask, p, aSlot[i]) : aSlot[i];
92526 0 0 if( !p->aBuffer ){
92542 0 0 while( nRem>0 && p->eFWErr==0 ){
0 0 while( nRem>0 && p->eFWErr==0 ){
92544 0 0 if( nCopy>(p->nBuffer - p->iBufEnd) ){
92550 0 0 if( p->iBufEnd==p->nBuffer ){
92575 0 0 if( p->eFWErr==0 && ALWAYS(p->aBuffer) && p->iBufEnd>p->iBufStart ){
0 0 if( p->eFWErr==0 && ALWAYS(p->aBuffer) && p->iBufEnd>p->iBufStart ){
0 0 if( p->eFWErr==0 && ALWAYS(p->aBuffer) && p->iBufEnd>p->iBufStart ){
92629 0 0 if( pTask->file.pFd==0 ){
92637 0 0 if( rc==SQLITE_OK ){
92642 0 0 if( rc==SQLITE_OK ){
92646 0 0 if( rc==SQLITE_OK ){
92654 0 0 for(p=pList->pList; p; p=pNext){
92658 0 0 if( pList->aMemory==0 ) sqlite3_free(p);
92689 0 0 if( rc==SQLITE_OK ){
92700 0 0 for(i=(pMerger->nTree+iPrev)/2; i>0; i=i/2){
92703 0 0 if( pReadr1->pFd==0 ){
92705 0 0 }else if( pReadr2->pFd==0 ){
92728 0 0 if( iRes<0 || (iRes==0 && pReadr1
0 0 if( iRes<0 || (iRes==0 && pReadr1
0 0 if( iRes<0 || (iRes==0 && pReadr1
92733 0 0 if( pReadr1->pFd ) bCached = 0;
92741 0 0 return (rc==SQLITE_OK ? pTask->pUnpacked->errCode : rc);
92843 4640 0 getVarint32((const u8*)&pVal->z[1], t);
92844 4634 6 if( t>0 && t<10 && t!=7 ){
4290 344 if( t>0 && t<10 && t!=7 ){
290 4000 if( t>0 && t<10 && t!=7 ){
92846 344 4006 }else if( t>10 && (t & 0x01) ){
344 0 }else if( t>10 && (t & 0x01) ){
92872 4640 0 if( pSorter->mxPmaSize ){
92873 4640 0 if( pSorter->list.aMemory ){
92874 4512 128 bFlush = pSorter->iMemory && (pSorter->iMemory+nReq) > pSorter->mxPmaSize;
0 4512 bFlush = pSorter->iMemory && (pSorter->iMemory+nReq) > pSorter->mxPmaSize;
92878 0 0 || (pSorter->list.szPMA > pSorter->mnPmaSize && sqlite3HeapNearlyFull())
0 0 || (pSorter->list.szPMA > pSorter->mnPmaSize && sqlite3HeapNearlyFull())
0 0 || (pSorter->list.szPMA > pSorter->mnPmaSize && sqlite3HeapNearlyFull())
92881 0 4640 if( bFlush ){
92890 187 4453 if( nPMA>pSorter->mxKeysize ){
92894 4640 0 if( pSorter->list.aMemory ){
92897 13 4627 if( nMin>pSorter->nMemory ){
92901 3 13 while( nNew < nMin ) nNew = nNew*2;
92902 0 13 if( nNew > pSorter->mxPmaSize ) nNew = pSorter->mxPmaSize;
92903 0 13 if( nNew < nMin ) nNew = nMin;
92906 0 13 if( !aNew ) return SQLITE_NOMEM_BKPT;
92914 4513 127 if( pSorter->list.pList ){
92919 0 0 if( pNew==0 ){
92950 0 0 while( rc==SQLITE_OK ){
92958 0 0 if( pReader->pFd==0 ) break;
92959 0 0 if( (iEof + nKey + sqlite3VarintLen(nKey))>(iStart + pIncr->mxSz) ) break;
92969 0 0 if( rc==SQLITE_OK ) rc = rc2;
93038 0 0 if( pIncr->aFile[0].iEof==pIncr->iStartOff ){
93058 0 0 IncrMerger *pIncr = *ppOut = (IncrMerger*)
93060 0 0 if( pIncr ){
93101 0 0 if( iOut>=(pMerger->nTree/2) ){
93112 0 0 if( p1->pFd==0 ){
93114 0 0 }else if( p2->pFd==0 ){
93124 0 0 if( res<=0 ){
93192 0 0 for(i=0; i
93205 0 0 if( rc!=SQLITE_OK ) return rc;
93208 0 0 for(i=pMerger->nTree-1; i>0; i--){
93261 0 0 if( rc==SQLITE_OK ){
93272 0 0 if( pTask->file2.pFd==0 ){
93277 0 0 if( rc==SQLITE_OK ){
93302 0 0 if( rc==SQLITE_OK && (SQLITE_MAX_WORKER_THREADS==0 || eMode!=INCRINIT_TASK) ){
93338 0 0 if( pIncr ){
93377 0 0 if( pNew==0 ) rc = SQLITE_NOMEM_BKPT;
93379 0 0 for(i=0; i
0 0 for(i=0; i
93386 0 0 if( rc!=SQLITE_OK ){
93407 0 0 while( nDiv < (i64)nPMA ){
93437 0 0 for(i=1; i
93441 0 0 for(i=1; i
0 0 for(i=1; i
93445 0 0 if( pReadr->pIncr==0 ){
93447 0 0 if( pNew==0 ){
93453 0 0 if( rc==SQLITE_OK ){
93459 0 0 if( rc==SQLITE_OK ){
93497 0 0 for(iTask=0; rc==SQLITE_OK && iTasknTask; iTask++){
0 0 for(iTask=0; rc==SQLITE_OK && iTasknTask; iTask++){
93505 0 0 if( pTask->nPMA<=SORTER_MAX_MERGE_COUNT ){
93511 0 0 if( pRoot==0 ) rc = SQLITE_NOMEM_BKPT;
93512 0 0 for(i=0; inPMA && rc==SQLITE_OK; i += SORTER_MAX_MERGE_COUNT){
0 0 for(i=0; inPMA && rc==SQLITE_OK; i += SORTER_MAX_MERGE_COUNT){
93518 0 0 if( rc==SQLITE_OK ){
93524 0 0 if( rc==SQLITE_OK ){
93540 0 0 if( rc!=SQLITE_OK ){
93571 0 0 if( rc==SQLITE_OK ){
93627 0 0 if( rc!=SQLITE_OK ){
93650 160 0 if( pSorter->bUsePMA==0 ){
93651 128 32 if( pSorter->list.pList ){
93675 0 0 if( rc==SQLITE_OK ){
93698 0 4630 if( pSorter->bUsePMA ){
93713 0 0 if( rc==SQLITE_OK && res ) rc = SQLITE_DONE;
0 0 if( rc==SQLITE_OK && res ) rc = SQLITE_DONE;
93719 0 4630 if( pSorter->list.aMemory==0 ) vdbeSorterRecordFree(db, pFree);
93720 4508 122 rc = pSorter->list.pList ? SQLITE_OK : SQLITE_DONE;
93734 0 4637 if( pSorter->bUsePMA ){
93763 0 4636 if( sqlite3VdbeMemClearAndResize(pOut, nKey) ){
93805 1 0 if( r2==0 ){
93807 0 1 if( r2==0 ) return SQLITE_NOMEM_BKPT;
93814 1 1 for(i=0; i
93815 0 1 if( r2->aMem[i].flags & MEM_Null ){
93934 172 111 if( p->readpoint.iOffset!=iOfst || iOfst==0 ){
1 171 if( p->readpoint.iOffset!=iOfst || iOfst==0 ){
93936 288 0 for(pChunk=p->pFirst;
93937 176 112 ALWAYS(pChunk) && (iOff+p->nChunkSize)<=iOfst;
93955 92 283 } while( nRead>=0 && (pChunk=pChunk->pNext)!=0 && nRead>0 );
92 0 } while( nRead>=0 && (pChunk=pChunk->pNext)!=0 && nRead>0 );
92 0 } while( nRead>=0 && (pChunk=pChunk->pNext)!=0 && nRead>0 );
93956 283 0 p->readpoint.iOffset = pChunk ? iOfst+iAmt : 0;
93968 4382 886 for(pIter=p->pFirst; pIter; pIter=pNext){
93985 0 0 if( rc==SQLITE_OK ){
93989 0 0 for(pIter=copy.pFirst; pIter; pIter=pIter->pNext){
93990 0 0 if( iOff + nChunk > copy.endpoint.iOffset ){
93994 0 0 if( rc ) break;
93997 0 0 if( rc==SQLITE_OK ){
94002 0 0 if( rc!=SQLITE_OK ){
94029 711 3311 if( p->nSpill>0 && (iAmt+iOfst)>p->nSpill ){
0 711 if( p->nSpill>0 && (iAmt+iOfst)>p->nSpill ){
94031 0 0 if( rc==SQLITE_OK ){
94055 7518 4022 while( nWrite>0 ){
94060 4382 3136 if( iChunkOffset==0 ){
94063 0 4382 if( !pNew ){
94067 3496 886 if( pChunk ){
94098 0 0 if( ALWAYS(size==0) ){
94189 74 886 if( nSpill==0 ){
94193 195 691 if( nSpill>0 ){
94308 6498 26202 if( rc ) return rc & WRC_Abort;
94309 6707 19495 if( !ExprHasProperty(pExpr,(EP_TokenOnly|EP_Leaf)) ){
94310 4077 2630 if( pExpr->pLeft && walkExpr(pWalker, pExpr->pLeft) ) return WRC_Abort;
12 4065 if( pExpr->pLeft && walkExpr(pWalker, pExpr->pLeft) ) return WRC_Abort;
94312 3699 2996 if( pExpr->pRight ){
94315 71 2925 }else if( ExprHasProperty(pExpr, EP_xIsSelect) ){
94316 23 48 if( sqlite3WalkSelect(pWalker, pExpr->x.pSelect) ) return WRC_Abort;
94317 1529 1396 }else if( pExpr->x.pList ){
94318 194 1335 if( sqlite3WalkExprList(pWalker, pExpr->x.pList) ) return WRC_Abort;
94321 0 2779 if( ExprHasProperty(pExpr, EP_WinFunc) ){
94323 0 0 if( sqlite3WalkExprList(pWalker, pWin->pPartition) ) return WRC_Abort;
94324 0 0 if( sqlite3WalkExprList(pWalker, pWin->pOrderBy) ) return WRC_Abort;
94325 0 0 if( sqlite3WalkExpr(pWalker, pWin->pFilter) ) return WRC_Abort;
94334 24924 8127 return pExpr ? walkExpr(pWalker,pExpr) : WRC_Continue;
94344 6288 5487 if( p ){
94345 10688 6094 for(i=p->nExpr, pItem=p->a; i>0; i--, pItem++){
94346 194 10494 if( sqlite3WalkExpr(pWalker, pItem->pExpr) ) return WRC_Abort;
94359 0 3156 if( sqlite3WalkExprList(pWalker, p->pEList) ) return WRC_Abort;
94360 0 3156 if( sqlite3WalkExpr(pWalker, p->pWhere) ) return WRC_Abort;
94361 0 3156 if( sqlite3WalkExprList(pWalker, p->pGroupBy) ) return WRC_Abort;
94362 0 3156 if( sqlite3WalkExpr(pWalker, p->pHaving) ) return WRC_Abort;
94363 0 3156 if( sqlite3WalkExprList(pWalker, p->pOrderBy) ) return WRC_Abort;
94364 0 3156 if( sqlite3WalkExpr(pWalker, p->pLimit) ) return WRC_Abort;
94382 2288 3156 for(i=pSrc->nSrc, pItem=pSrc->a; i>0; i--, pItem++){
94383 72 2216 if( pItem->pSelect && sqlite3WalkSelect(pWalker, pItem->pSelect) ){
0 72 if( pItem->pSelect && sqlite3WalkSelect(pWalker, pItem->pSelect) ){
94386 0 2288 if( pItem->fg.isTabFunc
94387 0 0 && sqlite3WalkExprList(pWalker, pItem->u1.pFuncArg)
94414 43 4551 if( p==0 ) return WRC_Continue;
94415 0 4551 if( pWalker->xSelectCallback==0 ) return WRC_Continue;
94418 1565 3156 if( rc ) return rc & WRC_Abort;
94419 3156 0 if( sqlite3WalkSelectExpr(pWalker, p)
94420 0 3156 || sqlite3WalkSelectFrom(pWalker, p)
94424 3148 8 if( pWalker->xSelectCallback2 ){
94428 170 2986 }while( p!=0 );
94462 0 0 if( pExpr->op==TK_AGG_FUNCTION ) pExpr->op2 += pWalker->u.n;
94466 0 116 if( N>0 ){
94511 123 0 if( pDup!=0 ){
94512 116 7 if( zType[0]!='G' ) incrAggFunctionDepth(pDup, nSubquery);
94513 0 123 if( pExpr->op==TK_COLLATE ){
94528 123 0 if( !ExprHasProperty(pExpr, EP_IntValue) && pExpr->u.zToken!=0 ){
120 3 if( !ExprHasProperty(pExpr, EP_IntValue) && pExpr->u.zToken!=0 ){
94546 0 0 if( pUsing ){
94548 0 0 for(k=0; knId; k++){
94549 0 0 if( sqlite3StrICmp(pUsing->a[k].zName, zCol)==0 ) return 1;
94569 0 0 for(n=0; ALWAYS(zSpan[n]) && zSpan[n]!='.'; n++){}
0 0 for(n=0; ALWAYS(zSpan[n]) && zSpan[n]!='.'; n++){}
94570 0 0 if( zDb && (sqlite3StrNICmp(zSpan, zDb, n)!=0 || zDb[n]!=0) ){
0 0 if( zDb && (sqlite3StrNICmp(zSpan, zDb, n)!=0 || zDb[n]!=0) ){
0 0 if( zDb && (sqlite3StrNICmp(zSpan, zDb, n)!=0 || zDb[n]!=0) ){
94574 0 0 for(n=0; ALWAYS(zSpan[n]) && zSpan[n]!='.'; n++){}
0 0 for(n=0; ALWAYS(zSpan[n]) && zSpan[n]!='.'; n++){}
94575 0 0 if( zTab && (sqlite3StrNICmp(zSpan, zTab, n)!=0 || zTab[n]!=0) ){
0 0 if( zTab && (sqlite3StrNICmp(zSpan, zTab, n)!=0 || zTab[n]!=0) ){
0 0 if( zTab && (sqlite3StrNICmp(zSpan, zTab, n)!=0 || zTab[n]!=0) ){
94579 0 0 if( zCol && sqlite3StrICmp(zSpan, zCol)!=0 ){
0 0 if( zCol && sqlite3StrICmp(zSpan, zCol)!=0 ){
94645 3 4107 if( zDb ){
94648 0 3 if( (pNC->ncFlags & (NC_PartIdx|NC_IsCheck))!=0 ){
94655 3 0 for(i=0; inDb; i++){
94657 3 0 if( sqlite3StrICmp(db->aDb[i].zDbSName,zDb)==0 ){
94671 4112 10 if( pSrcList ){
94672 4129 4112 for(i=0, pItem=pSrcList->a; inSrc; i++, pItem++){
94676 175 3954 if( pItem->pSelect && (pItem->pSelect->selFlags & SF_NestedFrom)!=0 ){
0 175 if( pItem->pSelect && (pItem->pSelect->selFlags & SF_NestedFrom)!=0 ){
94679 0 0 for(j=0; jnExpr; j++){
94680 0 0 if( sqlite3MatchSpanName(pEList->a[j].zSpan, zCol, zTab, zDb) ){
94688 0 0 if( hit || zTab==0 ) continue;
0 0 if( hit || zTab==0 ) continue;
94690 3 4126 if( zDb && pTab->pSchema!=pSchema ){
0 3 if( zDb && pTab->pSchema!=pSchema ){
94693 80 4049 if( zTab ){
94694 62 18 const char *zTabName = pItem->zAlias ? pItem->zAlias : pTab->zName;
94696 28 52 if( sqlite3StrICmp(zTabName, zTab)!=0 ){
94699 0 52 if( IN_RENAME_OBJECT && pItem->zAlias ){
0 0 if( IN_RENAME_OBJECT && pItem->zAlias ){
94703 4100 1 if( 0==(cntTab++) ){
94706 12142 640 for(j=0, pCol=pTab->aCol; jnCol; j++, pCol++){
94707 3461 8681 if( sqlite3StrICmp(pCol->zName, zCol)==0 ){
94712 0 3461 if( cnt==1 ){
94713 0 0 if( pItem->fg.jointype & JT_NATURAL ) continue;
94714 0 0 if( nameInUsingClause(pItem->pUsing, zCol) ) continue;
94719 3217 244 pExpr->iColumn = j==pTab->iPKey ? -1 : (i16)j;
94724 4100 12 if( pMatch ){
94729 0 4100 if( (pMatch->fg.jointype & JT_LEFT)!=0 ){
94741 4119 3 if( zDb==0 && zTab!=0 && cntTab==0 ){
61 4058 if( zDb==0 && zTab!=0 && cntTab==0 ){
12 49 if( zDb==0 && zTab!=0 && cntTab==0 ){
94744 0 12 if( pParse->pTriggerTab!=0 ){
94747 0 0 if( op!=TK_DELETE && sqlite3StrICmp("new",zTab) == 0 ){
0 0 if( op!=TK_DELETE && sqlite3StrICmp("new",zTab) == 0 ){
94750 0 0 }else if( op!=TK_INSERT && sqlite3StrICmp("old",zTab)==0 ){
0 0 }else if( op!=TK_INSERT && sqlite3StrICmp("old",zTab)==0 ){
94757 0 12 if( (pNC->ncFlags & NC_UUpsert)!=0 ){
94759 0 0 if( pUpsert && sqlite3StrICmp("excluded",zTab)==0 ){
0 0 if( pUpsert && sqlite3StrICmp("excluded",zTab)==0 ){
94766 0 12 if( pTab ){
94770 0 0 for(iCol=0, pCol=pTab->aCol; iColnCol; iCol++, pCol++){
94771 0 0 if( sqlite3StrICmp(pCol->zName, zCol)==0 ){
94772 0 0 if( iCol==pTab->iPKey ){
94778 0 0 if( iCol>=pTab->nCol && sqlite3IsRowid(zCol) && VisibleRowid(pTab) ){
0 0 if( iCol>=pTab->nCol && sqlite3IsRowid(zCol) && VisibleRowid(pTab) ){
0 0 if( iCol>=pTab->nCol && sqlite3IsRowid(zCol) && VisibleRowid(pTab) ){
94782 0 0 if( iColnCol ){
94785 0 0 if( pExpr->iTable==2 ){
94787 0 0 if( IN_RENAME_OBJECT ){
94800 0 0 if( iCol<0 ){
94802 0 0 }else if( pExpr->iTable==0 ){
94805 0 0 pParse->oldmask |= (iCol>=32 ? 0xffffffff : (((u32)1)<
94809 0 0 pParse->newmask |= (iCol>=32 ? 0xffffffff : (((u32)1)<
94824 661 3461 if( cnt==0
94825 639 22 && cntTab==1
94826 639 0 && pMatch
94827 639 0 && (pNC->ncFlags & NC_IdxExpr)==0
94828 631 8 && sqlite3IsRowid(zCol)
94829 631 0 && VisibleRowid(pMatch->pTab)
94854 1447 2675 if( (pNC->ncFlags & NC_UEList)!=0
94855 20 1427 && cnt==0
94856 8 12 && zTab==0
94860 16 1 for(j=0; jnExpr; j++){
94862 9 7 if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){
7 2 if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){
94868 7 0 if( (pNC->ncFlags&NC_AllowAgg)==0 && ExprHasProperty(pOrig, EP_Agg) ){
0 7 if( (pNC->ncFlags&NC_AllowAgg)==0 && ExprHasProperty(pOrig, EP_Agg) ){
94872 0 7 if( sqlite3ExprVectorSize(pOrig)!=1 ){
94880 0 7 if( IN_RENAME_OBJECT ){
94891 4092 23 if( cnt ) break;
94894 12 11 }while( pNC );
94907 11 4092 if( cnt==0 && zTab==0 ){
11 0 if( cnt==0 && zTab==0 ){
94909 11 0 if( ExprHasProperty(pExpr,EP_DblQuoted) ){
94914 0 0 if( sqlite3ExprIdToTrueFalse(pExpr) ){
94923 0 4092 if( cnt!=1 ){
94925 0 0 zErr = cnt==0 ? "no such column" : "ambiguous column name";
94926 0 0 if( zDb ){
94928 0 0 }else if( zTab ){
94943 3217 875 if( pExpr->iColumn>=0 && pMatch!=0 ){
3217 0 if( pExpr->iColumn>=0 && pMatch!=0 ){
94946 0 3217 if( n>=BMS ){
94962 4099 0 if( cnt==1 ){
94964 4092 7 if( !ExprHasProperty(pExpr, EP_Alias) ){
94972 4099 12 if( pTopNC==pNC ) break;
94987 0 0 if( p ){
94991 0 0 if( p->y.pTab->iPKey==iCol ){
95014 0 1641 if( (pNC->ncFlags & validMask)!=0 ){
95016 0 0 if( pNC->ncFlags & NC_IdxExpr ) zIn = "index expressions";
95018 0 0 else if( pNC->ncFlags & NC_IsCheck ) zIn = "CHECK constraints";
95031 0 0 if( p->op!=TK_FLOAT ) return -1;
95034 0 0 if( r>1.0 ) return -1;
95105 4058 52 if( pExpr->op==TK_ID ){
95113 49 3 if( pRight->op==TK_ID ){
95123 0 52 if( IN_RENAME_OBJECT ){
95135 544 101 int n = pList ? pList->nExpr : 0; /* Number of arguments */
95148 0 645 if( pDef==0 ){
95150 0 0 if( pDef==0 ){
95157 0 645 if( pDef->funcFlags & SQLITE_FUNC_UNLIKELY ){
95159 0 0 if( n==2 ){
95161 0 0 if( pExpr->iTable<0 ){
95177 0 0 pExpr->iTable = pDef->zName[0]=='u' ? 8388608 : 125829120;
95183 0 645 if( auth!=SQLITE_OK ){
95184 0 0 if( auth==SQLITE_DENY ){
95194 151 494 if( pDef->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_SLOCHNG) ){
95200 494 151 if( (pDef->funcFlags & SQLITE_FUNC_CONSTANT)==0 ){
95207 0 645 if( (pDef->funcFlags & SQLITE_FUNC_INTERNAL)!=0
95208 0 0 && pParse->nested==0
95209 0 0 && sqlite3Config.bInternalFunctions==0
95218 645 0 if( 0==IN_RENAME_OBJECT ){
95224 645 0 if( pDef && pDef->xValue==0 && ExprHasProperty(pExpr, EP_WinFunc) ){
596 49 if( pDef && pDef->xValue==0 && ExprHasProperty(pExpr, EP_WinFunc) ){
0 596 if( pDef && pDef->xValue==0 && ExprHasProperty(pExpr, EP_WinFunc) ){
95229 133 512 }else if(
95230 133 0 (is_agg && (pNC->ncFlags & NC_AllowAgg)==0)
95231 133 512 || (is_agg && (pDef->funcFlags&SQLITE_FUNC_WINDOW) && !pExpr->y.pWin)
0 133 || (is_agg && (pDef->funcFlags&SQLITE_FUNC_WINDOW) && !pExpr->y.pWin)
0 0 || (is_agg && (pDef->funcFlags&SQLITE_FUNC_WINDOW) && !pExpr->y.pWin)
95232 133 512 || (is_agg && pExpr->y.pWin && (pNC->ncFlags & NC_AllowWin)==0)
0 133 || (is_agg && pExpr->y.pWin && (pNC->ncFlags & NC_AllowWin)==0)
0 0 || (is_agg && pExpr->y.pWin && (pNC->ncFlags & NC_AllowWin)==0)
95235 0 0 if( (pDef->funcFlags & SQLITE_FUNC_WINDOW) || pExpr->y.pWin ){
0 0 if( (pDef->funcFlags & SQLITE_FUNC_WINDOW) || pExpr->y.pWin ){
95251 0 645 else if( no_such_func && pParse->db->init.busy==0
0 0 else if( no_such_func && pParse->db->init.busy==0
95258 0 645 }else if( wrong_num_args ){
95263 133 512 if( is_agg ){
95265 0 133 pNC->ncFlags &= ~(pExpr->y.pWin ? NC_AllowWin : NC_AllowAgg);
95272 133 512 if( is_agg ){
95274 0 133 if( pExpr->y.pWin ){
95280 0 0 if( 0==pSel->pWin
95281 0 0 || 0==sqlite3WindowCompare(pParse, pSel->pWin, pExpr->y.pWin)
95293 133 0 while( pNC2 && !sqlite3FunctionUsesThisSrc(pExpr, pNC2->pSrcList) ){
0 133 while( pNC2 && !sqlite3FunctionUsesThisSrc(pExpr, pNC2->pSrcList) ){
95298 133 0 if( pNC2 ){
95318 16 16 if( ExprHasProperty(pExpr, EP_xIsSelect) ){
95323 2 14 if( nRef!=pNC->nRef ){
95340 0 1 if( (pRight = pExpr->pRight)->op==TK_ID ){
95342 0 0 if( rc==WRC_Abort ) return WRC_Abort;
95343 0 0 if( pRight->op==TK_TRUEFALSE ){
95359 0 1114 if( pParse->db->mallocFailed ) break;
95362 14 1100 if( pExpr->op==TK_BETWEEN ){
95364 14 0 if( nRight==nLeft ){
95371 0 1114 if( nLeft!=nRight ){
95386 7859 0 return (pParse->nErr || pParse->db->mallocFailed) ? WRC_Abort : WRC_Continue;
0 7859 return (pParse->nErr || pParse->db->mallocFailed) ? WRC_Abort : WRC_Continue;
95410 537 1 if( pE->op==TK_ID ){
95412 1531 464 for(i=0; inExpr; i++){
95414 167 1364 if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){
73 94 if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){
95468 0 0 if( rc ) return 0;
95474 0 0 for(i=0; inExpr; i++){
95475 0 0 if( sqlite3ExprCompare(0, pEList->a[i].pExpr, pE, -1)<2 ){
95524 24 0 if( pOrderBy==0 ) return 0;
95526 0 0 if( pOrderBy->nExpr>db->aLimit[SQLITE_LIMIT_COLUMN] ){
95530 0 0 for(i=0; inExpr; i++){
95534 0 0 while( pSelect->pPrior ){
95538 0 0 while( pSelect && moreToDo ){
0 0 while( pSelect && moreToDo ){
95543 0 0 for(i=0, pItem=pOrderBy->a; inExpr; i++, pItem++){
95546 0 0 if( pItem->done ) continue;
95548 0 0 if( sqlite3ExprIsInteger(pE, &iCol) ){
95549 0 0 if( iCol<=0 || iCol>pEList->nExpr ){
0 0 if( iCol<=0 || iCol>pEList->nExpr ){
95555 0 0 if( iCol==0 ){
95557 0 0 if( !db->mallocFailed ){
95564 0 0 if( iCol>0 ){
95568 0 0 if( pNew==0 ) return 1;
95571 0 0 if( pItem->pExpr==pE ){
95576 0 0 while( pParent->pLeft->op==TK_COLLATE ) pParent = pParent->pLeft;
95589 0 0 for(i=0; inExpr; i++){
95590 0 0 if( pOrderBy->a[i].done==0 ){
95620 504 0 if( pOrderBy==0 || pParse->db->mallocFailed ) return 0;
0 504 if( pOrderBy==0 || pParse->db->mallocFailed ) return 0;
95621 0 504 if( pOrderBy->nExpr>db->aLimit[SQLITE_LIMIT_COLUMN] ){
95627 551 504 for(i=0, pItem=pOrderBy->a; inExpr; i++, pItem++){
95628 116 435 if( pItem->u.x.iOrderByCol ){
95629 0 116 if( pItem->u.x.iOrderByCol>pEList->nExpr ){
95670 1059 504 if( pOrderBy==0 ) return 0;
95673 551 504 for(i=0, pItem=pOrderBy->a; inExpr; i++, pItem++){
95676 538 13 if( zType[0]!='G' ){
95678 73 465 if( iCol>0 ){
95687 0 478 if( sqlite3ExprIsInteger(pE2, &iCol) ){
95691 0 0 if( iCol<1 || iCol>0xffff ){
0 0 if( iCol<1 || iCol>0xffff ){
95701 0 478 if( sqlite3ResolveExprNames(pNC, pE) ){
95704 1382 478 for(j=0; jpEList->nExpr; j++){
95705 43 1339 if( sqlite3ExprCompare(0, pE, pSelect->pEList->a[j].pExpr, -1)==0 ){
95707 0 43 if( ExprHasProperty(pE, EP_WinFunc) ){
95712 0 0 for(pp=&pSelect->pWin; *pp; pp=&(*pp)->pNextWin){
95713 0 0 if( *pp==pE->y.pWin ){
95742 16 1491 if( p->selFlags & SF_Resolved ){
95757 0 1491 if( (p->selFlags & SF_Expanded)==0 ){
95759 0 0 return (pParse->nErr || db->mallocFailed) ? WRC_Abort : WRC_Prune;
0 0 return (pParse->nErr || db->mallocFailed) ? WRC_Abort : WRC_Prune;
95765 1574 1491 while( p ){
95776 0 1574 if( sqlite3ResolveExprNames(&sNC, p->pLimit) ){
95786 0 1574 if( p->selFlags & SF_Converted ){
95796 1143 1574 for(i=0; ipSrc->nSrc; i++){
95798 35 1108 if( pItem->pSelect ){
95808 0 35 for(pNC=pOuterNC; pNC; pNC=pNC->pNext) nRef += pNC->nRef;
95810 0 35 if( pItem->zName ) pParse->zAuthContext = pItem->zName;
95813 35 0 if( pParse->nErr || db->mallocFailed ) return WRC_Abort;
0 35 if( pParse->nErr || db->mallocFailed ) return WRC_Abort;
95815 0 35 for(pNC=pOuterNC; pNC; pNC=pNC->pNext) nRef -= pNC->nRef;
95829 0 1574 if( sqlite3ResolveExprListNames(&sNC, p->pEList) ) return WRC_Abort;
95837 1561 13 if( pGroupBy || (sNC.ncFlags & NC_HasAgg)!=0 ){
120 1441 if( pGroupBy || (sNC.ncFlags & NC_HasAgg)!=0 ){
95846 5 1569 if( p->pHaving && !pGroupBy ){
0 5 if( p->pHaving && !pGroupBy ){
95862 0 1574 if( sqlite3ResolveExprNames(&sNC, p->pHaving) ) return WRC_Abort;
95863 0 1574 if( sqlite3ResolveExprNames(&sNC, p->pWhere) ) return WRC_Abort;
95866 1143 1574 for(i=0; ipSrc->nSrc; i++){
95868 0 1143 if( pItem->fg.isTabFunc
95869 0 0 && sqlite3ResolveExprListNames(&sNC, pItem->u1.pFuncArg)
95886 0 1574 if( p->selFlags & SF_Converted ){
95902 1550 24 if( isCompound<=nCompound /* Defer right-most ORDER BY of a compound */
95903 0 1550 && resolveOrderGroupBy(&sNC, p, p->pOrderBy, "ORDER")
95907 0 1574 if( db->mallocFailed ){
95915 13 1561 if( pGroupBy ){
95918 13 0 if( resolveOrderGroupBy(&sNC, p, pGroupBy, "GROUP") || db->mallocFailed ){
0 13 if( resolveOrderGroupBy(&sNC, p, pGroupBy, "GROUP") || db->mallocFailed ){
95921 13 13 for(i=0, pItem=pGroupBy->a; inExpr; i++, pItem++){
95922 0 13 if( ExprHasProperty(pItem->pExpr, EP_Agg) ){
95932 83 1491 if( p->pNext && p->pEList->nExpr!=p->pNext->pEList->nExpr ){
0 83 if( p->pNext && p->pEList->nExpr!=p->pNext->pEList->nExpr ){
95946 24 1467 if( isCompound && resolveCompoundOrderBy(pParse, pLeftmost) ){
0 24 if( isCompound && resolveCompoundOrderBy(pParse, pLeftmost) ){
96008 4054 8739 if( pExpr==0 ) return SQLITE_OK;
96018 0 8739 if( sqlite3ExprCheckHeight(w.pParse, w.pParse->nHeight) ){
96026 133 8606 if( pNC->ncFlags & NC_HasAgg ){
96030 8739 0 return pNC->nErr>0 || w.pParse->nErr>0;
0 8739 return pNC->nErr>0 || w.pParse->nErr>0;
96043 4222 0 if( pList ){
96044 6038 4222 for(i=0; inExpr; i++){
96045 0 6038 if( sqlite3ResolveExprNames(pNC, pList->a[i].pExpr) ) return WRC_Abort;
96110 0 126 if( sqlite3ResolveExprNames(&sNC, pExpr) ) return;
96111 0 126 if( pList ) sqlite3ResolveExprListNames(&sNC, pList);
96141 1227 10 return iCol>=0 ? pTab->aCol[iCol].affinity : SQLITE_AFF_INTEGER;
96163 7 2469 if( pExpr->flags & EP_Generic ) return 0;
96165 2 2467 if( op==TK_SELECT ){
96169 10 2457 if( op==TK_REGISTER ) op = pExpr->op2;
96171 0 2467 if( op==TK_CAST ){
96176 2467 0 if( (op==TK_AGG_COLUMN || op==TK_COLUMN) && pExpr->y.pTab ){
1237 1230 if( (op==TK_AGG_COLUMN || op==TK_COLUMN) && pExpr->y.pTab ){
1237 0 if( (op==TK_AGG_COLUMN || op==TK_COLUMN) && pExpr->y.pTab ){
96179 0 1230 if( op==TK_SELECT_COLUMN ){
96202 274 0 if( pCollName->n>0 ){
96204 274 0 if( pNew ){
96224 13992 815 while( pExpr && ExprHasProperty(pExpr, EP_Skip) ){
362 13630 while( pExpr && ExprHasProperty(pExpr, EP_Skip) ){
96225 0 362 if( ExprHasProperty(pExpr, EP_Unlikely) ){
96256 1590 0 while( p ){
96258 5 1585 if( p->flags & EP_Generic ) break;
96259 1571 14 if( (op==TK_AGG_COLUMN || op==TK_COLUMN
123 1448 if( (op==TK_AGG_COLUMN || op==TK_COLUMN
96260 123 0 || op==TK_REGISTER || op==TK_TRIGGER)
0 123 || op==TK_REGISTER || op==TK_TRIGGER)
96261 1462 0 && p->y.pTab!=0
96266 1025 437 if( j>=0 ){
96272 123 0 if( op==TK_CAST || op==TK_UPLUS ){
0 123 if( op==TK_CAST || op==TK_UPLUS ){
96276 107 16 if( op==TK_COLLATE || (op==TK_REGISTER && p->op2==TK_COLLATE) ){
0 107 if( op==TK_COLLATE || (op==TK_REGISTER && p->op2==TK_COLLATE) ){
0 0 if( op==TK_COLLATE || (op==TK_REGISTER && p->op2==TK_COLLATE) ){
96280 0 107 if( p->flags & EP_Collate ){
96281 0 0 if( p->pLeft && (p->pLeft->flags & EP_Collate)!=0 ){
0 0 if( p->pLeft && (p->pLeft->flags & EP_Collate)!=0 ){
96290 0 0 if( p->x.pList!=0 && ALWAYS(!ExprHasProperty(p, EP_xIsSelect)) ){
0 0 if( p->x.pList!=0 && ALWAYS(!ExprHasProperty(p, EP_xIsSelect)) ){
96292 0 0 for(i=0; ALWAYS(ix.pList->nExpr); i++){
96293 0 0 if( ExprHasProperty(p->x.pList->a[i].pExpr, EP_Collate) ){
96305 0 1590 if( sqlite3CheckCollSeq(pParse, pColl) ){
96323 424 229 if( p==0 ) p = pParse->db->pDfltColl;
96344 619 559 if( aff1 && aff2 ){
21 598 if( aff1 && aff2 ){
96348 5 16 if( sqlite3IsNumericAffinity(aff1) || sqlite3IsNumericAffinity(aff2) ){
0 5 if( sqlite3IsNumericAffinity(aff1) || sqlite3IsNumericAffinity(aff2) ){
96353 559 598 }else if( !aff1 && !aff2 ){
19 540 }else if( !aff1 && !aff2 ){
96376 499 0 if( pExpr->pRight ){
96378 0 0 }else if( ExprHasProperty(pExpr, EP_xIsSelect) ){
96380 0 0 }else if( aff==0 ){
96433 1 717 if( pLeft->flags & EP_Collate ){
96435 717 0 }else if( pRight && (pRight->flags & EP_Collate)!=0 ){
5 712 }else if( pRight && (pRight->flags & EP_Collate)!=0 ){
96439 23 689 if( !pColl ){
96491 230 4071 if( op==TK_REGISTER ) op = pExpr->op2;
96492 0 4301 if( op==TK_VECTOR ){
96494 2 4299 }else if( op==TK_SELECT ){
96518 0 47 if( sqlite3ExprIsVector(pVector) ){
96520 0 0 if( pVector->op==TK_SELECT || pVector->op2==TK_SELECT ){
0 0 if( pVector->op==TK_SELECT || pVector->op2==TK_SELECT ){
96556 0 0 if( pVector->op==TK_SELECT ){
96575 0 0 if( pRet ){
96581 0 0 if( pVector->op==TK_VECTOR ) pVector = pVector->x.pList->a[iField].pExpr;
96598 0 0 if( pExpr->op==TK_SELECT ){
96633 0 0 if( op==TK_REGISTER ){
96637 0 0 if( op==TK_SELECT ){
96673 0 0 if( nLeft!=sqlite3ExprVectorSize(pRight) ){
96688 0 0 if( opx==TK_LE ) opx = TK_LT;
96689 0 0 if( opx==TK_GE ) opx = TK_GT;
96710 0 0 if( i==nLeft-1 ){
96713 0 0 if( opx==TK_EQ ){
96716 0 0 }else if( opx==TK_NE ){
96726 0 0 if( i==nLeft-2 ) opx = op;
96741 0 11751 if( nHeight>mxHeight ){
96760 4972 2581 if( p ){
96761 2499 2473 if( p->nHeight>*pnHeight ){
96767 662 78 if( p ){
96769 1285 662 for(i=0; inExpr; i++){
96776 60 60 for(p=pSelect; p; p=p->pPrior){
96800 16 3028 if( ExprHasProperty(p, EP_xIsSelect) ){
96802 560 2468 }else if( p->x.pList ){
96818 0 677 if( pParse->nErr ) return;
96876 2019 303 if( pToken ){
96877 504 1515 if( op!=TK_INTEGER || pToken->z==0
504 0 if( op!=TK_INTEGER || pToken->z==0
96878 12 492 || sqlite3GetInt32(pToken->z, &iValue)==0 ){
96884 2322 0 if( pNew ){
96888 2019 303 if( pToken ){
96889 492 1527 if( nExtra==0 ){
96895 1445 82 if( pToken->n ) memcpy(pNew->u.zToken, pToken->z, pToken->n);
96897 799 728 if( dequote && sqlite3Isquote(pNew->u.zToken[0]) ){
4 795 if( dequote && sqlite3Isquote(pNew->u.zToken[0]) ){
96898 0 4 if( pNew->u.zToken[0]=='"' ) pNew->flags |= EP_DblQuoted;
96937 0 2367 if( pRoot==0 ){
96942 1799 568 if( pRight ){
96946 1825 542 if( pLeft ){
96968 272 2063 if( op==TK_AND && pParse->nErr==0 ){
272 0 if( op==TK_AND && pParse->nErr==0 ){
96973 2063 0 if( p ){
96980 2335 0 if( p ) {
96991 16 0 if( pExpr ){
97018 0 150 if( ExprHasProperty(p, EP_FromJoin) ) return 0;
97019 150 0 if( !sqlite3ExprIsInteger(p, &v) ) return 0;
97024 0 756 if( ExprHasProperty(p, EP_FromJoin) ) return 0;
97025 756 0 if( !sqlite3ExprIsInteger(p, &v) ) return 0;
97038 84 303 if( pLeft==0 ){
97040 0 303 }else if( pRight==0 ){
97042 303 0 }else if( exprAlwaysFalse(pLeft) || exprAlwaysFalse(pRight) ){
0 303 }else if( exprAlwaysFalse(pLeft) || exprAlwaysFalse(pRight) ){
97067 0 645 if( pNew==0 ){
97071 544 101 if( pList && pList->nExpr > pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
0 544 if( pList && pList->nExpr > pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
97078 0 645 if( eDistinct==SF_Distinct ) ExprSetProperty(pNew, EP_Distinct);
97103 0 1079 if( pExpr==0 ) return;
97109 1048 31 if( z[1]==0 ){
97115 13 18 if( z[0]=='?' ){
97120 13 0 if( n==2 ){ /*OPTIMIZATION-IF-TRUE*/
97130 13 0 if( bOk==0 || i<1 || i>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){
13 0 if( bOk==0 || i<1 || i>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){
0 13 if( bOk==0 || i<1 || i>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){
97136 13 0 if( x>pParse->nVar ){
97139 0 0 }else if( sqlite3VListNumToName(pParse->pVList, x)==0 ){
97148 17 1 if( x==0 ){
97153 30 1 if( doAdd ){
97158 0 1079 if( x>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){
97181 3930 12457 if( !ExprHasProperty(p, (EP_TokenOnly|EP_Leaf)) ){
97184 2098 1832 if( p->pLeft && p->op!=TK_SELECT_COLUMN ) sqlite3ExprDeleteNN(db, p->pLeft);
2098 0 if( p->pLeft && p->op!=TK_SELECT_COLUMN ) sqlite3ExprDeleteNN(db, p->pLeft);
97185 1753 2177 if( p->pRight ){
97187 16 2161 }else if( ExprHasProperty(p, EP_xIsSelect) ){
97192 0 3930 if( ExprHasProperty(p, EP_WinFunc) ){
97197 120 16267 if( ExprHasProperty(p, EP_MemToken) ) sqlite3DbFree(db, p->u.zToken);
97198 16260 127 if( !ExprHasProperty(p, EP_Static) ){
97203 12536 27259 if( p ) sqlite3ExprDeleteNN(db, p);
97212 0 2740 if( ExprHasProperty(p, EP_TokenOnly) ) return EXPR_TOKENONLYSIZE;
97213 0 2740 if( ExprHasProperty(p, EP_Reduced) ) return EXPR_REDUCEDSIZE;
97256 24 5480 if( 0==flags || p->op==TK_SELECT_COLUMN
24 0 if( 0==flags || p->op==TK_SELECT_COLUMN
97258 0 24 || ExprHasProperty(p, EP_WinFunc)
97267 12 12 if( p->pLeft || p->x.pList ){
0 12 if( p->pLeft || p->x.pList ){
97284 2676 80 if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){
2618 58 if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){
97305 2748 12 if( p ){
97307 8 2740 if( flags&EXPRDUP_REDUCE ){
97333 4 2744 if( pzBuffer ){
97342 2748 0 if( pNew ){
97351 2670 78 if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){
2612 58 if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){
97356 8 2740 if( dupFlags ){
97362 0 2740 if( nSize
97373 2612 136 if( nToken ){
97378 375 2373 if( 0==((p->flags|pNew->flags) & (EP_TokenOnly|EP_Leaf)) ){
97380 0 375 if( ExprHasProperty(p, EP_xIsSelect) ){
97388 8 2740 if( ExprHasProperty(pNew, EP_Reduced|EP_TokenOnly|EP_WinFunc) ){
97390 4 4 if( !ExprHasProperty(pNew, EP_TokenOnly|EP_Leaf) ){
97392 4 0 exprDup(db, p->pLeft, EXPRDUP_REDUCE, &zAlloc) : 0;
97394 0 4 exprDup(db, p->pRight, EXPRDUP_REDUCE, &zAlloc) : 0;
97397 0 8 if( ExprHasProperty(p, EP_WinFunc) ){
97402 4 4 if( pzBuffer ){
97406 371 2369 if( !ExprHasProperty(p, EP_TokenOnly|EP_Leaf) ){
97407 0 371 if( pNew->op==TK_SELECT_COLUMN ){
97429 0 0 if( p ){
97432 0 0 if( pRet ){
97435 0 0 for(i=0; inCte; i++){
97467 2744 736 return p ? exprDup(db, p, flags, 0) : 0;
97475 186 203 if( p==0 ) return 0;
97477 0 203 if( pNew==0 ) return 0;
97481 366 203 for(i=0; inExpr; i++, pItem++, pOldItem++){
97485 366 0 if( pOldExpr
97486 0 366 && pOldExpr->op==TK_SELECT_COLUMN
97487 0 0 && (pNewExpr = pItem->pExpr)!=0
97490 0 0 if( pNewExpr->iColumn==0 ){
97525 0 0 if( p==0 ) return 0;
97526 0 0 nByte = sizeof(*p) + (p->nSrc>0 ? sizeof(p->a[0]) * (p->nSrc-1) : 0);
97528 0 0 if( pNew==0 ) return 0;
97530 0 0 for(i=0; inSrc; i++){
97542 0 0 if( pNewItem->fg.isIndexedBy ){
97546 0 0 if( pNewItem->fg.isTabFunc ){
97551 0 0 if( pTab ){
97565 0 0 if( p==0 ) return 0;
97567 0 0 if( pNew==0 ) return 0;
97570 0 0 if( pNew->a==0 ){
97577 0 0 for(i=0; inId; i++){
97592 0 43 for(p=pDup; p; p=p->pPrior){
97594 0 0 if( pNew==0 ) break;
97655 6538 3859 if( pList==0 ){
97657 0 6538 if( pList==0 ){
97661 3365 494 }else if( (pList->nExpr & (pList->nExpr-1))==0 ){
97665 0 3365 if( pNew==0 ){
97704 0 0 int iFirst = pList ? pList->nExpr : 0;
97707 0 0 if( NEVER(pColumns==0) ) goto vector_append_error;
97708 0 0 if( pExpr==0 ) goto vector_append_error;
97715 0 0 if( pExpr->op!=TK_SELECT && pColumns->nId!=(n=sqlite3ExprVectorSize(pExpr)) ){
0 0 if( pExpr->op!=TK_SELECT && pColumns->nId!=(n=sqlite3ExprVectorSize(pExpr)) ){
97721 0 0 for(i=0; inId; i++){
97724 0 0 if( pList ){
97731 0 0 if( !db->mallocFailed && pExpr->op==TK_SELECT && ALWAYS(pList!=0) ){
0 0 if( !db->mallocFailed && pExpr->op==TK_SELECT && ALWAYS(pList!=0) ){
0 0 if( !db->mallocFailed && pExpr->op==TK_SELECT && ALWAYS(pList!=0) ){
97756 0 670 if( p==0 ) return;
97759 629 41 if( iSortOrder<0 ){
97781 1726 0 if( pList ){
97787 1463 263 if( dequote ) sqlite3Dequote(pItem->zName);
97788 0 1726 if( IN_RENAME_OBJECT ){
97810 2691 0 if( pList ){
97830 285 0 if( pEList && pEList->nExpr>mx ){
0 285 if( pEList && pEList->nExpr>mx ){
97847 4022 6741 }while( --i>0 );
97851 6741 19312 if( pList ) exprListDeleteNN(db, pList);
97862 957 560 for(i=0; inExpr; i++){
97890 0 0 if( sqlite3StrICmp(pExpr->u.zToken, "true")==0
97891 0 0 || sqlite3StrICmp(pExpr->u.zToken, "false")==0
97941 3344 1137 if( pWalker->eCode==2 && ExprHasProperty(pExpr, EP_FromJoin) ){
0 3344 if( pWalker->eCode==2 && ExprHasProperty(pExpr, EP_FromJoin) ){
97951 714 0 if( pWalker->eCode>=4 || ExprHasProperty(pExpr,EP_ConstFunc) ){
319 395 if( pWalker->eCode>=4 || ExprHasProperty(pExpr,EP_ConstFunc) ){
97960 0 0 if( sqlite3ExprIdToTrueFalse(pExpr) ){
97971 0 1166 if( ExprHasProperty(pExpr, EP_FixedCol) && pWalker->eCode!=2 ){
0 0 if( ExprHasProperty(pExpr, EP_FixedCol) && pWalker->eCode!=2 ){
97974 22 1144 if( pWalker->eCode==3 && pExpr->iTable==pWalker->u.iCur ){
22 0 if( pWalker->eCode==3 && pExpr->iTable==pWalker->u.iCur ){
97985 0 1117 if( pWalker->eCode==5 ){
97990 0 1117 }else if( pWalker->eCode==4 ){
98065 10 10 for(i=0; inExpr; i++){
98067 0 10 if( sqlite3ExprCompare(0, pExpr, p, -1)<2 ){
98069 0 0 if( sqlite3IsBinary(pColl) ){
98076 0 10 if( ExprHasProperty(pExpr, EP_xIsSelect) ){
98154 0 1832 if( p==0 ) return 0; /* Can only happen following on OOM */
98161 55 1777 if( p->flags & EP_IntValue ){
98172 0 0 if( sqlite3ExprIsInteger(p->pLeft, &v) ){
98200 0 58 while( p->op==TK_UPLUS || p->op==TK_UMINUS ){ p = p->pLeft; }
0 58 while( p->op==TK_UPLUS || p->op==TK_UMINUS ){ p = p->pLeft; }
98202 0 58 if( op==TK_REGISTER ) op = p->op2;
98210 5 0 return ExprHasProperty(p, EP_CanBeNull) ||
98211 5 0 p->y.pTab==0 || /* Reference to column of index on expression */
3 2 p->y.pTab==0 || /* Reference to column of index on expression */
98212 3 0 (p->iColumn>=0 && p->y.pTab->aCol[p->iColumn].notNull==0);
98230 5 53 if( aff==SQLITE_AFF_BLOB ) return 1;
98231 0 53 while( p->op==TK_UPLUS || p->op==TK_UMINUS ){ p = p->pLeft; }
0 53 while( p->op==TK_UPLUS || p->op==TK_UMINUS ){ p = p->pLeft; }
98233 0 53 if( op==TK_REGISTER ) op = p->op2;
98236 0 6 return aff==SQLITE_AFF_INTEGER || aff==SQLITE_AFF_NUMERIC;
0 0 return aff==SQLITE_AFF_INTEGER || aff==SQLITE_AFF_NUMERIC;
98239 0 0 return aff==SQLITE_AFF_REAL || aff==SQLITE_AFF_NUMERIC;
0 0 return aff==SQLITE_AFF_REAL || aff==SQLITE_AFF_NUMERIC;
98250 2 2 && (aff==SQLITE_AFF_INTEGER || aff==SQLITE_AFF_NUMERIC);
0 2 && (aff==SQLITE_AFF_INTEGER || aff==SQLITE_AFF_NUMERIC);
0 0 && (aff==SQLITE_AFF_INTEGER || aff==SQLITE_AFF_NUMERIC);
98262 0 641 if( sqlite3StrICmp(z, "_ROWID_")==0 ) return 1;
98263 631 10 if( sqlite3StrICmp(z, "ROWID")==0 ) return 1;
98264 0 10 if( sqlite3StrICmp(z, "OID")==0 ) return 1;
98290 16 0 if( !ExprHasProperty(pX, EP_xIsSelect) ) return 0; /* Not a subquery */
98291 0 0 if( ExprHasProperty(pX, EP_VarSelect) ) return 0; /* Correlated subq */
98293 0 0 if( p->pPrior ) return 0; /* Not a compound SELECT */
98294 0 0 if( p->selFlags & (SF_Distinct|SF_Aggregate) ){
98300 0 0 if( p->pLimit ) return 0; /* Has no LIMIT clause */
98301 0 0 if( p->pWhere ) return 0; /* Has no WHERE clause */
98304 0 0 if( pSrc->nSrc!=1 ) return 0; /* Single term in FROM clause */
98305 0 0 if( pSrc->a[0].pSelect ) return 0; /* FROM is not a subquery or view */
98309 0 0 if( IsVirtual(pTab) ) return 0; /* FROM clause not a virtual table */
98313 0 0 for(i=0; inExpr; i++){
98315 0 0 if( pRes->op!=TK_COLUMN ) return 0;
98460 0 16 if( prRhsHasNull && (pX->flags & EP_xIsSelect) ){
0 0 if( prRhsHasNull && (pX->flags & EP_xIsSelect) ){
98463 0 0 for(i=0; inExpr; i++){
98464 0 0 if( sqlite3ExprCanBeNull(pEList->a[i].pExpr) ) break;
98466 0 0 if( i==pEList->nExpr ){
98474 16 0 if( pParse->nErr==0 && (p = isCandidateForInOpt(pX))!=0 ){
0 16 if( pParse->nErr==0 && (p = isCandidateForInOpt(pX))!=0 ){
98492 0 0 if( nExpr==1 && pEList->a[0].pExpr->iColumn<0 ){
0 0 if( nExpr==1 && pEList->a[0].pExpr->iColumn<0 ){
98511 0 0 for(i=0; i
0 0 for(i=0; i
98533 0 0 if( affinity_ok ){
98535 0 0 for(pIdx=pTab->pIndex; pIdx && eType==0; pIdx=pIdx->pNext){
0 0 for(pIdx=pTab->pIndex; pIdx && eType==0; pIdx=pIdx->pNext){
98538 0 0 if( pIdx->nColumn
98543 0 0 if( pIdx->nColumn>=BMS-1 ) continue;
98544 0 0 if( mustBeUnique ){
98545 0 0 if( pIdx->nKeyCol>nExpr
98546 0 0 ||(pIdx->nColumn>nExpr && !IsUniqueIndex(pIdx))
0 0 ||(pIdx->nColumn>nExpr && !IsUniqueIndex(pIdx))
98553 0 0 for(i=0; i
98560 0 0 for(j=0; j
98561 0 0 if( pIdx->aiColumn[j]!=pRhs->iColumn ) continue;
98563 0 0 if( pReq!=0 && sqlite3StrICmp(pReq->zName, pIdx->azColl[j])!=0 ){
0 0 if( pReq!=0 && sqlite3StrICmp(pReq->zName, pIdx->azColl[j])!=0 ){
98568 0 0 if( j==nExpr ) break;
98570 0 0 if( mCol & colUsed ) break; /* Each column used only once */
98572 0 0 if( aiMap ) aiMap[i] = j;
98576 0 0 if( colUsed==(MASKBIT(nExpr)-1) ){
98587 0 0 if( prRhsHasNull ){
98594 0 0 if( nExpr==1 ){
98612 16 0 if( eType==0
98613 16 0 && (inFlags & IN_INDEX_NOOP_OK)
98614 16 0 && !ExprHasProperty(pX, EP_xIsSelect)
98615 16 0 && (!sqlite3InRhsIsConstant(pX) || pX->x.pList->nExpr<=2)
16 0 && (!sqlite3InRhsIsConstant(pX) || pX->x.pList->nExpr<=2)
98620 0 16 if( eType==0 ){
98627 0 0 if( inFlags & IN_INDEX_LOOP ){
98629 0 0 if( pX->pLeft->iColumn<0 && !ExprHasProperty(pX, EP_xIsSelect) ){
0 0 if( pX->pLeft->iColumn<0 && !ExprHasProperty(pX, EP_xIsSelect) ){
98632 0 0 }else if( prRhsHasNull ){
98641 16 0 if( aiMap && eType!=IN_INDEX_INDEX_ASC && eType!=IN_INDEX_INDEX_DESC ){
16 0 if( aiMap && eType!=IN_INDEX_INDEX_ASC && eType!=IN_INDEX_INDEX_DESC ){
16 0 if( aiMap && eType!=IN_INDEX_INDEX_ASC && eType!=IN_INDEX_INDEX_DESC ){
98644 16 16 for(i=0; i
98662 0 16 Select *pSelect = (pExpr->flags & EP_xIsSelect) ? pExpr->x.pSelect : 0;
98667 16 0 if( zRet ){
98669 16 16 for(i=0; i
98672 0 16 if( pSelect ){
98710 0 0 if( pExpr->flags & EP_xIsSelect ){
98758 0 16 if( NEVER(v==0) ) return 0;
98770 14 2 if( !ExprHasProperty(pExpr, EP_VarSelect) ){
98774 0 16 switch( pExpr->op ){
98798 0 0 addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral,
98800 0 0 pKeyInfo = isRowid ? 0 : sqlite3KeyInfoAlloc(pParse->db, nVal, 1);
98802 0 0 if( ExprHasProperty(pExpr, EP_xIsSelect) ){
98811 0 0 ExplainQueryPlan((pParse, 1, "%sLIST SUBQUERY",
98817 0 0 if( ALWAYS(pEList->nExpr==nVal) ){
98825 0 0 if( sqlite3Select(pParse, pSelect, &dest) ){
98835 0 0 for(i=0; i
98842 0 0 }else if( ALWAYS(pExpr->x.pList!=0) ){
98856 0 0 if( !affinity ){
98859 0 0 if( pKeyInfo ){
98867 0 0 if( isRowid ) sqlite3VdbeAddOp4(v, OP_Blob, 0, r2, 0, "", P4_STATIC);
98868 0 0 for(i=pList->nExpr, pItem=pList->a; i>0; i--, pItem++){
98877 0 0 if( jmpIfDynamic>=0 && !sqlite3ExprIsConstant(pE2) ){
0 0 if( jmpIfDynamic>=0 && !sqlite3ExprIsConstant(pE2) ){
98883 0 0 if( isRowid && sqlite3ExprIsInteger(pE2, &iValToIns) ){
0 0 if( isRowid && sqlite3ExprIsInteger(pE2, &iValToIns) ){
98887 0 0 if( isRowid ){
98901 0 0 if( pKeyInfo ){
98934 14 2 ExplainQueryPlan((pParse, 1, "%sSCALAR SUBQUERY",
98936 16 0 nReg = pExpr->op==TK_SELECT ? pSel->pEList->nExpr : 1;
98939 16 0 if( pExpr->op==TK_SELECT ){
98951 0 16 if( pSel->pLimit ){
98958 0 16 if( sqlite3Select(pParse, pSel, &dest) ){
98967 0 16 if( rHasNullFlag ){
98971 14 2 if( jmpIfDynamic>=0 ){
98988 0 32 if( (pIn->flags & EP_xIsSelect) ){
98989 0 0 if( nVector!=pIn->x.pSelect->pEList->nExpr ){
98993 0 32 }else if( nVector!=1 ){
99051 0 16 if( sqlite3ExprCheckIN(pParse, pExpr) ) return;
99057 0 16 if( pParse->db->mallocFailed ) goto sqlite3ExprCodeIN_oom_error;
99066 0 16 eType = sqlite3FindInIndex(pParse, pExpr,
99093 16 16 for(i=0; i
16 0 for(i=0; i
99094 16 0 if( i==nVector ){
99100 0 0 for(i=0; i
99111 16 0 if( eType==IN_INDEX_NOOP ){
99119 0 16 if( destIfNull!=destIfFalse ){
99123 32 16 for(ii=0; iinExpr; ii++){
99125 0 32 if( regCkNull && sqlite3ExprCanBeNull(pList->a[ii].pExpr) ){
0 0 if( regCkNull && sqlite3ExprCanBeNull(pList->a[ii].pExpr) ){
99128 16 16 if( iinExpr-1 || destIfNull!=destIfFalse ){
0 16 if( iinExpr-1 || destIfNull!=destIfFalse ){
99142 0 16 if( regCkNull ){
99155 0 0 if( destIfNull==destIfFalse ){
99160 0 0 for(i=0; i
99162 0 0 if( sqlite3ExprCanBeNull(p) ){
99172 0 0 if( eType==IN_INDEX_ROWID ){
99181 0 0 if( destIfFalse==destIfNull ){
99195 0 0 if( rRhsHasNull && nVector==1 ){
0 0 if( rRhsHasNull && nVector==1 ){
99203 0 0 if( destIfFalse==destIfNull ) sqlite3VdbeGoto(v, destIfFalse);
99212 0 0 if( destStep6 ) sqlite3VdbeResolveLabel(v, destStep6);
99215 0 0 if( nVector>1 ){
99222 0 0 for(i=0; i
99235 0 0 if( nVector>1 ){
99249 0 16 if( rLhs!=rLhsOrig ) sqlite3ReleaseTempReg(pParse, rLhs);
99267 2166 0 if( ALWAYS(z!=0) ){
99271 0 2166 if( negateFlag ) value = -value;
99286 472 12 if( pExpr->flags & EP_IntValue ){
99289 0 472 if( negFlag ) i = -i;
99297 0 12 if( (c==3 && !negFlag) || (c==2) || (negFlag && value==SMALLEST_INT64)){
0 0 if( (c==3 && !negFlag) || (c==2) || (negFlag && value==SMALLEST_INT64)){
12 0 if( (c==3 && !negFlag) || (c==2) || (negFlag && value==SMALLEST_INT64)){
0 12 if( (c==3 && !negFlag) || (c==2) || (negFlag && value==SMALLEST_INT64)){
0 0 if( (c==3 && !negFlag) || (c==2) || (negFlag && value==SMALLEST_INT64)){
99302 0 0 if( sqlite3_strnicmp(z,"0x",2)==0 ){
99303 0 0 sqlite3ErrorMsg(pParse, "hex literal too big: %s%s", negFlag?"-":"",z);
99311 0 12 if( negFlag ){ value = c==3 ? SMALLEST_INT64 : -value; }
0 0 if( negFlag ){ value = c==3 ? SMALLEST_INT64 : -value; }
99329 0 14 if( iTabCol==XN_EXPR ){
99351 0 3047 if( pTab==0 ){
99355 2967 80 if( iCol<0 || iCol==pTab->iPKey ){
2 2965 if( iCol<0 || iCol==pTab->iPKey ){
99358 54 2911 int op = IsVirtual(pTab) ? OP_VColumn : OP_Column;
99360 0 2965 if( !HasRowid(pTab) && !IsVirtual(pTab) ){
0 0 if( !HasRowid(pTab) && !IsVirtual(pTab) ){
99365 2967 80 if( iCol>=0 ){
99388 16 2952 if( p5 ){
99428 16 0 if( nResult==1 ){
99432 0 0 if( p->op==TK_SELECT ){
99442 0 0 for(i=0; i
99473 0 10055 if( v==0 ){
99479 56 10039 if( pExpr==0 ){
99488 8 58 if( !pAggInfo->directMode ){
99491 10 48 }else if( pAggInfo->useSortingIdx ){
99500 0 2968 if( ExprHasProperty(pExpr, EP_FixedCol) ){
99509 0 0 if( aff!=SQLITE_AFF_BLOB ){
99513 0 0 if( iReg!=target ){
99522 0 2968 if( iTab<0 ){
99523 0 0 if( pParse->iSelfTab<0 ){
99581 31 1048 if( pExpr->u.zToken[1]!=0 ){
99596 0 1 if( inReg!=target ){
99607 0 0 op = (op==TK_IS) ? TK_EQ : TK_NE;
99617 0 0 if( sqlite3ExprIsVector(pLeft) ){
99668 0 0 if( pLeft->op==TK_INTEGER ){
99672 0 0 }else if( pLeft->op==TK_FLOAT ){
99726 0 133 if( pInfo==0 ){
99746 0 619 if( ExprHasProperty(pExpr, EP_WinFunc) ){
99751 523 96 if( ConstFactorOk(pParse) && sqlite3ExprIsConstantNotJoin(pExpr) ){
49 474 if( ConstFactorOk(pParse) && sqlite3ExprIsConstantNotJoin(pExpr) ){
99757 0 570 if( ExprHasProperty(pExpr, EP_TokenOnly) ){
99762 552 18 nFarg = pFarg ? pFarg->nExpr : 0;
99771 570 0 if( pDef==0 || pDef->xFinalize!=0 ){
0 570 if( pDef==0 || pDef->xFinalize!=0 ){
99780 7 563 if( pDef->funcFlags & SQLITE_FUNC_COALESCE ){
99784 7 7 for(i=1; i
99796 0 563 if( pDef->funcFlags & SQLITE_FUNC_UNLIKELY ){
99817 975 563 for(i=0; i
99818 975 0 if( i<32 && sqlite3ExprIsConstant(pFarg->a[i].pExpr) ){
817 158 if( i<32 && sqlite3ExprIsConstant(pFarg->a[i].pExpr) ){
99822 0 975 if( (pDef->funcFlags & SQLITE_FUNC_NEEDCOLL)!=0 && !pColl ){
0 0 if( (pDef->funcFlags & SQLITE_FUNC_NEEDCOLL)!=0 && !pColl ){
99826 545 18 if( pFarg ){
99827 487 58 if( constMask ){
99839 22 523 if( (pDef->funcFlags & (SQLITE_FUNC_LENGTH|SQLITE_FUNC_TYPEOF))!=0 ){
99844 6 16 if( exprOp==TK_COLUMN || exprOp==TK_AGG_COLUMN ){
0 6 if( exprOp==TK_COLUMN || exprOp==TK_AGG_COLUMN ){
99871 418 145 if( nFarg>=2 && ExprHasProperty(pExpr, EP_InfixFunc) ){
141 277 if( nFarg>=2 && ExprHasProperty(pExpr, EP_InfixFunc) ){
99873 404 18 }else if( nFarg>0 ){
99877 0 563 if( pDef->funcFlags & SQLITE_FUNC_NEEDCOLL ){
99878 0 0 if( !pColl ) pColl = db->pDfltColl;
99892 0 563 sqlite3VdbeAddOp4(v, pParse->iSelfTab ? OP_PureFunc0 : OP_Function0,
99896 545 18 if( nFarg && constMask==0 ){
58 487 if( nFarg && constMask==0 ){
99907 16 0 if( op==TK_SELECT && (nCol = pExpr->x.pSelect->pEList->nExpr)!=1 ){
0 16 if( op==TK_SELECT && (nCol = pExpr->x.pSelect->pEList->nExpr)!=1 ){
99916 0 0 if( pExpr->pLeft->iTable==0 ){
99920 0 0 if( pExpr->iTable
99921 0 0 && pExpr->iTable!=(n = sqlite3ExprVectorSize(pExpr->pLeft))
100010 0 0 if( pExpr->iColumn>=0
100011 0 0 && pTab->aCol[pExpr->iColumn].affinity==SQLITE_AFF_REAL
100071 0 0 if( (pX = pExpr->pLeft)!=0 ){
100086 0 0 for(i=0; i
100087 0 0 if( pX ){
100101 0 0 if( (nExpr&1)!=0 ){
100116 0 0 if( !pParse->pTriggerTab ){
100121 0 0 if( pExpr->affinity==OE_Abort ){
100125 0 0 if( pExpr->affinity==OE_Ignore ){
100160 761 711 if( regDest<0 && p ){
307 454 if( regDest<0 && p ){
100163 452 276 for(pItem=p->a, i=p->nExpr; i>0; pItem++, i--){
100164 350 102 if( pItem->reusable && sqlite3ExprCompare(0,pItem->pExpr,pExpr,-1)==0 ){
31 319 if( pItem->reusable && sqlite3ExprCompare(0,pItem->pExpr,pExpr,-1)==0 ){
100171 1441 0 if( p ){
100174 730 711 if( regDest<0 ) regDest = ++pParse->nMem;
100197 1483 4 if( ConstFactorOk(pParse)
100198 1473 10 && pExpr->op!=TK_REGISTER
100199 712 761 && sqlite3ExprIsConstantNotJoin(pExpr)
100206 744 31 if( r2==r1 ){
100225 5712 56 if( pExpr && pExpr->op==TK_REGISTER ){
253 5459 if( pExpr && pExpr->op==TK_REGISTER ){
100230 1 5514 if( inReg!=target && pParse->pVdbe ){
1 0 if( inReg!=target && pParse->pVdbe ){
100244 0 0 if( !db->mallocFailed ) sqlite3ExprCode(pParse, pExpr, target);
100255 51 0 if( pParse->okConstFactor && sqlite3ExprIsConstantNotJoin(pExpr) ){
51 0 if( pParse->okConstFactor && sqlite3ExprIsConstantNotJoin(pExpr) ){
100315 2224 19 u8 copyOp = (flags & SQLITE_ECEL_DUP) ? OP_Copy : OP_SCopy;
100321 90 2153 if( !ConstFactorOk(pParse) ) flags &= ~SQLITE_ECEL_FACTOR;
100322 4055 2243 for(pItem=pList->a, i=0; i
100330 225 3830 if( (flags & SQLITE_ECEL_REF)!=0 && (j = pItem->u.x.iOrderByCol)>0 ){
88 137 if( (flags & SQLITE_ECEL_REF)!=0 && (j = pItem->u.x.iOrderByCol)>0 ){
100331 88 0 if( flags & SQLITE_ECEL_OMITREF ){
100337 818 3149 }else if( (flags & SQLITE_ECEL_FACTOR)!=0
100338 660 158 && sqlite3ExprIsConstantNotJoin(pExpr)
100343 184 3123 if( inReg!=target+i ){
100345 184 0 if( copyOp==OP_Copy
100346 2 182 && (pOp=sqlite3VdbeGetOp(v, -1))->opcode==OP_Copy
100347 1 1 && pOp->p1+pOp->p3+1==inReg
100348 1 0 && pOp->p2+pOp->p3+1==target+i
100410 0 0 if( xJump ){
100457 0 18 if( NEVER(v==0) ) return; /* Existence of VDBE checked by caller */
100458 0 18 if( NEVER(pExpr==0) ) return; /* No way this can happen */
100488 0 0 if( isTrue ^ isNot ){
100489 0 0 sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest,
100492 0 0 sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest,
100501 0 0 op = (op==TK_IS) ? TK_EQ : TK_NE;
100510 0 2 if( sqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr;
100549 0 0 int destIfNull = jumpIfNull ? dest : destIfFalse;
100558 0 12 if( exprAlwaysTrue(pExpr) ){
100560 12 0 }else if( exprAlwaysFalse(pExpr) ){
100593 0 932 if( NEVER(v==0) ) return; /* Existence of VDBE checked by caller */
100594 128 804 if( pExpr==0 ) return;
100655 0 0 if( isTrue ^ isNot ){
100657 0 0 sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest,
100662 0 0 sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest,
100671 0 1 op = (pExpr->op==TK_IS) ? TK_NE : TK_EQ;
100680 0 619 if( sqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr;
100716 16 0 if( jumpIfNull ){
100728 0 138 if( exprAlwaysFalse(pExpr) ){
100730 138 0 }else if( exprAlwaysTrue(pExpr) ){
100754 0 0 if( db->mallocFailed==0 ){
100779 0 0 if( pR ){
100783 0 0 if( pL ){
100784 0 0 if( sqlite3_value_type(pL)==SQLITE_TEXT ){
100827 1851 2992 if( pA==0 || pB==0 ){
0 1851 if( pA==0 || pB==0 ){
100828 2992 0 return pB==pA ? 0 : 2;
100830 0 1851 if( pParse && pA->op==TK_VARIABLE && exprCompareVariable(pParse, pA, pB) ){
0 0 if( pParse && pA->op==TK_VARIABLE && exprCompareVariable(pParse, pA, pB) ){
0 0 if( pParse && pA->op==TK_VARIABLE && exprCompareVariable(pParse, pA, pB) ){
100834 0 1851 if( combinedFlags & EP_IntValue ){
100835 0 0 if( (pA->flags&pB->flags&EP_IntValue)!=0 && pA->u.iValue==pB->u.iValue ){
0 0 if( (pA->flags&pB->flags&EP_IntValue)!=0 && pA->u.iValue==pB->u.iValue ){
100840 66 1785 if( pA->op!=pB->op ){
100841 16 50 if( pA->op==TK_COLLATE && sqlite3ExprCompare(pParse, pA->pLeft,pB,iTab)<2 ){
16 0 if( pA->op==TK_COLLATE && sqlite3ExprCompare(pParse, pA->pLeft,pB,iTab)<2 ){
100844 0 50 if( pB->op==TK_COLLATE && sqlite3ExprCompare(pParse, pA,pB->pLeft,iTab)<2 ){
0 0 if( pB->op==TK_COLLATE && sqlite3ExprCompare(pParse, pA,pB->pLeft,iTab)<2 ){
100849 413 1372 if( pA->op!=TK_COLUMN && pA->op!=TK_AGG_COLUMN && pA->u.zToken ){
413 0 if( pA->op!=TK_COLUMN && pA->op!=TK_AGG_COLUMN && pA->u.zToken ){
413 0 if( pA->op!=TK_COLUMN && pA->op!=TK_AGG_COLUMN && pA->u.zToken ){
100850 54 359 if( pA->op==TK_FUNCTION ){
100851 0 54 if( sqlite3StrICmp(pA->u.zToken,pB->u.zToken)!=0 ) return 2;
100862 0 54 if( ExprHasProperty(pA,EP_WinFunc) ){
100863 0 0 if( sqlite3WindowCompare(pParse,pA->y.pWin,pB->y.pWin)!=0 ) return 2;
100866 0 359 }else if( pA->op==TK_COLLATE ){
100867 0 0 if( sqlite3_stricmp(pA->u.zToken,pB->u.zToken)!=0 ) return 2;
100868 289 70 }else if( strcmp(pA->u.zToken,pB->u.zToken)!=0 ){
100872 0 1496 if( (pA->flags & EP_Distinct)!=(pB->flags & EP_Distinct) ) return 2;
100873 1496 0 if( ALWAYS((combinedFlags & EP_TokenOnly)==0) ){
100874 0 1496 if( combinedFlags & EP_xIsSelect ) return 2;
100875 1496 0 if( (combinedFlags & EP_FixedCol)==0
100876 0 1496 && sqlite3ExprCompare(pParse, pA->pLeft, pB->pLeft, iTab) ) return 2;
100877 0 1496 if( sqlite3ExprCompare(pParse, pA->pRight, pB->pRight, iTab) ) return 2;
100878 48 1448 if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList, iTab) ) return 2;
100880 1381 67 if( pA->op!=TK_STRING && pA->op!=TK_TRUEFALSE ){
1381 0 if( pA->op!=TK_STRING && pA->op!=TK_TRUEFALSE ){
100881 1312 69 if( pA->iColumn!=pB->iColumn ) return 2;
100882 2 67 if( pA->iTable!=pB->iTable
100883 0 2 && (pA->iTable!=iTab || NEVER(pB->iTable>=0)) ) return 2;
0 0 && (pA->iTable!=iTab || NEVER(pB->iTable>=0)) ) return 2;
100906 1563 68 if( pA==0 && pB==0 ) return 0;
1561 2 if( pA==0 && pB==0 ) return 0;
100907 68 2 if( pA==0 || pB==0 ) return 1;
11 57 if( pA==0 || pB==0 ) return 1;
100908 0 57 if( pA->nExpr!=pB->nExpr ) return 1;
100909 93 7 for(i=0; inExpr; i++){
100912 1 92 if( pA->a[i].sortOrder!=pB->a[i].sortOrder ) return 1;
100913 49 43 if( sqlite3ExprCompare(0, pExprA, pExprB, iTab) ) return 1;
100955 0 0 if( sqlite3ExprCompare(pParse, pE1, pE2, iTab)==0 ){
100958 0 0 if( pE2->op==TK_OR
100959 0 0 && (sqlite3ExprImpliesExpr(pParse, pE1, pE2->pLeft, iTab)
100960 0 0 || sqlite3ExprImpliesExpr(pParse, pE1, pE2->pRight, iTab) )
100964 0 0 if( pE2->op==TK_NOTNULL && pE1->op!=TK_ISNULL && pE1->op!=TK_IS ){
0 0 if( pE2->op==TK_NOTNULL && pE1->op!=TK_ISNULL && pE1->op!=TK_IS ){
0 0 if( pE2->op==TK_NOTNULL && pE1->op!=TK_ISNULL && pE1->op!=TK_IS ){
100967 0 0 if( sqlite3ExprCompare(pParse, pX, pE2->pLeft, iTab)==0 ) return 1;
100984 0 0 if( ExprHasProperty(pExpr, EP_FromJoin) ) return WRC_Prune;
101004 0 0 if( pWalker->u.iCur==pExpr->iTable ){
101025 0 0 if( (pExpr->pLeft->op==TK_COLUMN && IsVirtual(pExpr->pLeft->y.pTab))
0 0 if( (pExpr->pLeft->op==TK_COLUMN && IsVirtual(pExpr->pLeft->y.pTab))
101026 0 0 || (pExpr->pRight->op==TK_COLUMN && IsVirtual(pExpr->pRight->y.pTab))
0 0 || (pExpr->pRight->op==TK_COLUMN && IsVirtual(pExpr->pRight->y.pTab))
101086 43 99 if( pExpr->op==TK_COLUMN
101087 43 0 && pExpr->iTable==pWalker->u.pIdxCover->iCur
101088 0 43 && sqlite3ColumnOfIndex(pWalker->u.pIdxCover->pIdx, pExpr->iColumn)<0
101144 0 50 if( pExpr->op==TK_COLUMN || NEVER(pExpr->op==TK_AGG_COLUMN) ){
0 0 if( pExpr->op==TK_COLUMN || NEVER(pExpr->op==TK_AGG_COLUMN) ){
101148 50 0 int nSrc = pSrc ? pSrc->nSrc : 0;
101149 50 0 for(i=0; i
101150 50 0 if( pExpr->iTable==pSrc->a[i].iCursor ) break;
101152 50 0 if( i
101178 83 50 return cnt.nThis>0 || cnt.nOther==0;
83 0 return cnt.nThis>0 || cnt.nOther==0;
101233 59 0 if( ALWAYS(pSrcList!=0) ){
101235 60 0 for(i=0; inSrc; i++, pItem++){
101238 59 1 if( pExpr->iTable==pItem->iCursor ){
101247 5 58 for(k=0; knColumn; k++, pCol++){
101248 3 2 if( pCol->iTable==pExpr->iTable &&
1 2 if( pCol->iTable==pExpr->iTable &&
101253 58 1 if( (k>=pAggInfo->nColumn)
101254 58 0 && (k = addAggInfoColumn(pParse->db, pAggInfo))>=0
101263 10 48 if( pAggInfo->pGroupBy ){
101268 10 3 for(j=0; j
101270 10 0 if( pE->op==TK_COLUMN && pE->iTable==pExpr->iTable &&
9 1 if( pE->op==TK_COLUMN && pE->iTable==pExpr->iTable &&
7 2 if( pE->op==TK_COLUMN && pE->iTable==pExpr->iTable &&
101277 51 7 if( pCol->iSorterColumn<0 ){
101297 134 0 if( (pNC->ncFlags & NC_InAggFunc)==0
101298 134 0 && pWalker->walkerDepth==pExpr->op2
101304 1 133 for(i=0; inFunc; i++, pItem++){
101305 1 0 if( sqlite3ExprCompare(0, pItem->pExpr, pExpr, -1)==0 ){
101309 133 1 if( i>=pAggInfo->nFunc ){
101314 133 0 if( i>=0 ){
101320 50 83 pItem->pFunc = sqlite3FindFunction(pParse->db,
101323 0 133 if( pExpr->flags & EP_Distinct ){
101383 185 214 if( pList ){
101384 188 185 for(pItem=pList->a, i=0; inExpr; i++, pItem++){
101394 3227 617 if( pParse->nTempReg==0 ){
101405 1172 1010 if( iReg && pParse->nTempRegaTempReg) ){
1172 0 if( iReg && pParse->nTempRegaTempReg) ){
101415 144 62 if( nReg==1 ) return sqlite3GetTempReg(pParse);
101418 1 61 if( nReg<=n ){
101428 144 88 if( nReg==1 ){
101432 14 74 if( nReg>pParse->nRangeReg ){
101502 0 0 if( 0==sqlite3StrNICmp(zName, "sqlite_", 7) ){
101527 0 0 if( bTemp==0 ){
101545 0 0 if( v ){
101548 0 0 if( iDb!=1 ) sqlite3VdbeAddParseSchemaOp(pParse->pVdbe, 1, 0);
101573 0 0 if( NEVER(db->mallocFailed) ) goto exit_rename_table;
101578 0 0 if( !pTab ) goto exit_rename_table;
101585 0 0 if( !zName ) goto exit_rename_table;
101590 0 0 if( sqlite3FindTable(db, zName, zDb) || sqlite3FindIndex(db, zName, zDb) ){
0 0 if( sqlite3FindTable(db, zName, zDb) || sqlite3FindIndex(db, zName, zDb) ){
101599 0 0 if( SQLITE_OK!=isSystemTable(pParse, pTab->zName) ){
101602 0 0 if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){ goto
101607 0 0 if( pTab->pSelect ){
101615 0 0 if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){
101621 0 0 if( sqlite3ViewGetColumnNames(pParse, pTab) ){
101624 0 0 if( IsVirtual(pTab) ){
101626 0 0 if( pVTab->pVtab->pModule->xRename==0 ){
101638 0 0 if( v==0 ){
101677 0 0 if( sqlite3FindTable(db, "sqlite_sequence", zDb) ){
101687 0 0 if( iDb!=1 ){
101705 0 0 if( pVTab ){
101744 0 0 if( pParse->nErr || db->mallocFailed ) return;
0 0 if( pParse->nErr || db->mallocFailed ) return;
101759 0 0 if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){
101769 0 0 if( pDflt && pDflt->pLeft->op==TK_NULL ){
0 0 if( pDflt && pDflt->pLeft->op==TK_NULL ){
101777 0 0 if( pCol->colFlags & COLFLAG_PRIMKEY ){
101781 0 0 if( pNew->pIndex ){
101785 0 0 if( (db->flags&SQLITE_ForeignKeys) && pNew->pFKey && pDflt ){
0 0 if( (db->flags&SQLITE_ForeignKeys) && pNew->pFKey && pDflt ){
0 0 if( (db->flags&SQLITE_ForeignKeys) && pNew->pFKey && pDflt ){
101790 0 0 if( pCol->notNull && !pDflt ){
0 0 if( pCol->notNull && !pDflt ){
101799 0 0 if( pDflt ){
101804 0 0 if( rc!=SQLITE_OK ){
101808 0 0 if( !pVal ){
101817 0 0 if( zCol ){
101820 0 0 while( zEnd>zCol && (*zEnd==';' || sqlite3Isspace(*zEnd)) ){
0 0 while( zEnd>zCol && (*zEnd==';' || sqlite3Isspace(*zEnd)) ){
0 0 while( zEnd>zCol && (*zEnd==';' || sqlite3Isspace(*zEnd)) ){
101840 0 0 if( v ){
101881 0 0 if( db->mallocFailed ) goto exit_begin_add_column;
101883 0 0 if( !pTab ) goto exit_begin_add_column;
101886 0 0 if( IsVirtual(pTab) ){
101893 0 0 if( pTab->pSelect ){
101897 0 0 if( SQLITE_OK!=isSystemTable(pParse, pTab->zName) ){
101912 0 0 if( !pNew ) goto exit_begin_add_column;
101921 0 0 if( !pNew->aCol || !pNew->zName ){
0 0 if( !pNew->aCol || !pNew->zName ){
101926 0 0 for(i=0; inCol; i++){
101953 0 0 if( pTab->pSelect ){
101958 0 0 if( IsVirtual(pTab) ){
101962 0 0 if( zType ){
101996 0 0 if( !pTab ) goto exit_rename_column;
101999 0 0 if( SQLITE_OK!=isSystemTable(pParse, pTab->zName) ) goto exit_rename_column;
102000 0 0 if( SQLITE_OK!=isRealTable(pParse, pTab) ) goto exit_rename_column;
102009 0 0 if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){
102017 0 0 if( !zOld ) goto exit_rename_column;
102018 0 0 for(iCol=0; iColnCol; iCol++){
102019 0 0 if( 0==sqlite3StrICmp(pTab->aCol[iCol].zName, zOld) ) break;
102021 0 0 if( iCol==pTab->nCol ){
102031 0 0 if( !zNew ) goto exit_rename_column;
102156 0 0 if( pNew ){
102174 0 0 for(p=pParse->pRename; p; p=p->pNext){
102175 0 0 if( p->p==pFrom ){
102207 0 0 if( pEList ){
102214 0 0 for(i=0; inExpr; i++){
102226 0 0 for(p=pToken; p; p=pNext){
102241 0 0 for(pp=&pParse->pRename; (*pp); pp=&(*pp)->pNext){
102242 0 0 if( (*pp)->p==pPtr ){
102275 0 0 if( pExpr->op==TK_TRIGGER
102276 0 0 && pExpr->iColumn==p->iCol
102277 0 0 && pWalker->pParse->pTriggerTab==p->pTab
102280 0 0 }else if( pExpr->op==TK_COLUMN
102281 0 0 && pExpr->iColumn==p->iCol
102282 0 0 && p->pTab==pExpr->y.pTab
102303 0 0 for(pToken=pBest->pNext; pToken; pToken=pToken->pNext){
102304 0 0 if( pToken->t.z>pBest->t.z ) pBest = pToken;
102306 0 0 for(pp=&pCtx->pList; *pp!=pBest; pp=&(*pp)->pNext);
102330 0 0 zErr = sqlite3_mprintf("error in %s %s%s: %s",
102350 0 0 if( pEList ){
102352 0 0 for(i=0; inExpr; i++){
102354 0 0 if( 0==sqlite3_stricmp(zName, zOld) ){
102372 0 0 if( pIdList ){
102374 0 0 for(i=0; inId; i++){
102376 0 0 if( 0==sqlite3_stricmp(zName, zOld) ){
102398 0 0 db->init.iDb = bTemp ? 1 : sqlite3FindDbName(db, zDb);
102404 0 0 p->eParseMode = (bTable ? PARSE_MODE_RENAME_TABLE : PARSE_MODE_RENAME_COLUMN);
102412 0 0 if( db->mallocFailed ) rc = SQLITE_NOMEM;
102413 0 0 if( rc==SQLITE_OK
102414 0 0 && p->pNewTable==0 && p->pNewIndex==0 && p->pNewTrigger==0
0 0 && p->pNewTable==0 && p->pNewIndex==0 && p->pNewTrigger==0
0 0 && p->pNewTable==0 && p->pNewIndex==0 && p->pNewTrigger==0
102465 0 0 if( zQuot==0 ){
102470 0 0 if( bQuote ){
102481 0 0 if( zOut ){
102484 0 0 while( pRename->pList ){
102490 0 0 if( sqlite3IsIdChar(*pBest->t.z) ){
102499 0 0 if( pBest->t.n!=nReplace ){
102542 0 0 if( ALWAYS(pParse->pTriggerTab) ){
102547 0 0 if( rc==SQLITE_OK && pNew->pWhen ){
0 0 if( rc==SQLITE_OK && pNew->pWhen ){
102551 0 0 for(pStep=pNew->step_list; rc==SQLITE_OK && pStep; pStep=pStep->pNext){
0 0 for(pStep=pNew->step_list; rc==SQLITE_OK && pStep; pStep=pStep->pNext){
102552 0 0 if( pStep->pSelect ){
102554 0 0 if( pParse->nErr ) rc = pParse->rc;
102556 0 0 if( rc==SQLITE_OK && pStep->zTarget ){
0 0 if( rc==SQLITE_OK && pStep->zTarget ){
102558 0 0 if( pTarget==0 ){
102560 0 0 }else if( SQLITE_OK==(rc = sqlite3ViewGetColumnNames(pParse, pTarget)) ){
102567 0 0 if( pStep->pWhere ){
102570 0 0 if( rc==SQLITE_OK ){
102574 0 0 if( pStep->pUpsert ){
102581 0 0 if( rc==SQLITE_OK ){
102585 0 0 if( rc==SQLITE_OK ){
102588 0 0 if( rc==SQLITE_OK ){
102610 0 0 for(pStep=pTrigger->step_list; pStep; pStep=pStep->pNext){
102614 0 0 if( pStep->pUpsert ){
102630 0 0 if( pParse->pVdbe ){
102634 0 0 if( pParse->pNewIndex ) sqlite3FreeIndex(db, pParse->pNewIndex);
102690 0 0 if( zSql==0 ) return;
102691 0 0 if( zTable==0 ) return;
102692 0 0 if( zNew==0 ) return;
102693 0 0 if( iCol<0 ) return;
102696 0 0 if( pTab==0 || iCol>=pTab->nCol ){
0 0 if( pTab==0 || iCol>=pTab->nCol ){
102702 0 0 sCtx.iCol = ((iCol==pTab->iPKey) ? -1 : iCol);
102717 0 0 if( rc!=SQLITE_OK ) goto renameColumnFunc_done;
102718 0 0 if( sParse.pNewTable ){
102720 0 0 if( pSelect ){
102723 0 0 rc = (db->mallocFailed ? SQLITE_NOMEM : sParse.rc);
102724 0 0 if( rc==SQLITE_OK ){
102727 0 0 if( rc!=SQLITE_OK ) goto renameColumnFunc_done;
102734 0 0 if( bFKOnly==0 ){
102738 0 0 if( sCtx.iCol<0 ){
102742 0 0 for(pIdx=sParse.pNewTable->pIndex; pIdx; pIdx=pIdx->pNext){
102747 0 0 for(pFKey=sParse.pNewTable->pFKey; pFKey; pFKey=pFKey->pNextFrom){
102748 0 0 for(i=0; inCol; i++){
102749 0 0 if( bFKOnly==0 && pFKey->aCol[i].iFrom==iCol ){
0 0 if( bFKOnly==0 && pFKey->aCol[i].iFrom==iCol ){
102752 0 0 if( 0==sqlite3_stricmp(pFKey->zTo, zTable)
102753 0 0 && 0==sqlite3_stricmp(pFKey->aCol[i].zCol, zOld)
102760 0 0 }else if( sParse.pNewIndex ){
102766 0 0 rc = renameResolveTrigger(&sParse, (bTemp ? 0 : zDb));
102767 0 0 if( rc!=SQLITE_OK ) goto renameColumnFunc_done;
102769 0 0 for(pStep=sParse.pNewTrigger->step_list; pStep; pStep=pStep->pNext){
102770 0 0 if( pStep->zTarget ){
102772 0 0 if( pTarget==pTab ){
102773 0 0 if( pStep->pUpsert ){
102785 0 0 if( sParse.pTriggerTab==pTab ){
102797 0 0 if( rc!=SQLITE_OK ){
102798 0 0 if( sParse.zErrMsg ){
102818 0 0 if( pExpr->op==TK_COLUMN && p->pTab==pExpr->y.pTab ){
0 0 if( pExpr->op==TK_COLUMN && p->pTab==pExpr->y.pTab ){
102831 0 0 for(i=0; inSrc; i++){
102833 0 0 if( pItem->pTab==p->pTab ){
102874 0 0 if( zInput && zOld && zNew ){
0 0 if( zInput && zOld && zNew ){
0 0 if( zInput && zOld && zNew ){
102898 0 0 if( rc==SQLITE_OK ){
102900 0 0 if( sParse.pNewTable ){
102903 0 0 if( pTab->pSelect ){
102904 0 0 if( isLegacy==0 ){
102910 0 0 if( sParse.nErr ) rc = sParse.rc;
102916 0 0 if( isLegacy==0 || (db->flags & SQLITE_ForeignKeys) ){
0 0 if( isLegacy==0 || (db->flags & SQLITE_ForeignKeys) ){
102918 0 0 for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){
102919 0 0 if( sqlite3_stricmp(pFKey->zTo, zOld)==0 ){
102929 0 0 if( sqlite3_stricmp(zOld, pTab->zName)==0 ){
102931 0 0 if( isLegacy==0 ){
102939 0 0 else if( sParse.pNewIndex ){
102941 0 0 if( isLegacy==0 ){
102950 0 0 if( 0==sqlite3_stricmp(sParse.pNewTrigger->table, zOld)
102951 0 0 && sCtx.pTab->pSchema==pTrigger->pTabSchema
102956 0 0 if( isLegacy==0 ){
102957 0 0 rc = renameResolveTrigger(&sParse, bTemp ? 0 : zDb);
102958 0 0 if( rc==SQLITE_OK ){
102960 0 0 for(pStep=pTrigger->step_list; pStep; pStep=pStep->pNext){
102961 0 0 if( pStep->zTarget && 0==sqlite3_stricmp(pStep->zTarget, zOld) ){
0 0 if( pStep->zTarget && 0==sqlite3_stricmp(pStep->zTarget, zOld) ){
102971 0 0 if( rc==SQLITE_OK ){
102974 0 0 if( rc!=SQLITE_OK ){
102975 0 0 if( sParse.zErrMsg ){
103029 0 0 if( zDb && zInput ){
0 0 if( zDb && zInput ){
103033 0 0 if( rc==SQLITE_OK ){
103034 0 0 if( isLegacy==0 && sParse.pNewTable && sParse.pNewTable->pSelect ){
0 0 if( isLegacy==0 && sParse.pNewTable && sParse.pNewTable->pSelect ){
0 0 if( isLegacy==0 && sParse.pNewTable && sParse.pNewTable->pSelect ){
103039 0 0 if( sParse.nErr ) rc = sParse.rc;
103042 0 0 else if( sParse.pNewTrigger ){
103043 0 0 if( isLegacy==0 ){
103044 0 0 rc = renameResolveTrigger(&sParse, bTemp ? 0 : zDb);
103046 0 0 if( rc==SQLITE_OK ){
103049 0 0 if( i1==i2 ) sqlite3_result_int(context, 1);
103054 0 0 if( rc!=SQLITE_OK ){
103281 0 1 if( v==0 ) return;
103289 3 1 for(i=0; i
103292 3 0 if( (pStat = sqlite3FindTable(db, zTab, pDb->zDbSName))==0 ){
103293 1 2 if( aTable[i].zCols ){
103311 0 0 if( zWhere ){
103328 1 1 for(i=0; aTable[i].zCols; i++){
103514 0 0 if( p==0 ){
103824 0 0 if( p->nRow==0 ){
103826 0 0 for(i=0; inCol; i++) p->current.anEq[i] = 1;
103833 0 0 for(i=0; i
103836 0 0 for(i=iChng; inCol; i++){
103958 0 0 if( zRet==0 ){
103965 0 0 for(i=0; inKeyCol; i++){
104093 2 0 if( v==0 || NEVER(pTab==0) ){
0 2 if( v==0 || NEVER(pTab==0) ){
104096 0 2 if( pTab->tnum==0 ){
104100 1 1 if( sqlite3_strlike("sqlite\\_%", pTab->zName, '\\')==0 ){
104109 0 1 if( sqlite3AuthCheck(pParse, SQLITE_ANALYZE, pTab->zName, 0,
104138 0 1 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
104145 0 0 if( pOnlyIdx && pOnlyIdx!=pIdx ) continue;
0 0 if( pOnlyIdx && pOnlyIdx!=pIdx ) continue;
104146 0 0 if( pIdx->pPartIdxWhere==0 ) needTableCnt = 0;
104147 0 0 if( !HasRowid(pTab) && IsPrimaryKeyIndex(pIdx) ){
0 0 if( !HasRowid(pTab) && IsPrimaryKeyIndex(pIdx) ){
104154 0 0 nColTest = pIdx->uniqNotNull ? pIdx->nKeyCol-1 : nCol-1;
104237 0 0 if( nColTest>0 ){
104241 0 0 if( aGotoChng==0 ) continue;
104255 0 0 if( nColTest==1 && pIdx->nKeyCol==1 && IsUniqueIndex(pIdx) ){
0 0 if( nColTest==1 && pIdx->nKeyCol==1 && IsUniqueIndex(pIdx) ){
0 0 if( nColTest==1 && pIdx->nKeyCol==1 && IsUniqueIndex(pIdx) ){
104262 0 0 for(i=0; i
104283 0 0 for(i=0; i
104381 1 0 if( pOnlyIdx==0 && needTableCnt ){
1 0 if( pOnlyIdx==0 && needTableCnt ){
104405 1 0 if( v ){
104428 2 1 for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){
104450 0 0 if( pOnlyIdx ){
104484 0 1 if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){
104489 1 0 if( pName1==0 ){
104491 2 1 for(i=0; inDb; i++){
104492 1 1 if( i==1 ) continue; /* Do not analyze the TEMP database */
104495 0 0 }else if( pName2->n==0 && (iDb = sqlite3FindDb(db, pName1))>=0 ){
0 0 }else if( pName2->n==0 && (iDb = sqlite3FindDb(db, pName1))>=0 ){
104501 0 0 if( iDb>=0 ){
104502 0 0 zDb = pName2->n ? db->aDb[iDb].zDbSName : 0;
104504 0 0 if( z ){
104505 0 0 if( (pIdx = sqlite3FindIndex(db, z, zDb))!=0 ){
104507 0 0 }else if( (pTab = sqlite3LocateTable(pParse, 0, z, zDb))!=0 ){
104514 1 0 if( db->nSqlExec==0 && (v = sqlite3GetVdbe(pParse))!=0 ){
1 0 if( db->nSqlExec==0 && (v = sqlite3GetVdbe(pParse))!=0 ){
104551 0 0 for(i=0; *z && i
0 0 for(i=0; *z && i
104553 0 0 while( (c=z[0])>='0' && c<='9' ){
0 0 while( (c=z[0])>='0' && c<='9' ){
104566 0 0 if( *z==' ' ) z++;
104575 0 0 while( z[0] ){
104576 0 0 if( sqlite3_strglob("unordered*", z)==0 ){
104578 0 0 }else if( sqlite3_strglob("sz=[0-9]*", z)==0 ){
104580 0 0 }else if( sqlite3_strglob("noskipscan*", z)==0 ){
104588 0 0 while( z[0]!=0 && z[0]!=' ' ) z++;
0 0 while( z[0]!=0 && z[0]!=' ' ) z++;
104589 0 0 while( z[0]==' ' ) z++;
104614 0 0 if( argv==0 || argv[0]==0 || argv[2]==0 ){
0 0 if( argv==0 || argv[0]==0 || argv[2]==0 ){
0 0 if( argv==0 || argv[0]==0 || argv[2]==0 ){
104618 0 0 if( pTable==0 ){
104621 0 0 if( argv[1]==0 ){
104623 0 0 }else if( sqlite3_stricmp(argv[0],argv[1])==0 ){
104630 0 0 if( pIndex ){
104646 0 0 if( pIndex->pPartIdxWhere==0 ){
104960 221 187 for(i=sqliteHashFirst(&pSchema->tblHash); i; i=sqliteHashNext(i)){
104964 0 187 for(i=sqliteHashFirst(&pSchema->idxHash); i; i=sqliteHashNext(i)){
104976 1 186 if( sqlite3FindTable(db, "sqlite_stat1", sInfo.zDatabase)!=0 ){
104979 0 1 if( zSql==0 ){
104989 0 187 for(i=sqliteHashFirst(&pSchema->idxHash); i; i=sqliteHashNext(i)){
104991 0 0 if( !pIdx->hasStat1 ) sqlite3DefaultRowEst(pIdx);
105008 0 187 if( rc==SQLITE_NOMEM ){
105056 10 5 if( pExpr ){
105057 3 7 if( pExpr->op!=TK_ID ){
105102 0 5 if( zFile==0 ) zFile = "";
105103 0 5 if( zName==0 ) zName = "";
105131 0 5 if( db->nDb>=db->aLimit[SQLITE_LIMIT_ATTACHED]+2 ){
105137 10 5 for(i=0; inDb; i++){
105140 0 10 if( sqlite3StrICmp(z, zName)==0 ){
105149 5 0 if( db->aDb==db->aDbStatic ){
105151 0 5 if( aNew==0 ) return;
105155 0 0 if( aNew==0 ) return;
105167 0 5 if( rc!=SQLITE_OK ){
105168 0 0 if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);
105180 0 5 if( rc==SQLITE_CONSTRAINT ){
105183 5 0 }else if( rc==SQLITE_OK ){
105186 0 5 if( !pNew->pSchema ){
105188 0 5 }else if( pNew->pSchema->file_format && pNew->pSchema->enc!=ENC(db) ){
0 0 }else if( pNew->pSchema->file_format && pNew->pSchema->enc!=ENC(db) ){
105206 5 0 if( rc==SQLITE_OK && pNew->zDbSName==0 ){
0 5 if( rc==SQLITE_OK && pNew->zDbSName==0 ){
105248 5 0 if( rc==SQLITE_OK ){
105265 0 5 if( rc ){
105269 0 0 if( db->aDb[iDb].pBt ){
105276 0 0 if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){
0 0 if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){
105280 0 0 }else if( zErrDyn==0 ){
105291 0 0 if( zErrDyn ){
105295 0 0 if( rc ) sqlite3_result_error_code(context, rc);
105319 0 0 if( zName==0 ) zName = "";
105320 0 0 for(i=0; inDb; i++){
105322 0 0 if( pDb->pBt==0 ) continue;
105323 0 0 if( sqlite3StrICmp(pDb->zDbSName, zName)==0 ) break;
105326 0 0 if( i>=db->nDb ){
105330 0 0 if( i<2 ){
105334 0 0 if( sqlite3BtreeIsInReadTrans(pDb->pBt) || sqlite3BtreeIsInBackup(pDb->pBt) ){
0 0 if( sqlite3BtreeIsInReadTrans(pDb->pBt) || sqlite3BtreeIsInBackup(pDb->pBt) ){
105368 0 5 if( pParse->nErr ) goto attach_end;
105372 5 0 if(
105373 5 0 SQLITE_OK!=(rc = resolveAttachExpr(&sName, pFilename)) ||
105374 5 0 SQLITE_OK!=(rc = resolveAttachExpr(&sName, pDbname)) ||
105381 5 0 if( pAuthArg ){
105383 5 0 if( pAuthArg->op==TK_STRING ){
105389 0 5 if(rc!=SQLITE_OK ){
105403 5 0 if( v ){
105508 0 10 if( NEVER(pList==0) ) return 0;
105510 10 10 for(i=0, pItem=pList->a; inSrc; i++, pItem++){
105511 10 0 if( pFix->bVarOnly==0 ){
105512 0 10 if( pItem->zDatabase && sqlite3StrICmp(pItem->zDatabase, zDb) ){
0 0 if( pItem->zDatabase && sqlite3StrICmp(pItem->zDatabase, zDb) ){
105523 0 10 if( sqlite3FixSelect(pFix, pItem->pSelect) ) return 1;
105524 0 10 if( sqlite3FixExpr(pFix, pItem->pOn) ) return 1;
105526 0 10 if( pItem->fg.isTabFunc && sqlite3FixExprList(pFix, pItem->u1.pFuncArg) ){
0 0 if( pItem->fg.isTabFunc && sqlite3FixExprList(pFix, pItem->u1.pFuncArg) ){
105537 0 10 while( pSelect ){
105538 0 0 if( sqlite3FixExprList(pFix, pSelect->pEList) ){
105541 0 0 if( sqlite3FixSrcList(pFix, pSelect->pSrc) ){
105544 0 0 if( sqlite3FixExpr(pFix, pSelect->pWhere) ){
105547 0 0 if( sqlite3FixExprList(pFix, pSelect->pGroupBy) ){
105550 0 0 if( sqlite3FixExpr(pFix, pSelect->pHaving) ){
105553 0 0 if( sqlite3FixExprList(pFix, pSelect->pOrderBy) ){
105556 0 0 if( sqlite3FixExpr(pFix, pSelect->pLimit) ){
105559 0 0 if( pSelect->pWith ){
105561 0 0 for(i=0; ipWith->nCte; i++){
105562 0 0 if( sqlite3FixSelect(pFix, pSelect->pWith->a[i].pSelect) ){
105575 0 10 while( pExpr ){
105576 0 0 if( pExpr->op==TK_VARIABLE ){
105577 0 0 if( pFix->pParse->db->init.busy ){
105584 0 0 if( ExprHasProperty(pExpr, EP_TokenOnly|EP_Leaf) ) break;
105585 0 0 if( ExprHasProperty(pExpr, EP_xIsSelect) ){
105586 0 0 if( sqlite3FixSelect(pFix, pExpr->x.pSelect) ) return 1;
105588 0 0 if( sqlite3FixExprList(pFix, pExpr->x.pList) ) return 1;
105590 0 0 if( sqlite3FixExpr(pFix, pExpr->pRight) ){
105603 0 0 if( pList==0 ) return 0;
105604 0 0 for(i=0, pItem=pList->a; inExpr; i++, pItem++){
105605 0 0 if( sqlite3FixExpr(pFix, pItem->pExpr) ){
105618 0 0 while( pStep ){
105619 0 0 if( sqlite3FixSelect(pFix, pStep->pSelect) ){
105622 0 0 if( sqlite3FixExpr(pFix, pStep->pWhere) ){
105625 0 0 if( sqlite3FixExprList(pFix, pStep->pExprList) ){
105629 0 0 if( pStep->pUpsert ){
105631 0 0 if( sqlite3FixExprList(pFix, pUp->pUpsertTarget)
105632 0 0 || sqlite3FixExpr(pFix, pUp->pUpsertTargetWhere)
105633 0 0 || sqlite3FixExprList(pFix, pUp->pUpsertSet)
105634 0 0 || sqlite3FixExpr(pFix, pUp->pUpsertWhere)
105761 0 0 if( db->init.busy ) return SQLITE_OK;
105767 0 0 if( rc==SQLITE_DENY ){
105769 0 0 if( db->nDb>2 || iDb!=0 ) z = sqlite3_mprintf("%s.%z", zDb, z);
0 0 if( db->nDb>2 || iDb!=0 ) z = sqlite3_mprintf("%s.%z", zDb, z);
105772 0 0 }else if( rc!=SQLITE_IGNORE && rc!=SQLITE_OK ){
0 0 }else if( rc!=SQLITE_IGNORE && rc!=SQLITE_OK ){
105802 4092 0 if( db->xAuth==0 ) return;
105804 0 0 if( iDb<0 ){
105810 0 0 if( pExpr->op==TK_TRIGGER ){
105814 0 0 for(iSrc=0; ALWAYS(iSrcnSrc); iSrc++){
105815 0 0 if( pExpr->iTable==pTabList->a[iSrc].iCursor ){
105822 0 0 if( NEVER(pTab==0) ) return;
105824 0 0 if( iCol>=0 ){
105827 0 0 }else if( pTab->iPKey>=0 ){
105834 0 0 if( SQLITE_IGNORE==sqlite3AuthReadCol(pParse, pTab->zName, zCol, iDb) ){
105859 6811 1704 if( db->init.busy || IN_SPECIAL_PARSE ){
18 6793 if( db->init.busy || IN_SPECIAL_PARSE ){
105863 6789 4 if( db->xAuth==0 ){
105883 2 2 if( rc==SQLITE_DENY ){
105886 0 2 }else if( rc!=SQLITE_OK && rc!=SQLITE_IGNORE ){
0 0 }else if( rc!=SQLITE_OK && rc!=SQLITE_IGNORE ){
105914 0 293 if( pContext->pParse ){
105979 0 4518 Parse *pToplevel = sqlite3ParseToplevel(pParse);
105985 2501 2017 if( iDb==1 ) return;
105986 2017 0 if( !sqlite3BtreeSharable(pParse->db->aDb[iDb].pBt) ) return;
105987 0 0 for(i=0; inTableLock; i++){
105989 0 0 if( p->iDb==iDb && p->iTab==iTab ){
0 0 if( p->iDb==iDb && p->iTab==iTab ){
105990 0 0 p->isWriteLock = (p->isWriteLock || isWriteLock);
0 0 p->isWriteLock = (p->isWriteLock || isWriteLock);
105998 0 0 if( pToplevel->aTableLock ){
106021 0 4397 for(i=0; inTableLock; i++){
106061 278 5422 if( pParse->nested ) return;
106062 5422 0 if( db->mallocFailed || pParse->nErr ){
8 5414 if( db->mallocFailed || pParse->nErr ){
106063 0 8 if( pParse->rc==SQLITE_OK ) pParse->rc = SQLITE_ERROR;
106073 5414 0 if( v ){
106093 5414 0 if( db->mallocFailed==0
106094 1368 4046 && (DbMaskNonZero(pParse->cookieMask) || pParse->pConstExpr)
351 1017 && (DbMaskNonZero(pParse->cookieMask) || pParse->pConstExpr)
106099 8905 4397 for(iDb=0; iDbnDb; iDb++){
106101 4828 4077 if( DbMaskTest(pParse->cookieMask, iDb)==0 ) continue;
106111 3673 404 if( db->init.busy==0 ) sqlite3VdbeChangeP5(v, 1);
106116 17 4397 for(i=0; inVtabLock; i++){
106134 815 3582 if( pParse->pConstExpr ){
106137 1441 815 for(i=0; inExpr; i++){
106150 5414 0 if( v && pParse->nErr==0 && !db->mallocFailed ){
5414 0 if( v && pParse->nErr==0 && !db->mallocFailed ){
5414 0 if( v && pParse->nErr==0 && !db->mallocFailed ){
106153 2 5412 if( pParse->pAinc!=0 && pParse->nTab==0 ) pParse->nTab = 1;
0 2 if( pParse->pAinc!=0 && pParse->nTab==0 ) pParse->nTab = 1;
106180 0 278 if( pParse->nErr ) return;
106185 0 278 if( zSql==0 ){
106234 9257 1566 for(i=OMIT_TEMPDB; inDb; i++){
106235 9166 91 int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */
106236 3992 5265 if( zDatabase==0 || sqlite3StrICmp(zDatabase, db->aDb[j].zDbSName)==0 ){
1980 2012 if( zDatabase==0 || sqlite3StrICmp(zDatabase, db->aDb[j].zDbSName)==0 ){
106239 4244 3001 if( p ) return p;
106244 1329 237 if( sqlite3StrICmp(zName, MASTER_NAME)!=0 ) break;
106245 186 51 if( sqlite3_stricmp(zDatabase, db->aDb[1].zDbSName)!=0 ) break;
106272 4156 0 if( (db->mDbFlags & DBFLAG_SchemaKnownOk)==0
106273 0 4156 && SQLITE_OK!=sqlite3ReadSchema(pParse)
106279 9 4147 if( p==0 ){
106280 0 9 const char *zMsg = flags & LOCATE_VIEW ? "no such view" : "no such table";
106286 9 0 if( pMod==0 && sqlite3_strnicmp(zName, "pragma_", 7)==0 ){
0 9 if( pMod==0 && sqlite3_strnicmp(zName, "pragma_", 7)==0 ){
106289 0 9 if( pMod && sqlite3VtabEponymousTableInit(pParse, pMod) ){
0 0 if( pMod && sqlite3VtabEponymousTableInit(pParse, pMod) ){
106293 7 2 if( (flags & LOCATE_NOERR)==0 ){
106294 0 7 if( zDbase ){
106322 10 4068 if( p->pSchema ){
106348 1825 850 for(i=OMIT_TEMPDB; inDb; i++){
106349 1789 36 int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */
106352 1825 0 if( zDb && sqlite3StrICmp(zDb, db->aDb[j].zDbSName) ) continue;
930 895 if( zDb && sqlite3StrICmp(zDb, db->aDb[j].zDbSName) ) continue;
106355 45 850 if( p ) break;
106370 0 76 if( p->isResized ) sqlite3DbFree(db, (void *)p->azColl);
106390 0 0 if( ALWAYS(pIndex) ){
106391 0 0 if( pIndex->pTable->pIndex==pIndex ){
106398 0 0 while( ALWAYS(p) && p->pNext!=pIndex ){ p = p->pNext; }
0 0 while( ALWAYS(p) && p->pNext!=pIndex ){ p = p->pNext; }
106399 0 0 if( ALWAYS(p && p->pNext==pIndex) ){
0 0 if( ALWAYS(p && p->pNext==pIndex) ){
106418 5 265 for(i=j=2; inDb; i++){
106420 5 0 if( pDb->pBt==0 ){
106425 0 0 if( j
106431 265 0 if( db->nDb<=2 && db->aDb!=db->aDbStatic ){
5 260 if( db->nDb<=2 && db->aDb!=db->aDbStatic ){
106447 0 0 if( iDb>=0 ){
106454 0 0 if( db->nSchemaLock==0 ){
106455 0 0 for(i=0; inDb; i++){
106456 0 0 if( DbHasProperty(db, i, DB_ResetWanted) ){
106470 20 10 for(i=0; inDb; i++){
106472 20 0 if( pDb->pSchema ){
106473 20 0 if( db->nSchemaLock==0 ){
106483 10 0 if( db->nSchemaLock==0 ){
106503 852 20 if( (pCol = pTable->aCol)!=0 ){
106504 2916 852 for(i=0; inCol; i++, pCol++){
106542 71 872 for(pIndex = pTable->pIndex; pIndex; pIndex=pNext){
106546 33 38 if( (db==0 || db->pnBytesFreed==0) && !IsVirtual(pTable) ){
33 0 if( (db==0 || db->pnBytesFreed==0) && !IsVirtual(pTable) ){
71 0 if( (db==0 || db->pnBytesFreed==0) && !IsVirtual(pTable) ){
106583 8463 4928 if( !pTable ) return;
106584 4327 601 if( ((!db || db->pnBytesFreed==0) && (--pTable->nTabRef)>0) ) return;
4321 6 if( ((!db || db->pnBytesFreed==0) && (--pTable->nTabRef)>0) ) return;
4056 866 if( ((!db || db->pnBytesFreed==0) && (--pTable->nTabRef)>0) ) return;
106623 8168 111 if( pName ){
106640 220 5 if( p->nTab==0 ){
106653 261 0 if( zName ){
106655 540 0 for(i=(db->nDb-1), pDb=&db->aDb[i]; i>=0; i--, pDb--){
106656 261 279 if( 0==sqlite3_stricmp(pDb->zDbSName, zName) ) break;
106659 0 279 if( i==0 && 0==sqlite3_stricmp("main", zName) ) break;
0 0 if( i==0 && 0==sqlite3_stricmp("main", zName) ) break;
106706 141 514 if( pName2->n>0 ){
106707 0 141 if( db->init.busy ) {
106713 0 141 if( iDb<0 ){
106748 230 617 if( !pParse->db->init.busy && pParse->nested==0
225 5 if( !pParse->db->init.busy && pParse->nested==0
106749 225 0 && sqlite3WritableSchema(pParse->db)==0
106750 0 225 && 0==sqlite3StrNICmp(zName, "sqlite_", 7) ){
106762 26 29 for(p=pTab->pIndex; p && !IsPrimaryKeyIndex(p); p=p->pNext){}
4 22 for(p=pTab->pIndex; p && !IsPrimaryKeyIndex(p); p=p->pNext){}
106772 238 44 for(i=0; inColumn; i++){
106773 91 147 if( iCol==pIdx->aiColumn[i] ) return i;
106810 612 225 if( db->init.busy && db->init.newTnum==1 ){
367 245 if( db->init.busy && db->init.newTnum==1 ){
106813 181 186 zName = sqlite3DbStrDup(db, SCHEMA_TABLE(iDb));
106818 0 470 if( iDb<0 ) return;
106819 25 445 if( !OMIT_TEMPDB && isTemp && pName2->n>0 && iDb!=1 ){
0 25 if( !OMIT_TEMPDB && isTemp && pName2->n>0 && iDb!=1 ){
0 0 if( !OMIT_TEMPDB && isTemp && pName2->n>0 && iDb!=1 ){
106825 25 445 if( !OMIT_TEMPDB && isTemp ) iDb = 1;
106827 0 470 if( IN_RENAME_OBJECT ){
106832 0 837 if( zName==0 ) return;
106833 0 837 if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){
106836 206 631 if( db->init.iDb==1 ) isTemp = 1;
106848 231 606 if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(isTemp), 0, zDb) ){
0 837 if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(isTemp), 0, zDb) ){
106851 817 20 if( !isVirtual && sqlite3AuthCheck(pParse, (int)aCode[isTemp+2*isView],
0 817 if( !isVirtual && sqlite3AuthCheck(pParse, (int)aCode[isTemp+2*isView],
106865 828 9 if( !IN_SPECIAL_PARSE ){
106867 0 828 if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){
106871 0 828 if( pTable ){
106872 0 0 if( !noErr ){
106880 0 828 if( sqlite3FindIndex(db, zName, zDb)!=0 ){
106887 0 837 if( pTable==0 ){
106910 832 5 if( !pParse->nested && strcmp(zName, "sqlite_sequence")==0 ){
4 828 if( !pParse->nested && strcmp(zName, "sqlite_sequence")==0 ){
106924 225 612 if( !db->init.busy && (v = sqlite3GetVdbe(pParse))!=0 ){
225 0 if( !db->init.busy && (v = sqlite3GetVdbe(pParse))!=0 ){
106933 10 215 if( isVirtual ){
106948 0 225 1 : SQLITE_MAX_FILE_FORMAT;
106963 225 0 if( isView || isVirtual ){
10 215 if( isView || isVirtual ){
107017 0 2770 if( (p = pParse->pNewTable)==0 ) return;
107018 0 2770 if( p->nCol+1>db->aLimit[SQLITE_LIMIT_COLUMN] ){
107023 0 2770 if( z==0 ) return;
107024 0 2770 if( IN_RENAME_OBJECT ) sqlite3RenameTokenMap(pParse, (void*)z, pName);
107028 4469 2770 for(i=0; inCol; i++){
107029 0 4469 if( sqlite3_stricmp(z, p->aCol[i].zName)==0 ){
107035 817 1953 if( (p->nCol & 0x7)==0 ){
107038 0 817 if( aNew==0 ){
107049 282 2488 if( pType->n==0 ){
107081 173 0 if( p==0 || NEVER(p->nCol<1) ) return;
0 173 if( p==0 || NEVER(p->nCol<1) ) return;
107088 0 173 if( pCol->colFlags & COLFLAG_UNIQUE ){
107090 0 0 for(pIdx=p->pIndex; pIdx; pIdx=pIdx->pNext){
107092 0 0 if( pIdx->aiColumn[0]==p->nCol-1 ){
107130 9917 1720 while( zIn[0] ){
107133 120 9797 if( h==(('c'<<24)+('h'<<16)+('a'<<8)+'r') ){ /* CHAR */
107136 0 9797 }else if( h==(('c'<<24)+('l'<<16)+('o'<<8)+'b') ){ /* CLOB */
107138 1514 8283 }else if( h==(('t'<<24)+('e'<<16)+('x'<<8)+'t') ){ /* TEXT */
107140 54 8229 }else if( h==(('b'<<24)+('l'<<16)+('o'<<8)+'b') /* BLOB */
107141 0 54 && (aff==SQLITE_AFF_NUMERIC || aff==SQLITE_AFF_REAL) ){
0 0 && (aff==SQLITE_AFF_NUMERIC || aff==SQLITE_AFF_REAL) ){
107143 0 54 if( zIn[0]=='(' ) zChar = zIn;
107145 0 8229 }else if( h==(('r'<<24)+('e'<<16)+('a'<<8)+'l') /* REAL */
107146 0 0 && aff==SQLITE_AFF_NUMERIC ){
107148 0 8229 }else if( h==(('f'<<24)+('l'<<16)+('o'<<8)+'a') /* FLOA */
107149 0 0 && aff==SQLITE_AFF_NUMERIC ){
107151 0 8229 }else if( h==(('d'<<24)+('o'<<16)+('u'<<8)+'b') /* DOUB */
107152 0 0 && aff==SQLITE_AFF_NUMERIC ){
107155 769 7460 }else if( (h&0x00FFFFFF)==(('i'<<16)+('n'<<8)+'t') ){ /* INT */
107163 2488 1 if( pCol ){
107165 1688 800 if( aff
107166 120 1568 if( zChar ){
107167 269 21 while( zChar[0] ){
107168 99 170 if( sqlite3Isdigit(zChar[0]) ){
107185 0 2488 if( v>255 ) v = 255;
107211 4 0 if( p!=0 ){
107213 0 4 if( !sqlite3ExprIsConstantOrFunction(pExpr, db->init.busy) ){
107231 0 4 if( IN_RENAME_OBJECT ){
107254 0 206 if( p->op==TK_STRING ){
107256 0 206 }else if( p->op==TK_COLLATE && p->pLeft->op==TK_STRING ){
0 0 }else if( p->op==TK_COLLATE && p->pLeft->op==TK_STRING ){
107290 0 189 if( pTab==0 ) goto primary_key_exit;
107291 0 189 if( pTab->tabFlags & TF_HasPrimaryKey ){
107297 151 38 if( pList==0 ){
107304 80 38 for(i=0; i
107308 80 0 if( pCExpr->op==TK_ID ){
107310 150 0 for(iCol=0; iColnCol; iCol++){
107311 80 70 if( sqlite3StrICmp(zCName, pTab->aCol[iCol].zName)==0 ){
107320 161 28 if( nTerm==1
107321 161 0 && pCol
107322 139 22 && sqlite3StrICmp(sqlite3ColumnType(pCol,""), "INTEGER")==0
107323 139 0 && sortOrder!=SQLITE_SO_DESC
107325 0 139 if( IN_RENAME_OBJECT && pList ){
0 0 if( IN_RENAME_OBJECT && pList ){
107332 6 133 if( pList ) pParse->iPkSortOrder = pList->a[0].sortOrder;
107333 0 50 }else if( autoInc ){
107359 0 0 if( pTab && !IN_DECLARE_VTAB
0 0 if( pTab && !IN_DECLARE_VTAB
107360 0 0 && !sqlite3BtreeIsReadonly(db->aDb[db->init.iDb].pBt)
107363 0 0 if( pParse->constraintName.n ){
107383 0 0 if( (p = pParse->pNewTable)==0 ) return;
107387 0 0 if( !zColl ) return;
107389 0 0 if( sqlite3LocateCollSeq(pParse, zColl) ){
107398 0 0 for(pIdx=p->pIndex; pIdx; pIdx=pIdx->pNext){
107400 0 0 if( pIdx->aiColumn[0]==i ){
107436 64 0 if( !initbusy && (!pColl || !pColl->xCmp) ){
64 0 if( !initbusy && (!pColl || !pColl->xCmp) ){
0 64 if( !initbusy && (!pColl || !pColl->xCmp) ){
107481 0 0 for(n=0; *z; n++, z++){
107482 0 0 if( *z=='"' ){ n++; }
107505 0 0 for(j=0; zIdent[j]; j++){
107506 0 0 if( !sqlite3Isalnum(zIdent[j]) && zIdent[j]!='_' ) break;
0 0 if( !sqlite3Isalnum(zIdent[j]) && zIdent[j]!='_' ) break;
107509 0 0 || sqlite3KeywordCode(zIdent, j)!=TK_ID
107510 0 0 || zIdent[j]!=0
107511 0 0 || j==0;
0 0 || j==0;
107513 0 0 if( needQuote ) z[i++] = '"';
107514 0 0 for(j=0; zIdent[j]; j++){
107516 0 0 if( zIdent[j]=='"' ) z[i++] = '"';
107518 0 0 if( needQuote ) z[i++] = '"';
107534 0 0 for(pCol = p->aCol, i=0; inCol; i++, pCol++){
107538 0 0 if( n<50 ){
107549 0 0 if( zStmt==0 ){
107557 0 0 for(pCol=p->aCol, i=0; inCol; i++, pCol++){
107599 0 0 if( pIdx->nColumn>=N ) return SQLITE_OK;
107603 0 0 if( zExtra==0 ) return SQLITE_NOMEM_BKPT;
107624 2770 817 for(i=pTab->nCol, pTabCol=pTab->aCol; i>0; i--, pTabCol++){
107627 678 139 if( pTab->iPKey<0 ) wTable++;
107638 202 76 for(i=0; inColumn; i++){
107641 126 76 wIndex += x<0 ? 1 : aCol[pIdx->aiColumn[i]].szEst;
107649 0 0 while( nCol-- > 0 ) if( x==*(aiCol++) ) return 1;
0 0 while( nCol-- > 0 ) if( x==*(aiCol++) ) return 1;
107666 202 76 for(j=pIdx->nColumn-1; j>=0; j--){
107668 126 76 if( x>=0 ){
107671 126 0 if( x
107712 0 0 if( !db->init.imposterTable ){
107713 0 0 for(i=0; inCol; i++){
107714 0 0 if( (pTab->aCol[i].colFlags & COLFLAG_PRIMKEY)!=0 ){
107723 0 0 if( pParse->addrCrTab ){
107731 0 0 if( pTab->iPKey>=0 ){
107737 0 0 if( pList==0 ) return;
107742 0 0 if( db->mallocFailed || pParse->nErr ) return;
0 0 if( db->mallocFailed || pParse->nErr ) return;
107753 0 0 for(i=j=1; inKeyCol; i++){
107754 0 0 if( hasColumn(pPk->aiColumn, j, pPk->aiColumn[i]) ){
107764 0 0 if( !db->init.imposterTable ) pPk->uniqNotNull = 1;
107771 0 0 if( v && pPk->tnum>0 ){
0 0 if( v && pPk->tnum>0 ){
107782 0 0 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
107784 0 0 if( IsPrimaryKeyIndex(pIdx) ) continue;
107785 0 0 for(i=n=0; i
107786 0 0 if( !hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ) n++;
107788 0 0 if( n==0 ){
107793 0 0 if( resizeIndexObject(db, pIdx, pIdx->nKeyCol+n) ) return;
107794 0 0 for(i=0, j=pIdx->nKeyCol; i
107795 0 0 if( !hasColumn(pIdx->aiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ){
107807 0 0 if( nPknCol ){
107808 0 0 if( resizeIndexObject(db, pPk, pTab->nCol) ) return;
107809 0 0 for(i=0, j=nPk; inCol; i++){
107810 0 0 if( !hasColumn(pPk->aiColumn, j, i) ){
107839 294 523 if( zTail==0 ) return 0;
107843 461 62 if( pTab==0 ) return 0;
107844 0 62 if( !IsVirtual(pTab) ) return 0;
107846 0 62 if( pMod==0 ) return 0;
107847 0 62 if( pMod->pModule->iVersion<3 ) return 0;
107848 0 62 if( pMod->pModule->xShadowName==0 ) return 0;
107887 0 817 if( pEnd==0 && pSelect==0 ){
0 0 if( pEnd==0 && pSelect==0 ){
107892 0 817 if( p==0 ) return;
107894 817 0 if( pSelect==0 && isShadowTableName(db, p->zName) ){
62 755 if( pSelect==0 && isShadowTableName(db, p->zName) ){
107907 602 215 if( db->init.busy ){
107908 0 602 if( pSelect ){
107913 367 235 if( p->tnum==1 ) p->tabFlags |= TF_Readonly;
107917 0 817 if( tabOpts & TF_WithoutRowid ){
107918 0 0 if( (p->tabFlags & TF_Autoincrement) ){
107923 0 0 if( (p->tabFlags & TF_HasPrimaryKey)==0 ){
107936 0 817 if( p->pCheck ){
107943 66 817 for(pIdx=p->pIndex; pIdx; pIdx=pIdx->pNext){
107953 215 602 if( !db->init.busy ){
107961 0 215 if( NEVER(v==0) ) return;
107968 215 0 if( p->pSelect==0 ){
107993 0 215 if( pSelect ){
108012 0 0 if( pParse->nErr ) return;
108014 0 0 if( pSelTab==0 ) return;
108023 0 0 if( pParse->nErr ) return;
108038 0 215 if( pSelect ){
108041 0 215 Token *pEnd2 = tabOpts ? &pParse->sLastToken : pEnd;
108043 215 0 if( pEnd2->z[0]!=';' ) n += pEnd2->n;
108072 5 210 if( (p->tabFlags & TF_Autoincrement)!=0 ){
108075 4 1 if( pDb->pSchema->pSeqTab==0 ){
108092 602 215 if( db->init.busy ){
108097 0 602 if( pOld ){
108106 602 0 if( !p->pSelect ){
108110 579 23 if( pCons->z==0 ){
108143 0 0 if( pParse->nVar>0 ){
108149 0 0 if( p==0 || pParse->nErr ) goto create_view_fail;
0 0 if( p==0 || pParse->nErr ) goto create_view_fail;
108153 0 0 if( sqlite3FixSelect(&sFix, pSelect) ) goto create_view_fail;
108160 0 0 if( IN_RENAME_OBJECT ){
108167 0 0 if( db->mallocFailed ) goto create_view_fail;
108174 0 0 if( sEnd.z[0]!=';' ){
108181 0 0 while( sqlite3Isspace(z[n-1]) ){ n--; }
108190 0 0 if( IN_RENAME_OBJECT ){
108223 0 3037 if( rc ){
108226 60 2977 if( IsVirtual(pTable) ) return 0;
108233 2977 0 if( pTable->nCol>0 ) return 0;
108250 0 0 if( pTable->nCol<0 ){
108265 0 0 if( pSel ){
108283 0 0 if( pTable->pCheck ){
108292 0 0 if( db->mallocFailed==0
108293 0 0 && pParse->nErr==0
108294 0 0 && pTable->nCol==pSel->pEList->nExpr
108298 0 0 }else if( pSelTab ){
108322 0 0 if( db->mallocFailed ){
108339 5 0 if( !DbHasProperty(db, idx, DB_UnresetViews) ) return;
108340 0 0 for(i=sqliteHashFirst(&db->aDb[idx].pSchema->tblHash); i;i=sqliteHashNext(i)){
108342 0 0 if( pTab->pSelect ){
108380 0 0 for(pElem=sqliteHashFirst(pHash); pElem; pElem=sqliteHashNext(pElem)){
108382 0 0 if( pTab->tnum==iFrom ){
108387 0 0 for(pElem=sqliteHashFirst(pHash); pElem; pElem=sqliteHashNext(pElem)){
108389 0 0 if( pIdx->tnum==iFrom ){
108405 0 5 if( iTable<2 ) sqlite3ErrorMsg(pParse, "corrupt schema");
108455 5 5 if( iDestroyed==0 || iTab
0 5 if( iDestroyed==0 || iTab
108458 0 10 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
108461 0 0 if( (iDestroyed==0 || (iIdxiLargest ){
0 0 if( (iDestroyed==0 || (iIdxiLargest ){
0 0 if( (iDestroyed==0 || (iIdxiLargest ){
108465 5 5 if( iLargest==0 ){
108488 20 5 for(i=1; i<=4; i++){
108491 0 20 if( sqlite3FindTable(pParse->db, zTab, zDbName) ){
108514 0 5 if( IsVirtual(pTab) ){
108524 0 5 while( pTrigger ){
108537 0 5 if( pTab->tabFlags & TF_Autoincrement ){
108555 5 0 if( !isView && !IsVirtual(pTab) ){
5 0 if( !isView && !IsVirtual(pTab) ){
108562 0 5 if( IsVirtual(pTab) ){
108580 0 12 if( db->mallocFailed ){
108585 0 12 if( sqlite3ReadSchema(pParse) ) goto exit_drop_table;
108586 1 11 if( noErr ) db->suppressErr++;
108589 1 11 if( noErr ) db->suppressErr--;
108591 7 5 if( pTab==0 ){
108592 1 6 if( noErr ) sqlite3CodeVerifyNamedSchema(pParse, pName->a[0].zDatabase);
108601 0 5 if( IsVirtual(pTab) && sqlite3ViewGetColumnNames(pParse, pTab) ){
0 0 if( IsVirtual(pTab) && sqlite3ViewGetColumnNames(pParse, pTab) ){
108607 0 5 const char *zTab = SCHEMA_TABLE(iDb);
108610 0 5 if( sqlite3AuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb)){
108613 0 5 if( isView ){
108614 0 0 if( !OMIT_TEMPDB && iDb==1 ){
108620 0 5 }else if( IsVirtual(pTab) ){
108625 0 5 if( !OMIT_TEMPDB && iDb==1 ){
108631 0 5 if( sqlite3AuthCheck(pParse, code, pTab->zName, zArg2, zDb) ){
108634 0 5 if( sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0, zDb) ){
108639 0 5 if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0
108640 0 0 && sqlite3StrNICmp(pTab->zName, "sqlite_stat", 11)!=0 ){
108649 0 5 if( isView && pTab->pSelect==0 ){
0 0 if( isView && pTab->pSelect==0 ){
108653 5 0 if( !isView && pTab->pSelect ){
0 5 if( !isView && pTab->pSelect ){
108663 5 0 if( v ){
108665 5 0 if( !isView ){
108710 16 0 if( p==0 || IN_DECLARE_VTAB ) goto fk_end;
16 0 if( p==0 || IN_DECLARE_VTAB ) goto fk_end;
108711 12 4 if( pFromCol==0 ){
108713 0 12 if( NEVER(iCol<0) ) goto fk_end;
108714 12 0 if( pToCol && pToCol->nExpr!=1 ){
0 12 if( pToCol && pToCol->nExpr!=1 ){
108721 4 0 }else if( pToCol && pToCol->nExpr!=pFromCol->nExpr ){
0 4 }else if( pToCol && pToCol->nExpr!=pFromCol->nExpr ){
108730 16 0 if( pToCol ){
108731 18 16 for(i=0; inExpr; i++){
108736 0 16 if( pFKey==0 ){
108743 0 16 if( IN_RENAME_OBJECT ){
108751 12 4 if( pFromCol==0 ){
108754 6 4 for(i=0; i
108756 16 0 for(j=0; jnCol; j++){
108757 6 10 if( sqlite3StrICmp(p->aCol[j].zName, pFromCol->a[i].zName)==0 ){
108762 0 6 if( j>=p->nCol ){
108768 0 6 if( IN_RENAME_OBJECT ){
108773 16 0 if( pToCol ){
108774 18 16 for(i=0; i
108777 0 18 if( IN_RENAME_OBJECT ){
108793 0 16 if( pNextTo==pFKey ){
108797 0 16 if( pNextTo ){
108826 4 0 if( (pTab = pParse->pNewTable)==0 || (pFKey = pTab->pFKey)==0 ) return;
0 4 if( (pTab = pParse->pNewTable)==0 || (pFKey = pTab->pFKey)==0 ) return;
108859 0 5 if( sqlite3AuthCheck(pParse, SQLITE_REINDEX, pIndex->zName, 0,
108869 0 5 if( v==0 ) return;
108870 5 0 if( memRootPage>=0 ){
108895 0 5 if( memRootPage<0 ) sqlite3VdbeAddOp2(v, OP_Clear, tnum, iDb);
108898 5 0 sqlite3VdbeChangeP5(v, OPFLAG_BULKCSR|((memRootPage>=0)?OPFLAG_P2ISREG:0));
108901 2 3 if( IsUniqueIndex(pIndex) ){
108947 77 0 if( p ){
109002 76 0 if( db->mallocFailed || pParse->nErr>0 ){
76 0 if( db->mallocFailed || pParse->nErr>0 ){
109005 0 76 if( IN_DECLARE_VTAB && idxType!=SQLITE_IDXTYPE_PRIMARYKEY ){
0 0 if( IN_DECLARE_VTAB && idxType!=SQLITE_IDXTYPE_PRIMARYKEY ){
109008 0 76 if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){
109015 10 66 if( pTblName!=0 ){
109023 0 10 if( iDb<0 ) goto exit_create_index;
109031 5 5 if( !db->init.busy ){
109033 5 0 if( pName2->n==0 && pTab && pTab->pSchema==db->aDb[1].pSchema ){
5 0 if( pName2->n==0 && pTab && pTab->pSchema==db->aDb[1].pSchema ){
0 5 if( pName2->n==0 && pTab && pTab->pSchema==db->aDb[1].pSchema ){
109047 0 10 if( pTab==0 ) goto exit_create_index;
109048 0 10 if( iDb==1 && db->aDb[iDb].pSchema!=pTab->pSchema ){
0 0 if( iDb==1 && db->aDb[iDb].pSchema!=pTab->pSchema ){
109054 0 10 if( !HasRowid(pTab) ) pPk = sqlite3PrimaryKeyIndex(pTab);
109059 0 66 if( !pTab ) goto exit_create_index;
109066 0 76 if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0
109067 0 0 && db->init.busy==0
109074 0 0 && sqlite3StrNICmp(&pTab->zName[7],"altertab_",9)!=0
109080 0 76 if( pTab->pSelect ){
109086 0 76 if( IsVirtual(pTab) ){
109105 10 66 if( pName ){
109107 0 10 if( zName==0 ) goto exit_create_index;
109109 0 10 if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){
109112 10 0 if( !IN_RENAME_OBJECT ){
109113 5 5 if( !db->init.busy ){
109114 0 5 if( sqlite3FindTable(db, zName, 0)!=0 ){
109119 0 10 if( sqlite3FindIndex(db, zName, pDb->zDbSName)!=0 ){
109120 0 0 if( !ifNotExist ){
109132 2 66 for(pLoop=pTab->pIndex, n=1; pLoop; pLoop=pLoop->pNext, n++){}
109134 0 66 if( zName==0 ){
109143 0 66 if( IN_SPECIAL_PARSE ) zName[7]++;
109149 76 0 if( !IN_RENAME_OBJECT ){
109151 2 74 if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(iDb), 0, zDb) ){
0 76 if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(iDb), 0, zDb) ){
109155 2 74 if( !OMIT_TEMPDB && iDb==1 ) i = SQLITE_CREATE_TEMP_INDEX;
109156 0 76 if( sqlite3AuthCheck(pParse, i, zName, pTab->zName, zDb) ){
109166 26 50 if( pList==0 ){
109173 0 26 if( pList==0 ) goto exit_create_index;
109183 126 76 for(i=0; inExpr; i++){
109186 0 126 if( pExpr->op==TK_COLLATE ){
109195 0 76 nExtraCol = pPk ? pPk->nKeyCol : 1;
109198 0 76 if( db->mallocFailed ){
109212 0 76 if( pPIWhere ){
109221 55 21 if( pDb->pSchema->file_format>=4 ){
109237 0 76 if( IN_RENAME_OBJECT ){
109241 126 76 for(i=0; inKeyCol; i++, pListItem++){
109248 0 126 if( pParse->nErr ) goto exit_create_index;
109250 0 126 if( pCExpr->op!=TK_COLUMN ){
109251 0 0 if( pTab==pParse->pNewTable ){
109256 0 0 if( pIndex->aColExpr==0 ){
109266 0 126 if( j<0 ){
109268 98 28 }else if( pTab->aCol[j].notNull==0 ){
109274 0 126 if( pListItem->pExpr->op==TK_COLLATE ){
109283 126 0 }else if( j>=0 ){
109286 126 0 if( !zColl ) zColl = sqlite3StrBINARY;
109287 63 63 if( !db->init.busy && !sqlite3LocateCollSeq(pParse, zColl) ){
0 63 if( !db->init.busy && !sqlite3LocateCollSeq(pParse, zColl) ){
109299 0 76 if( pPk ){
109300 0 0 for(j=0; jnKeyCol; j++){
109303 0 0 if( hasColumn(pIndex->aiColumn, pIndex->nKeyCol, x) ){
109318 10 66 if( pParse->pNewTable==0 ) estimateIndexWidth(pIndex);
109325 10 66 if( pTblName!=0 && pIndex->nColumn>=pTab->nCol ){
6 4 if( pTblName!=0 && pIndex->nColumn>=pTab->nCol ){
109327 10 2 for(j=0; jnCol; j++){
109328 2 8 if( j==pTab->iPKey ) continue;
109329 4 4 if( sqlite3ColumnOfIndex(pIndex,j)>=0 ) continue;
109335 66 10 if( pTab==pParse->pNewTable ){
109358 2 66 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
109364 0 2 if( pIdx->nKeyCol!=pIndex->nKeyCol ) continue;
109365 2 0 for(k=0; knKeyCol; k++){
109369 2 0 if( pIdx->aiColumn[k]!=pIndex->aiColumn[k] ) break;
109372 0 0 if( sqlite3StrICmp(z1, z2) ) break;
109374 0 2 if( k==pIdx->nKeyCol ){
109375 0 0 if( pIdx->onError!=pIndex->onError ){
109383 0 0 if( !(pIdx->onError==OE_Default || pIndex->onError==OE_Default) ){
0 0 if( !(pIdx->onError==OE_Default || pIndex->onError==OE_Default) ){
109387 0 0 if( pIdx->onError==OE_Default ){
109391 0 0 if( idxType==SQLITE_IDXTYPE_PRIMARYKEY ) pIdx->idxType = idxType;
109397 76 0 if( !IN_RENAME_OBJECT ){
109403 38 38 if( db->init.busy ){
109409 0 38 if( p ){
109415 5 33 if( pTblName!=0 ){
109433 0 38 else if( HasRowid(pTab) || pTblName!=0 ){
0 0 else if( HasRowid(pTab) || pTblName!=0 ){
109439 0 38 if( v==0 ) goto exit_create_index;
109455 5 33 if( pStart ){
109457 3 2 if( pName->z[n-1]==';' ) n--;
109459 3 2 zStmt = sqlite3MPrintf(db, "CREATE%s INDEX %.*s",
109482 5 33 if( pTblName ){
109500 38 38 if( db->init.busy || pTblName==0 ){
33 5 if( db->init.busy || pTblName==0 ){
109501 0 71 if( onError!=OE_Replace || pTab->pIndex==0
0 0 if( onError!=OE_Replace || pTab->pIndex==0
109502 0 0 || pTab->pIndex->onError==OE_Replace){
109507 0 0 while( pOther->pNext && pOther->pNext->onError!=OE_Replace ){
0 0 while( pOther->pNext && pOther->pNext->onError!=OE_Replace ){
109515 0 5 else if( IN_RENAME_OBJECT ){
109523 5 71 if( pIndex ) sqlite3FreeIndex(db, pIndex);
109552 74 2 int nCopy = MIN(ArraySize(aVal), pIdx->nKeyCol);
109562 0 76 if( pIdx->pPartIdxWhere!=0 ) a[0] -= 10; assert( 10==sqlite3LogEst(2) );
109563 0 76 if( a[0]<33 ) a[0] = 33; assert( 33==sqlite3LogEst(10) );
109568 2 76 for(i=nCopy+1; i<=pIdx->nKeyCol; i++){
109573 70 6 if( IsUniqueIndex(pIdx) ) a[pIdx->nKeyCol] = 0;
109587 0 0 if( db->mallocFailed ){
109591 0 0 if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){
109595 0 0 if( pIndex==0 ){
109596 0 0 if( !ifExists ){
109604 0 0 if( pIndex->idxType!=SQLITE_IDXTYPE_APPDEF ){
109615 0 0 const char *zTab = SCHEMA_TABLE(iDb);
109616 0 0 if( sqlite3AuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb) ){
109619 0 0 if( !OMIT_TEMPDB && iDb ) code = SQLITE_DROP_TEMP_INDEX;
109620 0 0 if( sqlite3AuthCheck(pParse, code, pIndex->zName, pTab->zName, zDb) ){
109628 0 0 if( v ){
109670 2544 7 if( (n & (n-1))==0 ){
109671 75 2469 int sz = (n==0) ? 1 : 2*n;
109673 0 2544 if( pNew==0 ){
109695 2281 79 if( pList==0 ){
109697 0 2281 if( pList==0 ) return 0;
109706 0 2360 if( i<0 ){
109711 0 2360 if( IN_RENAME_OBJECT && pList->a[i].zName ){
0 0 if( IN_RENAME_OBJECT && pList->a[i].zName ){
109722 4490 2281 if( pList==0 ) return;
109723 2360 2281 for(i=0; inId; i++){
109736 0 0 if( pList==0 ) return -1;
109737 0 0 for(i=0; inId; i++){
109738 0 0 if( sqlite3StrICmp(pList->a[i].zName, zName)==0 ) return i;
109777 3 0 if( (u32)pSrc->nSrc+nExtra>pSrc->nAlloc ){
109783 0 3 if( pNew==0 ){
109794 0 3 for(i=pSrc->nSrc-1; i>=iStart; i--){
109801 3 3 for(i=iStart; i
109853 4105 3 if( pList==0 ){
109855 0 4105 if( pList==0 ) return 0;
109863 0 4108 if( db->mallocFailed ){
109868 1416 2692 if( pDatabase && pDatabase->z==0 ){
642 774 if( pDatabase && pDatabase->z==0 ){
109871 774 3334 if( pDatabase ){
109888 1609 0 if( pList ){
109889 1156 1596 for(i=0, pItem=pList->a; inSrc; i++, pItem++){
109890 13 1143 if( pItem->iCursor>=0 ) break;
109892 35 1108 if( pItem->pSelect ){
109905 66 7187 if( pList==0 ) return;
109906 4108 7187 for(pItem=pList->a, i=0; inSrc; i++, pItem++){
109910 0 4108 if( pItem->fg.isIndexedBy ) sqlite3DbFree(db, pItem->u1.zIndexedBy);
109911 0 4108 if( pItem->fg.isTabFunc ) sqlite3ExprListDelete(db, pItem->u1.pFuncArg);
109948 1140 3 if( !p && (pOn || pUsing) ){
1140 0 if( !p && (pOn || pUsing) ){
0 1140 if( !p && (pOn || pUsing) ){
109949 0 0 sqlite3ErrorMsg(pParse, "a JOIN clause is required before %s",
109955 0 1143 if( p==0 ){
109962 0 1143 if( IN_RENAME_OBJECT && pItem->zName ){
0 0 if( IN_RENAME_OBJECT && pItem->zName ){
109963 0 0 Token *pToken = (ALWAYS(pDatabase) && pDatabase->z) ? pDatabase : pTable;
0 0 Token *pToken = (ALWAYS(pDatabase) && pDatabase->z) ? pDatabase : pTable;
109967 12 1131 if( pAlias->n ){
109989 1401 0 if( p && pIndexedBy->n>0 ){
0 1401 if( p && pIndexedBy->n>0 ){
109996 0 0 if( pIndexedBy->n==1 && !pIndexedBy->z ){
0 0 if( pIndexedBy->n==1 && !pIndexedBy->z ){
110012 0 0 if( p ){
110040 1140 0 if( p ){
110042 3 1140 for(i=p->nSrc-1; i>0; i--){
110060 0 133 if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, "BEGIN", 0, 0) ){
110064 0 133 if( !v ) return;
110065 96 37 if( type!=TK_DEFERRED ){
110066 192 96 for(i=0; inDb; i++){
110067 12 180 sqlite3VdbeAddOp2(v, OP_Transaction, i, (type==TK_EXCLUSIVE)+1);
110087 28 84 if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION,
0 112 if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION,
110092 112 0 if( v ){
110103 34 0 if( zName ){
110109 34 0 if( !v || sqlite3AuthCheck(pParse, SQLITE_SAVEPOINT, az[op], zName, 0) ){
0 34 if( !v || sqlite3AuthCheck(pParse, SQLITE_SAVEPOINT, az[op], zName, 0) ){
110123 30 2424 if( db->aDb[1].pBt==0 && !pParse->explain ){
30 0 if( db->aDb[1].pBt==0 && !pParse->explain ){
110134 0 30 if( rc!=SQLITE_OK ){
110142 0 30 if( SQLITE_NOMEM==sqlite3BtreeSetPageSize(pBt, db->nextPagesize, -1, 0) ){
110157 0 4666 Parse *pToplevel = sqlite3ParseToplevel(pParse);
110163 4077 589 if( DbMaskTest(pToplevel->cookieMask, iDb)==0 ){
110165 2451 1626 if( !OMIT_TEMPDB && iDb==1 ){
110178 2 1 for(i=0; inDb; i++){
110180 1 1 if( pDb->pBt && (!zDb || 0==sqlite3StrICmp(zDb, pDb->zDbSName)) ){
0 1 if( pDb->pBt && (!zDb || 0==sqlite3StrICmp(zDb, pDb->zDbSName)) ){
0 0 if( pDb->pBt && (!zDb || 0==sqlite3StrICmp(zDb, pDb->zDbSName)) ){
110200 0 3215 Parse *pToplevel = sqlite3ParseToplevel(pParse);
110214 0 39 Parse *pToplevel = sqlite3ParseToplevel(pParse);
110235 0 162 Parse *pToplevel = sqlite3ParseToplevel(pParse);
110254 64 0 if( onError==OE_Abort ){
110275 0 26 if( pIdx->aColExpr ){
110278 37 26 for(j=0; jnKeyCol; j++){
110282 11 26 if( j ) sqlite3_str_append(&errMsg, ", ", 2);
110289 19 7 sqlite3HaltConstraint(pParse,
110306 32 0 if( pTab->iPKey>=0 ){
110326 0 0 for(i=0; inColumn; i++){
110329 0 0 if( pIndex->aiColumn[i]>=0 && 0==sqlite3StrICmp(z, zColl) ){
0 0 if( pIndex->aiColumn[i]>=0 && 0==sqlite3StrICmp(z, zColl) ){
110345 0 0 for(pIndex=pTab->pIndex; pIndex; pIndex=pIndex->pNext){
110346 0 0 if( zColl==0 || collationMatch(zColl, pIndex) ){
0 0 if( zColl==0 || collationMatch(zColl, pIndex) ){
110369 0 0 for(iDb=0, pDb=db->aDb; iDbnDb; iDb++, pDb++){
110371 0 0 for(k=sqliteHashFirst(&pDb->pSchema->tblHash); k; k=sqliteHashNext(k)){
110405 0 0 if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){
110409 0 0 if( pName1==0 ){
110412 0 0 }else if( NEVER(pName2==0) || pName2->z==0 ){
0 0 }else if( NEVER(pName2==0) || pName2->z==0 ){
110416 0 0 if( !zColl ) return;
110418 0 0 if( pColl ){
110426 0 0 if( iDb<0 ) return;
110428 0 0 if( z==0 ) return;
110431 0 0 if( pTab ){
110438 0 0 if( pIndex ){
110458 0 76 if( pParse->nErr ) return 0;
110459 6 70 if( pIdx->uniqNotNull ){
110464 76 0 if( pKey ){
110466 204 76 for(i=0; i
110468 1 203 pKey->aColl[i] = zColl==sqlite3StrBINARY ? 0 :
110472 0 76 if( pParse->nErr ){
110474 0 0 if( pIdx->bNoQuery==0 ){
110511 0 0 if( zName && pWith ){
0 0 if( zName && pWith ){
110513 0 0 for(i=0; inCte; i++){
110514 0 0 if( sqlite3StrICmp(zName, pWith->a[i].zName)==0 ){
110520 0 0 if( pWith ){
110528 0 0 if( db->mallocFailed ){
110548 0 0 if( pWith ){
110550 0 0 for(i=0; inCte; i++){
110587 12 0 if( db->xCollNeeded ){
110589 0 12 if( !zExternal ) return;
110594 0 12 if( db->xCollNeeded16 ){
110599 0 0 if( zExternal ){
110619 0 0 for(i=0; i<3; i++){
110621 0 0 if( pColl2->xCmp!=0 ){
110654 16 0 if( !p ){
110657 4 12 if( !p || !p->xCmp ){
0 4 if( !p || !p->xCmp ){
110664 16 0 if( p && !p->xCmp && synthCollSeq(db, p) ){
0 16 if( p && !p->xCmp && synthCollSeq(db, p) ){
0 0 if( p && !p->xCmp && synthCollSeq(db, p) ){
110668 0 16 if( p==0 ){
110687 1041 549 if( pColl && pColl->xCmp==0 ){
0 1041 if( pColl && pColl->xCmp==0 ){
110691 0 0 if( !p ){
110722 1586 1412 if( 0==pColl && create ){
787 799 if( 0==pColl && create ){
110725 787 0 if( pColl ){
110741 0 787 if( pDel!=0 ){
110773 2998 978 if( zName ){
110780 3177 799 if( pColl ) pColl += enc-1;
110821 0 13950 if( nArg==(-2) ) return (p->xSFunc==0) ? 0 : FUNC_PERFECT_MATCH;
0 0 if( nArg==(-2) ) return (p->xSFunc==0) ? 0 : FUNC_PERFECT_MATCH;
110824 8330 5620 if( p->nArg!=nArg && p->nArg>=0 ) return 0;
8156 174 if( p->nArg!=nArg && p->nArg>=0 ) return 0;
110828 5620 174 if( p->nArg==nArg ){
110835 1794 4000 if( enc==(p->funcFlags & SQLITE_FUNC_ENCMASK) ){
110837 1004 2996 }else if( (enc & p->funcFlags & 2)!=0 ){
110853 53140 18406 for(p=sqlite3BuiltinFunctions.a[h]; p; p=p->u.pHash){
110854 2286 50854 if( sqlite3StrICmp(p->zName, zFunc)==0 ){
110884 8075 380 for(i=0; i
110891 1805 6270 if( pOther ){
110944 13042 26038 while( p ){
110946 3787 9255 if( score>bestScore ){
110965 14906 11132 if( !createFlag && (pBest==0 || (db->mDbFlags & DBFLAG_PreferBuiltin)!=0) ){
2289 12617 if( !createFlag && (pBest==0 || (db->mDbFlags & DBFLAG_PreferBuiltin)!=0) ){
0 2289 if( !createFlag && (pBest==0 || (db->mDbFlags & DBFLAG_PreferBuiltin)!=0) ){
110969 908 12617 while( p ){
110971 509 399 if( score>bestScore ){
110983 11132 14906 if( createFlag && bestScore
11132 0 if( createFlag && bestScore
11132 0 if( createFlag && bestScore
110991 118405 11132 for(z=(u8*)pBest->zName; *z; z++) *z = sqlite3UpperToLower[*z];
110993 0 11132 if( pOther==pBest ){
111002 13902 12136 if( pBest && (pBest->xSFunc || createFlag) ){
11132 2770 if( pBest && (pBest->xSFunc || createFlag) ){
11132 0 if( pBest && (pBest->xSFunc || createFlag) ){
111026 0 523 for(pElem=sqliteHashFirst(&temp2); pElem; pElem=sqliteHashNext(pElem)){
111031 601 523 for(pElem=sqliteHashFirst(&temp1); pElem; pElem=sqliteHashNext(pElem)){
111038 363 160 if( pSchema->schemaFlags & DB_SchemaLoaded ){
111050 256 251 if( pBt ){
111055 0 507 if( !p ){
111057 507 0 }else if ( 0==p->file_format ){
111106 2948 0 if( pTab ){
111109 0 2948 if( sqlite3IndexedByLookup(pParse, pItem) ){
111132 17 2926 if( IsVirtual(pTab) ){
111135 2618 308 if( (pTab->tabFlags & (TF_Readonly|TF_Shadow))==0 ) return 0;
111137 273 35 if( (pTab->tabFlags & TF_Readonly)!=0 ){
111138 273 0 return sqlite3WritableSchema(db)==0 && pParse->nested==0;
0 273 return sqlite3WritableSchema(db)==0 && pParse->nested==0;
111143 0 0 && db->pVtabCtx==0
111145 0 35 && db->nVdbeExec==0;
0 0 && db->nVdbeExec==0;
111154 0 2943 if( tabIsReadOnly(pParse, pTab) ){
111159 2943 0 if( !viewOk && pTab->pSelect ){
0 2943 if( !viewOk && pTab->pSelect ){
111189 0 0 if( pFrom ){
111351 58 0 if( pParse->nErr || db->mallocFailed ){
58 0 if( pParse->nErr || db->mallocFailed ){
111363 0 58 if( pTab==0 ) goto delete_from_cleanup;
111375 58 0 bComplex = pTrigger || sqlite3FkRequired(pParse, pTab, 0, 0);
0 58 bComplex = pTrigger || sqlite3FkRequired(pParse, pTab, 0, 0);
111393 0 58 if( sqlite3ViewGetColumnNames(pParse, pTab) ){
111397 0 58 if( sqlite3IsReadOnly(pParse, pTab, (pTrigger?1:0)) ){
111405 2 56 if( rcauth==SQLITE_DENY ){
111414 8 56 for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){
111420 0 56 if( isView ){
111427 0 56 if( v==0 ){
111430 51 5 if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);
111437 0 56 if( isView ){
111452 0 56 if( sqlite3ResolveExprNames(&sNC, pWhere) ){
111459 0 56 if( (db->flags & SQLITE_CountRows)!=0
111460 0 0 && !pParse->nested
111461 0 0 && !pParse->pTriggerTab
111479 56 0 if( rcauth==SQLITE_OK
111480 28 28 && pWhere==0
111481 28 0 && !bComplex
111482 28 0 && !IsVirtual(pTab)
111489 28 0 if( HasRowid(pTab) ){
111490 0 28 sqlite3VdbeAddOp4(v, OP_Clear, pTab->tnum, iDb, memCnt ? memCnt : -1,
111493 0 28 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
111501 0 28 if( sNC.ncFlags & NC_VarSelect ) bComplex = 1;
111502 0 28 wcf |= (bComplex ? 0 : WHERE_ONEPASS_MULTIROW);
111503 28 0 if( HasRowid(pTab) ){
111531 0 28 if( pWInfo==0 ) goto delete_from_cleanup;
111535 24 4 if( eOnePass!=ONEPASS_SINGLE ) sqlite3MultiWrite(pParse);
111538 0 28 if( memCnt ){
111543 0 28 if( pPk ){
111544 0 0 for(i=0; i
111555 28 0 if( eOnePass!=ONEPASS_OFF ){
111561 0 28 if( aToOpen==0 ){
111567 28 0 if( aiCurOnePass[0]>=0 ) aToOpen[aiCurOnePass[0]-iTabCur] = 0;
111568 8 20 if( aiCurOnePass[1]>=0 ) aToOpen[aiCurOnePass[1]-iTabCur] = 0;
111569 0 28 if( addrEphOpen ) sqlite3VdbeChangeToNoop(v, addrEphOpen);
111571 0 0 if( pPk ){
111587 28 0 if( eOnePass!=ONEPASS_OFF ){
111598 28 0 if( !isView ){
111600 24 4 if( eOnePass==ONEPASS_MULTI ){
111608 24 4 if( eOnePass==ONEPASS_MULTI ) sqlite3VdbeJumpHere(v, iAddrOnce);
111614 28 0 if( eOnePass!=ONEPASS_OFF ){
111616 28 0 if( !IsVirtual(pTab) && aToOpen[iDataCur-iTabCur] ){
0 28 if( !IsVirtual(pTab) && aToOpen[iDataCur-iTabCur] ){
111621 0 0 }else if( pPk ){
111623 0 0 if( IsVirtual(pTab) ){
111637 0 28 if( IsVirtual(pTab) ){
111642 0 0 if( eOnePass==ONEPASS_SINGLE ){
111644 0 0 if( sqlite3IsToplevel(pParse) ){
111659 28 0 if( eOnePass!=ONEPASS_OFF ){
111662 0 0 }else if( pPk ){
111675 51 5 if( pParse->nested==0 && pParse->pTriggerTab==0 ){
51 0 if( pParse->nested==0 && pParse->pTriggerTab==0 ){
111683 0 56 if( memCnt ){
111778 35 0 opSeek = HasRowid(pTab) ? OP_NotExists : OP_NotFound;
111779 7 28 if( eMode==ONEPASS_OFF ){
111787 35 0 if( sqlite3FkRequired(pParse, pTab, 0, 0) || pTrigger ){
0 35 if( sqlite3FkRequired(pParse, pTab, 0, 0) || pTrigger ){
111804 0 0 for(iCol=0; iColnCol; iCol++){
111807 0 0 if( mask==0xffffffff || (iCol<=31 && (mask & MASKBIT32(iCol))!=0) ){
0 0 if( mask==0xffffffff || (iCol<=31 && (mask & MASKBIT32(iCol))!=0) ){
0 0 if( mask==0xffffffff || (iCol<=31 && (mask & MASKBIT32(iCol))!=0) ){
111826 0 0 if( addrStart
111850 35 0 if( pTab->pSelect==0 ){
111854 5 30 if( pParse->nested==0 || 0==sqlite3_stricmp(pTab->zName, "sqlite_stat1") ){
0 5 if( pParse->nested==0 || 0==sqlite3_stricmp(pTab->zName, "sqlite_stat1") ){
111857 28 7 if( eMode!=ONEPASS_OFF ){
111860 15 20 if( iIdxNoSeek>=0 && iIdxNoSeek!=iDataCur ){
15 0 if( iIdxNoSeek>=0 && iIdxNoSeek!=iDataCur ){
111863 24 11 if( eMode==ONEPASS_MULTI ) p5 |= OPFLAG_SAVEPOSITION;
111919 0 270 pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);
111920 15 270 for(i=0, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){
111922 0 15 if( aRegIdx!=0 && aRegIdx[i]==0 ) continue;
0 0 if( aRegIdx!=0 && aRegIdx[i]==0 ) continue;
111923 0 15 if( pIdx==pPk ) continue;
111924 15 0 if( iIdxCur+i==iIdxNoSeek ) continue;
111928 0 0 sqlite3VdbeAddOp3(v, OP_IdxDelete, iIdxCur+i, r1,
111981 5 1 if( piPartIdxLabel ){
111982 0 5 if( pIdx->pPartIdxWhere ){
111992 0 6 nCol = (prefixOnly && pIdx->uniqNotNull) ? pIdx->nKeyCol : pIdx->nColumn;
0 0 nCol = (prefixOnly && pIdx->uniqNotNull) ? pIdx->nKeyCol : pIdx->nColumn;
111994 0 6 if( pPrior && (regBase!=regPrior || pPrior->pPartIdxWhere) ) pPrior = 0;
0 0 if( pPrior && (regBase!=regPrior || pPrior->pPartIdxWhere) ) pPrior = 0;
0 0 if( pPrior && (regBase!=regPrior || pPrior->pPartIdxWhere) ) pPrior = 0;
111995 14 6 for(j=0; j
111996 0 14 if( pPrior
111997 0 0 && pPrior->aiColumn[j]==pIdx->aiColumn[j]
111998 0 0 && pPrior->aiColumn[j]!=XN_EXPR
112012 6 0 if( regOut ){
112014 0 6 if( pIdx->pTable->pSelect ){
112029 0 5 if( iLabel ){
112092 0 0 mask = sqlite3_user_data(context)==0 ? 0 : -1;
112097 0 0 if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
112098 0 0 for(i=1; i
112099 0 0 if( sqlite3_value_type(argv[i])==SQLITE_NULL ) return;
112100 0 0 if( (sqlite3MemCompare(argv[iBest], argv[i], pColl)^mask)>=0 ){
112154 0 13 if( z==0 ) return;
112156 144 13 while( (c = *z)!=0 ){
112158 3 141 if( c>=0xc0 ){
112159 4 3 while( (*z & 0xc0)==0x80 ){ z++; z0++; }
112184 0 0 if( iVal<0 ){
112185 0 0 if( iVal==SMALLEST_INT64 ){
112209 0 0 if( rVal<0 ) rVal = -rVal;
112243 0 0 if( typeHaystack==SQLITE_NULL || typeNeedle==SQLITE_NULL ) return;
0 0 if( typeHaystack==SQLITE_NULL || typeNeedle==SQLITE_NULL ) return;
112246 0 0 if( nNeedle>0 ){
112247 0 0 if( typeHaystack==SQLITE_BLOB && typeNeedle==SQLITE_BLOB ){
0 0 if( typeHaystack==SQLITE_BLOB && typeNeedle==SQLITE_BLOB ){
112256 0 0 if( zNeedle==0 || (nHaystack && zHaystack==0) ) return;
0 0 if( zNeedle==0 || (nHaystack && zHaystack==0) ) return;
0 0 if( zNeedle==0 || (nHaystack && zHaystack==0) ) return;
112257 0 0 while( nNeedle<=nHaystack && memcmp(zHaystack, zNeedle, nNeedle)!=0 ){
0 0 while( nNeedle<=nHaystack && memcmp(zHaystack, zNeedle, nNeedle)!=0 ){
112262 0 0 }while( isText && (zHaystack[0]&0xc0)==0x80 );
0 0 }while( isText && (zHaystack[0]&0xc0)==0x80 );
112264 0 0 if( nNeedle>nHaystack ) N = 0;
112283 0 0 if( argc>=1 && (zFormat = (const char*)sqlite3_value_text(argv[0]))!=0 ){
0 0 if( argc>=1 && (zFormat = (const char*)sqlite3_value_text(argv[0]))!=0 ){
112321 0 0 if( sqlite3_value_type(argv[1])==SQLITE_NULL
112322 0 0 || (argc==3 && sqlite3_value_type(argv[2])==SQLITE_NULL)
0 0 || (argc==3 && sqlite3_value_type(argv[2])==SQLITE_NULL)
112328 0 0 if( p0type==SQLITE_BLOB ){
112331 0 0 if( z==0 ) return;
112335 0 0 if( z==0 ) return;
112337 0 0 if( p1<0 ){
112338 0 0 for(z2=z; *z2; len++){
112339 0 0 SQLITE_SKIP_UTF8(z2);
0 0 SQLITE_SKIP_UTF8(z2);
112351 0 0 if( argc==3 ){
112353 0 0 if( p2<0 ){
112360 0 0 if( p1<0 ){
112362 0 0 if( p1<0 ){
112364 0 0 if( p2<0 ) p2 = 0;
112367 0 0 }else if( p1>0 ){
112369 0 0 }else if( p2>0 ){
112372 0 0 if( negP2 ){
112374 0 0 if( p1<0 ){
112380 0 0 if( p0type!=SQLITE_BLOB ){
112381 0 0 while( *z && p1 ){
0 0 while( *z && p1 ){
112382 0 0 SQLITE_SKIP_UTF8(z);
0 0 SQLITE_SKIP_UTF8(z);
112385 0 0 for(z2=z; *z2 && p2; p2--){
0 0 for(z2=z; *z2 && p2; p2--){
112386 0 0 SQLITE_SKIP_UTF8(z2);
0 0 SQLITE_SKIP_UTF8(z2);
112391 0 0 if( p1+p2>len ){
112393 0 0 if( p2<0 ) p2 = 0;
112408 0 0 if( argc==2 ){
112409 0 0 if( SQLITE_NULL==sqlite3_value_type(argv[1]) ) return;
112411 0 0 if( n>30 ) n = 30;
112412 0 0 if( n<0 ) n = 0;
112414 0 0 if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
112420 0 0 if( n==0 && r>=0 && r
0 0 if( n==0 && r>=0 && r
0 0 if( n==0 && r>=0 && r
112422 0 0 }else if( n==0 && r<0 && (-r)
0 0 }else if( n==0 && r<0 && (-r)
0 0 }else if( n==0 && r<0 && (-r)
112426 0 0 if( zBuf==0 ){
112450 0 20 if( nByte>db->aLimit[SQLITE_LIMIT_LENGTH] ){
112455 0 20 if( !z ){
112474 20 0 if( z2 ){
112476 20 0 if( z1 ){
112477 100 20 for(i=0; i
112493 0 0 if( z2 ){
112495 0 0 if( z1 ){
112496 0 0 for(i=0; i
112525 0 0 if( r<0 ){
112553 0 0 if( n<1 ){
112557 0 0 if( p ){
112701 293 56 while( (c = Utf8Read(zPattern))!=0 ){
286 63 while( (c = Utf8Read(zPattern))!=0 ){
112702 18 268 if( c==matchAll ){ /* Match "*" */
112706 18 0 while( (c=Utf8Read(zPattern)) == matchAll || c == matchOne ){
0 18 while( (c=Utf8Read(zPattern)) == matchAll || c == matchOne ){
0 18 while( (c=Utf8Read(zPattern)) == matchAll || c == matchOne ){
112707 0 0 if( c==matchOne && sqlite3Utf8Read(&zString)==0 ){
0 0 if( c==matchOne && sqlite3Utf8Read(&zString)==0 ){
112711 10 8 if( c==0 ){
112713 0 8 }else if( c==matchOther ){
112714 0 0 if( pInfo->matchSet==0 ){
112716 0 0 if( c==0 ) return SQLITE_NOWILDCARDMATCH;
112721 0 0 while( *zString ){
112723 0 0 if( bMatch!=SQLITE_NOMATCH ) return bMatch;
112724 0 0 SQLITE_SKIP_UTF8(zString);
0 0 SQLITE_SKIP_UTF8(zString);
112739 8 0 if( c<=0x80 ){
112742 8 0 if( noCase ){
112752 3 5 if( zString[0]==0 ) break;
112755 5 0 if( bMatch!=SQLITE_NOMATCH ) return bMatch;
112759 0 0 while( (c2 = Utf8Read(zString))!=0 ){
0 0 while( (c2 = Utf8Read(zString))!=0 ){
112760 0 0 if( c2!=c ) continue;
112762 0 0 if( bMatch!=SQLITE_NOMATCH ) return bMatch;
112767 9 259 if( c==matchOther ){
112768 9 0 if( pInfo->matchSet==0 ){
112770 0 9 if( c==0 ) return SQLITE_NOMATCH;
112777 0 0 if( c==0 ) return SQLITE_NOMATCH;
112779 0 0 if( c2=='^' ){
112783 0 0 if( c2==']' ){
112784 0 0 if( c==']' ) seen = 1;
112787 0 0 while( c2 && c2!=']' ){
0 0 while( c2 && c2!=']' ){
112788 0 0 if( c2=='-' && zPattern[0]!=']' && zPattern[0]!=0 && prior_c>0 ){
0 0 if( c2=='-' && zPattern[0]!=']' && zPattern[0]!=0 && prior_c>0 ){
0 0 if( c2=='-' && zPattern[0]!=']' && zPattern[0]!=0 && prior_c>0 ){
0 0 if( c2=='-' && zPattern[0]!=']' && zPattern[0]!=0 && prior_c>0 ){
112790 0 0 if( c>=prior_c && c<=c2 ) seen = 1;
0 0 if( c>=prior_c && c<=c2 ) seen = 1;
112793 0 0 if( c==c2 ){
112800 0 0 if( c2==0 || (seen ^ invert)==0 ){
0 0 if( c2==0 || (seen ^ invert)==0 ){
112806 240 28 c2 = Utf8Read(zString);
112807 147 121 if( c==c2 ) continue;
112808 121 0 if( noCase && sqlite3Tolower(c)==sqlite3Tolower(c2) && c<0x80 && c2<0x80 ){
52 69 if( noCase && sqlite3Tolower(c)==sqlite3Tolower(c2) && c<0x80 && c2<0x80 ){
52 0 if( noCase && sqlite3Tolower(c)==sqlite3Tolower(c2) && c<0x80 && c2<0x80 ){
52 0 if( noCase && sqlite3Tolower(c)==sqlite3Tolower(c2) && c<0x80 && c2<0x80 ){
112811 3 66 if( c==matchOne && zPattern!=zEscaped && c2!=0 ) continue;
1 2 if( c==matchOne && zPattern!=zEscaped && c2!=0 ) continue;
1 0 if( c==matchOne && zPattern!=zEscaped && c2!=0 ) continue;
112886 0 130 if( nPat > db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH] ){
112892 0 130 if( argc==3 ){
112897 0 0 if( zEsc==0 ) return;
112898 0 0 if( sqlite3Utf8CharLen((char*)zEsc, -1)!=1 ){
112907 130 0 if( zA && zB ){
130 0 if( zA && zB ){
112928 0 0 if( sqlite3MemCompare(argv[0], argv[1], pColl)!=0 ){
112997 0 0 if( (zOptName = (const char*)sqlite3_value_text(argv[0]))!=0 ){
113049 0 0 if( r1!=r2 ){
113065 0 0 if( zText ){
113067 0 0 for(i=0; i
113086 0 0 if( zArg==0 ) return;
113087 0 0 for(i=0, n=0; zArg[i]; i++){ if( zArg[i]=='\'' ) n++; }
0 0 for(i=0, n=0; zArg[i]; i++){ if( zArg[i]=='\'' ) n++; }
113089 0 0 if( z ){
113091 0 0 for(i=0, j=1; zArg[i]; i++){
113093 0 0 if( zArg[i]=='\'' ){
113122 0 0 if( z && z[0] ) sqlite3_result_int(context, sqlite3Utf8Read(&z));
0 0 if( z && z[0] ) sqlite3_result_int(context, sqlite3Utf8Read(&z));
113138 0 0 if( z==0 ){
113142 0 0 for(i=0; i
113146 0 0 if( x<0 || x>0x10ffff ) x = 0xfffd;
0 0 if( x<0 || x>0x10ffff ) x = 0xfffd;
113148 0 0 if( c<0x00080 ){
113150 0 0 }else if( c<0x00800 ){
113153 0 0 }else if( c<0x10000 ){
113185 0 0 if( zHex ){
113186 0 0 for(i=0; i
113209 0 1 if( n<0 ) n = 0;
113211 0 1 if( rc ){
113243 0 0 if( zStr==0 ) return;
113247 0 0 if( zPattern==0 ){
113252 0 0 if( zPattern[0]==0 ){
113260 0 0 if( zRep==0 ) return;
113266 0 0 if( zOut==0 ){
113271 0 0 for(i=j=0; i<=loopLimit; i++){
113272 0 0 if( zStr[i]!=zPattern[0] || memcmp(&zStr[i], zPattern, nPattern) ){
0 0 if( zStr[i]!=zPattern[0] || memcmp(&zStr[i], zPattern, nPattern) ){
113275 0 0 if( nRep>nPattern ){
113279 0 0 if( nOut-1>db->aLimit[SQLITE_LIMIT_LENGTH] ){
113285 0 0 if( (cntExpand&(cntExpand-1))==0 ){
113291 0 0 if( zOut==0 ){
113329 0 0 if( sqlite3_value_type(argv[0])==SQLITE_NULL ){
113333 0 0 if( zIn==0 ) return;
113336 0 0 if( argc==1 ){
113343 0 0 }else if( (zCharSet = sqlite3_value_text(argv[1]))==0 ){
113347 0 0 for(z=zCharSet, nChar=0; *z; nChar++){
113348 0 0 SQLITE_SKIP_UTF8(z);
0 0 SQLITE_SKIP_UTF8(z);
113350 0 0 if( nChar>0 ){
113352 0 0 if( azChar==0 ){
113356 0 0 for(z=zCharSet, nChar=0; *z; nChar++){
113358 0 0 SQLITE_SKIP_UTF8(z);
0 0 SQLITE_SKIP_UTF8(z);
113363 0 0 if( nChar>0 ){
113365 0 0 if( flags & 1 ){
113366 0 0 while( nIn>0 ){
113368 0 0 for(i=0; i
113370 0 0 if( len<=nIn && memcmp(zIn, azChar[i], len)==0 ) break;
0 0 if( len<=nIn && memcmp(zIn, azChar[i], len)==0 ) break;
113372 0 0 if( i>=nChar ) break;
113377 0 0 if( flags & 2 ){
113378 0 0 while( nIn>0 ){
113380 0 0 for(i=0; i
113382 0 0 if( len<=nIn && memcmp(&zIn[nIn-len],azChar[i],len)==0 ) break;
0 0 if( len<=nIn && memcmp(&zIn[nIn-len],azChar[i],len)==0 ) break;
113384 0 0 if( i>=nChar ) break;
113388 0 0 if( zCharSet ){
113489 0 0 if( (db->flags & SQLITE_LoadExtFunc)==0 ){
113494 0 0 if( argc==2 ){
113499 0 0 if( zFile && sqlite3_load_extension(db, zFile, zProc, &zErrMsg) ){
0 0 if( zFile && sqlite3_load_extension(db, zFile, zProc, &zErrMsg) ){
113537 10 0 if( p && type!=SQLITE_NULL ){
10 0 if( p && type!=SQLITE_NULL ){
113539 10 0 if( type==SQLITE_INTEGER ){
113542 10 0 if( (p->approx|p->overflow)==0 && sqlite3AddInt64(&p->iSum, v) ){
0 10 if( (p->approx|p->overflow)==0 && sqlite3AddInt64(&p->iSum, v) ){
113561 0 0 if( ALWAYS(p) && type!=SQLITE_NULL ){
0 0 if( ALWAYS(p) && type!=SQLITE_NULL ){
113565 0 0 if( type==SQLITE_INTEGER && p->approx==0 ){
0 0 if( type==SQLITE_INTEGER && p->approx==0 ){
113580 5 0 if( p && p->cnt>0 ){
5 0 if( p && p->cnt>0 ){
113581 0 5 if( p->overflow ){
113583 0 5 }else if( p->approx ){
113593 0 0 if( p && p->cnt>0 ){
0 0 if( p && p->cnt>0 ){
113601 0 0 sqlite3_result_double(context, p ? p->rSum : (double)0);
113622 247 50 if( (argc==0 || SQLITE_NULL!=sqlite3_value_type(argv[0])) && p ){
247 0 if( (argc==0 || SQLITE_NULL!=sqlite3_value_type(argv[0])) && p ){
297 0 if( (argc==0 || SQLITE_NULL!=sqlite3_value_type(argv[0])) && p ){
113638 33 4 sqlite3_result_int64(context, p ? p->n : 0);
113645 0 0 if( (argc==0 || SQLITE_NULL!=sqlite3_value_type(argv[0])) && ALWAYS(p) ){
0 0 if( (argc==0 || SQLITE_NULL!=sqlite3_value_type(argv[0])) && ALWAYS(p) ){
0 0 if( (argc==0 || SQLITE_NULL!=sqlite3_value_type(argv[0])) && ALWAYS(p) ){
113669 0 17 if( !pBest ) return;
113671 0 17 if( sqlite3_value_type(pArg)==SQLITE_NULL ){
113672 0 0 if( pBest->flags ) sqlite3SkipAccumulatorLoad(context);
113673 0 17 }else if( pBest->flags ){
113687 0 0 if( (max && cmp<0) || (!max && cmp>0) ){
0 0 if( (max && cmp<0) || (!max && cmp>0) ){
0 0 if( (max && cmp<0) || (!max && cmp>0) ){
0 0 if( (max && cmp<0) || (!max && cmp>0) ){
113700 17 31 if( pRes ){
113701 17 0 if( pRes->flags ){
113704 17 0 if( bValue==0 ) sqlite3VdbeMemRelease(pRes);
113731 0 0 if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
113734 0 0 if( pAccum ){
113738 0 0 if( !firstTerm ){
113739 0 0 if( argc==2 ){
113746 0 0 if( zSep ) sqlite3_str_append(pAccum, zSep, nSep);
113750 0 0 if( zVal ) sqlite3_str_append(pAccum, zVal, nVal);
113762 0 0 if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
113766 0 0 if( ALWAYS(pAccum) ){
113768 0 0 if( argc==2 ){
113773 0 0 if( n>=(int)pAccum->nChar ){
113779 0 0 if( pAccum->nChar==0 ) pAccum->mxAlloc = 0;
113788 0 0 if( pAccum ){
113789 0 0 if( pAccum->accError==SQLITE_TOOBIG ){
113791 0 0 }else if( pAccum->accError==SQLITE_NOMEM ){
113803 0 0 if( pAccum ){
113804 0 0 if( pAccum->accError==SQLITE_TOOBIG ){
113806 0 0 }else if( pAccum->accError==SQLITE_NOMEM ){
113826 0 251 if( rc==SQLITE_NOMEM ){
113837 0 0 if( ALWAYS(pDef) ){
113849 0 0 if( caseSensitive ){
113859 0 0 setLikeOptFlag(db, "like",
113883 167 1442 if( pExpr->op!=TK_FUNCTION || !pExpr->x.pList ){
0 167 if( pExpr->op!=TK_FUNCTION || !pExpr->x.pList ){
113889 167 0 if( NEVER(pDef==0) || (pDef->funcFlags & SQLITE_FUNC_LIKE)==0 ){
50 117 if( NEVER(pDef==0) || (pDef->funcFlags & SQLITE_FUNC_LIKE)==0 ){
113892 117 0 if( nExpr<3 ){
113897 0 0 if( pEscape->op!=TK_STRING ) return 0;
113899 0 0 if( zEscape[0]==0 || zEscape[1]!=0 ) return 0;
0 0 if( zEscape[0]==0 || zEscape[1]!=0 ) return 0;
114264 10 0 if( nCol==1 ){
114272 10 0 if( pParent->iPKey>=0 ){
114273 0 10 if( !zKey ) return 0;
114274 10 0 if( !sqlite3StrICmp(pParent->aCol[pParent->iPKey].zName, zKey) ) return 0;
114276 0 0 }else if( paiCol ){
114279 0 0 if( !aiCol ) return 1;
114283 0 0 for(pIdx=pParent->pIndex; pIdx; pIdx=pIdx->pNext){
114284 0 0 if( pIdx->nKeyCol==nCol && IsUniqueIndex(pIdx) && pIdx->pPartIdxWhere==0 ){
0 0 if( pIdx->nKeyCol==nCol && IsUniqueIndex(pIdx) && pIdx->pPartIdxWhere==0 ){
0 0 if( pIdx->nKeyCol==nCol && IsUniqueIndex(pIdx) && pIdx->pPartIdxWhere==0 ){
114289 0 0 if( zKey==0 ){
114293 0 0 if( IsPrimaryKeyIndex(pIdx) ){
114294 0 0 if( aiCol ){
114296 0 0 for(i=0; iaCol[i].iFrom;
114306 0 0 for(i=0; i
114311 0 0 if( iCol<0 ) break; /* No foreign keys against expression indexes */
114317 0 0 if( !zDfltColl ) zDfltColl = sqlite3StrBINARY;
114318 0 0 if( sqlite3StrICmp(pIdx->azColl[i], zDfltColl) ) break;
114321 0 0 for(j=0; j
114322 0 0 if( sqlite3StrICmp(pFKey->aCol[j].zCol, zIdxCol)==0 ){
114323 0 0 if( aiCol ) aiCol[i] = pFKey->aCol[j].iFrom;
114327 0 0 if( j==nCol ) break;
114329 0 0 if( i==nCol ) break; /* pIdx is usable */
114334 0 0 if( !pIdx ){
114335 0 0 if( !pParse->disableTriggers ){
114403 2 8 if( nIncr<0 ){
114407 10 10 for(i=0; inCol; i++){
114412 10 0 if( isIgnore==0 ){
114413 10 0 if( pIdx==0 ){
114432 0 10 if( pTab==pFKey->pFrom && nIncr==1 ){
0 0 if( pTab==pFKey->pFrom && nIncr==1 ){
114450 0 0 for(i=0; i
114464 0 0 if( pTab==pFKey->pFrom && nIncr==1 ){
0 0 if( pTab==pFKey->pFrom && nIncr==1 ){
114466 0 0 for(i=0; i
114471 0 0 if( pIdx->aiColumn[i]==pTab->iPKey ){
114490 10 0 if( !pFKey->isDeferred && !(pParse->db->flags & SQLITE_DeferFKs)
10 0 if( !pFKey->isDeferred && !(pParse->db->flags & SQLITE_DeferFKs)
114491 10 0 && !pParse->pToplevel
114492 6 4 && !pParse->isMultiWrite
114502 2 2 if( nIncr>0 && pFKey->isDeferred==0 ){
2 0 if( nIncr>0 && pFKey->isDeferred==0 ){
114533 0 0 if( pExpr ){
114534 0 0 if( iCol>=0 && iCol!=pTab->iPKey ){
0 0 if( iCol>=0 && iCol!=pTab->iPKey ){
114539 0 0 if( zColl==0 ) zColl = db->pDfltColl->zName;
114560 0 0 if( pExpr ){
114623 0 0 if( nIncr<0 ){
114636 0 0 for(i=0; inCol; i++){
114643 0 0 iCol = pIdx ? pIdx->aiColumn[i] : -1;
114645 0 0 iCol = aiCol ? aiCol[i] : pFKey->aCol[0].iFrom;
114664 0 0 if( pTab==pFKey->pFrom && nIncr>0 ){
0 0 if( pTab==pFKey->pFrom && nIncr>0 ){
114668 0 0 if( HasRowid(pTab) ){
114676 0 0 for(i=0; inKeyCol; i++){
114698 0 0 if( pParse->nErr==0 ){
114701 0 0 if( pWInfo ){
114708 0 0 if( iFkIfZero ){
114740 0 32 if( p ){
114769 0 5 if( (db->flags&SQLITE_ForeignKeys) && !IsVirtual(pTab) ){
0 0 if( (db->flags&SQLITE_ForeignKeys) && !IsVirtual(pTab) ){
114775 0 0 if( sqlite3FkReferences(pTab)==0 ){
114782 0 0 for(p=pTab->pFKey; p; p=p->pNextFrom){
114783 0 0 if( p->isDeferred || (db->flags & SQLITE_DeferFKs) ) break;
0 0 if( p->isDeferred || (db->flags & SQLITE_DeferFKs) ) break;
114785 0 0 if( !p ) return;
114803 0 0 if( (db->flags & SQLITE_DeferFKs)==0 ){
114811 0 0 if( iSkip ){
114837 6 0 for(i=0; inCol; i++){
114839 6 0 if( aChange[iChildKey]>=0 ) return 1;
114840 0 0 if( iChildKey==pTab->iPKey && bChngRowid ) return 1;
0 0 if( iChildKey==pTab->iPKey && bChngRowid ) return 1;
114864 0 0 for(i=0; inCol; i++){
114867 0 0 for(iKey=0; iKeynCol; iKey++){
114868 0 0 if( aChange[iKey]>=0 || (iKey==pTab->iPKey && bChngRowid) ){
0 0 if( aChange[iKey]>=0 || (iKey==pTab->iPKey && bChngRowid) ){
0 0 if( aChange[iKey]>=0 || (iKey==pTab->iPKey && bChngRowid) ){
114870 0 0 if( zKey ){
114871 0 0 if( 0==sqlite3StrICmp(pCol->zName, zKey) ) return 1;
114872 0 0 }else if( pCol->colFlags & COLFLAG_PRIMKEY ){
114887 0 8 Parse *pTop = sqlite3ParseToplevel(pParse);
114888 0 8 if( pTop->pTriggerPrg ){
114890 0 0 if( (p==pFKey->apTrigger[0] && pFKey->aAction[0]==OE_SetNull)
0 0 if( (p==pFKey->apTrigger[0] && pFKey->aAction[0]==OE_SetNull)
114891 0 0 || (p==pFKey->apTrigger[1] && pFKey->aAction[1]==OE_SetNull)
0 0 || (p==pFKey->apTrigger[1] && pFKey->aAction[1]==OE_SetNull)
114937 2606 31 if( (db->flags&SQLITE_ForeignKeys)==0 ) return;
114944 10 31 for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){
114953 4 6 if( aChange
114954 4 0 && sqlite3_stricmp(pTab->zName, pFKey->zTo)!=0
114955 0 4 && fkChildIsModified(pTab, pFKey, aChange, bChngRowid)==0
114964 0 10 if( pParse->disableTriggers ){
114969 10 0 if( !pTo || sqlite3FkLocateIndex(pParse, pTo, pFKey, &pIdx, &aiFree) ){
0 10 if( !pTo || sqlite3FkLocateIndex(pParse, pTo, pFKey, &pIdx, &aiFree) ){
114971 0 0 if( !isIgnoreErrors || db->mallocFailed ) return;
0 0 if( !isIgnoreErrors || db->mallocFailed ) return;
114972 0 0 if( pTo==0 ){
114982 0 0 for(i=0; inCol; i++){
114992 0 10 if( aiFree ){
114998 10 10 for(i=0; inCol; i++){
114999 0 10 if( aiCol[i]==pTab->iPKey ){
115007 0 10 if( db->xAuth ){
115009 0 0 char *zCol = pTo->aCol[pIdx ? pIdx->aiColumn[i] : pTo->iPKey].zName;
115022 2 8 if( regOld!=0 ){
115028 8 2 if( regNew!=0 && !isSetNullAction(pParse, pFKey) ){
8 0 if( regNew!=0 && !isSetNullAction(pParse, pFKey) ){
115045 15 31 for(pFKey = sqlite3FkReferences(pTab); pFKey; pFKey=pFKey->pNextTo){
115050 0 15 if( aChange && fkParentIsModified(pTab, pFKey, aChange, bChngRowid)==0 ){
0 0 if( aChange && fkParentIsModified(pTab, pFKey, aChange, bChngRowid)==0 ){
115054 15 0 if( !pFKey->isDeferred && !(db->flags & SQLITE_DeferFKs)
15 0 if( !pFKey->isDeferred && !(db->flags & SQLITE_DeferFKs)
115055 15 0 && !pParse->pToplevel && !pParse->isMultiWrite
15 0 && !pParse->pToplevel && !pParse->isMultiWrite
115063 0 0 if( sqlite3FkLocateIndex(pParse, pTab, pFKey, &pIdx, &aiCol) ){
115064 0 0 if( !isIgnoreErrors || db->mallocFailed ) return;
0 0 if( !isIgnoreErrors || db->mallocFailed ) return;
115072 0 0 if( pSrc ){
115079 0 0 if( regNew!=0 ){
115082 0 0 if( regOld!=0 ){
115102 0 0 if( !pFKey->isDeferred && eAction!=OE_Cascade && eAction!=OE_SetNull ){
0 0 if( !pFKey->isDeferred && eAction!=OE_Cascade && eAction!=OE_SetNull ){
0 0 if( !pFKey->isDeferred && eAction!=OE_Cascade && eAction!=OE_SetNull ){
115124 2 0 if( pParse->db->flags&SQLITE_ForeignKeys ){
115127 2 2 for(p=pTab->pFKey; p; p=p->pNextFrom){
115128 2 0 for(i=0; inCol; i++) mask |= COLUMN_MASK(p->aCol[i].iFrom);
2 2 for(i=0; inCol; i++) mask |= COLUMN_MASK(p->aCol[i].iFrom);
115130 0 2 for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){
115133 0 0 if( pIdx ){
115134 0 0 for(i=0; inKeyCol; i++){
115136 0 0 mask |= COLUMN_MASK(pIdx->aiColumn[i]);
115174 17 329 if( pParse->db->flags&SQLITE_ForeignKeys ){
115175 0 17 if( !aChange ){
115179 0 0 eRet = (sqlite3FkReferences(pTab) || pTab->pFKey);
0 0 eRet = (sqlite3FkReferences(pTab) || pTab->pFKey);
115186 2 17 for(p=pTab->pFKey; p; p=p->pNextFrom){
115187 0 2 if( 0==sqlite3_stricmp(pTab->zName, p->zTo) ) return 2;
115188 2 0 if( fkChildIsModified(pTab, p, aChange, chngRowid) ){
115194 0 17 for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){
115195 0 0 if( fkParentIsModified(pTab, p, aChange, chngRowid) ){
115196 0 0 if( p->aAction[1]!=OE_None ) return 2;
115246 0 0 if( action==OE_Restrict && (db->flags & SQLITE_DeferFKs) ){
0 0 if( action==OE_Restrict && (db->flags & SQLITE_DeferFKs) ){
115251 0 0 if( action!=OE_None && !pTrigger ){
0 0 if( action!=OE_None && !pTrigger ){
115263 0 0 if( sqlite3FkLocateIndex(pParse, pTab, pFKey, &pIdx, &aiCol) ) return 0;
115266 0 0 for(i=0; inCol; i++){
115274 0 0 iFromCol = aiCol ? aiCol[i] : pFKey->aCol[0].iFrom;
115279 0 0 pTab->aCol[pIdx ? pIdx->aiColumn[i] : pTab->iPKey].zName);
115299 0 0 if( pChanges ){
115311 0 0 if( action!=OE_Restrict && (action!=OE_Cascade || pChanges) ){
0 0 if( action!=OE_Restrict && (action!=OE_Cascade || pChanges) ){
0 0 if( action!=OE_Restrict && (action!=OE_Cascade || pChanges) ){
115313 0 0 if( action==OE_Cascade ){
115317 0 0 }else if( action==OE_SetDflt ){
115319 0 0 if( pDflt ){
115336 0 0 if( action==OE_Restrict ){
115343 0 0 if( pRaise ){
115363 0 0 if( pTrigger ){
115371 0 0 if( pWhen ){
115384 0 0 if( db->mallocFailed==1 ){
115395 0 0 if( !pChanges ){
115406 0 0 pTrigger->op = (pChanges ? TK_UPDATE : TK_DELETE);
115428 2 35 if( pParse->db->flags&SQLITE_ForeignKeys ){
115430 0 2 for(pFKey = sqlite3FkReferences(pTab); pFKey; pFKey=pFKey->pNextTo){
115431 0 0 if( aChange==0 || fkParentIsModified(pTab, pFKey, aChange, bChngRowid) ){
0 0 if( aChange==0 || fkParentIsModified(pTab, pFKey, aChange, bChngRowid) ){
115433 0 0 if( pAct ){
115454 16 872 for(pFKey=pTab->pFKey; pFKey; pFKey=pNext){
115457 8 8 if( !db || db->pnBytesFreed==0 ){
8 0 if( !db || db->pnBytesFreed==0 ){
115458 0 16 if( pFKey->pPrevTo ){
115462 0 16 const char *z = (p ? pFKey->pNextTo->zTo : pFKey->zTo);
115465 0 16 if( pFKey->pNextTo ){
115527 3972 0 if( HasRowid(pTab) ){
115561 15 24 if( !pIdx->zColAff ){
115573 0 15 if( !pIdx->zColAff ){
115577 43 15 for(n=0; nnColumn; n++){
115579 28 15 if( x>=0 ){
115581 15 0 }else if( x==XN_ROWID ){
115588 0 0 if( aff==0 ) aff = SQLITE_AFF_BLOB;
115621 297 2571 if( zColAff==0 ){
115624 0 297 if( !zColAff ){
115629 1062 297 for(i=0; inCol; i++){
115634 363 49 }while( i>=0 && zColAff[i]==SQLITE_AFF_BLOB );
115 248 }while( i>=0 && zColAff[i]==SQLITE_AFF_BLOB );
115639 457 2411 if( i ){
115640 19 438 if( iReg ){
115659 0 2 VTable *pVTab = IsVirtual(pTab) ? sqlite3GetVTable(p->db, pTab) : 0;
115662 34 2 for(i=1; i
115665 0 34 if( pOp->opcode==OP_OpenRead && pOp->p3==iDb ){
0 0 if( pOp->opcode==OP_OpenRead && pOp->p3==iDb ){
115668 0 0 if( tnum==pTab->tnum ){
115671 0 0 for(pIndex=pTab->pIndex; pIndex; pIndex=pIndex->pNext){
115672 0 0 if( tnum==pIndex->tnum ){
115678 0 34 if( pOp->opcode==OP_VOpen && pOp->p4.pVtab==pVTab ){
0 0 if( pOp->opcode==OP_VOpen && pOp->p4.pVtab==pVTab ){
115719 2 2648 if( (pTab->tabFlags & TF_Autoincrement)!=0
115720 2 0 && (pParse->db->mDbFlags & DBFLAG_Vacuum)==0
115722 0 2 Parse *pToplevel = sqlite3ParseToplevel(pParse);
115729 2 0 if( pSeqTab==0
115730 2 0 || !HasRowid(pSeqTab)
115731 2 0 || IsVirtual(pSeqTab)
115732 0 2 || pSeqTab->nCol!=2
115740 0 2 while( pInfo && pInfo->pTab!=pTab ){ pInfo = pInfo->pNext; }
0 0 while( pInfo && pInfo->pTab!=pTab ){ pInfo = pInfo->pNext; }
115741 2 0 if( pInfo==0 ){
115743 0 2 if( pInfo==0 ) return 0;
115774 2 4397 for(p = pParse->pAinc; p; p = p->pNext){
115797 0 2 if( aOp==0 ) break;
115822 2 2648 if( memId>0 ){
115840 2 2 for(p = pParse->pAinc; p; p = p->pNext){
115860 0 2 if( aOp==0 ) break;
115872 2 2666 if( pParse->pAinc ) autoIncrementEnd(pParse);
116036 2650 0 if( pParse->nErr || db->mallocFailed ){
2650 0 if( pParse->nErr || db->mallocFailed ){
116045 2650 0 if( pSelect && (pSelect->selFlags & SF_Values)!=0 && pSelect->pPrior==0 ){
2650 0 if( pSelect && (pSelect->selFlags & SF_Values)!=0 && pSelect->pPrior==0 ){
2648 2 if( pSelect && (pSelect->selFlags & SF_Values)!=0 && pSelect->pPrior==0 ){
116056 0 2650 if( pTab==0 ){
116061 0 2650 if( sqlite3AuthCheck(pParse, SQLITE_INSERT, pTab->zName, 0,
116087 0 2650 if( sqlite3ViewGetColumnNames(pParse, pTab) ){
116093 0 2650 if( sqlite3IsReadOnly(pParse, pTab, tmask) ){
116100 0 2650 if( v==0 ) goto insert_cleanup;
116101 2612 38 if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);
116102 2648 2 sqlite3BeginWriteOperation(pParse, pSelect || pTrigger, iDb);
0 2648 sqlite3BeginWriteOperation(pParse, pSelect || pTrigger, iDb);
116114 369 2281 if( pColumn==0 && xferOptimization(pParse, pTab, pSelect, onError, iDb) ){
0 369 if( pColumn==0 && xferOptimization(pParse, pTab, pSelect, onError, iDb) ){
116131 17 2633 if( IsVirtual(pTab) ){
116149 2281 369 if( pColumn ){
116150 2360 2281 for(i=0; inId; i++){
116153 2360 2281 for(i=0; inId; i++){
116154 2515 0 for(j=0; jnCol; j++){
116155 2360 155 if( sqlite3StrICmp(pColumn->a[i].zName, pTab->aCol[j].zName)==0 ){
116157 47 2313 if( i!=j ) bIdListInOrder = 0;
116158 14 2346 if( j==pTab->iPKey ){
116164 0 2360 if( j>=pTab->nCol ){
116165 0 0 if( sqlite3IsRowid(pColumn->a[i].zName) && !withoutRowid ){
0 0 if( sqlite3IsRowid(pColumn->a[i].zName) && !withoutRowid ){
116183 2 2648 if( pSelect ){
116194 2 0 dest.iSdst = bIdListInOrder ? regData : 0;
116198 2 0 if( rc || db->mallocFailed || pParse->nErr ) goto insert_cleanup;
2 0 if( rc || db->mallocFailed || pParse->nErr ) goto insert_cleanup;
2 0 if( rc || db->mallocFailed || pParse->nErr ) goto insert_cleanup;
116213 2 0 if( pTrigger || readsTable(pParse, iDb, pTab) ){
0 2 if( pTrigger || readsTable(pParse, iDb, pTab) ){
116217 0 2 if( useTempTable ){
116254 2648 0 if( pList ){
116256 0 2648 if( sqlite3ResolveExprListNames(&sNC, pList) ){
116268 369 2281 if( pColumn==0 && nColumn>0 ){
369 0 if( pColumn==0 && nColumn>0 ){
116275 3135 2650 for(i=0; inCol; i++){
116278 369 2281 if( pColumn==0 && nColumn && nColumn!=(pTab->nCol-nHidden) ){
369 0 if( pColumn==0 && nColumn && nColumn!=(pTab->nCol-nHidden) ){
0 369 if( pColumn==0 && nColumn && nColumn!=(pTab->nCol-nHidden) ){
116284 2281 369 if( pColumn!=0 && nColumn!=pColumn->nId ){
0 2281 if( pColumn!=0 && nColumn!=pColumn->nId ){
116291 0 2650 if( (db->flags & SQLITE_CountRows)!=0
116292 0 0 && !pParse->nested
116293 0 0 && !pParse->pTriggerTab
116300 2650 0 if( !isView ){
116305 0 2650 if( aRegIdx==0 ){
116308 32 2650 for(i=0, pIdx=pTab->pIndex; ipNext, i++){
116315 0 2650 if( pUpsert ){
116321 0 0 if( pUpsert->pUpsertTarget ){
116329 0 2650 if( useTempTable ){
116341 2 2648 }else if( pSelect ){
116357 0 2650 if( tmask & TRIGGER_BEFORE ){
116366 0 0 if( ipkColumn<0 ){
116371 0 0 if( useTempTable ){
116390 0 0 for(i=j=0; inCol; i++){
116391 0 0 if( pColumn ){
116392 0 0 for(j=0; jnId; j++){
116393 0 0 if( pColumn->a[j].idx==i ) break;
116396 0 0 if( (!useTempTable && !pList) || (pColumn && j>=pColumn->nId)
0 0 if( (!useTempTable && !pList) || (pColumn && j>=pColumn->nId)
0 0 if( (!useTempTable && !pList) || (pColumn && j>=pColumn->nId)
116397 0 0 || (pColumn==0 && IsOrdinaryHiddenColumn(&pTab->aCol[i])) ){
116399 0 0 }else if( useTempTable ){
116405 0 0 if( pColumn==0 && !IsOrdinaryHiddenColumn(&pTab->aCol[i]) ) j++;
116413 0 0 if( !isView ){
116427 2650 0 if( !isView ){
116428 17 2633 if( IsVirtual(pTab) ){
116432 43 2607 if( ipkColumn>=0 ){
116433 0 43 if( useTempTable ){
116435 2 41 }else if( pSelect ){
116442 0 41 if( pOp->opcode==OP_Null && !IsVirtual(pTab) ){
0 0 if( pOp->opcode==OP_Null && !IsVirtual(pTab) ){
116453 43 0 if( !appendFlag ){
116455 43 0 if( !IsVirtual(pTab) ){
116465 2590 17 }else if( IsVirtual(pTab) || withoutRowid ){
0 2590 }else if( IsVirtual(pTab) || withoutRowid ){
116477 3135 2650 for(i=0; inCol; i++){
116479 59 3076 if( i==pTab->iPKey ){
116488 679 2397 if( pColumn==0 ){
116489 0 679 if( IsHiddenColumn(&pTab->aCol[i]) ){
116496 2561 51 for(j=0; jnId; j++){
116497 2346 215 if( pColumn->a[j].idx==i ) break;
116500 3076 0 if( j<0 || nColumn==0 || (pColumn && j>=pColumn->nId) ){
3076 0 if( j<0 || nColumn==0 || (pColumn && j>=pColumn->nId) ){
2397 679 if( j<0 || nColumn==0 || (pColumn && j>=pColumn->nId) ){
51 2346 if( j<0 || nColumn==0 || (pColumn && j>=pColumn->nId) ){
116502 0 3025 }else if( useTempTable ){
116504 2 3023 }else if( pSelect ){
116505 0 2 if( regFromSelect!=regData ){
116517 17 2633 if( IsVirtual(pTab) ){
116521 4 13 sqlite3VdbeChangeP5(v, onError==OE_Default ? OE_Abort : onError);
116541 18 2615 bUseSeek = (isReplace==0 || (pTrigger==0 &&
18 0 bUseSeek = (isReplace==0 || (pTrigger==0 &&
0 18 bUseSeek = (isReplace==0 || (pTrigger==0 &&
116542 0 0 ((db->flags & SQLITE_ForeignKeys)==0 || sqlite3FkReferences(pTab)==0)
116552 0 2650 if( regRowCount ){
116556 0 2650 if( pTrigger ){
116566 0 2650 if( useTempTable ){
116570 2 2648 }else if( pSelect ){
116580 2612 38 if( pParse->nested==0 && pParse->pTriggerTab==0 ){
2612 0 if( pParse->nested==0 && pParse->pTriggerTab==0 ){
116589 0 2650 if( regRowCount ){
116630 0 0 if( pExpr->op==TK_COLUMN ){
116632 0 0 if( pExpr->iColumn>=0 ){
116633 0 0 if( pWalker->u.aiCol[pExpr->iColumn]>=0 ){
116669 0 0 if( !chngRowid ){
116808 2868 0 if( HasRowid(pTab) ){
116822 4216 2868 for(i=0; i
116823 61 4155 if( i==pTab->iPKey ){
116826 1160 2995 if( aiChng && aiChng[i]<0 ){
25 1135 if( aiChng && aiChng[i]<0 ){
116831 4056 74 if( onError==OE_None ) continue; /* This column is allowed to be NULL */
116832 0 74 if( overrideError!=OE_Default ){
116834 74 0 }else if( onError==OE_Default ){
116837 0 74 if( onError==OE_Replace && pTab->aCol[i].pDflt==0 ){
0 0 if( onError==OE_Replace && pTab->aCol[i].pDflt==0 ){
116876 0 2868 if( pTab->pCheck && (db->flags & SQLITE_IgnoreChecks)==0 ){
0 0 if( pTab->pCheck && (db->flags & SQLITE_IgnoreChecks)==0 ){
116879 0 0 onError = overrideError!=OE_Default ? overrideError : OE_Abort;
116880 0 0 for(i=0; inExpr; i++){
116883 0 0 if( aiChng
116884 0 0 && !sqlite3ExprReferencesUpdatedColumn(pExpr, aiChng, pkChng)
116893 0 0 if( onError==OE_Ignore ){
116897 0 0 if( zName==0 ) zName = pTab->zName;
116898 0 0 if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-15569-63625 */
116938 0 2868 if( pUpsert ){
116939 0 0 if( pUpsert->pUpsertTarget==0 ){
116945 0 0 }else if( (pUpIdx = pUpsert->pUpsertIdx)!=0 ){
116956 43 2825 if( pkChng && pPk==0 ){
43 0 if( pkChng && pPk==0 ){
116961 11 32 if( overrideError!=OE_Default ){
116963 32 0 }else if( onError==OE_Default ){
116968 0 43 if( pUpsert && pUpsert->pUpsertIdx==0 ){
0 0 if( pUpsert && pUpsert->pUpsertIdx==0 ){
116969 0 0 if( pUpsert->pUpsertSet==0 ){
116981 11 32 if( onError==OE_Replace /* IPK rule is REPLACE */
116982 0 11 && onError!=overrideError /* Rules for other contraints are different */
116983 0 0 && pTab->pIndex /* There exist other constraints */
116989 0 43 if( isUpdate ){
117043 0 11 if( db->flags&SQLITE_RecTriggers ){
117046 11 0 if( pTrigger || sqlite3FkRequired(pParse, pTab, 0, 0) ){
0 11 if( pTrigger || sqlite3FkRequired(pParse, pTab, 0, 0) ){
117060 0 11 if( pTab->pIndex ){
117081 0 43 if( ipkTop ){
117094 32 2868 for(ix=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, ix++){
117100 0 32 if( aRegIdx[ix]==0 ) continue; /* Skip indices that do not change */
117101 0 32 if( pUpIdx==pIdx ){
117109 32 0 if( bAffinityDone==0 && (pUpIdx==0 || pUpIdx==pIdx) ){
0 32 if( bAffinityDone==0 && (pUpIdx==0 || pUpIdx==pIdx) ){
0 0 if( bAffinityDone==0 && (pUpIdx==0 || pUpIdx==pIdx) ){
117118 0 32 if( pIdx->pPartIdxWhere ){
117130 81 32 for(i=0; inColumn; i++){
117133 0 81 if( iField==XN_EXPR ){
117139 49 32 if( iField==XN_ROWID || iField==pTab->iPKey ){
0 49 if( iField==XN_ROWID || iField==pTab->iPKey ){
117144 32 49 sqlite3VdbeAddOp2(v, iField<0 ? OP_IntCopy : OP_SCopy, x, regIdx+i);
117158 0 32 if( isUpdate && pPk==pIdx && pkChng==0 ){
0 0 if( isUpdate && pPk==pIdx && pkChng==0 ){
0 0 if( isUpdate && pPk==pIdx && pkChng==0 ){
117165 1 31 if( onError==OE_None ){
117169 7 24 if( overrideError!=OE_Default ){
117171 23 1 }else if( onError==OE_Default ){
117176 0 31 if( pUpIdx==pIdx ){
117177 0 0 if( pUpsert->pUpsertSet==0 ){
117191 31 0 if( (ix==0 && pIdx->pNext==0) /* Condition 3 */
31 0 if( (ix==0 && pIdx->pNext==0) /* Condition 3 */
117192 0 31 && pPk==pIdx /* Condition 2 */
117193 0 0 && onError==OE_Replace /* Condition 1 */
117196 0 0 && ( 0==(db->flags&SQLITE_ForeignKeys) || /* Condition 5 */
0 0 && ( 0==(db->flags&SQLITE_ForeignKeys) || /* Condition 5 */
117197 0 0 (0==pTab->pFKey && 0==sqlite3FkReferences(pTab)))
117209 31 0 regR = (pIdx==pPk) ? regIdx : sqlite3GetTempRange(pParse, nPkField);
117210 31 0 if( isUpdate || onError==OE_Replace ){
7 24 if( isUpdate || onError==OE_Replace ){
117211 7 0 if( HasRowid(pTab) ){
117215 0 7 if( isUpdate ){
117224 0 0 if( pIdx!=pPk ){
117225 0 0 for(i=0; inKeyCol; i++){
117233 0 0 if( isUpdate ){
117243 0 0 int regCmp = (IsPrimaryKeyIndex(pIdx) ? regIdx : regR);
117245 0 0 for(i=0; inKeyCol; i++){
117249 0 0 if( i==(pPk->nKeyCol-1) ){
117291 0 7 if( db->flags&SQLITE_RecTriggers ){
117294 7 0 if( pTrigger || sqlite3FkRequired(pParse, pTab, 0, 0) ){
0 7 if( pTrigger || sqlite3FkRequired(pParse, pTab, 0, 0) ){
117304 0 31 if( pUpIdx==pIdx ){
117310 31 0 if( regR!=regIdx ) sqlite3ReleaseTempRange(pParse, regR, nPkField);
117314 0 2868 if( ipkTop ){
117382 32 2868 for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
117383 0 32 if( aRegIdx[i]==0 ) continue;
117385 0 32 if( pIdx->pPartIdxWhere ){
117389 32 0 pik_flags = (useSeekResult ? OPFLAG_USESEEKRESULT : 0);
117390 26 6 if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){
0 26 if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){
117403 4 28 sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i],
117408 0 2868 if( !HasRowid(pTab) ) return;
117413 2836 32 if( !bAffinityDone ){
117416 268 2600 if( pParse->nested ){
117420 5 2595 pik_flags |= (update_flags?update_flags:OPFLAG_LASTROWID);
117422 2590 278 if( appendBias ){
117425 2633 235 if( useSeekResult ){
117429 2600 268 if( !pParse->nested ){
117474 17 2896 if( IsVirtual(pTab) ){
117483 2633 263 if( iBase<0 ) iBase = pParse->nTab;
117485 2661 235 if( piDataCur ) *piDataCur = iDataCur;
117486 2896 0 if( HasRowid(pTab) && (aToOpen==0 || aToOpen[0]) ){
263 2633 if( HasRowid(pTab) && (aToOpen==0 || aToOpen[0]) ){
7 256 if( HasRowid(pTab) && (aToOpen==0 || aToOpen[0]) ){
117491 2661 235 if( piIdxCur ) *piIdxCur = iBase;
117492 40 2896 for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
117495 34 6 if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){
0 34 if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){
117496 0 0 if( piDataCur ) *piDataCur = iIdxCur;
117499 8 32 if( aToOpen==0 || aToOpen[i+1] ){
0 8 if( aToOpen==0 || aToOpen[i+1] ){
117506 2633 263 if( iBase>pParse->nTab ) pParse->nTab = iBase;
117538 0 0 if( pDest->nKeyCol!=pSrc->nKeyCol ){
117541 0 0 if( pDest->onError!=pSrc->onError ){
117544 0 0 for(i=0; inKeyCol; i++){
117545 0 0 if( pSrc->aiColumn[i]!=pDest->aiColumn[i] ){
117548 0 0 if( pSrc->aiColumn[i]==XN_EXPR ){
117550 0 0 if( sqlite3ExprCompare(0, pSrc->aColExpr->a[i].pExpr,
117555 0 0 if( pSrc->aSortOrder[i]!=pDest->aSortOrder[i] ){
117558 0 0 if( sqlite3_stricmp(pSrc->azColl[i],pDest->azColl[i])!=0 ){
117562 0 0 if( sqlite3ExprCompare(0, pSrc->pPartIdxWhere, pDest->pPartIdxWhere, -1) ){
117618 369 0 if( pSelect==0 ){
117621 0 0 if( pParse->pWith || pSelect->pWith ){
0 0 if( pParse->pWith || pSelect->pWith ){
117627 0 0 if( sqlite3TriggerList(pParse, pDest) ){
117631 0 0 if( IsVirtual(pDest) ){
117635 0 0 if( onError==OE_Default ){
117636 0 0 if( pDest->iPKey>=0 ) onError = pDest->keyConf;
117637 0 0 if( onError==OE_Default ) onError = OE_Abort;
117640 0 0 if( pSelect->pSrc->nSrc!=1 ){
117643 0 0 if( pSelect->pSrc->a[0].pSelect ){
117646 0 0 if( pSelect->pWhere ){
117649 0 0 if( pSelect->pOrderBy ){
117654 0 0 if( pSelect->pGroupBy ){
117657 0 0 if( pSelect->pLimit ){
117660 0 0 if( pSelect->pPrior ){
117663 0 0 if( pSelect->selFlags & SF_Distinct ){
117668 0 0 if( pEList->nExpr!=1 ){
117672 0 0 if( pEList->a[0].pExpr->op!=TK_ASTERISK ){
117682 0 0 if( pSrc==0 ){
117685 0 0 if( pSrc==pDest ){
117688 0 0 if( HasRowid(pDest)!=HasRowid(pSrc) ){
117692 0 0 if( IsVirtual(pSrc) ){
117696 0 0 if( pSrc->pSelect ){
117699 0 0 if( pDest->nCol!=pSrc->nCol ){
117702 0 0 if( pDest->iPKey!=pSrc->iPKey ){
117705 0 0 for(i=0; inCol; i++){
117715 0 0 if( pDestCol->affinity!=pSrcCol->affinity ){
117718 0 0 if( sqlite3_stricmp(pDestCol->zColl, pSrcCol->zColl)!=0 ){
117721 0 0 if( pDestCol->notNull && !pSrcCol->notNull ){
0 0 if( pDestCol->notNull && !pSrcCol->notNull ){
117725 0 0 if( i>0 ){
117728 0 0 if( (pDestCol->pDflt==0)!=(pSrcCol->pDflt==0)
117729 0 0 || (pDestCol->pDflt && strcmp(pDestCol->pDflt->u.zToken,
0 0 || (pDestCol->pDflt && strcmp(pDestCol->pDflt->u.zToken,
117736 0 0 for(pDestIdx=pDest->pIndex; pDestIdx; pDestIdx=pDestIdx->pNext){
117737 0 0 if( IsUniqueIndex(pDestIdx) ){
117740 0 0 for(pSrcIdx=pSrc->pIndex; pSrcIdx; pSrcIdx=pSrcIdx->pNext){
117741 0 0 if( xferCompatibleIndex(pDestIdx, pSrcIdx) ) break;
117743 0 0 if( pSrcIdx==0 ){
117748 0 0 if( pDest->pCheck && sqlite3ExprListCompare(pSrc->pCheck,pDest->pCheck,-1) ){
0 0 if( pDest->pCheck && sqlite3ExprListCompare(pSrc->pCheck,pDest->pCheck,-1) ){
117760 0 0 if( (db->flags & SQLITE_ForeignKeys)!=0 && pDest->pFKey!=0 ){
0 0 if( (db->flags & SQLITE_ForeignKeys)!=0 && pDest->pFKey!=0 ){
117764 0 0 if( (db->flags & SQLITE_CountRows)!=0 ){
117785 0 0 if( (db->mDbFlags & DBFLAG_Vacuum)==0 && (
0 0 if( (db->mDbFlags & DBFLAG_Vacuum)==0 && (
117786 0 0 (pDest->iPKey<0 && pDest->pIndex!=0) /* (1) */
117787 0 0 || destHasUniqueIdx /* (2) */
117788 0 0 || (onError!=OE_Abort && onError!=OE_Rollback) /* (3) */
0 0 || (onError!=OE_Abort && onError!=OE_Rollback) /* (3) */
117811 0 0 if( HasRowid(pSrc) ){
117815 0 0 if( pDest->iPKey>=0 ){
117823 0 0 }else if( pDest->pIndex==0 ){
117830 0 0 if( db->mDbFlags & DBFLAG_Vacuum ){
117847 0 0 for(pDestIdx=pDest->pIndex; pDestIdx; pDestIdx=pDestIdx->pNext){
117849 0 0 for(pSrcIdx=pSrc->pIndex; ALWAYS(pSrcIdx); pSrcIdx=pSrcIdx->pNext){
117850 0 0 if( xferCompatibleIndex(pDestIdx, pSrcIdx) ) break;
117862 0 0 if( db->mDbFlags & DBFLAG_Vacuum ){
117877 0 0 for(i=0; inColumn; i++){
117879 0 0 if( sqlite3_stricmp(sqlite3StrBINARY, zColl) ) break;
117881 0 0 if( i==pSrcIdx->nColumn ){
117886 0 0 if( !HasRowid(pSrc) && pDestIdx->idxType==2 ){
0 0 if( !HasRowid(pSrc) && pDestIdx->idxType==2 ){
117896 0 0 if( emptySrcTest ) sqlite3VdbeJumpHere(v, emptySrcTest);
117899 0 0 if( emptyDestTest ){
117955 0 3365 if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
117956 0 3365 if( zSql==0 ) zSql = "";
117960 6693 39 while( rc==SQLITE_OK && zSql[0] ){
3367 3326 while( rc==SQLITE_OK && zSql[0] ){
117967 4 3363 if( rc!=SQLITE_OK ){
117970 4 3359 if( !pStmt ){
117984 688 6954 if( xCallback && (SQLITE_ROW==rc ||
405 283 if( xCallback && (SQLITE_ROW==rc ||
405 0 if( xCallback && (SQLITE_ROW==rc ||
117985 158 247 (SQLITE_DONE==rc && !callbackIsInit
117986 0 158 && db->flags&SQLITE_NullCallback)) ){
117987 247 36 if( !callbackIsInit ){
117989 0 247 if( azCols==0 ){
117992 741 247 for(i=0; i
118000 283 0 if( rc==SQLITE_ROW ){
118002 849 283 for(i=0; i
118004 33 816 if( !azVals[i] && sqlite3_column_type(pStmt, i)!=SQLITE_NULL ){
0 33 if( !azVals[i] && sqlite3_column_type(pStmt, i)!=SQLITE_NULL ){
118011 0 283 if( xCallback(pArg, nCol, azVals, azCols) ){
118023 3359 4283 if( rc!=SQLITE_ROW ){
118027 0 3359 while( sqlite3Isspace(zSql[0]) ) zSql++;
118037 0 3365 if( pStmt ) sqlite3VdbeFinalize((Vdbe *)pStmt);
118041 39 3326 if( rc!=SQLITE_OK && pzErrMsg ){
39 0 if( rc!=SQLITE_OK && pzErrMsg ){
118043 0 39 if( *pzErrMsg==0 ){
118047 2892 434 }else if( pzErrMsg ){
119194 0 0 if( pzErrMsg ) *pzErrMsg = 0;
119203 0 0 if( (db->flags & SQLITE_LoadExtension)==0 ){
119204 0 0 if( pzErrMsg ){
119210 0 0 zEntry = zProc ? zProc : "sqlite3_extension_init";
119214 0 0 for(ii=0; ii
0 0 for(ii=0; ii
119216 0 0 if( zAltFile==0 ) return SQLITE_NOMEM_BKPT;
119221 0 0 if( handle==0 ){
119222 0 0 if( pzErrMsg ){
119224 0 0 if( zErrmsg ){
119245 0 0 if( xInit==0 && zProc==0 ){
0 0 if( xInit==0 && zProc==0 ){
119249 0 0 if( zAltEntry==0 ){
119254 0 0 for(iFile=ncFile-1; iFile>=0 && zFile[iFile]!='/'; iFile--){}
0 0 for(iFile=ncFile-1; iFile>=0 && zFile[iFile]!='/'; iFile--){}
119256 0 0 if( sqlite3_strnicmp(zFile+iFile, "lib", 3)==0 ) iFile += 3;
119257 0 0 for(iEntry=8; (c = zFile[iFile])!=0 && c!='.'; iFile++){
0 0 for(iEntry=8; (c = zFile[iFile])!=0 && c!='.'; iFile++){
119258 0 0 if( sqlite3Isalpha(c) ){
119266 0 0 if( xInit==0 ){
119267 0 0 if( pzErrMsg ){
119270 0 0 if( zErrmsg ){
119282 0 0 if( rc ){
119283 0 0 if( rc==SQLITE_OK_LOAD_PERMANENTLY ) return SQLITE_OK;
119284 0 0 if( pzErrMsg ){
119294 0 0 if( aHandle==0 ){
119297 0 0 if( db->nExtension>0 ){
119327 0 255 for(i=0; inExtension; i++){
119339 0 0 if( onoff ){
119389 0 0 if( rc ){
119400 0 0 for(i=0; i
119401 0 0 if( wsdAutoext.aExt[i]==xInit ) break;
119403 0 0 if( i==wsdAutoext.nExt ){
119407 0 0 if( aNew==0 ){
119440 0 0 for(i=(int)wsdAutoext.nExt-1; i>=0; i--){
119441 0 0 if( wsdAutoext.aExt[i]==xInit ){
119457 0 0 if( sqlite3_initialize()==SQLITE_OK )
119484 251 0 if( wsdAutoext.nExt==0 ){
119488 0 0 for(i=0; go; i++){
119499 0 0 if( i>=wsdAutoext.nExt ){
119507 0 0 if( xInit && (rc = xInit(db, &zErrmsg, pThunk))!=0 ){
0 0 if( xInit && (rc = xInit(db, &zErrmsg, pThunk))!=0 ){
120242 2 6 if( sqlite3Isdigit(*z) ){
120246 6 0 for(i=0; i
120247 6 0 if( iLength[i]==n && sqlite3StrNICmp(&zText[iOffset[i]],z,n)==0
6 0 if( iLength[i]==n && sqlite3StrNICmp(&zText[iOffset[i]],z,n)==0
120248 6 0 && (!omitFull || iValue[i]<=1)
6 0 && (!omitFull || iValue[i]<=1)
120273 0 0 if( z ){
120274 0 0 if( 0==sqlite3StrICmp(z, "exclusive") ) return PAGER_LOCKINGMODE_EXCLUSIVE;
120275 0 0 if( 0==sqlite3StrICmp(z, "normal") ) return PAGER_LOCKINGMODE_NORMAL;
120289 0 0 if( 0==sqlite3StrICmp(z, "none") ) return BTREE_AUTOVACUUM_NONE;
120290 0 0 if( 0==sqlite3StrICmp(z, "full") ) return BTREE_AUTOVACUUM_FULL;
120291 0 0 if( 0==sqlite3StrICmp(z, "incremental") ) return BTREE_AUTOVACUUM_INCR;
120293 0 0 return (u8)((i>=0&&i<=2)?i:0);
0 0 return (u8)((i>=0&&i<=2)?i:0);
120304 0 0 if( z[0]>='0' && z[0]<='2' ){
0 0 if( z[0]>='0' && z[0]<='2' ){
120306 0 0 }else if( sqlite3StrICmp(z, "file")==0 ){
120308 0 0 }else if( sqlite3StrICmp(z, "memory")==0 ){
120323 0 0 if( db->aDb[1].pBt!=0 ){
120324 0 0 if( !db->autoCommit || sqlite3BtreeIsInReadTrans(db->aDb[1].pBt) ){
0 0 if( !db->autoCommit || sqlite3BtreeIsInReadTrans(db->aDb[1].pBt) ){
120346 0 0 if( db->temp_store==ts ) return SQLITE_OK;
120347 0 0 if( invalidateTempStorage( pParse ) != SQLITE_OK ){
120363 155 16 sqlite3VdbeSetNumCols(v, n==0 ? 1 : n);
120364 16 155 if( n==0 ){
120368 682 155 for(i=0, j=pPragma->iPragCName; i
120389 0 0 if( zValue ){
120402 8 0 if( db->autoCommit ){
120411 16 8 while( (n--) > 0 ){
120412 8 8 if( pDb->pBt ){
120464 0 0 if( eMode==ArraySize(azModeName) ) return 0;
120475 1020 0 while( lwr<=upr ){
120478 175 845 if( rc==0 ) break;
120479 286 559 if( rc<0 ){
120485 175 0 return lwr>upr ? 0 : &aPragmaName[mid];
120538 0 175 if( v==0 ) return;
120545 0 175 if( iDb<0 ) return;
120551 3 172 if( iDb==1 && sqlite3OpenTempDatabase(pParse) ){
0 3 if( iDb==1 && sqlite3OpenTempDatabase(pParse) ){
120556 0 175 if( !zLeft ) return;
120557 0 175 if( minusFlag ){
120564 99 76 zDb = pId2->n>0 ? pDb->zDbSName : 0;
120565 0 175 if( sqlite3AuthCheck(pParse, SQLITE_PRAGMA, zLeft, zRight, zDb) ){
120590 0 175 if( rc==SQLITE_OK ){
120597 0 175 if( rc!=SQLITE_NOTFOUND ){
120598 0 0 if( aFcntl[0] ){
120609 0 175 if( pPragma==0 ) goto pragma_out;
120612 155 20 if( (pPragma->mPragFlg & PragFlg_NeedSchema)!=0 ){
120613 0 155 if( sqlite3ReadSchema(pParse) ) goto pragma_out;
120617 175 0 if( (pPragma->mPragFlg & PragFlg_NoColumns)==0
120618 20 155 && ((pPragma->mPragFlg & PragFlg_NoColumns1)==0 || zRight==0)
12 8 && ((pPragma->mPragFlg & PragFlg_NoColumns1)==0 || zRight==0)
120658 0 0 if( !zRight ){
120691 8 0 if( !zRight ){
120692 8 0 int size = ALWAYS(pBt) ? sqlite3BtreeGetPageSize(pBt) : 0;
120699 0 0 if( SQLITE_NOMEM==sqlite3BtreeSetPageSize(pBt, db->nextPagesize,-1,0) ){
120718 0 0 if( zRight ){
120719 0 0 if( sqlite3_stricmp(zRight, "fast")==0 ){
120725 0 0 if( pId2->n==0 && b>=0 ){
0 0 if( pId2->n==0 && b>=0 ){
120727 0 0 for(ii=0; iinDb; ii++){
120757 0 0 if( sqlite3Tolower(zLeft[0])=='p' ){
120775 0 0 if( pId2->n==0 && eMode==PAGER_LOCKINGMODE_QUERY ){
0 0 if( pId2->n==0 && eMode==PAGER_LOCKINGMODE_QUERY ){
120783 0 0 if( pId2->n==0 ){
120794 0 0 for(ii=2; iinDb; ii++){
120806 0 0 if( eMode==PAGER_LOCKINGMODE_EXCLUSIVE ){
120822 0 0 if( zRight==0 ){
120829 0 0 for(eMode=0; (zMode = sqlite3JournalModename(eMode))!=0; eMode++){
120830 0 0 if( sqlite3StrNICmp(zRight, zMode, n)==0 ) break;
120832 0 0 if( !zMode ){
120838 0 0 if( eMode==PAGER_JOURNALMODE_QUERY && pId2->n==0 ){
0 0 if( eMode==PAGER_JOURNALMODE_QUERY && pId2->n==0 ){
120843 0 0 for(ii=db->nDb-1; ii>=0; ii--){
120844 0 0 if( db->aDb[ii].pBt && (ii==iDb || pId2->n==0) ){
0 0 if( db->aDb[ii].pBt && (ii==iDb || pId2->n==0) ){
0 0 if( db->aDb[ii].pBt && (ii==iDb || pId2->n==0) ){
120862 0 0 if( zRight ){
120864 0 0 if( iLimit<-1 ) iLimit = -1;
120884 0 0 if( !zRight ){
120896 0 0 if( rc==SQLITE_OK && (eAuto==1 || eAuto==2) ){
0 0 if( rc==SQLITE_OK && (eAuto==1 || eAuto==2) ){
0 0 if( rc==SQLITE_OK && (eAuto==1 || eAuto==2) ){
120935 0 0 if( zRight==0 || !sqlite3GetInt32(zRight, &iLimit) || iLimit<=0 ){
0 0 if( zRight==0 || !sqlite3GetInt32(zRight, &iLimit) || iLimit<=0 ){
0 0 if( zRight==0 || !sqlite3GetInt32(zRight, &iLimit) || iLimit<=0 ){
120963 0 0 if( !zRight ){
120997 0 0 if( !zRight ){
120998 0 0 returnSingleInt(v,
121003 0 0 if( sqlite3GetInt32(zRight, &size) ){
121006 0 0 if( sqlite3GetBoolean(zRight, size!=0) ){
121034 0 0 if( zRight ){
121037 0 0 if( sz<0 ) sz = sqlite3GlobalConfig.szMmap;
121038 0 0 if( pId2->n==0 ) db->szMmap = sz;
121039 0 0 for(ii=db->nDb-1; ii>=0; ii--){
121040 0 0 if( db->aDb[ii].pBt && (ii==iDb || pId2->n==0) ){
0 0 if( db->aDb[ii].pBt && (ii==iDb || pId2->n==0) ){
0 0 if( db->aDb[ii].pBt && (ii==iDb || pId2->n==0) ){
121051 0 0 if( rc==SQLITE_OK ){
121053 0 0 }else if( rc!=SQLITE_NOTFOUND ){
121072 0 0 if( !zRight ){
121091 0 0 if( !zRight ){
121095 0 0 if( zRight[0] ){
121098 0 0 if( rc!=SQLITE_OK || res==0 ){
0 0 if( rc!=SQLITE_OK || res==0 ){
121103 0 0 if( SQLITE_TEMP_STORE==0
121110 0 0 if( zRight[0] ){
121206 0 0 if( !zRight ){
121209 0 0 if( !db->autoCommit ){
121212 0 0 }else if( iDb!=1 ){
121214 0 0 if( iLevel==0 ) iLevel = 1;
121226 4 8 if( zRight==0 ){
121231 0 8 if( db->autoCommit==0 ){
121243 7 1 if( sqlite3GetBoolean(zRight, 0) ){
121247 0 1 if( mask==SQLITE_DeferFKs ) db->nDeferredImmCons = 0;
121275 53 0 case PragTyp_TABLE_INFO: if( zRight ){
121278 51 2 if( pTab ){
121287 94 51 for(i=0, pCol=pTab->aCol; inCol; i++, pCol++){
121289 0 94 if( isHidden && pPragma->iArg==0 ){
0 0 if( isHidden && pPragma->iArg==0 ){
121293 42 52 if( (pCol->colFlags & COLFLAG_PRIMKEY)==0 ){
121295 23 29 }else if( pPk==0 ){
121298 37 0 for(k=1; k<=pTab->nCol && pPk->aiColumn[k-1]!=i; k++){}
8 29 for(k=1; k<=pTab->nCol && pPk->aiColumn[k-1]!=i; k++){}
121301 0 94 sqlite3VdbeMultiLoad(v, 1, pPragma->iArg ? "issisii" : "issisi",
0 94 sqlite3VdbeMultiLoad(v, 1, pPragma->iArg ? "issisii" : "issisi",
121341 24 0 case PragTyp_INDEX_INFO: if( zRight ){
121345 12 12 if( pIdx ){
121349 0 12 if( pPragma->iArg ){
121361 16 12 for(i=0; i
121363 16 0 sqlite3VdbeMultiLoad(v, 1, "iisX", i, cnum,
121365 0 16 if( pPragma->iArg ){
121377 4 0 case PragTyp_INDEX_LIST: if( zRight ){
121382 4 0 if( pTab ){
121386 16 4 for(pIdx=pTab->pIndex, i=0; pIdx; pIdx=pIdx->pNext, i++){
121402 155 64 for(i=0; inDb; i++){
121403 39 116 if( db->aDb[i].pBt==0 ) continue;
121417 0 0 for(p=sqliteHashFirst(&db->aCollSeq); p; p=sqliteHashNext(p)){
121467 10 0 case PragTyp_FOREIGN_KEY_LIST: if( zRight ){
121471 10 0 if( pTab ){
121473 7 3 if( pFK ){
121478 12 7 while(pFK){
121480 14 12 for(j=0; jnCol; j++){
121523 0 0 while( k ){
121525 0 0 if( zRight ){
121532 0 0 if( pTab==0 || pTab->pFKey==0 ) continue;
0 0 if( pTab==0 || pTab->pFKey==0 ) continue;
121536 0 0 if( pTab->nCol+regRow>pParse->nMem ) pParse->nMem = pTab->nCol + regRow;
121539 0 0 for(i=1, pFK=pTab->pFKey; pFK; i++, pFK=pFK->pNextFrom){
121541 0 0 if( pParent==0 ) continue;
121545 0 0 if( x==0 ){
121546 0 0 if( pIdx==0 ){
121558 0 0 if( pFK ) break;
121559 0 0 if( pParse->nTabnTab = i;
121561 0 0 for(i=1, pFK=pTab->pFKey; pFK; i++, pFK=pFK->pNextFrom){
121565 0 0 if( pParent ){
121575 0 0 for(j=0; jnCol; j++){
121576 0 0 int iCol = aiCols ? aiCols[j] : pFK->aCol[j].iFrom;
121583 0 0 if( pIdx ){
121588 0 0 }else if( pParent ){
121596 0 0 if( HasRowid(pTab) ){
121631 0 0 if( zRight ){
121670 0 0 if( pId2->z==0 ) iDb = -1;
121677 0 0 if( zRight ){
121679 0 0 if( mxErr<=0 ){
121686 0 0 for(i=0; inDb; i++){
121694 0 0 if( iDb>=0 && i!=iDb ) continue;
0 0 if( iDb>=0 && i!=iDb ) continue;
121705 0 0 for(cnt=0, x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){
121709 0 0 if( HasRowid(pTab) ) cnt++;
121710 0 0 for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){ cnt++; }
121711 0 0 if( nIdx>mxIdx ) mxIdx = nIdx;
121714 0 0 if( aRoot==0 ) break;
121715 0 0 for(cnt=0, x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){
121718 0 0 if( HasRowid(pTab) ) aRoot[++cnt] = pTab->tnum;
121719 0 0 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
121742 0 0 for(x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){
121750 0 0 if( pTab->tnum<1 ) continue; /* Skip VIEWs or VIRTUAL TABLEs */
121751 0 0 pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);
121758 0 0 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
121765 0 0 if( !isQuick ){
121771 0 0 for(j=0; jnCol; j++){
121774 0 0 if( j==pTab->iPKey ) continue;
121775 0 0 if( pTab->aCol[j].notNull==0 ) continue;
121786 0 0 if( pTab->pCheck && (db->flags & SQLITE_IgnoreChecks)==0 ){
0 0 if( pTab->pCheck && (db->flags & SQLITE_IgnoreChecks)==0 ){
121788 0 0 if( db->mallocFailed==0 ){
121794 0 0 for(k=pCheck->nExpr-1; k>0; k--){
121809 0 0 if( !isQuick ){ /* Omit the remaining tests for quick_check */
121811 0 0 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
121814 0 0 if( pPk==pIdx ) continue;
121833 0 0 if( IsUniqueIndex(pIdx) ){
121837 0 0 for(kk=0; kknKeyCol; kk++){
121840 0 0 if( iCol>=0 && pTab->aCol[iCol].notNull ) continue;
0 0 if( iCol>=0 && pTab->aCol[iCol].notNull ) continue;
121860 0 0 if( !isQuick ){
121862 0 0 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
121863 0 0 if( pPk==pIdx ) continue;
121890 0 0 if( aOp ){
121942 0 0 if( !zRight ){ /* "PRAGMA encoding" */
121943 0 0 if( sqlite3ReadSchema(pParse) ) goto pragma_out;
121954 0 0 if(
121955 0 0 !(DbHasProperty(db, 0, DB_SchemaLoaded)) ||
121958 0 0 for(pEnc=&encnames[0]; pEnc->zName; pEnc++){
121959 0 0 if( 0==sqlite3StrICmp(zRight, pEnc->zName) ){
121960 0 0 SCHEMA_ENC(db) = ENC(db) =
121965 0 0 if( !pEnc->zName ){
122010 0 0 if( zRight && (pPragma->mPragFlg & PragFlg_ReadOnly)==0 ){
0 0 if( zRight && (pPragma->mPragFlg & PragFlg_ReadOnly)==0 ){
122055 0 0 while( (zOpt = sqlite3_compileoption_get(i++))!=0 ){
122071 0 0 int iBt = (pId2->z?iDb:SQLITE_MAX_ATTACHED);
122073 0 0 if( zRight ){
122074 0 0 if( sqlite3StrICmp(zRight, "full")==0 ){
122076 0 0 }else if( sqlite3StrICmp(zRight, "restart")==0 ){
122078 0 0 }else if( sqlite3StrICmp(zRight, "truncate")==0 ){
122097 0 0 if( zRight ){
122100 0 0 returnSingleInt(v,
122184 0 0 if( zRight ){
122186 0 0 if( (opMask & 0x02)==0 ) break;
122191 0 0 for(iDbLast = zDb?iDb:db->nDb-1; iDb<=iDbLast; iDb++){
0 0 for(iDbLast = zDb?iDb:db->nDb-1; iDb<=iDbLast; iDb++){
122192 0 0 if( iDb==1 ) continue;
122195 0 0 for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){
122201 0 0 if( (pTab->tabFlags & TF_StatsUsed)==0 ) continue;
122205 0 0 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
122206 0 0 if( !pIdx->hasStat1 ){
122211 0 0 if( szThreshold ){
122219 0 0 if( opMask & 0x01 ){
122243 0 0 if( zRight ){
122263 0 0 if( zRight && sqlite3DecOrHexToI64(zRight, &N)==SQLITE_OK ){
0 0 if( zRight && sqlite3DecOrHexToI64(zRight, &N)==SQLITE_OK ){
122279 0 0 if( zRight
122280 0 0 && sqlite3DecOrHexToI64(zRight, &N)==SQLITE_OK
122281 0 0 && N>=0
122430 0 0 for(i=0, j=pPragma->iPragCName; inPragCName; i++, j++){
122434 0 0 if( i==0 ){
122439 0 0 if( pPragma->mPragFlg & PragFlg_Result1 ){
122443 0 0 if( pPragma->mPragFlg & (PragFlg_SchemaOpt|PragFlg_SchemaReq) ){
122451 0 0 if( rc==SQLITE_OK ){
122453 0 0 if( pTab==0 ){
122493 0 0 if( pTab->nHidden==0 ){ return SQLITE_OK; }
122497 0 0 for(i=0; inConstraint; i++, pConstraint++){
122498 0 0 if( pConstraint->usable==0 ) continue;
122499 0 0 if( pConstraint->op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue;
122500 0 0 if( pConstraint->iColumn < pTab->iHidden ) continue;
122505 0 0 if( seen[0]==0 ){
122513 0 0 if( seen[1]==0 ) return SQLITE_OK;
122526 0 0 if( pCsr==0 ) return SQLITE_NOMEM;
122538 0 0 for(i=0; iazArg); i++){
122560 0 0 if( SQLITE_ROW!=sqlite3_step(pCsr->pPragma) ){
122587 0 0 for(i=0; i
122591 0 0 if( zText ){
122593 0 0 if( pCsr->azArg[j]==0 ){
122600 0 0 if( pCsr->azArg[1] ){
122604 0 0 if( pCsr->azArg[0] ){
122608 0 0 if( zSql==0 ) return SQLITE_NOMEM;
122611 0 0 if( rc!=SQLITE_OK ){
122636 0 0 if( iiHidden ){
122690 0 0 if( pName==0 ) return 0;
122691 0 0 if( (pName->mPragFlg & (PragFlg_Result0|PragFlg_Result1))==0 ) return 0;
122729 0 0 if( db->mallocFailed ){
122731 0 0 }else if( pData->pzErrMsg[0]!=0 ){
122733 0 0 }else if( pData->mInitFlags & INITFLAG_AlterTable ){
122736 0 0 }else if( db->flags & SQLITE_WriteSchema ){
122740 0 0 if( zObj==0 ) zObj = "?";
122742 0 0 if( zExtra && zExtra[0] ) z = sqlite3MPrintf(db, "%z - %s", z, zExtra);
0 0 if( zExtra && zExtra[0] ) z = sqlite3MPrintf(db, "%z - %s", z, zExtra);
122769 0 650 if( db->mallocFailed ){
122775 0 650 if( argv==0 ) return 0; /* Might happen if EMPTY_RESULT_CALLBACKS are on */
122776 0 650 if( argv[1]==0 ){
122778 617 33 }else if( sqlite3_strnicmp(argv[2],"create ",7)==0 ){
122798 0 617 if( SQLITE_OK!=rc ){
122799 0 0 if( db->init.orphanTrigger ){
122803 0 0 if( rc==SQLITE_NOMEM ){
122805 0 0 }else if( rc!=SQLITE_INTERRUPT && (rc&0xFF)!=SQLITE_LOCKED ){
0 0 }else if( rc!=SQLITE_INTERRUPT && (rc&0xFF)!=SQLITE_LOCKED ){
122811 33 0 }else if( argv[0]==0 || (argv[2]!=0 && argv[2][0]!=0) ){
0 33 }else if( argv[0]==0 || (argv[2]!=0 && argv[2][0]!=0) ){
0 0 }else if( argv[0]==0 || (argv[2]!=0 && argv[2][0]!=0) ){
122822 33 0 if( pIndex==0 ){
122829 0 33 }else if( sqlite3GetInt32(argv[1], &pIndex->tnum)==0 ){
122870 181 186 azArg[0] = zMasterName = SCHEMA_TABLE(iDb);
122881 0 367 if( initData.rc ){
122889 181 186 if( pDb->pBt==0 ){
122900 162 24 if( !sqlite3BtreeIsInReadTrans(pDb->pBt) ){
122902 0 162 if( rc!=SQLITE_OK ){
122926 930 186 for(i=0; i
122929 0 186 if( (db->flags & SQLITE_ResetDatabase)!=0 ){
122939 29 157 if( meta[BTREE_TEXT_ENCODING-1] ){ /* text encoding */
122940 29 0 if( iDb==0 ){
122945 0 29 if( encoding==0 ) encoding = SQLITE_UTF8;
122952 0 0 if( meta[BTREE_TEXT_ENCODING-1]!=ENC(db) ){
122964 185 1 if( pDb->pSchema->cache_size==0 ){
122967 185 0 if( size==0 ){ size = SQLITE_DEFAULT_CACHE_SIZE; }
122982 157 29 if( pDb->pSchema->file_format==0 ){
122985 0 186 if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
122996 181 5 if( iDb==0 && meta[BTREE_FILE_FORMAT-1]>=4 ){
29 152 if( iDb==0 && meta[BTREE_FILE_FORMAT-1]>=4 ){
123019 186 0 if( rc==SQLITE_OK ) rc = initData.rc;
123022 186 0 if( rc==SQLITE_OK ){
123027 0 186 if( db->mallocFailed ){
123031 0 186 if( rc==SQLITE_OK || (db->flags&SQLITE_NoSchemaError)){
0 0 if( rc==SQLITE_OK || (db->flags&SQLITE_NoSchemaError)){
123049 162 24 if( openedTransaction ){
123055 0 367 if( rc ){
123056 0 0 if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){
0 0 if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){
123085 181 4006 if( !DbHasProperty(db, 0, DB_SchemaLoaded) ){
123087 0 181 if( rc ) return rc;
123090 4387 4187 for(i=db->nDb-1; i>0; i--){
123092 186 4201 if( !DbHasProperty(db, i, DB_SchemaLoaded) ){
123094 0 186 if( rc ) return rc;
123097 4059 128 if( commit_internal ){
123111 4169 1059 if( !db->init.busy ){
123113 0 4169 if( rc!=SQLITE_OK ){
123116 0 4169 }else if( db->noSharedCache ){
123137 14 7 for(iDb=0; iDbnDb; iDb++){
123140 7 7 if( pBt==0 ) continue;
123145 7 0 if( !sqlite3BtreeIsInReadTrans(pBt) ){
123147 7 0 if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){
0 7 if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){
123150 0 7 if( rc!=SQLITE_OK ) return;
123159 0 7 if( cookie!=db->aDb[iDb].pSchema->schema_cookie ){
123165 7 0 if( openedTransaction ){
123192 10301 35 if( pSchema ){
123195 10301 5485 if( db->aDb[i].pSchema==pSchema ){
123211 5447 0 if( db ){
123245 70 5353 if( prepFlags & SQLITE_PREPARE_PERSISTENT ){
123273 11014 5423 for(i=0; inDb; i++) {
123275 8253 2761 if( pBt ){
123278 0 8253 if( rc ){
123290 0 5423 if( nBytes>=0 && (nBytes==0 || zSql[nBytes-1]!=0) ){
0 0 if( nBytes>=0 && (nBytes==0 || zSql[nBytes-1]!=0) ){
0 0 if( nBytes>=0 && (nBytes==0 || zSql[nBytes-1]!=0) ){
123295 0 0 if( nBytes>mxLen ){
123301 0 0 if( zSqlCopy ){
123313 5405 18 if( sParse.rc==SQLITE_DONE ) sParse.rc = SQLITE_OK;
123314 7 5416 if( sParse.checkSchema ){
123317 0 5423 if( db->mallocFailed ){
123320 4480 943 if( pzTail ){
123326 5413 10 if( rc==SQLITE_OK && sParse.pVdbe && sParse.explain ){
5405 8 if( rc==SQLITE_OK && sParse.pVdbe && sParse.explain ){
0 5405 if( rc==SQLITE_OK && sParse.pVdbe && sParse.explain ){
123332 0 0 if( sParse.explain==2 ){
123341 0 0 for(i=iFirst; i
123348 4402 1021 if( db->init.busy==0 ){
123351 5405 18 if( sParse.pVdbe && (rc!=SQLITE_OK || db->mallocFailed) ){
5405 0 if( sParse.pVdbe && (rc!=SQLITE_OK || db->mallocFailed) ){
0 5405 if( sParse.pVdbe && (rc!=SQLITE_OK || db->mallocFailed) ){
123358 10 5413 if( zErrMsg ){
123366 0 5423 while( sParse.pTriggerPrg ){
123393 5423 0 if( !sqlite3SafetyCheckOk(db)||zSql==0 ){
0 5423 if( !sqlite3SafetyCheckOk(db)||zSql==0 ){
123405 0 5423 || (rc==SQLITE_SCHEMA && (sqlite3ResetOneSchema(db,-1), cnt++)==0) );
0 5423 || (rc==SQLITE_SCHEMA && (sqlite3ResetOneSchema(db,-1), cnt++)==0) );
0 0 || (rc==SQLITE_SCHEMA && (sqlite3ResetOneSchema(db,-1), cnt++)==0) );
123723 0 1 if( rc ){
123724 0 0 if( rc==SQLITE_NOMEM ){
123826 0 0 if( !sqlite3SafetyCheckOk(db)||zSql==0 ){
0 0 if( !sqlite3SafetyCheckOk(db)||zSql==0 ){
123829 0 0 if( nBytes>=0 ){
123832 0 0 for(sz=0; sz
0 0 for(sz=0; sz
0 0 for(sz=0; sz
123837 0 0 if( zSql8 ){
123841 0 0 if( zTail8 && pzTail ){
0 0 if( zTail8 && pzTail ){
123997 4222 4139 while( p ){
124007 0 4222 if( OK_IF_ALWAYS_TRUE(p->pWinDefn) ){
124011 0 4222 if( OK_IF_ALWAYS_TRUE(p->pWith) ) sqlite3WithDelete(db, p->pWith);
124012 4222 0 if( bFree ) sqlite3DbFreeNN(db, p);
124048 0 4222 if( pNew==0 ){
124052 0 4222 if( pEList==0 ){
124065 2658 1564 if( pSrc==0 ) pSrc = sqlite3DbMallocZero(pParse->db, sizeof(*pSrc));
124079 0 4222 if( pParse->db->mallocFailed ) {
124094 4139 7683 if( OK_IF_ALWAYS_TRUE(p) ) clearSelect(db, p, 1);
124101 0 2 while( p->pNext ) p = p->pNext;
124145 0 0 for(i=0; i<3 && apAll[i]; i++){
0 0 for(i=0; i<3 && apAll[i]; i++){
124147 0 0 for(j=0; j
124148 0 0 if( p->n==aKeyword[j].nChar
124149 0 0 && sqlite3StrNICmp((char*)p->z, &zKeyText[aKeyword[j].i], p->n)==0 ){
124155 0 0 if( j>=ArraySize(aKeyword) ){
124160 0 0 if(
124161 0 0 (jointype & (JT_INNER|JT_OUTER))==(JT_INNER|JT_OUTER) ||
124166 0 0 if( pC==0 ){ zSp++; }
124170 0 0 }else if( (jointype & JT_OUTER)!=0
124171 0 0 && (jointype & (JT_LEFT|JT_RIGHT))!=JT_LEFT ){
124185 0 0 for(i=0; inCol; i++){
124186 0 0 if( sqlite3StrICmp(pTab->aCol[i].zName, zCol)==0 ) return i;
124211 0 0 for(i=0; i
124213 0 0 if( iCol>=0 ){
124214 0 0 if( piTab ){
124259 0 0 if( pEq && isOuterJoin ){
0 0 if( pEq && isOuterJoin ){
124295 0 0 while( p ){
124300 0 0 if( p->op==TK_FUNCTION && p->x.pList ){
0 0 if( p->op==TK_FUNCTION && p->x.pList ){
124302 0 0 for(i=0; ix.pList->nExpr; i++){
124318 303 596 while( p ){
124319 0 303 if( ExprHasProperty(p, EP_FromJoin)
124320 0 0 && (iTable<0 || p->iRightJoinTable==iTable) ){
0 0 && (iTable<0 || p->iRightJoinTable==iTable) ){
124323 96 207 if( p->op==TK_FUNCTION && p->x.pList ){
96 0 if( p->op==TK_FUNCTION && p->x.pList ){
124325 192 96 for(i=0; ix.pList->nExpr; i++){
124357 3 1574 for(i=0; inSrc-1; i++, pRight++, pLeft++){
124361 3 0 if( NEVER(pLeft->pTab==0 || pRightTab==0) ) continue;
0 3 if( NEVER(pLeft->pTab==0 || pRightTab==0) ) continue;
124367 0 3 if( pRight->fg.jointype & JT_NATURAL ){
124368 0 0 if( pRight->pOn || pRight->pUsing ){
0 0 if( pRight->pOn || pRight->pUsing ){
124373 0 0 for(j=0; jnCol; j++){
124379 0 0 if( tableAndColumnIndex(pSrc, i+1, zName, &iLeft, &iLeftCol) ){
124388 0 3 if( pRight->pOn && pRight->pUsing ){
0 0 if( pRight->pOn && pRight->pUsing ){
124397 0 3 if( pRight->pOn ){
124398 0 0 if( isOuter ) setJoinExpr(pRight->pOn, pRight->iCursor);
124410 0 3 if( pRight->pUsing ){
124412 0 0 for(j=0; jnId; j++){
124420 0 0 if( iRightCol<0
124421 0 0 || !tableAndColumnIndex(pSrc, i+1, zName, &iLeft, &iLeftCol)
124484 1 73 if( pSort->pDeferredRowLoad ){
124532 74 0 if( nPrefixReg ){
124540 0 74 iLimit = pSelect->iOffset ? pSelect->iOffset+1 : pSelect->iLimit;
124542 18 56 sqlite3ExprCodeExprList(pParse, pSort->pOrderBy, regBase, regOrigData,
124544 1 73 if( bSeq ){
124547 0 74 if( nPrefixReg==0 && nData>0 ){
0 0 if( nPrefixReg==0 && nData>0 ){
124550 15 59 if( nOBSat>0 ){
124562 0 15 if( bSeq ){
124570 0 15 if( pParse->db->mallocFailed ) return;
124584 0 15 if( iLimit ){
124592 1 73 if( iLimit ){
124617 59 15 if( regRecord==0 ){
124620 73 1 if( pSort->sortFlags & SORTFLAG_UseSorter ){
124627 1 73 if( iSkip ){
124628 0 1 sqlite3VdbeChangeP2(v, iSkip,
124641 0 1563 if( iOffset>0 ){
124794 1431 132 hasDistinct = pDistinct ? pDistinct->eTnctType : WHERE_DISTINCT_NOOP;
124795 1431 132 if( pSort && pSort->pOrderBy==0 ) pSort = 0;
1357 74 if( pSort && pSort->pOrderBy==0 ) pSort = 0;
124796 1489 74 if( pSort==0 && !hasDistinct ){
1487 2 if( pSort==0 && !hasDistinct ){
124805 1464 99 if( pDest->iSdst==0 ){
124806 74 1390 if( pSort ){
124808 1 73 if( !(pSort->sortFlags & SORTFLAG_UseSorter) ) nPrefixReg++;
124813 0 99 }else if( pDest->iSdst+nResultCol > pParse->nMem ){
124823 2 1561 if( srcTab>=0 ){
124824 2 2 for(i=0; i
124828 1561 0 }else if( eDest!=SRT_Exists ){
124837 1545 16 if( eDest==SRT_Mem || eDest==SRT_Output || eDest==SRT_Coroutine ){
107 1438 if( eDest==SRT_Mem || eDest==SRT_Output || eDest==SRT_Coroutine ){
101 6 if( eDest==SRT_Mem || eDest==SRT_Output || eDest==SRT_Coroutine ){
124842 74 1487 if( pSort && hasDistinct==0 && eDest!=SRT_EphemTab && eDest!=SRT_Table ){
74 0 if( pSort && hasDistinct==0 && eDest!=SRT_EphemTab && eDest!=SRT_Table ){
74 0 if( pSort && hasDistinct==0 && eDest!=SRT_EphemTab && eDest!=SRT_Table ){
74 0 if( pSort && hasDistinct==0 && eDest!=SRT_EphemTab && eDest!=SRT_Table ){
124851 106 74 for(i=pSort->nOBSat; ipOrderBy->nExpr; i++){
124853 88 18 if( (j = pSort->pOrderBy->a[i].u.x.iOrderByCol)>0 ){
124875 207 74 for(i=0; inExpr; i++){
124876 88 119 if( pEList->a[i].u.x.iOrderByCol>0
124901 18 1543 if( p->iLimit
124902 1 17 && (ecelFlags & SQLITE_ECEL_OMITREF)!=0
124903 1 0 && nPrefixReg>0
124918 2 1561 if( hasDistinct ){
124942 0 0 for(i=0; i
124944 0 0 if( i
124971 2 0 if( pSort==0 ){
125013 0 0 if( eDest==SRT_DistFifo ){
125026 0 0 if( pSort ){
125046 0 0 if( pSort ){
125077 0 16 if( pSort ){
125094 74 1467 if( pSort ){
125097 103 1364 }else if( eDest==SRT_Coroutine ){
125124 0 0 if( eDest==SRT_DistQueue ){
125133 0 0 if( eDest==SRT_DistQueue ){
125137 0 0 for(i=0; i
125145 0 0 if( addrTest ) sqlite3VdbeJumpHere(v, addrTest);
125171 1489 74 if( pSort==0 && p->iLimit ){
17 1472 if( pSort==0 && p->iLimit ){
125183 599 0 if( p ){
125201 619 0 if( p ){
125204 599 20 if( p->nRef==0 ) sqlite3DbFreeNN(p->db, p);
125212 20 0 if( p ){
125257 521 0 if( pInfo ){
125259 571 521 for(i=iStart, pItem=pList->a+iStart; i
125345 15 59 if( pSort->labelBkOut ){
125362 0 74 if( eDest==SRT_Output || eDest==SRT_Coroutine || eDest==SRT_Mem ){
0 0 if( eDest==SRT_Output || eDest==SRT_Coroutine || eDest==SRT_Mem ){
0 0 if( eDest==SRT_Output || eDest==SRT_Coroutine || eDest==SRT_Mem ){
125370 73 1 if( pSort->sortFlags & SORTFLAG_UseSorter ){
125373 15 58 if( pSort->labelBkOut ){
125378 15 58 if( addrOnce ) sqlite3VdbeJumpHere(v, addrOnce);
125390 207 74 for(i=0, iCol=nKey+bSeq-1; i
125394 119 88 if( aOutEx[i].u.x.iOrderByCol==0 ) iCol++;
125427 207 74 for(i=nColumn-1; i>=0; i--){
125435 88 119 if( aOutEx[i].u.x.iOrderByCol ){
125469 74 0 if( eDest==SRT_Output ){
125477 0 74 if( regRowid ){
125478 0 0 if( eDest==SRT_Set ){
125488 73 1 if( pSort->sortFlags & SORTFLAG_UseSorter ){
125493 15 59 if( pSort->regReturn ) sqlite3VdbeAddOp1(v, OP_Return, pSort->regReturn);
125558 4322 0 while( pNC && !pTab ){
2161 2161 while( pNC && !pTab ){
125560 2166 0 for(j=0;jnSrc && pTabList->a[j].iCursor!=pExpr->iTable;j++);
5 2161 for(j=0;jnSrc && pTabList->a[j].iCursor!=pExpr->iTable;j++);
125561 2161 0 if( jnSrc ){
125569 0 2161 if( pTab==0 ){
125591 198 1963 if( pS ){
125596 198 0 if( iCol>=0 && iColpEList->nExpr ){
198 0 if( iCol>=0 && iColpEList->nExpr ){
125612 28 1935 if( iCol<0 ) iCol = pTab->iPKey;
125614 0 1963 if( iCol<0 ){
125622 1930 33 if( pNC->pParse && pTab->pSchema ){
1930 0 if( pNC->pParse && pTab->pSchema ){
125657 2748 146 if( pzOrigDb ){
125683 2550 1438 for(i=0; inExpr; i++){
125753 0 1438 if( pParse->explain ){
125758 0 1438 if( pParse->colNamesSet ) return;
125760 0 1438 while( pSelect->pPrior ) pSelect = pSelect->pPrior;
125768 1 1437 srcName = (db->flags & SQLITE_ShortColNames)!=0 || fullName;
1 0 srcName = (db->flags & SQLITE_ShortColNames)!=0 || fullName;
125770 2550 1438 for(i=0; inExpr; i++){
125776 291 2259 if( pEList->a[i].zName ){
125780 2259 0 }else if( srcName && p->op==TK_COLUMN ){
1748 511 }else if( srcName && p->op==TK_COLUMN ){
125785 13 1735 if( iCol<0 ) iCol = pTab->iPKey;
125787 0 1748 if( iCol<0 ){
125792 0 1748 if( fullName ){
125801 0 511 z = z==0 ? sqlite3MPrintf(db, "column%d", i+1) : sqlite3DbStrDup(db, z);
125846 35 0 if( pEList ){
125850 0 35 if( nCol>32767 ) nCol = 32767;
125859 146 35 for(i=0, pCol=aCol; imallocFailed; i++, pCol++){
146 0 for(i=0, pCol=aCol; imallocFailed; i++, pCol++){
125862 59 87 if( (zName = pEList->a[i].zName)!=0 ){
125866 0 59 while( pColExpr->op==TK_DOT ){
125871 0 59 if( pColExpr->op==TK_COLUMN ){
125876 0 0 if( iCol<0 ) iCol = pTab->iPKey;
125877 0 0 zName = iCol>=0 ? pTab->aCol[iCol].zName : "rowid";
125878 59 0 }else if( pColExpr->op==TK_ID ){
125886 146 0 if( zName ){
125896 146 0 while( zName && sqlite3HashFind(&ht, zName)!=0 ){
0 146 while( zName && sqlite3HashFind(&ht, zName)!=0 ){
125898 0 0 if( nName>0 ){
125899 0 0 for(j=nName-1; j>0 && sqlite3Isdigit(zName[j]); j--){}
0 0 for(j=nName-1; j>0 && sqlite3Isdigit(zName[j]); j--){}
125900 0 0 if( zName[j]==':' ) nName = j;
125903 0 0 if( cnt>3 ) sqlite3_randomness(sizeof(cnt), &cnt);
125907 146 0 if( zName && sqlite3HashInsert(&ht, zName, pCol)==pCol ){
0 146 if( zName && sqlite3HashInsert(&ht, zName, pCol)==pCol ){
125912 0 35 if( db->mallocFailed ){
125913 0 0 for(j=0; j
125951 0 35 if( db->mallocFailed ) return;
125955 146 35 for(i=0, pCol=pTab->aCol; inCol; i++, pCol++){
125962 33 113 if( zType ){
125966 33 0 if( pCol->zName ){
125971 61 85 if( pCol->affinity==0 ) pCol->affinity = SQLITE_AFF_BLOB;
125973 85 61 if( pColl && pCol->zColl==0 ){
85 0 if( pColl && pCol->zColl==0 ){
125993 0 0 if( pParse->nErr ) return 0;
125994 0 0 while( pSelect->pPrior ) pSelect = pSelect->pPrior;
125997 0 0 if( pTab==0 ){
126009 0 0 if( db->mallocFailed ){
126021 22970 5414 if( pParse->pVdbe ){
126024 5414 0 if( pParse->pToplevel==0
126025 5414 0 && OptimizationEnabled(pParse->db,SQLITE_FactorOutConst)
126063 0 1553 if( p->iLimit ) return;
126071 18 1535 if( pLimit ){
126077 18 0 if( sqlite3ExprIsInteger(pLimit->pLeft, &n) ){
126080 0 18 if( n==0 ){
126082 18 0 }else if( n>=0 && p->nSelectRow>sqlite3LogEst((u64)n) ){
18 0 }else if( n>=0 && p->nSelectRow>sqlite3LogEst((u64)n) ){
126092 0 18 if( pLimit->pRight ){
126115 4 2 if( p->pPrior ){
126124 6 0 if( pRet==0 && ALWAYS(iColpEList->nExpr) ){
6 0 if( pRet==0 && ALWAYS(iColpEList->nExpr) ){
126144 0 0 if( pRet ){
126146 0 0 for(i=0; i
126151 0 0 if( pTerm->flags & EP_Collate ){
126155 0 0 if( pColl==0 ) pColl = db->pDfltColl;
126229 0 0 if( p->pWin ){
126236 0 0 if( sqlite3AuthCheck(pParse, SQLITE_RECURSIVE, 0, 0, 0) ) return;
126250 0 0 for(i=0; ALWAYS(inSrc); i++){
126251 0 0 if( pSrc->a[i].fg.isRecursive ){
126261 0 0 if( p->op==TK_UNION ){
126262 0 0 eDest = pOrderBy ? SRT_DistQueue : SRT_DistFifo;
126265 0 0 eDest = pOrderBy ? SRT_Queue : SRT_Fifo;
126272 0 0 if( pOrderBy ){
126281 0 0 if( iDistinct ){
126294 0 0 if( rc ) goto end_of_recursive_query;
126301 0 0 if( pOrderBy ){
126313 0 0 if( regLimit ){
126322 0 0 if( p->selFlags & SF_Aggregate ){
126380 2 8 if( p->pPrior==0 ) break;
126385 0 2 ExplainQueryPlan((pParse, 0, "SCAN %d CONSTANT ROW%s", nRow,
126387 10 2 while( p ){
126389 0 10 if( !bShowAll ) break;
126447 77 0 if( pPrior->pOrderBy || pPrior->pLimit ){
0 77 if( pPrior->pOrderBy || pPrior->pLimit ){
126448 0 0 sqlite3ErrorMsg(pParse,"%s clause should come after %s not before",
126459 0 77 if( dest.eDest==SRT_EphemTab ){
126467 2 75 if( p->selFlags & SF_MultiValue ){
126479 0 75 if( p->selFlags & SF_Recursive ){
126486 0 75 if( p->pOrderBy ){
126491 22 53 if( pPrior->pPrior==0 ){
126509 0 71 if( rc ){
126515 0 71 if( p->iLimit ){
126518 0 0 if( p->iOffset ){
126529 0 71 if( pPrior->pLimit
126530 0 0 && sqlite3ExprIsInteger(pPrior->pLimit->pLeft, &nLimit)
126531 0 0 && nLimit>0 && p->nSelectRow > sqlite3LogEst((u64)nLimit)
0 0 && nLimit>0 && p->nSelectRow > sqlite3LogEst((u64)nLimit)
126535 0 71 if( addr ){
126552 2 2 if( dest.eDest==priorOp ){
126576 0 4 if( rc ){
126582 0 4 if( p->op==TK_EXCEPT ){
126602 4 0 if( p->op==TK_UNION ){
126614 2 2 if( dest.eDest!=priorOp ){
126657 0 0 if( rc ){
126676 0 0 if( p->nSelectRow>pPrior->nSelectRow ){
126707 22 53 if( p->pNext==0 ){
126722 2 73 if( p->selFlags & SF_UsesEphemeral ){
126732 0 2 if( !pKeyInfo ){
126736 2 2 for(i=0, apColl=pKeyInfo->aColl; i
126738 2 0 if( 0==*apColl ){
126743 6 2 for(pLoop=p; pLoop; pLoop=pLoop->pPrior){
126744 8 0 for(i=0; i<2; i++){
126746 6 2 if( addr<0 ){
126774 0 0 if( p->selFlags & SF_Values ){
126821 0 0 if( regPrev ){
126831 0 0 if( pParse->db->mallocFailed ) return 0;
126885 0 0 if( pDest->iSdst==0 ){
126911 0 0 if( p->iLimit ){
127071 0 0 if( op!=TK_ALL ){
127072 0 0 for(i=1; db->mallocFailed==0 && i<=p->pEList->nExpr; i++){
0 0 for(i=1; db->mallocFailed==0 && i<=p->pEList->nExpr; i++){
127074 0 0 for(j=0, pItem=pOrderBy->a; j
127076 0 0 if( pItem->u.x.iOrderByCol==i ) break;
127078 0 0 if( j==nOrderBy ){
127080 0 0 if( pNew==0 ) return SQLITE_NOMEM_BKPT;
127084 0 0 if( pOrderBy ) pOrderBy->a[nOrderBy++].u.x.iOrderByCol = (u16)i;
127097 0 0 if( aPermute ){
127100 0 0 for(i=1, pItem=pOrderBy->a; i<=nOrderBy; i++, pItem++){
127119 0 0 if( op==TK_ALL ){
127128 0 0 if( pKeyDup ){
127130 0 0 for(i=0; i
127142 0 0 if( pPrior->pPrior==0 ){
127148 0 0 if( p->iLimit && op==TK_ALL ){
0 0 if( p->iLimit && op==TK_ALL ){
127151 0 0 sqlite3VdbeAddOp2(v, OP_Copy, p->iOffset ? p->iOffset+1 : p->iLimit,
127208 0 0 if( op==TK_ALL || op==TK_UNION ){
0 0 if( op==TK_ALL || op==TK_UNION ){
127219 0 0 if( op==TK_EXCEPT || op==TK_INTERSECT ){
0 0 if( op==TK_EXCEPT || op==TK_INTERSECT ){
127233 0 0 if( op==TK_INTERSECT ){
127235 0 0 if( p->nSelectRow > pPrior->nSelectRow ) p->nSelectRow = pPrior->nSelectRow;
127252 0 0 if( op==TK_ALL ){
127254 0 0 }else if( op==TK_INTERSECT ){
127268 0 0 if( op==TK_ALL || op==TK_UNION ){
0 0 if( op==TK_ALL || op==TK_UNION ){
127295 0 0 if( p->pPrior ){
127345 1120 734 if( pExpr==0 ) return 0;
127346 0 734 if( ExprHasProperty(pExpr, EP_FromJoin)
127347 0 0 && pExpr->iRightJoinTable==pSubst->iTable
127351 325 409 if( pExpr->op==TK_COLUMN && pExpr->iTable==pSubst->iTable ){
233 92 if( pExpr->op==TK_COLUMN && pExpr->iTable==pSubst->iTable ){
127352 0 233 if( pExpr->iColumn<0 ){
127360 0 233 if( sqlite3ExprIsVector(pCopy) ){
127364 0 233 if( pSubst->isLeftJoin && pCopy->op!=TK_COLUMN ){
0 0 if( pSubst->isLeftJoin && pCopy->op!=TK_COLUMN ){
127372 233 0 if( pNew && pSubst->isLeftJoin ){
0 233 if( pNew && pSubst->isLeftJoin ){
127375 233 0 if( pNew && ExprHasProperty(pExpr,EP_FromJoin) ){
0 233 if( pNew && ExprHasProperty(pExpr,EP_FromJoin) ){
127384 0 501 if( pExpr->op==TK_IF_NULL_ROW && pExpr->iTable==pSubst->iTable ){
0 0 if( pExpr->op==TK_IF_NULL_ROW && pExpr->iTable==pSubst->iTable ){
127389 0 501 if( ExprHasProperty(pExpr, EP_xIsSelect) ){
127402 504 219 if( pList==0 ) return;
127403 603 219 for(i=0; inExpr; i++){
127415 35 26 if( !p ) return;
127424 48 74 for(i=pSrc->nSrc, pItem=pSrc->a; i>0; i--, pItem++){
127426 0 48 if( pItem->fg.isTabFunc ){
127430 61 13 }while( doPrior && (p = p->pPrior)!=0 );
48 13 }while( doPrior && (p = p->pPrior)!=0 );
127612 0 35 if( OptimizationDisabled(db, SQLITE_QueryFlattener) ) return 0;
127621 35 0 if( p->pWin || pSub->pWin ) return 0; /* Restriction (25) */
0 35 if( p->pWin || pSub->pWin ) return 0; /* Restriction (25) */
127631 0 35 if( pSub->pLimit && p->pLimit ) return 0; /* Restriction (13) */
0 0 if( pSub->pLimit && p->pLimit ) return 0; /* Restriction (13) */
127632 0 35 if( pSub->pLimit && pSub->pLimit->pRight ) return 0; /* Restriction (14) */
0 0 if( pSub->pLimit && pSub->pLimit->pRight ) return 0; /* Restriction (14) */
127633 0 35 if( (p->selFlags & SF_Compound)!=0 && pSub->pLimit ){
0 0 if( (p->selFlags & SF_Compound)!=0 && pSub->pLimit ){
127636 22 13 if( pSubSrc->nSrc==0 ) return 0; /* Restriction (7) */
127637 0 13 if( pSub->selFlags & SF_Distinct ) return 0; /* Restriction (4) */
127638 0 13 if( pSub->pLimit && (pSrc->nSrc>1 || isAgg) ){
0 0 if( pSub->pLimit && (pSrc->nSrc>1 || isAgg) ){
0 0 if( pSub->pLimit && (pSrc->nSrc>1 || isAgg) ){
127641 13 0 if( p->pOrderBy && pSub->pOrderBy ){
0 13 if( p->pOrderBy && pSub->pOrderBy ){
127644 0 13 if( isAgg && pSub->pOrderBy ) return 0; /* Restriction (16) */
0 0 if( isAgg && pSub->pOrderBy ) return 0; /* Restriction (16) */
127645 0 13 if( pSub->pLimit && p->pWhere ) return 0; /* Restriction (19) */
0 0 if( pSub->pLimit && p->pWhere ) return 0; /* Restriction (19) */
127646 0 13 if( pSub->pLimit && (p->selFlags & SF_Distinct)!=0 ){
0 0 if( pSub->pLimit && (p->selFlags & SF_Distinct)!=0 ){
127649 0 13 if( pSub->selFlags & (SF_Recursive) ){
127673 0 13 if( (pSubitem->fg.jointype & JT_OUTER)!=0 ){
127675 0 0 if( pSubSrc->nSrc>1 || isAgg || IsVirtual(pSubSrc->a[0].pTab) ){
0 0 if( pSubSrc->nSrc>1 || isAgg || IsVirtual(pSubSrc->a[0].pTab) ){
0 0 if( pSubSrc->nSrc>1 || isAgg || IsVirtual(pSubSrc->a[0].pTab) ){
127695 0 13 if( pSub->pPrior ){
127696 0 0 if( pSub->pOrderBy ){
127699 0 0 if( isAgg || (p->selFlags & SF_Distinct)!=0 || pSrc->nSrc!=1 ){
0 0 if( isAgg || (p->selFlags & SF_Distinct)!=0 || pSrc->nSrc!=1 ){
0 0 if( isAgg || (p->selFlags & SF_Distinct)!=0 || pSrc->nSrc!=1 ){
127702 0 0 for(pSub1=pSub; pSub1; pSub1=pSub1->pPrior){
127707 0 0 if( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))!=0 /* (17b) */
127708 0 0 || (pSub1->pPrior && pSub1->op!=TK_ALL) /* (17a) */
0 0 || (pSub1->pPrior && pSub1->op!=TK_ALL) /* (17a) */
127709 0 0 || pSub1->pSrc->nSrc<1 /* (17c) */
127717 0 0 if( p->pOrderBy ){
127719 0 0 for(ii=0; iipOrderBy->nExpr; ii++){
127720 0 0 if( p->pOrderBy->a[ii].u.x.iOrderByCol==0 ) return 0;
127776 0 13 for(pSub=pSub->pPrior; pSub; pSub=pSub->pPrior){
127790 0 0 if( pNew==0 ){
127794 0 0 if( pPrior ) pPrior->pNext = pNew;
127800 0 0 if( db->mallocFailed ) return 1;
127826 13 0 if( ALWAYS(pSubitem->pTab!=0) ){
127828 13 0 if( pTabToDel->nTabRef==1 ){
127829 0 13 Parse *pToplevel = sqlite3ParseToplevel(pParse);
127851 13 13 for(pParent=p; pParent; pParent=pParent->pPrior, pSub=pSub->pPrior){
127858 13 0 if( pSrc ){
127864 0 0 if( pSrc==0 ){
127885 0 13 if( nSubSrc>1 ){
127887 0 0 if( db->mallocFailed ){
127895 13 13 for(i=0; i
127916 0 13 if( pSub->pOrderBy ){
127928 0 0 for(i=0; inExpr; i++){
127936 0 13 if( isLeftJoin>0 ){
127940 13 0 if( db->mallocFailed==0 ){
127961 0 13 if( pSub->pLimit ){
128009 0 2 for(i=0; inConst; i++){
128012 0 0 if( pExpr->iTable==pColumn->iTable
128013 0 0 && pExpr->iColumn==pColumn->iColumn
128022 0 2 if( pConst->apExpr==0 ){
128025 0 2 if( ExprHasProperty(pValue, EP_FixedCol) ) pValue = pValue->pLeft;
128039 0 7 if( pExpr==0 ) return;
128040 0 7 if( ExprHasProperty(pExpr, EP_FromJoin) ) return;
128041 2 5 if( pExpr->op==TK_AND ){
128046 0 5 if( pExpr->op!=TK_EQ ) return;
128051 3 2 if( pRight->op==TK_COLUMN
128052 3 0 && !ExprHasProperty(pRight, EP_FixedCol)
128053 0 3 && sqlite3ExprIsConstant(pLeft)
128054 0 0 && sqlite3IsBinary(sqlite3BinaryCompareCollSeq(pConst->pParse,pLeft,pRight))
128058 5 0 if( pLeft->op==TK_COLUMN
128059 5 0 && !ExprHasProperty(pLeft, EP_FixedCol)
128060 2 3 && sqlite3ExprIsConstant(pRight)
128061 2 0 && sqlite3IsBinary(sqlite3BinaryCompareCollSeq(pConst->pParse,pLeft,pRight))
128076 8 6 if( pExpr->op!=TK_COLUMN ) return WRC_Continue;
128077 0 6 if( ExprHasProperty(pExpr, EP_FixedCol) ) return WRC_Continue;
128079 6 6 for(i=0; inConst; i++){
128081 2 4 if( pColumn==pExpr ) continue;
128082 2 2 if( pColumn->iTable!=pExpr->iTable ) continue;
128083 2 0 if( pColumn->iColumn!=pExpr->iColumn ) continue;
128145 2 1 if( x.nConst ){
128157 0 3 }while( x.nChng );
128224 3 22 if( pWhere==0 ) return 0;
128225 0 22 if( pSubq->selFlags & SF_Recursive ) return 0; /* restriction (2) */
128228 0 22 if( pSubq->pWin ) return 0; /* restriction (6) */
128244 0 22 if( pSubq->pLimit!=0 ){
128247 3 22 while( pWhere->op==TK_AND ){
128252 0 22 if( isLeftJoin
128253 0 0 && (ExprHasProperty(pWhere,EP_FromJoin)==0
128254 0 0 || pWhere->iRightJoinTable!=iCursor)
128258 0 22 if( ExprHasProperty(pWhere,EP_FromJoin) && pWhere->iRightJoinTable!=iCursor ){
0 0 if( ExprHasProperty(pWhere,EP_FromJoin) && pWhere->iRightJoinTable!=iCursor ){
128261 22 0 if( sqlite3ExprIsTableConstant(pWhere, iCursor) ){
128263 101 22 while( pSubq ){
128273 0 101 if( pSubq->selFlags & SF_Aggregate ){
128310 48 72 if( pEList==0 || pEList->nExpr!=1 ) return eRet;
0 48 if( pEList==0 || pEList->nExpr!=1 ) return eRet;
128312 0 48 if( sqlite3StrICmp(zFunc, "min")==0 ){
128315 14 34 }else if( sqlite3StrICmp(zFunc, "max")==0 ){
128323 14 0 if( pOrderBy ) pOrderBy->a[0].sortOrder = sortOrder;
128344 98 22 if( p->pWhere || p->pEList->nExpr!=1
98 0 if( p->pWhere || p->pEList->nExpr!=1
128345 98 0 || p->pSrc->nSrc!=1 || p->pSrc->a[0].pSelect
0 98 || p->pSrc->nSrc!=1 || p->pSrc->a[0].pSelect
128353 0 98 if( IsVirtual(pTab) ) return 0;
128354 0 98 if( pExpr->op!=TK_AGG_FUNCTION ) return 0;
128355 0 98 if( NEVER(pAggInfo->nFunc==0) ) return 0;
128356 89 9 if( (pAggInfo->aFunc[0].pFunc->funcFlags&SQLITE_FUNC_COUNT)==0 ) return 0;
128357 0 9 if( pExpr->flags&EP_Distinct ) return 0;
128370 4091 0 if( pFrom->pTab && pFrom->fg.isIndexedBy ){
0 4091 if( pFrom->pTab && pFrom->fg.isIndexedBy ){
128374 0 0 for(pIdx=pTab->pIndex;
128375 0 0 pIdx && sqlite3StrICmp(pIdx->zName, zIndexedBy);
128378 0 0 if( !pIdx ){
128418 4 4 if( p->pPrior==0 ) return WRC_Continue;
128419 4 0 if( p->pOrderBy==0 ) return WRC_Continue;
128420 0 0 for(pX=p; pX && (pX->op==TK_ALL || pX->op==TK_SELECT); pX=pX->pPrior){}
0 0 for(pX=p; pX && (pX->op==TK_ALL || pX->op==TK_SELECT); pX=pX->pPrior){}
0 0 for(pX=p; pX && (pX->op==TK_ALL || pX->op==TK_SELECT); pX=pX->pPrior){}
128421 0 0 if( pX==0 ) return WRC_Continue;
128423 0 0 for(i=p->pOrderBy->nExpr-1; i>=0; i--){
128424 0 0 if( a[i].pExpr->flags & EP_Collate ) break;
128426 0 0 if( i<0 ) return WRC_Continue;
128433 0 0 if( pNew==0 ) return WRC_Abort;
128436 0 0 if( pNewSrc==0 ) return WRC_Abort;
128463 0 1065 if( pFrom->fg.isTabFunc ){
128487 677 466 if( pItem->zDatabase==0 && (zName = pItem->zName)!=0 ){
642 35 if( pItem->zDatabase==0 && (zName = pItem->zName)!=0 ){
128489 0 642 for(p=pWith; p; p=p->pOuter){
128491 0 0 for(i=0; inCte; i++){
128492 0 0 if( sqlite3StrICmp(zName, p->a[i].zName)==0 ){
128514 0 1574 if( pWith ){
128518 0 0 if( bFree ) pParse->pWithToFree = pWith;
128549 0 1143 if( pCte ){
128561 0 0 if( pCte->zCteErr ){
128565 0 0 if( cannotBeFunction(pParse, pFrom) ) return SQLITE_ERROR;
128569 0 0 if( pTab==0 ) return WRC_Abort;
128576 0 0 if( db->mallocFailed ) return SQLITE_NOMEM_BKPT;
128581 0 0 bMayRecursive = ( pSel->op==TK_ALL || pSel->op==TK_UNION );
0 0 bMayRecursive = ( pSel->op==TK_ALL || pSel->op==TK_UNION );
128582 0 0 if( bMayRecursive ){
128585 0 0 for(i=0; inSrc; i++){
128587 0 0 if( pItem->zDatabase==0
128588 0 0 && pItem->zName!=0
128589 0 0 && 0==sqlite3StrICmp(pItem->zName, pCte->zName)
128600 0 0 if( pTab->nTabRef>2 ){
128612 0 0 if( bMayRecursive ){
128623 0 0 for(pLeft=pSel; pLeft->pPrior; pLeft=pLeft->pPrior);
128625 0 0 if( pCte->pCols ){
128626 0 0 if( pEList && pEList->nExpr!=pCte->pCols->nExpr ){
0 0 if( pEList && pEList->nExpr!=pCte->pCols->nExpr ){
128637 0 0 if( bMayRecursive ){
128638 0 0 if( pSel->selFlags & SF_Recursive ){
128664 0 1574 if( OK_IF_ALWAYS_TRUE(pParse->pWith) && p->pPrior==0 ){
0 0 if( OK_IF_ALWAYS_TRUE(pParse->pWith) && p->pPrior==0 ){
128666 0 0 if( pWith!=0 ){
128689 0 35 if( pTab==0 ) return SQLITE_NOMEM;
128691 2 33 if( pFrom->zAlias ){
128696 75 35 while( pSel->pPrior ){ pSel = pSel->pPrior; }
128741 0 1609 if( db->mallocFailed ){
128745 35 1574 if( (selFlags & SF_Expanded)!=0 ){
128761 1143 1574 for(i=0, pFrom=pTabList->a; inSrc; i++, pFrom++){
128764 0 1143 if( pFrom->fg.isRecursive ) continue;
128767 0 1143 if( withExpand(pWalker, pFrom) ) return WRC_Abort;
128768 1143 0 if( pFrom->pTab ) {} else
128770 35 1108 if( pFrom->zName==0 ){
128776 0 35 if( sqlite3WalkSelect(pWalker, pSel) ) return WRC_Abort;
128777 0 35 if( sqlite3ExpandSubquery(pParse, pFrom) ) return WRC_Abort;
128783 0 1108 if( pTab==0 ) return WRC_Abort;
128784 0 1108 if( pTab->nTabRef>=0xffff ){
128791 1065 43 if( !IsVirtual(pTab) && cannotBeFunction(pParse, pFrom) ){
0 1065 if( !IsVirtual(pTab) && cannotBeFunction(pParse, pFrom) ){
128795 1065 43 if( IsVirtual(pTab) || pTab->pSelect ){
0 1065 if( IsVirtual(pTab) || pTab->pSelect ){
128797 0 43 if( sqlite3ViewGetColumnNames(pParse, pTab) ) return WRC_Abort;
128809 0 1143 if( sqlite3IndexedByLookup(pParse, pFrom) ){
128816 1574 0 if( db->mallocFailed || sqliteProcessJoin(pParse, p) ){
0 1574 if( db->mallocFailed || sqliteProcessJoin(pParse, p) ){
128831 2796 1489 for(k=0; knExpr; k++){
128833 82 2714 if( pE->op==TK_ASTERISK ) break;
128836 18 2696 if( pE->op==TK_DOT && pE->pRight->op==TK_ASTERISK ) break;
3 15 if( pE->op==TK_DOT && pE->pRight->op==TK_ASTERISK ) break;
128839 85 1489 if( knExpr ){
128849 1 84 && (flags & SQLITE_ShortColNames)==0;
1 0 && (flags & SQLITE_ShortColNames)==0;
128851 90 85 for(k=0; knExpr; k++){
128856 8 82 if( pE->op!=TK_ASTERISK
128857 6 2 && (pE->op!=TK_DOT || pRight->op!=TK_ASTERISK)
3 3 && (pE->op!=TK_DOT || pRight->op!=TK_ASTERISK)
128862 5 0 if( pNew ){
128874 3 82 if( pE->op==TK_DOT ){
128879 85 85 for(i=0, pFrom=pTabList->a; inSrc; i++, pFrom++){
128885 85 0 if( zTabName==0 ){
128888 0 85 if( db->mallocFailed ) break;
128889 13 72 if( pSub==0 || (pSub->selFlags & SF_NestedFrom)==0 ){
13 0 if( pSub==0 || (pSub->selFlags & SF_NestedFrom)==0 ){
128891 3 82 if( zTName && sqlite3StrICmp(zTName, zTabName)!=0 ){
0 3 if( zTName && sqlite3StrICmp(zTName, zTabName)!=0 ){
128895 72 13 zSchemaName = iDb>=0 ? db->aDb[iDb].zDbSName : "*";
128897 269 85 for(j=0; jnCol; j++){
128904 9 260 if( zTName && pSub
0 9 if( zTName && pSub
128905 0 0 && sqlite3MatchSpanName(pSub->pEList->a[j].zSpan, 0, zTName, 0)==0
128914 269 0 if( (p->selFlags & SF_IncludeHidden)==0
128915 6 263 && IsHiddenColumn(&pTab->aCol[j])
128921 0 263 if( i>0 && zTName==0 ){
0 0 if( i>0 && zTName==0 ){
128922 0 0 if( (pFrom->fg.jointype & JT_NATURAL)!=0
128923 0 0 && tableAndColumnIndex(pTabList, i, zName, 0, 0)
128929 0 0 if( sqlite3IdListIndex(pFrom->pUsing, zName)>=0 ){
128938 260 3 if( longNames || pTabList->nSrc>1 ){
0 260 if( longNames || pTabList->nSrc>1 ){
128942 3 0 if( zSchemaName ){
128946 3 0 if( longNames ){
128956 263 0 if( pNew && (p->selFlags & SF_NestedFrom)!=0 ){
0 263 if( pNew && (p->selFlags & SF_NestedFrom)!=0 ){
128958 0 0 if( pSub ){
128971 0 85 if( !tableSeen ){
128972 0 0 if( zTName ){
128983 1574 0 if( p->pEList ){
128984 0 1574 if( p->pEList->nExpr>db->aLimit[SQLITE_LIMIT_COLUMN] ){
128988 549 1025 if( (elistFlags & (EP_HasFunc|EP_Subquery))!=0 ){
129045 2 1438 if( OK_IF_ALWAYS_TRUE(pParse->hasCompound) ){
129077 0 1574 if( p->selFlags & SF_HasTypeInfo ) return;
129081 1143 1574 for(i=0, pFrom=pTabList->a; inSrc; i++, pFrom++){
129084 35 1108 if( (pTab->tabFlags & TF_Ephemeral)!=0 ){
129087 35 0 if( pSel ){
129088 75 35 while( pSel->pPrior ) pSel = pSel->pPrior;
129134 0 1628 if( pParse->db->mallocFailed ) return;
129135 188 1440 if( p->selFlags & SF_HasTypeInfo ) return;
129137 1440 0 if( pParse->nErr || pParse->db->mallocFailed ) return;
0 1440 if( pParse->nErr || pParse->db->mallocFailed ) return;
129139 1440 0 if( pParse->nErr || pParse->db->mallocFailed ) return;
0 1440 if( pParse->nErr || pParse->db->mallocFailed ) return;
129156 0 124 if( nReg==0 ) return;
129171 124 124 for(pFunc=pAggInfo->aFunc, i=0; inFunc; i++, pFunc++){
129172 0 124 if( pFunc->iDistinct>=0 ){
129175 0 0 if( pE->x.pList==0 || pE->x.pList->nExpr!=1 ){
0 0 if( pE->x.pList==0 || pE->x.pList->nExpr!=1 ){
129196 124 124 for(i=0, pF=pAggInfo->aFunc; inFunc; i++, pF++){
129199 50 74 sqlite3VdbeAddOp2(v, OP_AggFinal, pF->iMem, pList ? pList->nExpr : 0);
129223 124 124 for(i=0, pF=pAggInfo->aFunc; inFunc; i++, pF++){
129229 50 74 if( pList ){
129237 0 124 if( pF->iDistinct>=0 ){
129243 14 110 if( pF->pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL ){
129248 21 7 for(j=0, pItem=pList->a; !pColl && j
14 7 for(j=0, pItem=pList->a; !pColl && j
129251 7 7 if( !pColl ){
129254 14 0 if( regHit==0 && pAggInfo->nAccumulator ) regHit = ++pParse->nMem;
0 14 if( regHit==0 && pAggInfo->nAccumulator ) regHit = ++pParse->nMem;
129261 0 124 if( addrNext ){
129265 124 0 if( regHit==0 && pAggInfo->nAccumulator ){
7 117 if( regHit==0 && pAggInfo->nAccumulator ){
129268 7 117 if( regHit ){
129271 8 124 for(i=0, pC=pAggInfo->aCol; inAccumulator; i++, pC++){
129275 7 117 if( addrHitTest ){
129290 0 9 if( pParse->explain==2 ){
129291 0 0 int bCover = (pIdx!=0 && (HasRowid(pTab) || !IsPrimaryKeyIndex(pIdx)));
0 0 int bCover = (pIdx!=0 && (HasRowid(pTab) || !IsPrimaryKeyIndex(pIdx)));
0 0 int bCover = (pIdx!=0 && (HasRowid(pTab) || !IsPrimaryKeyIndex(pIdx)));
129292 0 0 sqlite3VdbeExplain(pParse, 0, "SCAN TABLE %s%s%s",
0 0 sqlite3VdbeExplain(pParse, 0, "SCAN TABLE %s%s%s",
129315 5 0 if( pExpr->op!=TK_AND ){
129317 0 5 if( sqlite3ExprIsConstantOrGroupBy(pWalker->pParse, pExpr, pS->pGroupBy) ){
129320 0 0 if( pNew ){
129373 0 0 for(pItem = pTabList->a; pItem
129374 0 0 if( pItem->pSelect==0 ) continue;
129375 0 0 if( pItem->fg.viaCoroutine ) continue;
129376 0 0 if( pItem->zName==0 ) continue;
129377 0 0 if( sqlite3_stricmp(pItem->zDatabase, pThis->zDatabase)!=0 ) continue;
129378 0 0 if( sqlite3_stricmp(pItem->zName, pThis->zName)!=0 ) continue;
129379 0 0 if( sqlite3ExprCompare(0,
129513 1628 0 if( p==0 || db->mallocFailed || pParse->nErr ){
1628 0 if( p==0 || db->mallocFailed || pParse->nErr ){
0 1628 if( p==0 || db->mallocFailed || pParse->nErr ){
129516 0 1628 if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1;
129529 8 1620 if( IgnorableOrderby(pDest) ){
129541 1628 0 if( pParse->nErr || db->mallocFailed ){
1628 0 if( pParse->nErr || db->mallocFailed ){
129552 1438 190 if( pDest->eDest==SRT_Output ){
129557 0 1628 if( sqlite3WindowRewrite(pParse, p) ){
129576 2694 77 for(i=0; !p->pPrior && inSrc; i++){
1143 1551 for(i=0; !p->pPrior && inSrc; i++){
129584 0 1143 if( (pItem->fg.jointype & JT_LEFT)!=0
129585 0 0 && sqlite3ExprImpliesNonNullRow(p->pWhere, pItem->iCursor)
129586 0 0 && OptimizationEnabled(db, SQLITE_SimplifyJoin)
129595 1108 35 if( pSub==0 ) continue;
129599 0 35 if( pTab->nCol!=pSub->pEList->nExpr ){
129612 0 35 if( (pSub->selFlags & SF_Aggregate)!=0 ) continue;
129633 0 35 if( pSub->pOrderBy!=0
129634 0 0 && i==0
129635 0 0 && (p->selFlags & SF_ComplexResult)!=0
129636 0 0 && (pTabList->nSrc==1
129637 0 0 || (pTabList->a[1].fg.jointype&(JT_LEFT|JT_CROSS))!=0)
129642 13 22 if( flattenSubquery(pParse, p, i, isAgg) ){
129647 0 35 if( db->mallocFailed ) goto select_end;
129648 35 0 if( !IgnorableOrderby(pDest) ){
129658 77 1551 if( p->pPrior ){
129666 24 53 if( p->pNext==0 ) ExplainQueryPlanPop(pParse);
129676 3 1548 if( pTabList->nSrc>1
129677 3 0 && OptimizationEnabled(db, SQLITE_PropagateConst)
129704 1130 1551 for(i=0; inSrc; i++){
129728 80 1050 if( pItem->colUsed==0 ){
129736 1108 22 if( pSub==0 ) continue;
129744 0 22 if( pItem->addrFillSub ){
129745 0 0 if( pItem->fg.viaCoroutine==0 ){
129767 22 0 if( OptimizationEnabled(db, SQLITE_PushDown)
129794 22 0 if( i==0
129795 0 22 && (pTabList->nSrc==1
129796 0 0 || (pTabList->a[1].fg.jointype&(JT_LEFT|JT_CROSS))!=0) /* (1) */
129831 0 0 if( pItem->fg.isCorrelated==0 ){
129841 0 0 if( pPrior ){
129851 0 0 if( onceAddr ) sqlite3VdbeJumpHere(v, onceAddr);
129857 0 22 if( db->mallocFailed ) goto select_end;
129893 2 1549 if( (p->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct
129894 0 2 && sqlite3ExprListCompare(sSort.pOrderBy, pEList, -1)==0
129919 491 1060 if( sSort.pOrderBy ){
129935 0 1551 if( pDest->eDest==SRT_EphemTab ){
129942 1551 0 if( (p->selFlags & SF_FixedLimit)==0 ){
129946 1533 18 if( p->iLimit==0 && sSort.addrSortIndex>=0 ){
490 1043 if( p->iLimit==0 && sSort.addrSortIndex>=0 ){
129953 2 1549 if( p->selFlags & SF_Distinct ){
129965 1418 133 if( !isAgg && pGroupBy==0 ){
1418 0 if( !isAgg && pGroupBy==0 ){
129967 2 1416 u16 wctrlFlags = (sDistinct.isTnct ? WHERE_WANT_DISTINCT : 0)
129971 0 1418 if( pWin ){
129982 0 1418 if( pWInfo==0 ) goto select_end;
129983 1417 1 if( sqlite3WhereOutputRowCount(pWInfo) < p->nSelectRow ){
129986 2 1416 if( sDistinct.isTnct && sqlite3WhereIsDistinct(pWInfo) ){
0 2 if( sDistinct.isTnct && sqlite3WhereIsDistinct(pWInfo) ){
129989 489 929 if( sSort.pOrderBy ){
129992 417 72 if( sSort.nOBSat==sSort.pOrderBy->nExpr ){
130001 489 929 if( sSort.addrSortIndex>=0 && sSort.pOrderBy==0 ){
417 72 if( sSort.addrSortIndex>=0 && sSort.pOrderBy==0 ){
130007 0 1418 if( pWin ){
130055 13 120 if( pGroupBy ){
130059 16 13 for(k=p->pEList->nExpr, pItem=p->pEList->a; k>0; k--, pItem++){
130062 13 13 for(k=pGroupBy->nExpr, pItem=pGroupBy->a; k>0; k--, pItem++){
130066 12 1 if( p->nSelectRow>66 ) p->nSelectRow = 66;
130080 120 13 if( sqlite3ExprListCompare(pGroupBy, sSort.pOrderBy, -1)==0 ){
130097 13 120 sAggInfo.nSortingColumn = pGroupBy ? pGroupBy->nExpr : 0;
130101 5 128 if( pHaving ){
130102 5 0 if( pGroupBy ){
130112 120 13 if( p->pGroupBy==0 && p->pHaving==0 && sAggInfo.nFunc==1 ){
120 0 if( p->pGroupBy==0 && p->pHaving==0 && sAggInfo.nFunc==1 ){
120 0 if( p->pGroupBy==0 && p->pHaving==0 && sAggInfo.nFunc==1 ){
130117 133 133 for(i=0; i
130124 0 133 if( db->mallocFailed ) goto select_end;
130147 13 120 if( pGroupBy ){
130192 0 13 pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pGroupBy, 0,
130195 0 13 if( pWInfo==0 ) goto select_end;
130196 0 13 if( sqlite3WhereIsOrdered(pWInfo)==pGroupBy->nExpr ){
130213 0 13 explainTempTable(pParse,
130214 0 0 (sDistinct.isTnct && (p->selFlags&SF_Distinct)==0) ?
130221 10 13 for(i=0; i
130222 3 7 if( sAggInfo.aCol[i].iSorterColumn>=j ){
130230 10 13 for(i=0; i
130232 3 7 if( pCol->iSorterColumn>=j ){
130260 0 13 if( orderByGrp && OptimizationEnabled(db, SQLITE_GroupByOrder)
0 0 if( orderByGrp && OptimizationEnabled(db, SQLITE_GroupByOrder)
130261 0 0 && (groupBySort || sqlite3WhereIsSorted(pWInfo))
0 0 && (groupBySort || sqlite3WhereIsSorted(pWInfo))
130273 13 0 if( groupBySort ){
130277 13 13 for(j=0; jnExpr; j++){
130278 13 0 if( groupBySort ){
130317 13 0 if( groupBySort ){
130371 9 111 if( (pTab = isSimpleCount(p, &sAggInfo))!=0 ){
130404 0 9 if( !HasRowid(pTab) ) pBest = sqlite3PrimaryKeyIndex(pTab);
130405 0 9 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
130406 0 0 if( pIdx->bUnordered==0
130407 0 0 && pIdx->szIdxRowszTabRow
130408 0 0 && pIdx->pPartIdxWhere==0
130409 0 0 && (!pBest || pIdx->szIdxRowszIdxRow)
0 0 && (!pBest || pIdx->szIdxRowszIdxRow)
130414 0 9 if( pBest ){
130421 0 9 if( pKeyInfo ){
130437 0 111 if( sAggInfo.nAccumulator ){
130438 0 0 for(i=0; i
130439 0 0 if( sAggInfo.aFunc[i].pFunc->funcFlags&SQLITE_FUNC_NEEDCOLL ) break;
130441 0 0 if( i==sAggInfo.nFunc ){
130465 0 111 if( pWInfo==0 ){
130469 0 111 if( regAcc ) sqlite3VdbeAddOp2(v, OP_Integer, 1, regAcc);
130470 14 97 if( sqlite3WhereIsOrdered(pWInfo)>0 ){
130488 2 1549 if( sDistinct.eTnctType==WHERE_DISTINCT_UNORDERED ){
130495 74 1477 if( sSort.pOrderBy ){
130496 15 59 explainTempTable(pParse,
130579 0 0 if( p->nRow==0 && argv!=0 ){
0 0 if( p->nRow==0 && argv!=0 ){
130584 0 0 if( p->nData + need > p->nAlloc ){
130588 0 0 if( azNew==0 ) goto malloc_failed;
130595 0 0 if( p->nRow==0 ){
130597 0 0 for(i=0; i
130599 0 0 if( z==0 ) goto malloc_failed;
130602 0 0 }else if( (int)p->nColumn!=nCol ){
130613 0 0 if( argv!=0 ){
130614 0 0 for(i=0; i
130615 0 0 if( argv[i]==0 ){
130620 0 0 if( z==0 ) goto malloc_failed;
130659 0 0 if( pnColumn ) *pnColumn = 0;
130660 0 0 if( pnRow ) *pnRow = 0;
130661 0 0 if( pzErrMsg ) *pzErrMsg = 0;
130669 0 0 if( res.azResult==0 ){
130677 0 0 if( (rc&0xff)==SQLITE_ABORT ){
130679 0 0 if( res.zErrMsg ){
130680 0 0 if( pzErrMsg ){
130690 0 0 if( rc!=SQLITE_OK ){
130694 0 0 if( res.nAlloc>res.nData ){
130697 0 0 if( azNew==0 ){
130705 0 0 if( pnColumn ) *pnColumn = res.nColumn;
130706 0 0 if( pnRow ) *pnRow = res.nRow;
130716 0 0 if( azResult ){
130721 0 0 for(i=1; i
0 0 for(i=1; i
130749 0 0 while( pTriggerStep ){
130782 0 2948 if( pParse->disableTriggers ){
130786 608 2340 if( pTmpSchema!=pTab->pSchema ){
130789 0 608 for(p=sqliteHashFirst(&pTmpSchema->trigHash); p; p=sqliteHashNext(p)){
130791 0 0 if( pTrig->pTabSchema==pTab->pSchema
130792 0 0 && 0==sqlite3StrICmp(pTrig->table, pTab->zName)
130794 0 0 pTrig->pNext = (pList ? pList : pTab->pTrigger);
130800 2948 0 return (pList ? pList : pTab->pTrigger);
130835 0 0 if( isTemp ){
130837 0 0 if( pName2->n>0 ){
130846 0 0 if( iDb<0 ){
130850 0 0 if( !pTableName || db->mallocFailed ){
0 0 if( !pTableName || db->mallocFailed ){
130862 0 0 if( db->init.busy && iDb!=1 ){
0 0 if( db->init.busy && iDb!=1 ){
130873 0 0 if( db->init.busy==0 && pName2->n==0 && pTab
0 0 if( db->init.busy==0 && pName2->n==0 && pTab
0 0 if( db->init.busy==0 && pName2->n==0 && pTab
130874 0 0 && pTab->pSchema==db->aDb[1].pSchema ){
130879 0 0 if( db->mallocFailed ) goto trigger_cleanup;
130882 0 0 if( sqlite3FixSrcList(&sFix, pTableName) ){
130886 0 0 if( !pTab ){
130888 0 0 if( db->init.iDb==1 ){
130901 0 0 if( IsVirtual(pTab) ){
130909 0 0 if( !zName || SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){
0 0 if( !zName || SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){
130913 0 0 if( !IN_RENAME_OBJECT ){
130914 0 0 if( sqlite3HashFind(&(db->aDb[iDb].pSchema->trigHash),zName) ){
130915 0 0 if( !noErr ){
130926 0 0 if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 ){
130934 0 0 if( pTab->pSelect && tr_tm!=TK_INSTEAD ){
0 0 if( pTab->pSelect && tr_tm!=TK_INSTEAD ){
130935 0 0 sqlite3ErrorMsg(pParse, "cannot create %s trigger on view: %S",
130939 0 0 if( !pTab->pSelect && tr_tm==TK_INSTEAD ){
0 0 if( !pTab->pSelect && tr_tm==TK_INSTEAD ){
130946 0 0 if( !IN_RENAME_OBJECT ){
130950 0 0 const char *zDbTrig = isTemp ? db->aDb[1].zDbSName : zDb;
130951 0 0 if( iTabDb==1 || isTemp ) code = SQLITE_CREATE_TEMP_TRIGGER;
0 0 if( iTabDb==1 || isTemp ) code = SQLITE_CREATE_TEMP_TRIGGER;
130952 0 0 if( sqlite3AuthCheck(pParse, code, zName, pTab->zName, zDbTrig) ){
130955 0 0 if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(iTabDb),0,zDb)){
0 0 if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(iTabDb),0,zDb)){
130966 0 0 if (tr_tm == TK_INSTEAD){
130972 0 0 if( pTrigger==0 ) goto trigger_cleanup;
130979 0 0 pTrigger->tr_tm = tr_tm==TK_BEFORE ? TRIGGER_BEFORE : TRIGGER_AFTER;
130980 0 0 if( IN_RENAME_OBJECT ){
130997 0 0 if( !pParse->pNewTrigger ){
131021 0 0 if( NEVER(pParse->nErr) || !pTrig ) goto triggerfinish_cleanup;
0 0 if( NEVER(pParse->nErr) || !pTrig ) goto triggerfinish_cleanup;
131025 0 0 while( pStepList ){
131031 0 0 if( sqlite3FixTriggerStep(&sFix, pTrig->step_list)
131032 0 0 || sqlite3FixExpr(&sFix, pTrig->pWhen)
131038 0 0 if( IN_RENAME_OBJECT ){
131048 0 0 if( !db->init.busy ){
131054 0 0 if( v==0 ) goto triggerfinish_cleanup;
131068 0 0 if( db->init.busy ){
131073 0 0 if( pTrig ){
131075 0 0 }else if( pLink->pSchema==pLink->pTabSchema ){
131097 0 0 if( z ) for(i=0; z[i]; i++) if( sqlite3Isspace(z[i]) ) z[i] = ' ';
0 0 if( z ) for(i=0; z[i]; i++) if( sqlite3Isspace(z[i]) ) z[i] = ' ';
0 0 if( z ) for(i=0; z[i]; i++) if( sqlite3Isspace(z[i]) ) z[i] = ' ';
131115 0 0 if( pTriggerStep==0 ) {
131143 0 0 if( pTriggerStep ){
131150 0 0 if( IN_RENAME_OBJECT ){
131180 0 0 if( pTriggerStep ){
131181 0 0 if( IN_RENAME_OBJECT ){
131219 0 0 if( pTriggerStep ){
131220 0 0 if( IN_RENAME_OBJECT ){
131252 0 0 if( pTriggerStep ){
131253 0 0 if( IN_RENAME_OBJECT ){
131269 5710 0 if( pTrigger==0 ) return;
131293 0 0 if( db->mallocFailed ) goto drop_trigger_cleanup;
131294 0 0 if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){
131302 0 0 for(i=OMIT_TEMPDB; inDb; i++){
131303 0 0 int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */
131304 0 0 if( zDb && sqlite3StrICmp(db->aDb[j].zDbSName, zDb) ) continue;
0 0 if( zDb && sqlite3StrICmp(db->aDb[j].zDbSName, zDb) ) continue;
131307 0 0 if( pTrigger ) break;
131309 0 0 if( !pTrigger ){
131310 0 0 if( !noErr ){
131351 0 0 const char *zTab = SCHEMA_TABLE(iDb);
131352 0 0 if( iDb==1 ) code = SQLITE_DROP_TEMP_TRIGGER;
131363 0 0 if( (v = sqlite3GetVdbe(pParse))!=0 ){
131383 0 0 if( ALWAYS(pTrigger) ){
131384 0 0 if( pTrigger->pSchema==pTrigger->pTabSchema ){
131387 0 0 for(pp=&pTab->pTrigger; *pp!=pTrigger; pp=&((*pp)->pNext));
131406 0 0 if( pIdList==0 || NEVER(pEList==0) ) return 1;
0 0 if( pIdList==0 || NEVER(pEList==0) ) return 1;
131407 0 0 for(e=0; enExpr; e++){
131408 0 0 if( sqlite3IdListIndex(pIdList, pEList->a[e].zName)>=0 ) return 1;
131430 2943 0 if( (pParse->db->flags & SQLITE_EnableTrigger)!=0 ){
131434 0 2943 for(p=pList; p; p=p->pNext){
131435 0 0 if( p->op==op && checkColumnOverlap(p->pColumns, pChanges) ){
0 0 if( p->op==op && checkColumnOverlap(p->pColumns, pChanges) ){
131439 2885 58 if( pMask ){
131442 0 2943 return (mask ? pList : 0);
131464 0 0 if( pSrc ){
131468 0 0 if( iDb==0 || iDb>=2 ){
0 0 if( iDb==0 || iDb>=2 ){
131494 0 0 for(pStep=pStepList; pStep; pStep=pStep->pNext){
131508 0 0 pParse->eOrconf = (orconf==OE_Default)?pStep->orconf:(u8)orconf;
131512 0 0 if( pStep->zSpan ){
131555 0 0 if( pStep->op!=TK_SELECT ){
131589 0 0 if( pTo->nErr==0 ){
131608 0 0 Parse *pTop = sqlite3ParseToplevel(pParse);
131625 0 0 if( !pPrg ) return 0;
131629 0 0 if( !pProgram ) return 0;
131639 0 0 if( !pSubParse ) return 0;
131650 0 0 if( v ){
131660 0 0 if( pTrigger->zName ){
131670 0 0 if( pTrigger->pWhen ){
131672 0 0 if( SQLITE_OK==sqlite3ResolveExprNames(&sNC, pWhen)
131673 0 0 && db->mallocFailed==0
131685 0 0 if( iEndTrigger ){
131692 0 0 if( db->mallocFailed==0 && pParse->nErr==0 ){
0 0 if( db->mallocFailed==0 && pParse->nErr==0 ){
131723 0 0 Parse *pRoot = sqlite3ParseToplevel(pParse);
131732 0 0 for(pPrg=pRoot->pTriggerPrg;
131733 0 0 pPrg && (pPrg->pTrigger!=pTrigger || pPrg->orconf!=orconf);
0 0 pPrg && (pPrg->pTrigger!=pTrigger || pPrg->orconf!=orconf);
131738 0 0 if( !pPrg ){
131766 0 0 if( pPrg ){
131767 0 0 int bRecursive = (p->zName && 0==(pParse->db->flags&SQLITE_RecTriggers));
0 0 int bRecursive = (p->zName && 0==(pParse->db->flags&SQLITE_RecTriggers));
131840 0 270 for(p=pTrigger; p; p=p->pNext){
131851 0 0 if( p->op==op
131852 0 0 && p->tr_tm==tr_tm
131853 0 0 && checkColumnOverlap(p->pColumns, pChanges)
131894 237 0 const int op = pChanges ? TK_UPDATE : TK_DELETE;
131899 0 237 for(p=pTrigger; p; p=p->pNext){
131900 0 0 if( p->op==op && (tr_tm&p->tr_tm)
0 0 if( p->op==op && (tr_tm&p->tr_tm)
131901 0 0 && checkColumnOverlap(p->pColumns,pChanges)
131905 0 0 if( pPrg ){
131980 2967 0 if( !pTab->pSelect ){
131988 0 2967 if( pValue ){
131993 0 2967 if( pTab->aCol[i].affinity==SQLITE_AFF_REAL ){
132018 0 0 if( iIdxCol>=0 ){
132045 0 0 if( pIdx->pPartIdxWhere==0 ) return 0;
132122 235 0 if( pParse->nErr || db->mallocFailed ){
235 0 if( pParse->nErr || db->mallocFailed ){
132130 0 235 if( pTab==0 ) goto update_cleanup;
132160 0 235 if( sqlite3ViewGetColumnNames(pParse, pTab) ){
132163 0 235 if( sqlite3IsReadOnly(pParse, pTab, tmask) ){
132174 0 235 pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);
132176 0 235 for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){
132177 0 0 if( pPk==pIdx ){
132182 0 235 if( pUpsert ){
132194 0 235 if( aXRef==0 ) goto update_cleanup;
132199 1162 235 for(i=0; inCol; i++) aXRef[i] = -1;
132215 1135 235 for(i=0; inExpr; i++){
132216 0 1135 if( sqlite3ResolveExprNames(&sNC, pChanges->a[i].pExpr) ){
132219 3405 0 for(j=0; jnCol; j++){
132220 1135 2270 if( sqlite3StrICmp(pTab->aCol[j].zName, pChanges->a[i].zName)==0 ){
132221 0 1135 if( j==pTab->iPKey ){
132224 0 1135 }else if( pPk && (pTab->aCol[j].colFlags & COLFLAG_PRIMKEY)!=0 ){
0 0 }else if( pPk && (pTab->aCol[j].colFlags & COLFLAG_PRIMKEY)!=0 ){
132231 0 1135 if( j>=pTab->nCol ){
132232 0 0 if( pPk==0 && sqlite3IsRowid(pChanges->a[i].zName) ){
0 0 if( pPk==0 && sqlite3IsRowid(pChanges->a[i].zName) ){
132245 1135 0 rc = sqlite3AuthCheck(pParse, SQLITE_UPDATE, pTab->zName,
132248 0 1135 if( rc==SQLITE_DENY ){
132250 0 1135 }else if( rc==SQLITE_IGNORE ){
132266 0 235 pTabList->a[0].colUsed = IsVirtual(pTab) ? ALLBITS : 0;
132274 0 235 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
132276 0 0 if( chngKey || hasFK>1 || pIdx==pPk
0 0 if( chngKey || hasFK>1 || pIdx==pPk
0 0 if( chngKey || hasFK>1 || pIdx==pPk
132277 0 0 || indexWhereClauseMightChange(pIdx,aXRef,chngRowid)
132283 0 0 for(i=0; inKeyCol; i++){
132284 0 0 if( indexColumnIsBeingUpdated(pIdx, i, aXRef, chngRowid) ){
132287 0 0 if( (onError==OE_Replace)
132288 0 0 || (onError==OE_Default && pIdx->onError==OE_Replace)
0 0 || (onError==OE_Default && pIdx->onError==OE_Replace)
132296 0 0 if( reg==0 ) aToOpen[j+1] = 0;
132299 0 235 if( bReplace ){
132307 0 235 if( v==0 ) goto update_cleanup;
132308 5 230 if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);
132309 235 0 sqlite3BeginWriteOperation(pParse, pTrigger || hasFK, iDb);
2 233 sqlite3BeginWriteOperation(pParse, pTrigger || hasFK, iDb);
132312 235 0 if( !IsVirtual(pTab) ){
132315 235 0 if( chngPk || pTrigger || hasFK ){
235 0 if( chngPk || pTrigger || hasFK ){
2 233 if( chngPk || pTrigger || hasFK ){
132319 235 0 if( chngKey || pTrigger || hasFK ){
235 0 if( chngKey || pTrigger || hasFK ){
2 233 if( chngKey || pTrigger || hasFK ){
132327 0 235 if( isView ){
132335 0 235 if( isView ){
132347 0 235 if( sqlite3ResolveExprNames(&sNC, pWhere) ){
132353 0 235 if( IsVirtual(pTab) ){
132365 0 235 if( (db->flags&SQLITE_CountRows)!=0
132366 0 0 && !pParse->pTriggerTab
132367 0 0 && !pParse->nested
132368 0 0 && pUpsert==0
132374 235 0 if( HasRowid(pTab) ){
132382 0 0 if( pUpsert==0 ){
132390 0 235 if( pUpsert ){
132408 5 230 if( !pParse->nested && !pTrigger && !hasFK && !chngKey && !bReplace ){
5 0 if( !pParse->nested && !pTrigger && !hasFK && !chngKey && !bReplace ){
3 2 if( !pParse->nested && !pTrigger && !hasFK && !chngKey && !bReplace ){
3 0 if( !pParse->nested && !pTrigger && !hasFK && !chngKey && !bReplace ){
3 0 if( !pParse->nested && !pTrigger && !hasFK && !chngKey && !bReplace ){
132412 0 235 if( pWInfo==0 ) goto update_cleanup;
132425 10 225 if( eOnePass!=ONEPASS_SINGLE ){
132427 3 7 if( eOnePass==ONEPASS_MULTI ){
132429 0 3 if( iCur>=0 && iCur!=iDataCur && aToOpen[iCur-iBaseCur] ){
0 0 if( iCur>=0 && iCur!=iDataCur && aToOpen[iCur-iBaseCur] ){
0 0 if( iCur>=0 && iCur!=iDataCur && aToOpen[iCur-iBaseCur] ){
132437 235 0 if( HasRowid(pTab) ){
132442 7 228 if( eOnePass==ONEPASS_OFF ){
132451 0 0 for(i=0; i
132455 0 0 if( eOnePass ){
132456 0 0 if( addrOpen ) sqlite3VdbeChangeToNoop(v, addrOpen);
132466 235 0 if( pUpsert==0 ){
132467 232 3 if( eOnePass!=ONEPASS_MULTI ){
132471 235 0 if( !isView ){
132475 228 7 if( eOnePass!=ONEPASS_OFF ){
132476 228 0 if( aiCurOnePass[0]>=0 ) aToOpen[aiCurOnePass[0]-iBaseCur] = 0;
132477 0 228 if( aiCurOnePass[1]>=0 ) aToOpen[aiCurOnePass[1]-iBaseCur] = 0;
132480 3 232 if( eOnePass==ONEPASS_MULTI && (nIdx-(aiCurOnePass[1]>=0))>0 ){
0 3 if( eOnePass==ONEPASS_MULTI && (nIdx-(aiCurOnePass[1]>=0))>0 ){
132485 0 235 if( addrOnce ) sqlite3VdbeJumpHere(v, addrOnce);
132489 228 7 if( eOnePass!=ONEPASS_OFF ){
132490 228 0 if( !isView && aiCurOnePass[0]!=iDataCur && aiCurOnePass[1]!=iDataCur ){
0 228 if( !isView && aiCurOnePass[0]!=iDataCur && aiCurOnePass[1]!=iDataCur ){
0 0 if( !isView && aiCurOnePass[0]!=iDataCur && aiCurOnePass[1]!=iDataCur ){
132495 3 225 if( eOnePass!=ONEPASS_SINGLE ){
132498 0 228 sqlite3VdbeAddOp2(v, OP_IsNull, pPk ? regKey : regOldRowid, labelBreak);
132501 0 7 }else if( pPk ){
132521 0 235 if( chngRowid ){
132528 235 0 if( chngPk || hasFK || pTrigger ){
233 2 if( chngPk || hasFK || pTrigger ){
0 233 if( chngPk || hasFK || pTrigger ){
132529 2 0 u32 oldmask = (hasFK ? sqlite3FkOldmask(pParse, pTab) : 0);
132533 6 2 for(i=0; inCol; i++){
132534 6 0 if( oldmask==0xffffffff
132535 6 0 || (i<32 && (oldmask & MASKBIT32(i))!=0)
4 2 || (i<32 && (oldmask & MASKBIT32(i))!=0)
132536 2 2 || (pTab->aCol[i].colFlags & COLFLAG_PRIMKEY)!=0
132544 2 0 if( chngRowid==0 && pPk==0 ){
2 0 if( chngRowid==0 && pPk==0 ){
132565 1162 235 for(i=0; inCol; i++){
132566 2 1160 if( i==pTab->iPKey ){
132570 1135 25 if( j>=0 ){
132572 0 25 }else if( 0==(tmask&TRIGGER_BEFORE) || i>31 || (newmask & MASKBIT32(i)) ){
0 0 }else if( 0==(tmask&TRIGGER_BEFORE) || i>31 || (newmask & MASKBIT32(i)) ){
0 0 }else if( 0==(tmask&TRIGGER_BEFORE) || i>31 || (newmask & MASKBIT32(i)) ){
132590 0 235 if( tmask&TRIGGER_BEFORE ){
132601 0 0 if( pPk ){
132618 0 0 for(i=0; inCol; i++){
132619 0 0 if( aXRef[i]<0 && i!=pTab->iPKey ){
0 0 if( aXRef[i]<0 && i!=pTab->iPKey ){
132625 235 0 if( !isView ){
132635 2 233 if( hasFK ){
132640 235 0 if( bReplace || chngKey ){
0 235 if( bReplace || chngKey ){
132641 0 0 if( pPk ){
132673 235 0 if( hasFK>1 || chngKey ){
0 235 if( hasFK>1 || chngKey ){
132677 235 0 if( bReplace || chngKey ){
0 235 if( bReplace || chngKey ){
132681 2 233 if( hasFK ){
132686 3 232 sqlite3CompleteInsertion(
132695 2 233 if( hasFK ){
132702 0 235 if( regRowCount ){
132712 10 225 if( eOnePass==ONEPASS_SINGLE ){
132714 3 7 }else if( eOnePass==ONEPASS_MULTI ){
132717 0 7 }else if( pPk ){
132729 5 230 if( pParse->nested==0 && pParse->pTriggerTab==0 && pUpsert==0 ){
5 0 if( pParse->nested==0 && pParse->pTriggerTab==0 && pUpsert==0 ){
5 0 if( pParse->nested==0 && pParse->pTriggerTab==0 && pUpsert==0 ){
132737 0 235 if( regRowCount ){
132825 0 0 if( pWInfo==0 ) return;
132828 0 0 for(i=0; inCol; i++){
132829 0 0 if( aXRef[i]>=0 ){
132836 0 0 if( HasRowid(pTab) ){
132838 0 0 if( pRowid ){
132859 0 0 if( eOnePass ){
132879 0 0 if( eOnePass==ONEPASS_OFF ){
132888 0 0 for(i=0; i
132894 0 0 sqlite3VdbeChangeP5(v, onError==OE_Default ? OE_Abort : onError);
132899 0 0 if( eOnePass==ONEPASS_OFF ){
132932 0 2650 if( p ){
132945 0 0 if( p==0 ) return 0;
132966 0 0 if( pNew==0 ){
133016 0 0 if( rc ) return rc;
133018 0 0 if( rc ) return rc;
133024 0 0 if( HasRowid(pTab)
133025 0 0 && pTarget->nExpr==1
133026 0 0 && (pTerm = pTarget->a[0].pExpr)->op==TK_COLUMN
133027 0 0 && pTerm->iColumn==XN_ROWID
133047 0 0 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
133049 0 0 if( !IsUniqueIndex(pIdx) ) continue;
133050 0 0 if( pTarget->nExpr!=pIdx->nKeyCol ) continue;
133051 0 0 if( pIdx->pPartIdxWhere ){
133052 0 0 if( pUpsert->pUpsertTargetWhere==0 ) continue;
133053 0 0 if( sqlite3ExprCompare(pParse, pUpsert->pUpsertTargetWhere,
133059 0 0 for(ii=0; ii
133062 0 0 if( pIdx->aiColumn[ii]==XN_EXPR ){
133066 0 0 if( pExpr->op!=TK_COLLATE ){
133075 0 0 for(jj=0; jj
133076 0 0 if( sqlite3ExprCompare(pParse, pTarget->a[jj].pExpr, pExpr,iCursor)<2 ){
133080 0 0 if( jj>=nn ){
133085 0 0 if( ii
133123 0 0 if( pIdx && iCur!=iDataCur ){
0 0 if( pIdx && iCur!=iDataCur ){
133124 0 0 if( HasRowid(pTab) ){
133136 0 0 for(i=0; i
133203 0 0 if( rc!=SQLITE_OK ) return rc;
133204 0 0 while( SQLITE_ROW==(rc = sqlite3_step(pStmt)) ){
133212 0 0 if( zSubSql
133213 0 0 && (strncmp(zSubSql,"CRE",3)==0 || strncmp(zSubSql,"INS",3)==0)
0 0 && (strncmp(zSubSql,"CRE",3)==0 || strncmp(zSubSql,"INS",3)==0)
133216 0 0 if( rc!=SQLITE_OK ) break;
133220 0 0 if( rc==SQLITE_DONE ) rc = SQLITE_OK;
133221 0 0 if( rc ){
133234 0 0 if( z==0 ) return SQLITE_NOMEM;
133273 0 0 if( v==0 ) return;
133274 0 0 if( pNm ){
133279 0 0 if( iDb<0 ) return;
133290 0 0 if( iDb!=1 ){
133315 0 0 if( !db->autoCommit ){
133319 0 0 if( db->nVdbeActive>1 ){
133358 0 0 if( rc!=SQLITE_OK ) goto end_of_vacuum;
133392 0 0 if( rc!=SQLITE_OK ) goto end_of_vacuum;
133394 0 0 if( rc!=SQLITE_OK ) goto end_of_vacuum;
133397 0 0 if( sqlite3PagerGetJournalMode(sqlite3BtreePager(pMain))
133402 0 0 if( sqlite3BtreeSetPageSize(pTemp, sqlite3BtreeGetPageSize(pMain), nRes, 0)
133403 0 0 || (!isMemDb && sqlite3BtreeSetPageSize(pTemp, db->nextPagesize, nRes, 0))
0 0 || (!isMemDb && sqlite3BtreeSetPageSize(pTemp, db->nextPagesize, nRes, 0))
133404 0 0 || NEVER(db->mallocFailed)
133411 0 0 sqlite3BtreeSetAutoVacuum(pTemp, db->nextAutovac>=0 ? db->nextAutovac :
133425 0 0 if( rc!=SQLITE_OK ) goto end_of_vacuum;
133431 0 0 if( rc!=SQLITE_OK ) goto end_of_vacuum;
133447 0 0 if( rc!=SQLITE_OK ) goto end_of_vacuum;
133461 0 0 if( rc ) goto end_of_vacuum;
133491 0 0 for(i=0; i
133496 0 0 if( NEVER(rc!=SQLITE_OK) ) goto end_of_vacuum;
133500 0 0 if( rc!=SQLITE_OK ) goto end_of_vacuum;
133502 0 0 if( rc!=SQLITE_OK ) goto end_of_vacuum;
133530 0 0 if( pDb ){
133592 0 2510 if( pMod==0 ){
133605 0 2510 if( pDel ){
133629 0 2510 if( sqlite3HashFind(&db->aModule, zName) ){
133635 0 2510 if( rc!=SQLITE_OK && xDestroy ) xDestroy(pAux);
0 0 if( rc!=SQLITE_OK && xDestroy ) xDestroy(pAux);
133693 215 0 for(pVtab=pTab->pVTable; pVtab && pVtab->db!=db; pVtab=pVtab->pNext);
0 215 for(pVtab=pTab->pVTable; pVtab && pVtab->db!=db; pVtab=pVtab->pNext);
133709 9 116 if( pVTab->nRef==0 ){
133711 9 0 if( p ){
133738 0 866 while( pVTable ){
133742 0 0 if( db2==db ){
133772 9 1 for(ppVTab=&p->pVTable; *ppVTab; ppVTab=&(*ppVTab)->pNext){
133773 9 0 if( (*ppVTab)->db==db ){
133810 0 5953 if( p ){
133816 0 0 }while( p );
133835 271 601 if( !db || db->pnBytesFreed==0 ) vtabDisconnectAll(0, p);
265 6 if( !db || db->pnBytesFreed==0 ) vtabDisconnectAll(0, p);
133836 20 852 if( p->azModuleArg ){
133838 110 20 for(i=0; inModuleArg; i++){
133839 90 20 if( i!=1 ) sqlite3DbFree(db, p->azModuleArg[i]);
133855 0 110 if( azModuleArg==0 ){
133882 0 20 if( pTable==0 ) return;
133904 20 0 if( pTable->azModuleArg ){
133919 50 22 if( pParse->sArg.z && pParse->pNewTable ){
50 0 if( pParse->sArg.z && pParse->pNewTable ){
133935 0 20 if( pTab==0 ) return;
133938 0 20 if( pTab->nModuleArg<1 ) return;
133946 10 10 if( !db->init.busy ){
133954 10 0 if( pEnd ){
134002 0 10 if( pOld ){
134027 50 38 if( pArg->z==0 ){
134059 0 10 for(pCtx=db->pVtabCtx; pCtx; pCtx=pCtx->pPrior){
134060 0 0 if( pCtx->pTab==pTab ){
134069 0 10 if( !zModuleName ){
134074 0 10 if( !pVTable ){
134095 0 10 if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);
134098 1 9 if( SQLITE_OK!=rc ){
134099 0 1 if( zErr==0 ){
134106 9 0 }else if( ALWAYS(pVTable->pVtab) ){
134112 0 9 if( sCtx.bDeclared==0 ){
134128 41 9 for(iCol=0; iColnCol; iCol++){
134133 22 19 for(i=0; i
134134 22 0 if( 0==sqlite3StrNICmp("hidden", &zType[i], 6)
134135 0 22 && (i==0 || zType[i-1]==' ')
0 0 && (i==0 || zType[i-1]==' ')
134136 0 22 && (zType[i+6]=='\0' || zType[i+6]==' ')
0 0 && (zType[i+6]=='\0' || zType[i+6]==' ')
134141 22 19 if( i
134143 0 22 int nDel = 6 + (zType[i+6] ? 1 : 0);
134144 22 22 for(j=i; (j+nDel)<=nType; j++){
134147 22 0 if( zType[i]=='\0' && i>0 ){
0 22 if( zType[i]=='\0' && i>0 ){
134178 60 2977 if( !IsVirtual(pTab) || sqlite3GetVTable(db, pTab) ){
60 0 if( !IsVirtual(pTab) || sqlite3GetVTable(db, pTab) ){
134186 0 0 if( !pMod ){
134193 0 0 if( rc!=SQLITE_OK ){
134210 39 0 if( (db->nVTrans%ARRAY_INCR)==0 ){
134214 0 39 if( !aVTrans ){
134259 10 0 if( pMod==0 || pMod->pModule->xCreate==0 || pMod->pModule->xDestroy==0 ){
10 0 if( pMod==0 || pMod->pModule->xCreate==0 || pMod->pModule->xDestroy==0 ){
0 10 if( pMod==0 || pMod->pModule->xCreate==0 || pMod->pModule->xDestroy==0 ){
134268 9 1 if( rc==SQLITE_OK && ALWAYS(sqlite3GetVTable(db, pTab)) ){
9 0 if( rc==SQLITE_OK && ALWAYS(sqlite3GetVTable(db, pTab)) ){
134270 9 0 if( rc==SQLITE_OK ){
134297 9 0 if( !pCtx || pCtx->bDeclared ){
0 9 if( !pCtx || pCtx->bDeclared ){
134309 9 0 if( SQLITE_OK==sqlite3RunParser(&sParse, zCreateTable, &zErr)
134310 9 0 && sParse.pNewTable
134311 9 0 && !db->mallocFailed
134312 9 0 && !sParse.pNewTable->pSelect
134313 9 0 && !IsVirtual(sParse.pNewTable)
134315 9 0 if( !pTab->aCol ){
134325 0 9 if( !HasRowid(pNew)
134326 0 0 && pCtx->pVTable->pMod->pModule->xUpdate!=0
134327 0 0 && sqlite3PrimaryKeyIndex(pNew)->nKeyCol!=1
134334 0 9 if( pIdx ){
134343 0 0 sqlite3ErrorWithMsg(db, SQLITE_ERROR, (zErr ? "%s" : 0), zErr);
134349 9 0 if( sParse.pVdbe ){
134373 0 0 if( pTab!=0 && ALWAYS(pTab->pVTable!=0) ){
0 0 if( pTab!=0 && ALWAYS(pTab->pVTable!=0) ){
134376 0 0 for(p=pTab->pVTable; p; p=p->pNext){
134378 0 0 if( p->pVtab->nRef>0 ){
134387 0 0 if( rc==SQLITE_OK ){
134408 39 2400 if( db->aVTrans ){
134411 39 39 for(i=0; inVTrans; i++){
134414 39 0 if( p ){
134417 38 1 if( x ) x(p);
134440 1911 0 for(i=0; rc==SQLITE_OK && inVTrans; i++){
39 1872 for(i=0; rc==SQLITE_OK && inVTrans; i++){
134443 39 0 if( pVtab && (x = pVtab->pModule->xSync)!=0 ){
38 1 if( pVtab && (x = pVtab->pModule->xSync)!=0 ){
134487 5 40 if( sqlite3VtabInSync(db) ){
0 5 if( sqlite3VtabInSync(db) ){
134490 10 35 if( !pVTab ){
134495 35 0 if( pModule->xBegin ){
134499 5 30 for(i=0; inVTrans; i++){
134500 5 0 if( db->aVTrans[i]==pVTab ){
134508 30 0 if( rc==SQLITE_OK ){
134510 30 0 if( rc==SQLITE_OK ){
134513 0 30 if( iSvpt && pModule->xSavepoint ){
0 0 if( iSvpt && pModule->xSavepoint ){
134543 0 27 if( db->aVTrans ){
134545 0 0 for(i=0; rc==SQLITE_OK && inVTrans; i++){
0 0 for(i=0; rc==SQLITE_OK && inVTrans; i++){
134548 0 0 if( pVTab->pVtab && pMod->iVersion>=2 ){
0 0 if( pVTab->pVtab && pMod->iVersion>=2 ){
134562 0 0 if( xMethod && pVTab->iSavepoint>iSavepoint ){
0 0 if( xMethod && pVTab->iSavepoint>iSavepoint ){
134599 0 545 if( NEVER(pExpr==0) ) return pDef;
134600 409 136 if( pExpr->op!=TK_COLUMN ) return pDef;
134602 0 136 if( pTab==0 ) return pDef;
134603 136 0 if( !IsVirtual(pTab) ) return pDef;
134608 0 0 if( pMod->xFindFunction==0 ) return pDef;
134627 0 0 if( rc==0 ){
134635 0 0 if( pNew==0 ){
134654 0 17 Parse *pToplevel = sqlite3ParseToplevel(pParse);
134659 0 17 for(i=0; inVtabLock; i++){
134660 0 0 if( pTab==pToplevel->apVtabLock[i] ) return;
134664 17 0 if( apVtabLock ){
134692 0 0 if( pMod->pEpoTab ) return 1;
134693 0 0 if( pModule->xCreate!=0 && pModule->xCreate!=pModule->xConnect ) return 0;
0 0 if( pModule->xCreate!=0 && pModule->xCreate!=pModule->xConnect ) return 0;
134695 0 0 if( pTab==0 ) return 0;
134697 0 0 if( pTab->zName==0 ){
134710 0 0 if( rc ){
134725 0 2490 if( pTab!=0 ){
134769 8 0 switch( op ){
134772 0 8 if( !p ){
134776 8 0 p->pVTable->bConstraint = (u8)va_arg(ap, int);
134786 0 8 if( rc!=SQLITE_OK ) sqlite3Error(db, rc);
135411 0 0 if( i==XN_EXPR ) return "";
135412 0 0 if( i==XN_ROWID ) return "rowid";
135435 0 0 if( bAnd ) sqlite3_str_append(pStr, " AND ", 5);
135437 0 0 if( nTerm>1 ) sqlite3_str_append(pStr, "(", 1);
135438 0 0 for(i=0; i
135439 0 0 if( i ) sqlite3_str_append(pStr, ",", 1);
135442 0 0 if( nTerm>1 ) sqlite3_str_append(pStr, ")", 1);
135446 0 0 if( nTerm>1 ) sqlite3_str_append(pStr, "(", 1);
135447 0 0 for(i=0; i
135448 0 0 if( i ) sqlite3_str_append(pStr, ",", 1);
135451 0 0 if( nTerm>1 ) sqlite3_str_append(pStr, ")", 1);
135474 0 0 if( nEq==0 && (pLoop->wsFlags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))==0 ) return;
0 0 if( nEq==0 && (pLoop->wsFlags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))==0 ) return;
135476 0 0 for(i=0; i
135478 0 0 if( i ) sqlite3_str_append(pStr, " AND ", 5);
135479 0 0 sqlite3_str_appendf(pStr, i>=nSkip ? "%s=?" : "ANY(%s)", z);
135483 0 0 if( pLoop->wsFlags&WHERE_BTM_LIMIT ){
135487 0 0 if( pLoop->wsFlags&WHERE_TOP_LIMIT ){
135510 0 1394 if( sqlite3ParseToplevel(pParse)->explain==2 )
0 1394 if( sqlite3ParseToplevel(pParse)->explain==2 )
135525 0 0 if( (flags&WHERE_MULTI_OR) || (wctrlFlags&WHERE_OR_SUBCLAUSE) ) return 0;
0 0 if( (flags&WHERE_MULTI_OR) || (wctrlFlags&WHERE_OR_SUBCLAUSE) ) return 0;
135528 0 0 || ((flags&WHERE_VIRTUALTABLE)==0 && (pLoop->u.btree.nEq>0))
0 0 || ((flags&WHERE_VIRTUALTABLE)==0 && (pLoop->u.btree.nEq>0))
135529 0 0 || (wctrlFlags&(WHERE_ORDERBY_MIN|WHERE_ORDERBY_MAX));
0 0 || (wctrlFlags&(WHERE_ORDERBY_MIN|WHERE_ORDERBY_MAX));
135532 0 0 sqlite3_str_appendall(&str, isSearch ? "SEARCH" : "SCAN");
135533 0 0 if( pItem->pSelect ){
135539 0 0 if( pItem->zAlias ){
135542 0 0 if( (flags & (WHERE_IPK|WHERE_VIRTUALTABLE))==0 ){
135549 0 0 if( !HasRowid(pItem->pTab) && IsPrimaryKeyIndex(pIdx) ){
0 0 if( !HasRowid(pItem->pTab) && IsPrimaryKeyIndex(pIdx) ){
135550 0 0 if( isSearch ){
135553 0 0 }else if( flags & WHERE_PARTIALIDX ){
135555 0 0 }else if( flags & WHERE_AUTO_INDEX ){
135557 0 0 }else if( flags & WHERE_IDX_ONLY ){
135562 0 0 if( zFmt ){
135567 0 0 }else if( (flags & WHERE_IPK)!=0 && (flags & WHERE_CONSTRAINT)!=0 ){
0 0 }else if( (flags & WHERE_IPK)!=0 && (flags & WHERE_CONSTRAINT)!=0 ){
135569 0 0 if( flags&(WHERE_COLUMN_EQ|WHERE_COLUMN_IN) ){
135571 0 0 }else if( (flags&WHERE_BOTH_LIMIT)==WHERE_BOTH_LIMIT ){
135573 0 0 }else if( flags&WHERE_BTM_LIMIT ){
135583 0 0 else if( (flags & WHERE_VIRTUALTABLE)!=0 ){
135679 601 0 while( (pTerm->wtFlags & TERM_CODED)==0
135680 0 601 && (pLevel->iLeftJoin==0 || ExprHasProperty(pTerm->pExpr, EP_FromJoin))
0 0 && (pLevel->iLeftJoin==0 || ExprHasProperty(pTerm->pExpr, EP_FromJoin))
135681 601 0 && (pLevel->notReady & pTerm->prereqAll)==0
135683 49 552 if( nLoop && (pTerm->wtFlags & TERM_LIKE)!=0 ){
0 49 if( nLoop && (pTerm->wtFlags & TERM_LIKE)!=0 ){
135688 538 63 if( pTerm->iParent<0 ) break;
135692 14 49 if( pTerm->nChild!=0 ) break;
135710 0 54 if( zAff==0 ){
135719 58 7 while( n>0 && zAff[0]==SQLITE_AFF_BLOB ){
11 47 while( n>0 && zAff[0]==SQLITE_AFF_BLOB ){
135724 2 54 while( n>1 && zAff[n-1]==SQLITE_AFF_BLOB ){
2 0 while( n>1 && zAff[n-1]==SQLITE_AFF_BLOB ){
135729 47 7 if( n>0 ){
135750 31 31 for(i=0; i
135752 31 0 if( sqlite3CompareAffinity(p, zAff[i])==SQLITE_AFF_BLOB
135753 2 29 || sqlite3ExprNeedsNoAffinityChange(p, zAff[i])
135798 0 0 if( db->mallocFailed==0 ){
135806 0 0 for(i=iEq; inLTerm; i++){
135807 0 0 if( pLoop->aLTerm[i]->pExpr==pX ){
135809 0 0 if( pOrigRhs->a[iField].pExpr==0 ) continue; /* Duplicate PK column */
135821 0 0 if( pLhs && pLhs->nExpr==1 ){
0 0 if( pLhs && pLhs->nExpr==1 ){
135831 0 0 if( pSelect->pOrderBy ){
135840 0 0 for(i=0; inExpr; i++){
135885 2 457 if( pX->op==TK_EQ || pX->op==TK_IS ){
0 2 if( pX->op==TK_EQ || pX->op==TK_IS ){
135887 2 0 }else if( pX->op==TK_ISNULL ){
135900 0 0 if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0
135901 0 0 && pLoop->u.btree.pIndex!=0
135902 0 0 && pLoop->u.btree.pIndex->aSortOrder[iEq]
135911 0 0 for(i=0; i
135912 0 0 if( pLoop->aLTerm[i] && pLoop->aLTerm[i]->pExpr==pX ){
0 0 if( pLoop->aLTerm[i] && pLoop->aLTerm[i]->pExpr==pX ){
135917 0 0 for(i=iEq;inLTerm; i++){
135919 0 0 if( pLoop->aLTerm[i]->pExpr==pX ) nEq++;
135922 0 0 if( (pX->flags & EP_xIsSelect)==0 || pX->x.pSelect->pEList->nExpr==1 ){
0 0 if( (pX->flags & EP_xIsSelect)==0 || pX->x.pSelect->pEList->nExpr==1 ){
135928 0 0 if( !db->mallocFailed ){
135937 0 0 if( eType==IN_INDEX_INDEX_DESC ){
135942 0 0 sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iTab, 0);
135948 0 0 if( pLevel->u.in.nIn==0 ){
135958 0 0 if( pIn ){
135961 0 0 for(i=iEq;inLTerm; i++){
135962 0 0 if( pLoop->aLTerm[i]->pExpr==pX ){
135964 0 0 if( eType==IN_INDEX_ROWID ){
135968 0 0 int iCol = aiMap ? aiMap[iMap++] : 0;
135972 0 0 if( i==iEq ){
135974 0 0 pIn->eEndLoopOp = bRev ? OP_Prev : OP_Next;
135975 0 0 if( iEq>0 && (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 ){
0 0 if( iEq>0 && (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 ){
136078 0 39 if( nSkip ){
136080 0 0 sqlite3VdbeAddOp1(v, (bRev?OP_Last:OP_Rewind), iIdxCur);
136085 0 0 pLevel->addrSkip = sqlite3VdbeAddOp4Int(v, (bRev?OP_SeekLT:OP_SeekGT),
136090 0 0 for(j=0; j
136100 29 39 for(j=nSkip; j
136109 0 29 if( r1!=regBase+j ){
136110 0 0 if( nReg==1 ){
136117 0 29 if( pTerm->eOperator & WO_IN ){
136118 0 0 if( pTerm->pExpr->flags & EP_xIsSelect ){
136123 0 0 if( zAff ) zAff[j] = SQLITE_AFF_BLOB;
136125 27 2 }else if( (pTerm->eOperator & WO_ISNULL)==0 ){
136127 27 0 if( (pTerm->wtFlags & TERM_IS)==0 && sqlite3ExprCanBeNull(pRight) ){
21 6 if( (pTerm->wtFlags & TERM_IS)==0 && sqlite3ExprCanBeNull(pRight) ){
136131 27 0 if( zAff ){
136132 5 22 if( sqlite3CompareAffinity(pRight, zAff[j])==SQLITE_AFF_BLOB ){
136135 11 16 if( sqlite3ExprNeedsNoAffinityChange(pRight, zAff[j]) ){
136168 0 31 if( pTerm->wtFlags & TERM_LIKEOPT ){
136428 4 19 if( (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)
136429 0 4 && DbMaskAllZero(sqlite3ParseToplevel(pParse)->writeMask)
4 0 && DbMaskAllZero(sqlite3ParseToplevel(pParse)->writeMask)
136434 4 0 if( ai ){
136436 4 4 for(i=0; inColumn-1; i++){
136438 4 0 if( pIdx->aiColumn[i]>=0 ) ai[pIdx->aiColumn[i]+1] = i+1;
136456 91 0 if( p && sqlite3ExprIsVector(p) ){
0 91 if( p && sqlite3ExprIsVector(p) ){
136458 0 0 if( (p->flags & EP_xIsSelect) ){
136468 0 0 for(i=0; i
136497 0 0 if( sqlite3ExprCompare(0, pExpr, pX->pIdxExpr, pX->iTabCur)==0 ){
136524 39 0 if( aColExpr==0 ) return; /* Not an index on expressions */
136530 0 0 for(iIdxCol=0; iIdxColnExpr; iIdxCol++){
136531 0 0 if( pIdx->aiColumn[iIdxCol]!=XN_EXPR ) continue;
136582 12 1377 && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0;
8 4 && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0;
136605 3 1386 if( pLevel->iFrom>0 && (pTabItem[0].fg.jointype & JT_LEFT)!=0 ){
0 3 if( pLevel->iFrom>0 && (pTabItem[0].fg.jointype & JT_LEFT)!=0 ){
136613 3 1389 for(j=iLevel; j>0 && pWInfo->a[j].iLeftJoin==0; j--){}
3 0 for(j=iLevel; j>0 && pWInfo->a[j].iLeftJoin==0; j--){}
136617 22 1367 if( pTabItem->fg.viaCoroutine ){
136627 43 1324 if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)!=0 ){
136638 60 43 for(j=0; j
136641 0 60 if( NEVER(pTerm==0) ) continue;
136642 0 60 if( pTerm->eOperator & WO_IN ){
136652 6 37 sqlite3VdbeAddOp4(v, OP_VFilter, iCur, addrNotFound, iReg,
136658 0 43 pLevel->op = pWInfo->eOnePass ? OP_Noop : OP_VNext;
136661 60 43 for(j=nConstraint-1; j>=0; j--){
136663 60 0 if( j<16 && (pLoop->u.vtab.omitMask>>j)&1 ){
60 0 if( j<16 && (pLoop->u.vtab.omitMask>>j)&1 ){
136665 0 0 }else if( (pTerm->eOperator & WO_IN)!=0 ){
136675 0 0 if( !db->mallocFailed ){
136689 0 0 if( pCompare ){
136692 0 0 if( pRight ){
136711 1283 41 if( (pLoop->wsFlags & WHERE_IPK)!=0
136712 430 853 && (pLoop->wsFlags & (WHERE_COLUMN_IN|WHERE_COLUMN_EQ))!=0
136727 225 205 if( iRowidReg!=iReleaseReg ) sqlite3ReleaseTempReg(pParse, iReleaseReg);
136732 853 41 }else if( (pLoop->wsFlags & WHERE_IPK)!=0
136733 0 853 && (pLoop->wsFlags & WHERE_COLUMN_RANGE)!=0
136745 0 0 if( pLoop->wsFlags & WHERE_BTM_LIMIT ) pStart = pLoop->aLTerm[j++];
136746 0 0 if( pLoop->wsFlags & WHERE_TOP_LIMIT ) pEnd = pLoop->aLTerm[j++];
136748 0 0 if( bRev ){
136754 0 0 if( pStart ){
136777 0 0 if( sqlite3ExprIsVector(pX->pRight) ){
136802 0 0 sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iCur, addrHalt);
136806 0 0 if( pEnd ){
136815 0 0 if( 0==sqlite3ExprIsVector(pX->pRight)
136816 0 0 && (pX->op==TK_LT || pX->op==TK_GT)
0 0 && (pX->op==TK_LT || pX->op==TK_GT)
136818 0 0 testOp = bRev ? OP_Le : OP_Ge;
136820 0 0 testOp = bRev ? OP_Lt : OP_Gt;
136822 0 0 if( 0==sqlite3ExprIsVector(pX->pRight) ){
136827 0 0 pLevel->op = bRev ? OP_Prev : OP_Next;
136831 0 0 if( testOp!=OP_Noop ){
136841 39 855 }else if( pLoop->wsFlags & WHERE_INDEXED ){
136922 0 39 if( (pWInfo->wctrlFlags&WHERE_ORDERBY_MIN)!=0
136923 0 0 && pWInfo->nOBSat>0
136924 0 0 && (pIdx->nKeyCol>nEq)
136935 16 23 if( pLoop->wsFlags & WHERE_BTM_LIMIT ){
136942 15 24 if( pLoop->wsFlags & WHERE_TOP_LIMIT ){
136946 0 15 if( (pRangeEnd->wtFlags & TERM_LIKEOPT)!=0 ){
136962 1 14 if( pRangeStart==0 ){
136964 1 0 if( (j>=0 && pIdx->pTable->aCol[j].notNull==0) || j==XN_EXPR ){
0 1 if( (j>=0 && pIdx->pTable->aCol[j].notNull==0) || j==XN_EXPR ){
0 0 if( (j>=0 && pIdx->pTable->aCol[j].notNull==0) || j==XN_EXPR ){
136975 30 9 if( (nEqnKeyCol && bRev==(pIdx->aSortOrder[nEq]==SQLITE_SO_ASC))
9 21 if( (nEqnKeyCol && bRev==(pIdx->aSortOrder[nEq]==SQLITE_SO_ASC))
136976 0 18 || (bRev && pIdx->nKeyCol==nEq)
0 0 || (bRev && pIdx->nKeyCol==nEq)
136990 39 0 if( zStartAff && nTop ){
15 24 if( zStartAff && nTop ){
136999 16 23 startEq = !pRangeStart || pRangeStart->eOperator & (WO_LE|WO_GE);
14 2 startEq = !pRangeStart || pRangeStart->eOperator & (WO_LE|WO_GE);
137000 15 24 endEq = !pRangeEnd || pRangeEnd->eOperator & (WO_LE|WO_GE);
14 1 endEq = !pRangeEnd || pRangeEnd->eOperator & (WO_LE|WO_GE);
137001 23 16 start_constraints = pRangeStart || nEq>0;
22 1 start_constraints = pRangeStart || nEq>0;
137005 16 23 if( pRangeStart ){
137009 14 2 if( (pRangeStart->wtFlags & TERM_VNULL)==0
137015 16 0 if( zStartAff ){
137020 16 0 if( sqlite3ExprIsVector(pRight)==0 ){
137026 1 22 }else if( bSeekPastNull ){
137033 0 39 if( pLoop->nSkip>0 && nConstraint==pLoop->nSkip ){
0 0 if( pLoop->nSkip>0 && nConstraint==pLoop->nSkip ){
137038 0 39 if( pLoop->wsFlags & WHERE_IN_EARLYOUT ){
137057 15 24 if( pRangeEnd ){
137061 15 0 if( (pRangeEnd->wtFlags & TERM_VNULL)==0
137067 15 0 if( zEndAff ){
137076 15 0 if( sqlite3ExprIsVector(pRight)==0 ){
137081 0 24 }else if( bStopAtNull ){
137093 39 0 if( nConstraint ){
137102 0 39 if( pLoop->wsFlags & WHERE_IN_EARLYOUT ){
137107 31 8 if( omitTable ){
137109 31 0 }else if( HasRowid(pIdx->pTable) ){
137110 23 8 if( (pWInfo->wctrlFlags & WHERE_SEEK_TABLE) || (
0 23 if( (pWInfo->wctrlFlags & WHERE_SEEK_TABLE) || (
137112 0 0 && (pWInfo->eOnePass==ONEPASS_SINGLE)
137121 0 0 }else if( iCur!=iIdxCur ){
137124 0 0 for(j=0; jnKeyCol; j++){
137142 39 0 if( pLevel->iLeftJoin==0 ){
137147 6 33 if( pLoop->wsFlags & WHERE_ONEROW ){
137149 21 12 }else if( bRev ){
137156 0 39 if( (pLoop->wsFlags & WHERE_CONSTRAINT)==0 ){
137161 8 31 if( omitTable ) pIdx = 0;
137165 2 853 if( pLoop->wsFlags & WHERE_MULTI_OR ){
137237 0 2 if( pWInfo->nLevel>1 ){
137243 0 0 if( pOrTab==0 ) return notReady;
137248 0 0 for(k=1; k<=nNotReady; k++){
137267 2 0 if( (pWInfo->wctrlFlags & WHERE_DUPLICATES_OK)==0 ){
137268 2 0 if( HasRowid(pTab) ){
137295 1 1 if( pWC->nTerm>1 ){
137297 3 1 for(iTerm=0; iTermnTerm; iTerm++){
137299 1 2 if( &pWC->a[iTerm] == pTerm ) continue;
137302 1 1 if( (pWC->a[iTerm].wtFlags & (TERM_VIRTUAL|TERM_CODED))!=0 ) continue;
137303 0 1 if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue;
137308 1 0 if( pAndExpr ){
137319 6 2 for(ii=0; iinTerm; ii++){
137321 5 1 if( pOrTerm->leftCursor==iCur || (pOrTerm->eOperator & WO_AND)!=0 ){
4 1 if( pOrTerm->leftCursor==iCur || (pOrTerm->eOperator & WO_AND)!=0 ){
137328 2 3 if( pAndExpr ){
137337 5 0 if( pSubWInfo ){
137349 5 0 if( (pWInfo->wctrlFlags & WHERE_DUPLICATES_OK)==0 ){
137350 3 2 int iSet = ((ii==pOrWc->nTerm-1)?-1:ii);
137351 5 0 if( HasRowid(pTab) ){
137364 0 0 for(iPk=0; iPk
137380 0 0 if( iSet ){
137384 0 0 if( iSet>=0 ){
137388 0 0 if( iSet ) sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
137401 5 0 if( jmp1 ) sqlite3VdbeJumpHere(v, jmp1);
137408 0 5 if( pSubWInfo->untestedTerms ) untestedTerms = 1;
137424 4 1 if( (pSubLoop->wsFlags & WHERE_INDEXED)!=0
137425 3 1 && (ii==0 || pSubLoop->u.btree.pIndex==pCov)
1 2 && (ii==0 || pSubLoop->u.btree.pIndex==pCov)
137426 0 2 && (HasRowid(pTab) || !IsPrimaryKeyIndex(pSubLoop->u.btree.pIndex))
0 0 && (HasRowid(pTab) || !IsPrimaryKeyIndex(pSubLoop->u.btree.pIndex))
137441 0 2 if( pCov ) pLevel->iIdxCur = iCovCur;
137442 1 1 if( pAndExpr ){
137450 0 2 if( pWInfo->nLevel>1 ) sqlite3StackFree(db, pOrTab);
137451 2 0 if( !untestedTerms ) disableTerm(pLevel, pTerm);
137462 0 853 if( pTabItem->fg.isRecursive ){
137495 31 1358 iLoop = (pIdx ? 1 : 2);
137498 1513 1391 for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){
137503 781 732 if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
137504 3 729 if( (pTerm->prereqAll & pLevel->notReady)!=0 ){
137512 0 729 if( (pTabItem->fg.jointype&JT_LEFT) && !ExprHasProperty(pE,EP_FromJoin) ){
0 0 if( (pTabItem->fg.jointype&JT_LEFT) && !ExprHasProperty(pE,EP_FromJoin) ){
137516 1 728 if( iLoop==1 && !sqlite3ExprCoveredByIndex(pE, pLevel->iTabCur, pIdx) ){
0 1 if( iLoop==1 && !sqlite3ExprCoveredByIndex(pE, pLevel->iTabCur, pIdx) ){
137520 727 2 if( iLoop<3 && (pTerm->wtFlags & TERM_VARSELECT) ){
2 725 if( iLoop<3 && (pTerm->wtFlags & TERM_VARSELECT) ){
137521 2 0 if( iNext==0 ) iNext = 3;
137525 0 727 if( (pTerm->wtFlags & TERM_LIKECOND)!=0 ){
137535 0 0 if( x>0 ){
137536 0 0 skipLikeAddr = sqlite3VdbeAddOp1(v, (x&1)?OP_IfNot:OP_If,(int)(x>>1));
137548 0 727 if( skipLikeAddr ) sqlite3VdbeJumpHere(v, skipLikeAddr);
137552 2 1389 }while( iLoop>0 );
137562 1511 1389 for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){
137565 1508 3 if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
137566 0 3 if( (pTerm->eOperator & (WO_EQ|WO_IS))==0 ) continue;
137567 0 3 if( (pTerm->eOperator & WO_EQUIV)==0 ) continue;
137568 2 1 if( pTerm->leftCursor!=iCur ) continue;
137569 0 1 if( pLevel->iLeftJoin ) continue;
137575 1 0 if( pAlt==0 ) continue;
137576 0 0 if( pAlt->wtFlags & (TERM_CODED) ) continue;
137577 0 0 if( (pAlt->eOperator & WO_IN)
137578 0 0 && (pAlt->pExpr->flags & EP_xIsSelect)
137579 0 0 && (pAlt->pExpr->x.pSelect->pEList->nExpr>1)
137595 0 1389 if( pLevel->iLeftJoin ){
137599 0 0 for(pTerm=pWC->a, j=0; jnTerm; j++, pTerm++){
137602 0 0 if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
137603 0 0 if( (pTerm->prereqAll & pLevel->notReady)!=0 ){
137681 0 1670 if( pWC->nTerm>=pWC->nSlot ){
137685 0 0 if( pWC->a==0 ){
137686 0 0 if( wtFlags & TERM_DYNAMIC ){
137693 0 0 if( pOld!=pWC->aStatic ){
137699 1670 0 if( p && ExprHasProperty(p, EP_Unlikely) ){
0 1670 if( p && ExprHasProperty(p, EP_Unlikely) ){
137723 1629 16 return op==TK_IN || (op>=TK_EQ && op<=TK_GE) || op==TK_ISNULL || op==TK_IS;
1340 289 return op==TK_IN || (op>=TK_EQ && op<=TK_GE) || op==TK_ISNULL || op==TK_IS;
173 1167 return op==TK_IN || (op>=TK_EQ && op<=TK_GE) || op==TK_ISNULL || op==TK_IS;
438 24 return op==TK_IN || (op>=TK_EQ && op<=TK_GE) || op==TK_ISNULL || op==TK_IS;
0 438 return op==TK_IN || (op>=TK_EQ && op<=TK_GE) || op==TK_ISNULL || op==TK_IS;
137742 14 1 if( expRight==expLeft ){
137744 0 14 if( expRight ){
137748 7 7 }else if( sqlite3ExprCollSeq(pParse, pExpr->pLeft)!=0 ){
137756 8 7 if( pExpr->op>=TK_GT ){
137772 16 1074 if( op==TK_IN ){
137774 16 1058 }else if( op==TK_ISNULL ){
137776 0 1058 }else if( op==TK_IS ){
137825 1492 117 if( !sqlite3IsLikeFunction(db, pExpr, pnoCase, (char*)wc) ){
137836 0 117 if( op==TK_VARIABLE && (db->flags & SQLITE_EnableQPSG)==0 ){
0 0 if( op==TK_VARIABLE && (db->flags & SQLITE_EnableQPSG)==0 ){
137840 0 0 if( pVal && sqlite3_value_type(pVal)==SQLITE_TEXT ){
0 0 if( pVal && sqlite3_value_type(pVal)==SQLITE_TEXT ){
137845 117 0 }else if( op==TK_STRING ){
137848 117 0 if( z ){
137852 372 111 while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){
366 6 while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){
366 0 while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){
366 0 while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){
137854 0 366 if( c==wc[3] && z[cnt]!=0 ) cnt++;
0 0 if( c==wc[3] && z[cnt]!=0 ) cnt++;
137865 117 0 if( cnt!=0 && 255!=(u8)z[cnt-1] && (cnt>1 || z[0]!=wc[3]) ){
117 0 if( cnt!=0 && 255!=(u8)z[cnt-1] && (cnt>1 || z[0]!=wc[3]) ){
6 111 if( cnt!=0 && 255!=(u8)z[cnt-1] && (cnt>1 || z[0]!=wc[3]) ){
6 0 if( cnt!=0 && 255!=(u8)z[cnt-1] && (cnt>1 || z[0]!=wc[3]) ){
137869 6 111 *pisComplete = c==wc[0] && z[cnt+1]==0;
6 0 *pisComplete = c==wc[0] && z[cnt+1]==0;
137873 117 0 if( pPrefix ){
137877 366 117 for(iFrom=iTo=0; iFrom
137878 0 366 if( zNew[iFrom]==wc[3] ) iFrom++;
137895 117 0 if( sqlite3Isdigit(zNew[0])
137896 117 0 || zNew[0]=='-'
137897 0 117 || (zNew[0]+1=='0' && iTo==1)
0 0 || (zNew[0]+1=='0' && iTo==1)
137899 0 0 if( pLeft->op!=TK_COLUMN
137900 0 0 || sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT
137901 0 0 || IsVirtual(pLeft->y.pTab) /* Value might be numeric */
137913 0 117 if( op==TK_VARIABLE ){
137916 0 0 if( *pisComplete && pRight->u.zToken[1] ){
0 0 if( *pisComplete && pRight->u.zToken[1] ){
137975 167 1442 if( pExpr->op==TK_FUNCTION ){
137990 167 0 if( pList==0 || pList->nExpr!=2 ){
0 167 if( pList==0 || pList->nExpr!=2 ){
138002 116 51 if( pCol->op==TK_COLUMN && IsVirtual(pCol->y.pTab) ){
34 82 if( pCol->op==TK_COLUMN && IsVirtual(pCol->y.pTab) ){
138003 34 0 for(i=0; i
138004 34 0 if( sqlite3StrICmp(pExpr->u.zToken, aOp[i].zOp)==0 ){
138024 0 133 if( pCol->op==TK_COLUMN && IsVirtual(pCol->y.pTab) ){
0 0 if( pCol->op==TK_COLUMN && IsVirtual(pCol->y.pTab) ){
138033 0 0 if( pMod->xFindFunction!=0 ){
138035 0 0 if( i>=SQLITE_INDEX_CONSTRAINT_FUNCTION ){
138043 1234 208 }else if( pExpr->op==TK_NE || pExpr->op==TK_ISNOT || pExpr->op==TK_NOTNULL ){
1233 1 }else if( pExpr->op==TK_NE || pExpr->op==TK_ISNOT || pExpr->op==TK_NOTNULL ){
9 1224 }else if( pExpr->op==TK_NE || pExpr->op==TK_ISNOT || pExpr->op==TK_NOTNULL ){
138047 218 0 if( pLeft->op==TK_COLUMN && IsVirtual(pLeft->y.pTab) ){
0 218 if( pLeft->op==TK_COLUMN && IsVirtual(pLeft->y.pTab) ){
138050 209 9 if( pRight && pRight->op==TK_COLUMN && IsVirtual(pRight->y.pTab) ){
0 209 if( pRight && pRight->op==TK_COLUMN && IsVirtual(pRight->y.pTab) ){
0 0 if( pRight && pRight->op==TK_COLUMN && IsVirtual(pRight->y.pTab) ){
138056 208 10 if( pExpr->op==TK_NE ) *peOp2 = SQLITE_INDEX_CONSTRAINT_NE;
138057 1 217 if( pExpr->op==TK_ISNOT ) *peOp2 = SQLITE_INDEX_CONSTRAINT_ISNOT;
138058 9 209 if( pExpr->op==TK_NOTNULL ) *peOp2 = SQLITE_INDEX_CONSTRAINT_ISNOTNULL;
138070 262 0 if( pDerived ){
138091 0 0 if( pTerm->eOperator!=WO_AND ){
138092 0 0 return N==0 ? pTerm : 0;
138094 0 0 if( Nu.pAndInfo->wc.nTerm ){
138132 0 0 if( (pOne->eOperator & (WO_EQ|WO_LT|WO_LE|WO_GT|WO_GE))==0 ) return;
138133 0 0 if( (pTwo->eOperator & (WO_EQ|WO_LT|WO_LE|WO_GT|WO_GE))==0 ) return;
138134 0 0 if( (eOp & (WO_EQ|WO_LT|WO_LE))!=eOp
138135 0 0 && (eOp & (WO_EQ|WO_GT|WO_GE))!=eOp ) return;
138138 0 0 if( sqlite3ExprCompare(0,pOne->pExpr->pLeft, pTwo->pExpr->pLeft, -1) ) return;
138139 0 0 if( sqlite3ExprCompare(0,pOne->pExpr->pRight, pTwo->pExpr->pRight,-1) )return;
138141 0 0 if( (eOp & (eOp-1))!=0 ){
138142 0 0 if( eOp & (WO_LT|WO_LE) ){
138151 0 0 if( pNew==0 ) return;
138152 0 0 for(op=TK_EQ; eOp!=(WO_EQ<<(op-TK_EQ)); op++){ assert( op
138271 0 5 if( pOrInfo==0 ) return;
138278 0 5 if( db->mallocFailed ) return;
138286 15 5 for(i=pOrWc->nTerm-1, pOrTerm=pOrWc->a; i>=0 && indexable; i--, pOrTerm++){
15 0 for(i=pOrWc->nTerm-1, pOrTerm=pOrWc->a; i>=0 && indexable; i--, pOrTerm++){
138287 9 6 if( (pOrTerm->eOperator & WO_SINGLE)==0 ){
138292 9 0 if( pAndInfo ){
138306 9 0 if( !db->mallocFailed ){
138307 24 9 for(j=0, pAndTerm=pAndWC->a; jnTerm; j++, pAndTerm++){
138309 8 16 if( allowedOp(pAndTerm->pExpr->op)
138310 0 8 || pAndTerm->eOperator==WO_AUX
138318 3 3 }else if( pOrTerm->wtFlags & TERM_COPIED ){
138324 3 0 if( pOrTerm->wtFlags & TERM_VIRTUAL ){
138329 0 3 if( (pOrTerm->eOperator & WO_EQ)==0 ){
138342 5 0 if( indexable ){
138351 5 0 if( indexable && pOrWc->nTerm==2 ){
0 5 if( indexable && pOrWc->nTerm==2 ){
138354 0 0 while( (pOne = whereNthSubterm(&pOrWc->a[0],iOne++))!=0 ){
138357 0 0 while( (pTwo = whereNthSubterm(&pOrWc->a[1],iTwo++))!=0 ){
138384 0 5 if( chngToIN ){
138396 0 0 for(j=0; j<2 && !okToChngToIN; j++){
0 0 for(j=0; j<2 && !okToChngToIN; j++){
138398 0 0 for(i=pOrWc->nTerm-1; i>=0; i--, pOrTerm++){
138401 0 0 if( pOrTerm->leftCursor==iCursor ){
138407 0 0 if( (chngToIN & sqlite3WhereGetMask(&pWInfo->sMaskSet,
138422 0 0 if( i<0 ){
138435 0 0 for(; i>=0 && okToChngToIN; i--, pOrTerm++){
0 0 for(; i>=0 && okToChngToIN; i--, pOrTerm++){
138437 0 0 if( pOrTerm->leftCursor!=iCursor ){
138439 0 0 }else if( pOrTerm->u.leftColumn!=iColumn ){
138449 0 0 if( affRight!=0 && affRight!=affLeft ){
0 0 if( affRight!=0 && affRight!=affLeft ){
138462 0 0 if( okToChngToIN ){
138468 0 0 for(i=pOrWc->nTerm-1, pOrTerm=pOrWc->a; i>=0; i--, pOrTerm++){
138469 0 0 if( (pOrTerm->wtFlags & TERM_OR_OK)==0 ) continue;
138480 0 0 if( pNew ){
138516 0 15 if( !OptimizationEnabled(pParse->db, SQLITE_Transitive) ) return 0;
138517 8 7 if( pExpr->op!=TK_EQ && pExpr->op!=TK_IS ) return 0;
8 0 if( pExpr->op!=TK_EQ && pExpr->op!=TK_IS ) return 0;
138518 0 7 if( ExprHasProperty(pExpr, EP_FromJoin) ) return 0;
138521 0 7 if( aff1!=aff2
138522 0 0 && (!sqlite3IsNumericAffinity(aff1) || !sqlite3IsNumericAffinity(aff2))
0 0 && (!sqlite3IsNumericAffinity(aff1) || !sqlite3IsNumericAffinity(aff2))
138527 7 0 if( sqlite3IsBinary(pColl) ) return 1;
138538 4 8 while( pS ){
138545 4 0 if( ALWAYS(pSrc!=0) ){
138547 4 4 for(i=0; inSrc; i++){
138550 0 4 if( pSrc->a[i].fg.isTabFunc ){
138582 0 11 for(i=0; mPrereq>1; i++, mPrereq>>=1){}
138584 8 11 for(pIdx=pFrom->a[i].pTab->pIndex; pIdx; pIdx=pIdx->pNext){
138585 8 0 if( pIdx->aColExpr==0 ) continue;
138586 0 0 for(i=0; inKeyCol; i++){
138587 0 0 if( pIdx->aiColumn[i]!=XN_EXPR ) continue;
138588 0 0 if( sqlite3ExprCompareSkip(pExpr, pIdx->aColExpr->a[i].pExpr, iCur)==0 ){
138610 0 2350 if( pExpr->op==TK_VECTOR && (op>=TK_GT && ALWAYS(op<=TK_GE)) ){
0 0 if( pExpr->op==TK_VECTOR && (op>=TK_GT && ALWAYS(op<=TK_GE)) ){
0 0 if( pExpr->op==TK_VECTOR && (op>=TK_GT && ALWAYS(op<=TK_GE)) ){
138614 1090 1260 if( pExpr->op==TK_COLUMN ){
138619 1249 11 if( mPrereq==0 ) return 0; /* No table references */
138620 0 11 if( (mPrereq&(mPrereq-1))!=0 ) return 0; /* Refs more than one table */
138663 0 1621 if( db->mallocFailed ){
138672 16 1605 if( op==TK_IN ){
138674 0 16 if( sqlite3ExprCheckIN(pParse, pExpr) ) return;
138675 0 16 if( ExprHasProperty(pExpr, EP_xIsSelect) ){
138680 16 1589 }else if( op==TK_ISNULL ){
138687 2 1619 if( pMaskSet->bVarSelect ) pTerm->wtFlags |= TERM_VARSELECT;
138688 0 1621 if( ExprHasProperty(pExpr, EP_FromJoin) ){
138693 0 0 if( (prereqAll>>1)>=x ){
138702 1191 430 if( allowedOp(op) ){
138706 1191 0 u16 opMask = (pTerm->prereqRight & prereqLeft)==0 ? WO_ALL : WO_EQUIV;
138708 0 1191 if( pTerm->iField>0 ){
138714 1075 116 if( exprMightBeIndexed(pSrc, prereqLeft, aiCurCol, pLeft, op) ){
138719 0 1191 if( op==TK_IS ) pTerm->wtFlags |= TERM_IS;
138720 1159 32 if( pRight
138721 15 1144 && exprMightBeIndexed(pSrc, pTerm->prereqRight, aiCurCol, pRight, op)
138727 15 0 if( pTerm->leftCursor>=0 ){
138730 0 15 if( db->mallocFailed ){
138735 0 15 if( idxNew==0 ) return;
138738 0 15 if( op==TK_IS ) pNew->wtFlags |= TERM_IS;
138742 7 8 if( termIsEquivalence(pParse, pDup) ){
138776 14 416 else if( pExpr->op==TK_BETWEEN && pWC->op==TK_AND ){
14 0 else if( pExpr->op==TK_BETWEEN && pWC->op==TK_AND ){
138782 28 14 for(i=0; i<2; i++){
138802 5 411 else if( pExpr->op==TK_OR ){
138823 1609 12 if( pWC->op==TK_AND
138824 117 1492 && isLikeOrGlob(pParse, pExpr, &pStr1, &isComplete, &noCase)
138842 117 0 if( noCase && !pParse->db->mallocFailed ){
117 0 if( noCase && !pParse->db->mallocFailed ){
138846 366 117 for(i=0; (c = pStr1->u.zToken[i])!=0; i++){
138852 117 0 if( !db->mallocFailed ){
138856 117 0 if( noCase ){
138863 0 117 if( c=='A'-1 ) isComplete = 0;
138868 117 0 zCollSeqName = noCase ? "NOCASE" : sqlite3StrBINARY;
138886 6 111 if( isComplete ){
138903 1609 12 if( pWC->op==TK_AND ){
138906 34 1609 while( res-- > 0 ){
138913 34 0 if( (prereqExpr & prereqColumn)==0 ){
138917 0 34 if( ExprHasProperty(pExpr, EP_FromJoin) && pNewExpr ){
0 0 if( ExprHasProperty(pExpr, EP_FromJoin) && pNewExpr ){
138945 1609 12 if( pWC->op==TK_AND
138946 758 851 && (pExpr->op==TK_EQ || pExpr->op==TK_IS)
0 758 && (pExpr->op==TK_EQ || pExpr->op==TK_IS)
138947 0 851 && (nLeft = sqlite3ExprVectorSize(pExpr->pLeft))>1
138948 0 0 && sqlite3ExprVectorSize(pExpr->pRight)==nLeft
138949 0 0 && ( (pExpr->pLeft->flags & EP_xIsSelect)==0
138950 0 0 || (pExpr->pRight->flags & EP_xIsSelect)==0)
138953 0 0 for(i=0; i
138977 1609 12 if( pWC->op==TK_AND && pExpr->op==TK_IN && pTerm->iField==0
16 1593 if( pWC->op==TK_AND && pExpr->op==TK_IN && pTerm->iField==0
16 0 if( pWC->op==TK_AND && pExpr->op==TK_IN && pTerm->iField==0
138978 0 16 && pExpr->pLeft->op==TK_VECTOR
138979 0 0 && pExpr->x.pSelect->pPrior==0
138982 0 0 for(i=0; ipLeft); i++){
139063 783 1677 if( pE2==0 ) return;
139064 1359 318 if( pE2->op!=op ){
139096 1670 1824 for(i=pWC->nTerm-1, a=pWC->a; i>=0; i--, a++){
139097 311 1359 if( a->wtFlags & TERM_DYNAMIC ){
139100 5 1665 if( a->wtFlags & TERM_ORINFO ){
139102 9 1656 }else if( a->wtFlags & TERM_ANDINFO ){
139106 0 1824 if( pWC->a!=pWC->aStatic ){
139119 3022 5679 if( p->op==TK_COLUMN && !ExprHasProperty(p, EP_FixedCol) ){
3022 0 if( p->op==TK_COLUMN && !ExprHasProperty(p, EP_FixedCol) ){
139121 2358 3321 }else if( ExprHasProperty(p, EP_TokenOnly|EP_Leaf) ){
139125 0 3321 mask = (p->op==TK_IF_NULL_ROW) ? sqlite3WhereGetMask(pMaskSet, p->iTable) : 0;
139126 2171 1150 if( p->pLeft ) mask |= sqlite3WhereExprUsageNN(pMaskSet, p->pLeft);
139127 1504 1817 if( p->pRight ){
139130 4 1813 }else if( ExprHasProperty(p, EP_xIsSelect) ){
139131 4 0 if( ExprHasProperty(p, EP_VarSelect) ) pMaskSet->bVarSelect = 1;
139133 239 1574 }else if( p->x.pList ){
139139 3405 387 return p ? sqlite3WhereExprUsageNN(pMaskSet,p) : 0;
139144 261 8 if( pList ){
139145 500 261 for(i=0; inExpr; i++){
139166 1359 1824 for(i=pWC->nTerm-1; i>=0; i--){
139188 1389 0 if( pItem->fg.isTabFunc==0 ) return;
139192 0 0 if( pArgs==0 ) return;
139193 0 0 for(j=k=0; jnExpr; j++){
139195 0 0 while( knCol && (pTab->aCol[k].colFlags & COLFLAG_HIDDEN)==0 ){k++;}
0 0 while( knCol && (pTab->aCol[k].colFlags & COLFLAG_HIDDEN)==0 ){k++;}
139196 0 0 if( k>=pTab->nCol ){
139202 0 0 if( pColRef==0 ) return;
139308 489 0 if( !pWInfo->bOrderedInnerLoop ){
139387 9 11 for(i=pSet->n, p=pSet->a; i>0; i--, p++){
139388 9 0 if( rRun<=p->rRun && (prereq & p->prereq)==prereq ){
9 0 if( rRun<=p->rRun && (prereq & p->prereq)==prereq ){
139391 0 0 if( p->rRun<=rRun && (p->prereq & prereq)==p->prereq ){
0 0 if( p->rRun<=rRun && (p->prereq & prereq)==p->prereq ){
139395 11 0 if( pSet->n
139400 0 0 for(i=1; in; i++){
139401 0 0 if( p->rRun>pSet->a[i].rRun ) p = pSet->a + i;
139403 0 0 if( p->rRun<=rRun ) return 0;
139408 9 11 if( p->nOut>nOut ) p->nOut = nOut;
139419 5407 144 for(i=0; in; i++){
139420 5245 162 if( pMaskSet->ix[i]==iCursor ){
139460 4524 3306 for(pTerm=pWC->a+k; knTerm; k++, pTerm++){
139461 2924 1600 if( pTerm->leftCursor==iCur
139462 818 2106 && pTerm->u.leftColumn==iColumn
139463 0 818 && (iColumn!=XN_EXPR
139464 0 0 || sqlite3ExprCompareSkip(pTerm->pExpr->pLeft,
139466 7 811 && (pScan->iEquiv<=1 || !ExprHasProperty(pTerm->pExpr, EP_FromJoin))
7 0 && (pScan->iEquiv<=1 || !ExprHasProperty(pTerm->pExpr, EP_FromJoin))
139468 16 802 if( (pTerm->eOperator & WO_EQUIV)!=0
139469 16 0 && pScan->nEquivaiCur)
139470 16 0 && (pX = sqlite3ExprSkipCollate(pTerm->pExpr->pRight))->op==TK_COLUMN
139473 16 9 for(j=0; jnEquiv; j++){
139474 7 9 if( pScan->aiCur[j]==pX->iTable
139475 7 0 && pScan->aiColumn[j]==pX->iColumn ){
139479 9 7 if( j==pScan->nEquiv ){
139485 552 266 if( (pTerm->eOperator & pScan->opMask)!=0 ){
139487 92 460 if( pScan->zCollName && (pTerm->eOperator & WO_ISNULL)==0 ){
87 5 if( pScan->zCollName && (pTerm->eOperator & WO_ISNULL)==0 ){
139491 0 87 if( !sqlite3IndexAffinityOk(pX, pScan->idxaff) ){
139497 0 87 if( pColl==0 ) pColl = pParse->db->pDfltColl;
139498 0 87 if( sqlite3StrICmp(pColl->zName, pScan->zCollName) ){
139502 489 63 if( (pTerm->eOperator & (WO_EQ|WO_IS))!=0
139503 16 473 && (pX = pTerm->pExpr->pRight)->op==TK_COLUMN
139504 7 9 && pX->iTable==pScan->aiCur[0]
139505 7 0 && pX->iColumn==pScan->aiColumn[0]
139518 42 3264 }while( pWC!=0 );
139519 3255 9 if( pScan->iEquiv>=pScan->nEquiv ) break;
139559 1107 2601 if( pIdx ){
139562 0 1107 if( iColumn==XN_EXPR ){
139565 866 241 }else if( iColumn==pIdx->pTable->iPKey ){
139567 163 78 }else if( iColumn>=0 ){
139571 0 2601 }else if( iColumn==XN_EXPR ){
139622 457 2215 while( p ){
139623 453 4 if( (p->prereqRight & notReady)==0 ){
139624 453 0 if( p->prereqRight==0 && (p->eOperator&op)!=0 ){
453 0 if( p->prereqRight==0 && (p->eOperator&op)!=0 ){
139628 0 0 if( pResult==0 ) pResult = p;
139652 0 0 for(i=0; inExpr; i++){
139654 0 0 if( p->op==TK_COLUMN
139655 0 0 && p->iColumn==pIdx->aiColumn[iCol]
139656 0 0 && p->iTable==iBase
139659 0 0 if( 0==sqlite3StrICmp(pColl->zName, zColl) ){
139676 5 0 if( j>=0 ){
139678 0 0 }else if( j==(-1) ){
139708 2 0 if( pTabList->nSrc!=1 ) return 0;
139716 0 0 for(i=0; inExpr; i++){
139718 0 0 if( p->op==TK_COLUMN && p->iTable==iBase && p->iColumn<0 ) return 1;
0 0 if( p->op==TK_COLUMN && p->iTable==iBase && p->iColumn<0 ) return 1;
0 0 if( p->op==TK_COLUMN && p->iTable==iBase && p->iColumn<0 ) return 1;
139734 0 0 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
139735 0 0 if( !IsUniqueIndex(pIdx) ) continue;
139736 0 0 for(i=0; inKeyCol; i++){
139737 0 0 if( 0==sqlite3WhereFindTerm(pWC, iBase, i, ~(Bitmask)0, WO_EQ, pIdx) ){
139738 0 0 if( findIndexCol(pParse, pDistinct, iBase, pIdx, i)<0 ) break;
139739 0 0 if( indexColumnNotNull(pIdx, i)==0 ) break;
139742 0 0 if( i==pIdx->nKeyCol ){
139756 2068 2 return N<=10 ? 0 : sqlite3LogEst(N) - 33;
139781 0 22 if( pParse->db->mallocFailed ) return;
139782 283 22 for(; iStart
139783 135 148 if( pOp->p1!=iTabCur ) continue;
139784 91 57 if( pOp->opcode==OP_Column ){
139789 0 57 }else if( pOp->opcode==OP_Rowid ){
139790 0 0 if( bIncrRowid ){
139861 363 597 if( pTerm->leftCursor!=pSrc->iCursor ) return 0;
139862 183 414 if( (pTerm->eOperator & (WO_EQ|WO_IS))==0 ) return 0;
139863 0 414 if( (pSrc->fg.jointype & JT_LEFT)
139864 0 0 && !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
139865 0 0 && (pTerm->eOperator & WO_IS)
139872 0 414 if( (pTerm->prereqRight & notReady)!=0 ) return 0;
139873 2 412 if( pTerm->u.leftColumn<0 ) return 0;
139875 0 412 if( !sqlite3IndexAffinityOk(pTerm->pExpr, aff) ) return 0;
139932 2 1 for(pTerm=pWC->a; pTerm
139937 0 2 if( pLoop->prereq==0
139938 0 0 && (pTerm->wtFlags & TERM_VIRTUAL)==0
139939 0 0 && !ExprHasProperty(pExpr, EP_FromJoin)
139940 0 0 && sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){
139944 1 1 if( termCanDriveIndex(pTerm, pSrc, notReady) ){
139946 1 0 Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
139949 1 0 if( !sentWarning ){
139955 1 0 if( (idxCols & cMask)==0 ){
139956 0 1 if( whereLoopResize(pParse->db, pLoop, nKeyCol+1) ){
139981 2 1 for(i=0; i
139982 1 1 if( extraCols & MASKBIT(i) ) nKeyCol++;
139984 0 1 if( pSrc->colUsed & MASKBIT(BMS-1) ){
139990 0 1 if( pIdx==0 ) goto end_auto_index_create;
139996 2 1 for(pTerm=pWC->a; pTerm
139997 1 1 if( termCanDriveIndex(pTerm, pSrc, notReady) ){
139999 1 0 Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
140002 1 0 if( (idxCols & cMask)==0 ){
140007 1 0 pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY;
140016 2 1 for(i=0; i
140017 1 1 if( extraCols & MASKBIT(i) ){
140023 0 1 if( pSrc->colUsed & MASKBIT(BMS-1) ){
140024 0 0 for(i=BMS-1; inCol; i++){
140043 0 1 if( pTabItem->fg.viaCoroutine ){
140053 0 1 if( pPartial ){
140064 0 1 if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue);
140065 0 1 if( pTabItem->fg.viaCoroutine ){
140113 95 43 for(i=nTerm=0, pTerm=pWC->a; inTerm; i++, pTerm++){
140114 34 61 if( pTerm->leftCursor != pSrc->iCursor ) continue;
140115 0 61 if( pTerm->prereqRight & mUnusable ) continue;
140121 0 61 if( (pTerm->eOperator & ~(WO_EQUIV))==0 ) continue;
140132 0 43 if( pOrderBy ){
140134 0 0 for(i=0; i
140136 0 0 if( pExpr->op!=TK_COLUMN || pExpr->iTable!=pSrc->iCursor ) break;
0 0 if( pExpr->op!=TK_COLUMN || pExpr->iTable!=pSrc->iCursor ) break;
140138 0 0 if( i==n){
140148 0 43 if( pIdxInfo==0 ){
140171 95 43 for(i=j=0, pTerm=pWC->a; inTerm; i++, pTerm++){
140173 34 61 if( pTerm->leftCursor != pSrc->iCursor ) continue;
140174 0 61 if( pTerm->prereqRight & mUnusable ) continue;
140180 0 61 if( (pTerm->eOperator & ~(WO_EQUIV))==0 ) continue;
140182 0 61 if( (pSrc->fg.jointype & JT_LEFT)!=0
140183 0 0 && !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
140184 0 0 && (pTerm->eOperator & (WO_IS|WO_ISNULL))
140200 0 61 if( op==WO_IN ) op = WO_EQ;
140201 34 27 if( op==WO_AUX ){
140203 0 27 }else if( op & (WO_ISNULL|WO_IS) ){
140204 0 0 if( op==WO_ISNULL ){
140221 24 3 if( op & (WO_LT|WO_LE|WO_GT|WO_GE)
140222 0 24 && sqlite3ExprIsVector(pTerm->pExpr->pRight)
140224 0 0 if( i<16 ) mNoOmit |= (1 << i);
140225 0 0 if( op==WO_LT ) pIdxCons[j].op = WO_LE;
140226 0 0 if( op==WO_GT ) pIdxCons[j].op = WO_GE;
140232 0 43 for(i=0; i
140266 0 43 if( rc!=SQLITE_OK && rc!=SQLITE_CONSTRAINT ){
0 0 if( rc!=SQLITE_OK && rc!=SQLITE_CONSTRAINT ){
140267 0 0 if( rc==SQLITE_NOMEM ){
140269 0 0 }else if( !pVtab->zErrMsg ){
140489 72 44 if( pTerm ){
140490 0 72 if( pTerm->truthProb<=0 ){
140808 42 16 if( pLower && pLower->truthProb>0 && pUpper && pUpper->truthProb>0 ){
42 0 if( pLower && pLower->truthProb>0 && pUpper && pUpper->truthProb>0 ){
14 28 if( pLower && pLower->truthProb>0 && pUpper && pUpper->truthProb>0 ){
14 0 if( pLower && pLower->truthProb>0 && pUpper && pUpper->truthProb>0 ){
140813 0 58 if( nNew<10 ) nNew = 10;
140814 58 0 if( nNew
141056 472 3696 if( p->wsFlags & (WHERE_VIRTUALTABLE|WHERE_AUTO_INDEX) ){
141057 86 386 if( (p->wsFlags & WHERE_VIRTUALTABLE)!=0 && p->u.vtab.needFree ){
0 86 if( (p->wsFlags & WHERE_VIRTUALTABLE)!=0 && p->u.vtab.needFree ){
141061 386 86 }else if( (p->wsFlags & WHERE_AUTO_INDEX)!=0 && p->u.btree.pIndex!=0 ){
1 385 }else if( (p->wsFlags & WHERE_AUTO_INDEX)!=0 && p->u.btree.pIndex!=0 ){
141073 14 2729 if( p->aLTerm!=p->aLTermSpace ) sqlite3DbFreeNN(db, p->aLTerm);
141083 1543 14 if( p->nLSlot>=n ) return SQLITE_OK;
141086 0 14 if( paNew==0 ) return SQLITE_NOMEM_BKPT;
141088 0 14 if( p->aLTerm!=p->aLTermSpace ) sqlite3DbFreeNN(db, p->aLTerm);
141099 0 1425 if( whereLoopResize(db, pTo, pFrom->nLTerm) ){
141105 43 1382 if( pFrom->wsFlags & WHERE_VIRTUALTABLE ){
141107 386 996 }else if( (pFrom->wsFlags & WHERE_AUTO_INDEX)!=0 ){
141127 1389 1810 for(i=0; inLevel; i++){
141129 1389 0 if( pLevel->pWLoop && (pLevel->pWLoop->wsFlags & WHERE_IN_ABLE) ){
0 1389 if( pLevel->pWLoop && (pLevel->pWLoop->wsFlags & WHERE_IN_ABLE) ){
141134 1358 1810 while( pWInfo->pLoops ){
141165 55 56 if( pX->nLTerm-pX->nSkip >= pY->nLTerm-pY->nSkip ){
141168 0 56 if( pY->nSkip > pX->nSkip ) return 0;
141169 56 0 if( pX->rRun >= pY->rRun ){
141170 55 1 if( pX->rRun > pY->rRun ) return 0; /* X costs more than Y */
141171 0 1 if( pX->nOut > pY->nOut ) return 0; /* X costs more than Y */
141173 1 1 for(i=pX->nLTerm-1; i>=0; i--){
141174 0 1 if( pX->aLTerm[i]==0 ) continue;
141175 2 0 for(j=pY->nLTerm-1; j>=0; j--){
141176 1 1 if( pY->aLTerm[j]==pX->aLTerm[i] ) break;
141178 0 1 if( j<0 ) return 0; /* X not a subset of Y since term X[i] not used by Y */
141180 1 0 if( (pX->wsFlags&WHERE_IDX_ONLY)!=0
141181 0 1 && (pY->wsFlags&WHERE_IDX_ONLY)==0 ){
141202 1373 90 if( (pTemplate->wsFlags & WHERE_INDEXED)==0 ) return;
141203 161 90 for(; p; p=p->pNextLoop){
141204 0 161 if( p->iTab!=pTemplate->iTab ) continue;
141205 105 56 if( (p->wsFlags & WHERE_INDEXED)==0 ) continue;
141206 1 55 if( whereLoopCheaperProperSubset(p, pTemplate) ){
141213 0 55 }else if( whereLoopCheaperProperSubset(pTemplate, p) ){
141243 590 1366 for(p=(*ppPrev); p; ppPrev=&p->pNextLoop, p=*ppPrev){
141244 578 12 if( p->iTab!=pTemplate->iTab || p->iSortIdx!=pTemplate->iSortIdx ){
303 275 if( p->iTab!=pTemplate->iTab || p->iSortIdx!=pTemplate->iSortIdx ){
141264 200 75 if( (p->wsFlags & WHERE_AUTO_INDEX)!=0
141265 200 0 && (pTemplate->nSkip)==0
141266 8 192 && (pTemplate->wsFlags & WHERE_INDEXED)!=0
141267 8 0 && (pTemplate->wsFlags & WHERE_COLUMN_EQ)!=0
141268 8 0 && (p->prereq & pTemplate->prereq)==pTemplate->prereq
141278 265 2 if( (p->prereq & pTemplate->prereq)==p->prereq /* (1) */
141279 99 166 && p->rSetup<=pTemplate->rSetup /* (2a) */
141280 39 60 && p->rRun<=pTemplate->rRun /* (2b) */
141281 38 1 && p->nOut<=pTemplate->nOut /* (2c) */
141291 227 2 if( (p->prereq & pTemplate->prereq)==pTemplate->prereq /* (1) */
141292 59 168 && p->rRun>=pTemplate->rRun /* (2a) */
141293 59 0 && p->nOut>=pTemplate->nOut /* (2b) */
141333 0 1487 if( pBuilder->iPlanLimit==0 ){
141335 0 0 if( pBuilder->pOrSet ) pBuilder->pOrSet->n = 0;
141343 24 1463 if( pBuilder->pOrSet!=0 ){
141344 16 8 if( pTemplate->nLTerm ){
141366 38 1425 if( ppPrev==0 ){
141396 1366 59 if( p==0 ){
141399 0 1366 if( p==0 ) return SQLITE_NOMEM_BKPT;
141408 8 59 while( *ppTail ){
141410 0 8 if( ppTail==0 ) break;
141412 0 8 if( pToDel==0 ) break;
141424 1382 43 if( (p->wsFlags & WHERE_VIRTUALTABLE)==0 ){
141426 994 388 if( pIndex && pIndex->tnum==0 ){
918 76 if( pIndex && pIndex->tnum==0 ){
141473 1131 866 for(i=pWC->nTerm, pTerm=pWC->a; i>0; i--, pTerm++){
141474 165 966 if( (pTerm->wtFlags & TERM_VIRTUAL)!=0 ) break;
141475 40 926 if( (pTerm->prereqAll & pLoop->maskSelf)==0 ) continue;
141476 6 920 if( (pTerm->prereqAll & notAllowed)!=0 ) continue;
141477 181 823 for(j=pLoop->nLTerm-1; j>=0; j--){
141479 0 181 if( pX==0 ) continue;
141480 55 126 if( pX==pTerm ) break;
141481 42 84 if( pX->iParent>=0 && (&pWC->a[pX->iParent])==pTerm ) break;
42 0 if( pX->iParent>=0 && (&pWC->a[pX->iParent])==pTerm ) break;
141483 823 97 if( j<0 ){
141484 0 823 if( pTerm->truthProb<=0 ){
141492 430 393 if( pTerm->eOperator&(WO_EQ|WO_IS) ){
141495 37 393 if( sqlite3ExprIsInteger(pRight, &k) && k>=(-1) && k<=1 ){
37 0 if( sqlite3ExprIsInteger(pRight, &k) && k>=(-1) && k<=1 ){
31 6 if( sqlite3ExprIsInteger(pRight, &k) && k>=(-1) && k<=1 ){
141500 398 32 if( iReduce
141505 392 639 if( pLoop->nOut > nRow-iReduce ) pLoop->nOut = nRow - iReduce;
141536 0 58 for(i=1; i
141544 0 0 if( pRhs->flags & EP_xIsSelect ){
141554 0 0 if( pLhs->op!=TK_COLUMN
141555 0 0 || pLhs->iTable!=iCur
141556 0 0 || pLhs->iColumn!=pIdx->aiColumn[i+nEq]
141557 0 0 || pIdx->aSortOrder[i+nEq]!=pIdx->aSortOrder[nEq]
141565 0 0 if( aff!=idxaff ) break;
141568 0 0 if( pColl==0 ) break;
141569 0 0 if( sqlite3StrICmp(pColl->zName, pIdx->azColl[i+nEq]) ) break;
141623 0 1040 if( db->mallocFailed ) return SQLITE_NOMEM_BKPT;
141629 28 1012 if( pNew->wsFlags & WHERE_BTM_LIMIT ){
141635 0 1040 if( pProbe->bUnordered ) opMask &= ~(WO_GT|WO_GE|WO_LT|WO_LE);
141652 1128 0 for(; rc==SQLITE_OK && pTerm!=0; pTerm = whereScanNext(&scan)){
88 1040 for(; rc==SQLITE_OK && pTerm!=0; pTerm = whereScanNext(&scan)){
141660 5 83 if( (eOp==WO_ISNULL || (pTerm->wtFlags&TERM_VNULL)!=0)
141661 0 5 && indexColumnNotNull(pProbe, saved_nEq)
141665 0 88 if( pTerm->prereqRight & pNew->maskSelf ) continue;
141669 0 88 if( pTerm->wtFlags & TERM_LIKEOPT && pTerm->eOperator==WO_LT ) continue;
0 0 if( pTerm->wtFlags & TERM_LIKEOPT && pTerm->eOperator==WO_LT ) continue;
141674 0 88 if( (pSrc->fg.jointype & JT_LEFT)!=0
141675 0 0 && !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
141680 72 16 if( IsUniqueIndex(pProbe) && saved_nEq==pProbe->nKeyCol-1 ){
11 61 if( IsUniqueIndex(pProbe) && saved_nEq==pProbe->nKeyCol-1 ){
141690 0 88 if( whereLoopResize(db, pNew, pNew->nLTerm+1) ) break; /* OOM */
141700 0 88 if( eOp & WO_IN ){
141702 0 0 if( ExprHasProperty(pExpr, EP_xIsSelect) ){
141712 0 0 for(i=0; inLTerm-1; i++){
141713 0 0 if( pNew->aLTerm[i] && pNew->aLTerm[i]->pExpr==pExpr ) nIn = 0;
0 0 if( pNew->aLTerm[i] && pNew->aLTerm[i]->pExpr==pExpr ) nIn = 0;
141715 0 0 }else if( ALWAYS(pExpr->x.pList && pExpr->x.pList->nExpr) ){
0 0 }else if( ALWAYS(pExpr->x.pList && pExpr->x.pList->nExpr) ){
141721 0 0 if( pProbe->hasStat1 ){
141745 0 0 if( M + logK + safetyMargin < nIn + rLogSize ){
141757 25 63 }else if( eOp & (WO_EQ|WO_IS) ){
141761 23 2 if( iCol==XN_ROWID
141762 23 0 || (iCol>=0 && nInMul==0 && saved_nEq==pProbe->nKeyCol-1)
23 0 || (iCol>=0 && nInMul==0 && saved_nEq==pProbe->nKeyCol-1)
4 19 || (iCol>=0 && nInMul==0 && saved_nEq==pProbe->nKeyCol-1)
141764 4 2 if( iCol==XN_ROWID || pProbe->uniqNotNull
3 1 if( iCol==XN_ROWID || pProbe->uniqNotNull
141765 3 0 || (pProbe->nKeyCol==1 && pProbe->onError && eOp==WO_EQ)
0 3 || (pProbe->nKeyCol==1 && pProbe->onError && eOp==WO_EQ)
0 0 || (pProbe->nKeyCol==1 && pProbe->onError && eOp==WO_EQ)
141772 5 58 }else if( eOp & WO_ISNULL ){
141774 28 30 }else if( eOp & (WO_GT|WO_GE) ){
141783 0 28 if( pTerm->wtFlags & TERM_LIKEOPT ){
141790 0 0 if( whereLoopResize(db, pNew, pNew->nLTerm+1) ) break; /* OOM */
141805 14 16 pNew->aLTerm[pNew->nLTerm-2] : 0;
141814 58 30 if( pNew->wsFlags & WHERE_COLUMN_RANGE ){
141823 0 30 if( pTerm->truthProb<=0 && pProbe->aiColumn[saved_nEq]>=0 ){
0 0 if( pTerm->truthProb<=0 && pProbe->aiColumn[saved_nEq]>=0 ){
141858 5 25 if( eOp & WO_ISNULL ){
141874 42 46 if( (pNew->wsFlags & (WHERE_IDX_ONLY|WHERE_IPK))==0 ){
141885 58 30 if( pNew->wsFlags & WHERE_COLUMN_RANGE ){
141891 58 30 if( (pNew->wsFlags & WHERE_TOP_LIMIT)==0
141892 56 2 && pNew->u.btree.nEqnColumn
141921 1006 34 if( saved_nEq==saved_nSkip
141922 44 962 && saved_nEq+1nKeyCol
141923 44 0 && pProbe->noSkipScan==0
141924 44 0 && OptimizationEnabled(db, SQLITE_SkipScan)
141925 0 44 && pProbe->aiRowLogEst[saved_nEq+1]>=42 /* TUNING: Minimum for skip-scan */
141926 0 0 && (rc = whereLoopResize(db, pNew, pNew->nLTerm+1))==SQLITE_OK
141967 0 984 if( pIndex->bUnordered ) return 0;
141968 441 543 if( (pOB = pBuilder->pWInfo->pOrderBy)==0 ) return 0;
141969 594 97 for(ii=0; iinExpr; ii++){
141971 594 0 if( pExpr->op==TK_COLUMN && pExpr->iTable==iCursor ){
589 5 if( pExpr->op==TK_COLUMN && pExpr->iTable==iCursor ){
141972 425 164 if( pExpr->iColumn<0 ) return 1;
141973 171 143 for(jj=0; jjnKeyCol; jj++){
141974 21 150 if( pExpr->iColumn==pIndex->aiColumn[jj] ) return 1;
141976 0 5 }else if( (aColExpr = pIndex->aColExpr)!=0 ){
141977 0 0 for(jj=0; jjnKeyCol; jj++){
141978 0 0 if( pIndex->aiColumn[jj]!=XN_EXPR ) continue;
141979 0 0 if( sqlite3ExprCompareSkip(pExpr,aColExpr->a[jj].pExpr,iCursor)==0 ){
141995 0 0 while( pWhere->op==TK_AND ){
141996 0 0 if( !whereUsablePartialIndex(iTab,pWC,pWhere->pLeft) ) return 0;
141999 0 0 if( pParse->db->flags & SQLITE_EnableQPSG ) pParse = 0;
142000 0 0 for(i=0, pTerm=pWC->a; inTerm; i++, pTerm++){
142002 0 0 if( (!ExprHasProperty(pExpr, EP_FromJoin) || pExpr->iRightJoinTable==iTab)
0 0 if( (!ExprHasProperty(pExpr, EP_FromJoin) || pExpr->iRightJoinTable==iTab)
142003 0 0 && sqlite3ExprImpliesExpr(pParse, pExpr, pWhere, iTab)
142075 0 921 if( pSrc->pIBIndex ){
142078 0 921 }else if( !HasRowid(pTab) ){
142097 921 0 if( pSrc->fg.notIndexed==0 ){
142109 913 8 if( !pBuilder->pOrSet /* Not part of an OR optimization */
142110 908 5 && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0
142111 908 0 && (pWInfo->pParse->db->flags & SQLITE_AutoIndex)!=0
142112 908 0 && pSrc->pIBIndex==0 /* Has no INDEXED BY clause */
142113 908 0 && !pSrc->fg.notIndexed /* Has no NOT INDEXED clause */
142114 908 0 && HasRowid(pTab) /* Not WITHOUT ROWID table. (FIXME: Why not?) */
142115 908 0 && !pSrc->fg.isCorrelated /* Not a correlated subquery */
142116 908 0 && !pSrc->fg.isRecursive /* Not a recursive common table expression. */
142121 1874 0 for(pTerm=pWC->a; rc==SQLITE_OK && pTerm
966 908 for(pTerm=pWC->a; rc==SQLITE_OK && pTerm
142122 10 956 if( pTerm->prereqRight & pNew->maskSelf ) continue;
142123 410 546 if( termCanDriveIndex(pTerm, pSrc, 0) ){
142138 410 0 if( pTab->pSelect==0 && (pTab->tabFlags & TF_Ephemeral)==0 ){
409 1 if( pTab->pSelect==0 && (pTab->tabFlags & TF_Ephemeral)==0 ){
142144 0 410 if( pNew->rSetup<0 ) pNew->rSetup = 0;
142161 1905 0 for(; rc==SQLITE_OK && pProbe;
984 921 for(; rc==SQLITE_OK && pProbe;
142162 984 0 pProbe=(pSrc->pIBIndex ? 0 : pProbe->pNext), iSortIdx++
142164 0 984 if( pProbe->pPartIdxWhere!=0
142165 0 0 && !whereUsablePartialIndex(pSrc->iCursor, pWC, pProbe->pPartIdxWhere) ){
142169 0 984 if( pProbe->bNoQuery ) continue;
142184 921 63 if( pProbe->tnum<=0 ){
142189 424 497 pNew->iSortIdx = b ? iSortIdx : 0;
142196 0 921 if( rc ) break;
142199 14 49 if( pProbe->isCovering ){
142204 16 33 pNew->wsFlags = (m==0) ? (WHERE_IDX_ONLY|WHERE_INDEXED) : WHERE_INDEXED;
142208 41 22 if( b
142209 41 0 || !HasRowid(pTab)
142210 41 0 || pProbe->pPartIdxWhere!=0
142211 22 19 || ( m==0
142212 22 0 && pProbe->bUnordered==0
142213 8 14 && (pProbe->szIdxRowszTabRow)
142214 0 8 && (pWInfo->wctrlFlags & WHERE_ONEPASS_DESIRED)==0
142215 0 0 && sqlite3GlobalConfig.bUseCis
142216 0 0 && OptimizationEnabled(pWInfo->pParse->db, SQLITE_CoverIdxScan)
142219 22 0 pNew->iSortIdx = b ? iSortIdx : 0;
142225 14 8 if( m!=0 ){
142235 42 14 for(ii=0; iinTerm; ii++){
142237 0 42 if( !sqlite3ExprCoveredByIndex(pTerm->pExpr, iCur, pProbe) ){
142242 0 42 if( pTerm->truthProb<=0 ){
142246 0 42 if( pTerm->eOperator & (WO_EQ|WO_IS) ) nLookup -= 19;
142256 0 22 if( rc ) break;
142262 38 946 if( pBuilder->bldFlags==SQLITE_BLDF_INDEXED ){
142327 61 43 for(i=0; i
142330 61 0 if( (pTerm->prereqRight & mUsable)==pTerm->prereqRight
142331 61 0 && (pTerm->eOperator & mExclude)==0
142350 0 43 if( rc ){
142351 0 0 if( rc==SQLITE_CONSTRAINT ){
142364 61 43 for(i=0; iaLTerm[i] = 0;
142367 61 43 for(i=0; i
142369 60 1 if( (iTerm = pUsage[i].argvIndex - 1)>=0 ){
142372 60 0 if( iTerm>=nConstraint
142373 60 0 || j<0
142374 60 0 || j>=pWC->nTerm
142375 60 0 || pNew->aLTerm[iTerm]!=0
142376 0 60 || pIdxCons->usable==0
142389 60 0 if( iTerm>mxTerm ) mxTerm = iTerm;
142392 60 0 if( iTerm<16 && pUsage[i].omit ) pNew->u.vtab.omitMask |= 1<
60 0 if( iTerm<16 && pUsage[i].omit ) pNew->u.vtab.omitMask |= 1<
142393 0 60 if( (pTerm->eOperator & WO_IN)!=0 ){
142408 60 43 for(i=0; i<=mxTerm; i++){
142409 0 60 if( pNew->aLTerm[i]==0 ){
142422 0 43 pNew->u.vtab.isOrdered = (i8)(pIdxInfo->orderByConsumed ?
142430 2 41 if( pIdxInfo->idxFlags & SQLITE_INDEX_SCAN_UNIQUE ){
142436 0 43 if( pNew->u.vtab.needFree ){
142457 0 0 if( iCons>=0 && iConsnConstraint ){
0 0 if( iCons>=0 && iConsnConstraint ){
142461 0 0 if( pX->pLeft ){
142464 0 0 zRet = (pC ? pC->zName : sqlite3StrBINARY);
142520 0 43 if( p==0 ) return SQLITE_NOMEM_BKPT;
142526 0 43 if( whereLoopResize(pParse->db, pNew, nConstraint) ){
142541 43 0 if( rc==SQLITE_OK && (mBest = (pNew->prereq & ~mPrereq))!=0 ){
0 43 if( rc==SQLITE_OK && (mBest = (pNew->prereq & ~mPrereq))!=0 ){
142549 0 0 if( bIn ){
142555 0 0 if( mBestNoIn==0 ){
142563 0 0 while( rc==SQLITE_OK ){
142567 0 0 for(i=0; i
142571 0 0 if( mThis>mPrev && mThis
0 0 if( mThis>mPrev && mThis
142574 0 0 if( mNext==ALLBITS ) break;
142575 0 0 if( mNext==mBest || mNext==mBestNoIn ) continue;
0 0 if( mNext==mBest || mNext==mBestNoIn ) continue;
142580 0 0 if( pNew->prereq==mPrereq ){
142582 0 0 if( bIn==0 ) seenZeroNoIN = 1;
142589 0 0 if( rc==SQLITE_OK && seenZero==0 ){
0 0 if( rc==SQLITE_OK && seenZero==0 ){
142593 0 0 if( bIn==0 ) seenZeroNoIN = 1;
142599 0 0 if( rc==SQLITE_OK && seenZeroNoIN==0 ){
0 0 if( rc==SQLITE_OK && seenZeroNoIN==0 ){
142606 0 43 if( p->needToFreeIdxStr ) sqlite3_free(p->idxStr);
142640 22 11 for(pTerm=pWC->a; pTerm
22 0 for(pTerm=pWC->a; pTerm
142641 4 18 if( (pTerm->eOperator & WO_OR)!=0
142642 4 0 && (pTerm->u.pOrInfo->indexable & pNew->maskSelf)!=0
142655 10 3 for(pOrTerm=pOrWC->a; pOrTerm
142656 6 4 if( (pOrTerm->eOperator & WO_AND)!=0 ){
142658 2 2 }else if( pOrTerm->leftCursor==iCur ){
142677 0 8 if( IsVirtual(pItem->pTab) ){
142684 8 0 if( rc==SQLITE_OK ){
142688 1 7 if( sCur.n==0 ){
142691 3 4 }else if( once ){
142698 4 4 for(i=0; i
142699 4 4 for(j=0; j
142713 7 0 for(i=0; rc==SQLITE_OK && i
3 4 for(i=0; rc==SQLITE_OK && i
142757 956 1377 for(iTab=0, pItem=pTabList->a; pItem
142762 0 956 if( ((pItem->fg.jointype|priorJointype) & (JT_LEFT|JT_CROSS))!=0 ){
142769 43 913 if( IsVirtual(pItem->pTab) ){
142771 0 43 for(p=&pItem[1]; p
142772 0 0 if( mUnusable || (p->fg.jointype & (JT_LEFT|JT_CROSS)) ){
0 0 if( mUnusable || (p->fg.jointype & (JT_LEFT|JT_CROSS)) ){
142782 956 0 if( rc==SQLITE_OK && pBuilder->pWC->hasOr ){
3 953 if( rc==SQLITE_OK && pBuilder->pWC->hasOr ){
142786 956 0 if( rc || db->mallocFailed ){
0 956 if( rc || db->mallocFailed ){
142787 0 0 if( rc==SQLITE_DONE ){
142875 2 1127 if( nLoop && OptimizationDisabled(db, SQLITE_OrderByIdxJoin) ) return 0;
0 2 if( nLoop && OptimizationDisabled(db, SQLITE_OrderByIdxJoin) ) return 0;
142879 0 1129 if( nOrderBy>BMS-1 ) return 0; /* Cannot optimize overly large ORDER BYs */
142885 586 543 if( wctrlFlags & WHERE_ORDERBY_LIMIT ) eqOpMask |= WO_IN;
142886 1977 281 for(iLoop=0; isOrderDistinct && obSat
1131 846 for(iLoop=0; isOrderDistinct && obSat
1131 0 for(iLoop=0; isOrderDistinct && obSat
142887 2 1129 if( iLoop>0 ) ready |= pLoop->maskSelf;
142888 2 1129 if( iLoop
142890 2 0 if( wctrlFlags & WHERE_ORDERBY_LIMIT ) continue;
142894 0 1129 if( pLoop->wsFlags & WHERE_VIRTUALTABLE ){
142895 0 0 if( pLoop->u.vtab.isOrdered ) obSat = obDone;
142907 1272 1129 for(i=0; i
142908 0 1272 if( MASKBIT(i) & obSat ) continue;
142910 0 1272 if( pOBExpr->op!=TK_COLUMN ) continue;
142911 7 1265 if( pOBExpr->iTable!=iCur ) continue;
142914 1259 6 if( pTerm==0 ) continue;
142915 0 6 if( pTerm->eOperator==WO_IN ){
142920 0 0 for(j=0; jnLTerm && pTerm!=pLoop->aLTerm[j]; j++){}
0 0 for(j=0; jnLTerm && pTerm!=pLoop->aLTerm[j]; j++){}
142921 0 0 if( j>=pLoop->nLTerm ) continue;
142923 6 0 if( (pTerm->eOperator&(WO_EQ|WO_IS))!=0 && pOBExpr->iColumn>=0 ){
6 0 if( (pTerm->eOperator&(WO_EQ|WO_IS))!=0 && pOBExpr->iColumn>=0 ){
142924 0 6 if( sqlite3ExprCollSeqMatch(pWInfo->pParse,
142933 1129 0 if( (pLoop->wsFlags & WHERE_ONEROW)==0 ){
142934 1084 45 if( pLoop->wsFlags & WHERE_IPK ){
142938 43 2 }else if( (pIndex = pLoop->u.btree.pIndex)==0 || pIndex->bUnordered ){
0 43 }else if( (pIndex = pLoop->u.btree.pIndex)==0 || pIndex->bUnordered ){
142954 1183 846 for(j=0; j
142960 14 1169 if( ju.btree.nEq && j>=pLoop->nSkip ){
14 0 if( ju.btree.nEq && j>=pLoop->nSkip ){
142971 14 0 if( (eOp & eqOpMask)!=0 ){
142972 0 14 if( eOp & WO_ISNULL ){
142977 0 0 }else if( ALWAYS(eOp & WO_IN) ){
142983 0 0 for(i=j+1; iu.btree.nEq; i++){
142984 0 0 if( pLoop->aLTerm[i]->pExpr==pX ){
142996 85 1084 if( pIndex ){
142999 14 71 if( iColumn==pIndex->pTable->iPKey ) iColumn = XN_ROWID;
143008 1126 43 if( isOrderDistinct
143009 42 1084 && iColumn>=0
143010 42 0 && j>=pLoop->u.btree.nEq
143011 42 0 && pIndex->pTable->aCol[iColumn].notNull==0
143020 1237 219 for(i=0; bOnce && i
1203 34 for(i=0; bOnce && i
143021 48 1155 if( MASKBIT(i) & obSat ) continue;
143025 1133 22 if( (wctrlFlags & (WHERE_GROUPBY|WHERE_DISTINCTBY))==0 ) bOnce = 0;
143026 1155 0 if( iColumn>=XN_ROWID ){
143027 0 1155 if( pOBExpr->op!=TK_COLUMN ) continue;
143028 5 1150 if( pOBExpr->iTable!=iCur ) continue;
143029 234 916 if( pOBExpr->iColumn!=iColumn ) continue;
143032 0 0 if( sqlite3ExprCompareSkip(pOBExpr, pIdxExpr, iCur) ){
143036 70 846 if( iColumn!=XN_ROWID ){
143038 0 70 if( sqlite3StrICmp(pColl->zName, pIndex->azColl[j])!=0 ) continue;
143044 916 253 if( isMatch && (wctrlFlags & WHERE_GROUPBY)==0 ){
916 0 if( isMatch && (wctrlFlags & WHERE_GROUPBY)==0 ){
143047 28 888 if( revSet ){
143048 28 0 if( (rev ^ revIdx)!=pOrderBy->a[i].sortOrder ) isMatch = 0;
143051 56 832 if( rev ) *pRevMask |= MASKBIT(iLoop);
143055 888 281 if( isMatch ){
143056 846 42 if( iColumn==XN_ROWID ){
143063 42 239 if( j==0 || j
28 14 if( j==0 || j
143070 846 281 if( distinctColumns ){
143077 846 281 if( isOrderDistinct ){
143079 848 846 for(i=0; i
143082 846 2 if( MASKBIT(i) & obSat ) continue;
143085 0 2 if( mTerm==0 && !sqlite3ExprIsConstant(p) ) continue;
0 0 if( mTerm==0 && !sqlite3ExprIsConstant(p) ) continue;
143086 2 0 if( (mTerm&~orderDistinctMask)==0 ){
143092 864 263 if( obSat==obDone ) return (i8)nOrderBy;
143093 263 0 if( !isOrderDistinct ){
143094 141 233 for(i=nOrderBy-1; i>0; i--){
143096 30 111 if( (obSat&m)==m ) return i;
143176 0 109 if( (pWInfo->wctrlFlags & WHERE_USE_LIMIT)!=0 && pWInfo->iLimit
0 0 if( (pWInfo->wctrlFlags & WHERE_USE_LIMIT)!=0 && pWInfo->iLimit
143223 6 1889 mxChoice = (nLoop<=1) ? 1 : (nLoop==2 ? 5 : 10);
6 0 mxChoice = (nLoop<=1) ? 1 : (nLoop==2 ? 5 : 10);
143232 1036 859 if( pWInfo->pOrderBy==0 || nRowEst==0 ){
518 518 if( pWInfo->pOrderBy==0 || nRowEst==0 ){
143242 0 1895 if( pSpace==0 ) return SQLITE_NOMEM_BKPT;
143247 3838 1895 for(ii=mxChoice*2, pFrom=aTo; ii>0; ii--, pFrom++, pX += nLoop){
143250 518 1377 if( nOrderBy ){
143271 518 1377 if( nOrderBy ){
143278 0 518 aFrom[0].isOrdered = nLoop>0 ? -1 : nOrderBy;
143284 1477 1895 for(iLoop=0; iLoop
143286 1483 1477 for(ii=0, pFrom=aFrom; ii
143287 2183 1483 for(pWLoop=pWInfo->pLoops; pWLoop; pWLoop=pWLoop->pNextLoop){
143295 16 2167 if( (pWLoop->prereq & ~pFrom->maskLoop)!=0 ) continue;
143296 16 2151 if( (pWLoop->maskSelf & pFrom->maskLoop)!=0 ) continue;
143297 614 1537 if( (pWLoop->wsFlags & WHERE_AUTO_INDEX)!=0 && pFrom->nRow<3 ){
606 8 if( (pWLoop->wsFlags & WHERE_AUTO_INDEX)!=0 && pFrom->nRow<3 ){
143312 543 1002 if( isOrdered<0 ){
143319 1545 0 if( isOrdered>=0 && isOrdered
118 1427 if( isOrdered>=0 && isOrdered
143320 109 9 if( aSortCost[isOrdered]==0 ){
143351 68 1483 for(jj=0, pTo=aTo; jj
143352 62 6 if( pTo->maskLoop==maskNew
143353 62 0 && ((pTo->isOrdered^isOrdered)&0x80)==0
143359 1483 62 if( jj>=nTo ){
143361 0 1483 if( nTo>=mxChoice
143362 0 0 && (rCost>mxCost || (rCost==mxCost && rUnsorted>=mxUnsorted))
0 0 && (rCost>mxCost || (rCost==mxCost && rUnsorted>=mxUnsorted))
0 0 && (rCost>mxCost || (rCost==mxCost && rUnsorted>=mxUnsorted))
143378 1483 0 if( nTo
143402 49 13 if( pTo->rCost
143403 3 46 || (pTo->rCost==rCost
143404 3 0 && (pTo->nRow
143405 3 0 || (pTo->nRow==nOut && pTo->rUnsorted<=rUnsorted)
3 0 || (pTo->nRow==nOut && pTo->rUnsorted<=rUnsorted)
143448 1507 22 if( nTo>=mxChoice ){
143452 0 1507 for(jj=1, pTo=&aTo[1]; jj
143453 0 0 if( pTo->rCost>mxCost
143454 0 0 || (pTo->rCost==mxCost && pTo->rUnsorted>mxUnsorted)
0 0 || (pTo->rCost==mxCost && pTo->rUnsorted>mxUnsorted)
143488 0 1895 if( nFrom==0 ){
143496 0 1895 for(ii=1; ii
143497 0 0 if( pFrom->rCost>aFrom[ii].rCost ) pFrom = &aFrom[ii];
143501 1477 1895 for(iLoop=0; iLoop
143507 4 1891 if( (pWInfo->wctrlFlags & WHERE_WANT_DISTINCT)!=0
143508 0 4 && (pWInfo->wctrlFlags & WHERE_DISTINCTBY)==0
143509 0 0 && pWInfo->eDistinct==WHERE_DISTINCT_NOOP
143510 0 0 && nRowEst
143515 0 0 if( rc==pWInfo->pResultSet->nExpr ){
143520 1036 859 if( pWInfo->pOrderBy ){
143521 4 1032 if( pWInfo->wctrlFlags & WHERE_DISTINCTBY ){
143522 0 4 if( pFrom->isOrdered==pWInfo->pOrderBy->nExpr ){
143528 586 446 if( pWInfo->nOBSat<=0 ){
143530 586 0 if( nLoop>0 ){
143532 586 0 if( (wsFlags & WHERE_ONEROW)==0
143533 586 0 && (wsFlags&(WHERE_IPK|WHERE_COLUMN_IN))!=(WHERE_IPK|WHERE_COLUMN_IN)
143540 431 155 if( rc==pWInfo->pOrderBy->nExpr ){
143548 0 1036 if( (pWInfo->wctrlFlags & WHERE_SORTBYGROUP)
143549 0 0 && pWInfo->nOBSat==pWInfo->pOrderBy->nExpr && nLoop>0
0 0 && pWInfo->nOBSat==pWInfo->pOrderBy->nExpr && nLoop>0
143556 0 0 if( nOrder==pWInfo->pOrderBy->nExpr ){
143594 5 1378 if( pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE ) return 0;
143598 43 1335 if( IsVirtual(pTab) ) return 0;
143599 0 1335 if( pItem->fg.isIndexedBy ) return 0;
143606 428 907 if( pTerm ){
143615 56 902 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
143618 54 2 if( !IsUniqueIndex(pIdx)
143619 54 0 || pIdx->pPartIdxWhere!=0
143620 1 53 || pIdx->nKeyCol>ArraySize(pLoop->aLTermSpace)
143622 8 45 opMask = pIdx->uniqNotNull ? (WO_EQ|WO_IS) : WO_EQ;
143623 67 5 for(j=0; jnKeyCol; j++){
143625 48 19 if( pTerm==0 ) break;
143629 48 5 if( j!=pIdx->nKeyCol ) continue;
143631 5 0 if( pIdx->isCovering || (pItem->colUsed & pIdx->colNotIdxed)==0 ){
0 5 if( pIdx->isCovering || (pItem->colUsed & pIdx->colNotIdxed)==0 ){
143642 433 902 if( pLoop->wsFlags ){
143649 0 433 if( pWInfo->pOrderBy ) pWInfo->nOBSat = pWInfo->pOrderBy->nExpr;
143650 0 433 if( pWInfo->wctrlFlags & WHERE_WANT_DISTINCT ){
143665 9 32 if( pExpr->op==TK_FUNCTION && ExprHasProperty(pExpr, EP_ConstFunc)==0 ){
0 9 if( pExpr->op==TK_FUNCTION && ExprHasProperty(pExpr, EP_ConstFunc)==0 ){
143814 516 1294 if( pOrderBy && pOrderBy->nExpr>=BMS ) pOrderBy = 0;
0 516 if( pOrderBy && pOrderBy->nExpr>=BMS ) pOrderBy = 0;
143819 0 1810 if( OptimizationDisabled(db, SQLITE_DistinctOpt) ){
143827 0 1810 if( pTabList->nSrc>BMS ){
143837 1805 5 nTabList = (wctrlFlags & WHERE_OR_SUBCLAUSE) ? 1 : pTabList->nSrc;
143848 0 1810 if( db->mallocFailed ){
143887 424 1386 if( nTabList==0 ){
143888 0 424 if( pOrderBy ) pWInfo->nOBSat = pOrderBy->nExpr;
143889 0 424 if( wctrlFlags & WHERE_WANT_DISTINCT ){
143912 3 1386 }while( (++ii)nSrc );
143927 0 1810 if( db->mallocFailed ) goto whereBeginError;
143940 1631 1810 for(ii=0; iinTerm; ii++){
143942 304 1327 if( pT->wtFlags & TERM_VIRTUAL ) continue;
143943 62 1265 if( pT->prereqAll==0 && (nTabList==0 || exprIsDeterministic(pT->pExpr)) ){
18 44 if( pT->prereqAll==0 && (nTabList==0 || exprIsDeterministic(pT->pExpr)) ){
18 0 if( pT->prereqAll==0 && (nTabList==0 || exprIsDeterministic(pT->pExpr)) ){
143949 2 1808 if( wctrlFlags & WHERE_WANT_DISTINCT ){
143950 0 2 if( isDistinctRedundant(pParse, pTabList, &pWInfo->sWC, pResultSet) ){
143953 2 0 }else if( pOrderBy==0 ){
143974 1383 427 if( nTabList!=1 || whereShortCut(&sWLB)==0 ){
950 433 if( nTabList!=1 || whereShortCut(&sWLB)==0 ){
143976 0 1377 if( rc ) goto whereBeginError;
143992 0 1377 if( db->mallocFailed ) goto whereBeginError;
143993 518 859 if( pWInfo->pOrderBy ){
143995 0 518 if( db->mallocFailed ) goto whereBeginError;
143998 1292 518 if( pWInfo->pOrderBy==0 && (db->flags & SQLITE_ReverseOrder)!=0 ){
0 1292 if( pWInfo->pOrderBy==0 && (db->flags & SQLITE_ReverseOrder)!=0 ){
144001 1810 0 if( pParse->nErr || NEVER(db->mallocFailed) ){
1810 0 if( pParse->nErr || NEVER(db->mallocFailed) ){
144061 3 1807 if( pWInfo->nLevel>=2
144062 2 1 && pResultSet!=0 /* guarantees condition (1) above */
144063 2 0 && OptimizationEnabled(db, SQLITE_OmitNoopJoin)
144067 0 2 if( sWLB.pOrderBy ){
144070 2 2 for(i=pWInfo->nLevel-1; i>=1; i--){
144075 2 0 if( (pItem->fg.jointype & JT_LEFT)==0 ) continue;
144076 0 0 if( (wctrlFlags & WHERE_WANT_DISTINCT)==0
144077 0 0 && (pLoop->wsFlags & WHERE_ONEROW)==0
144081 0 0 if( (tabUsed & pLoop->maskSelf)!=0 ) continue;
144083 0 0 for(pTerm=sWLB.pWC->a; pTerm
144084 0 0 if( (pTerm->prereqAll & pLoop->maskSelf)!=0 ){
144085 0 0 if( !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
144086 0 0 || pTerm->pExpr->iRightJoinTable!=pItem->iCursor
144092 0 0 if( pTerm
144095 0 0 for(pTerm=sWLB.pWC->a; pTerm
144096 0 0 if( (pTerm->prereqAll & pLoop->maskSelf)!=0 ){
144100 0 0 if( i!=pWInfo->nLevel-1 ){
144131 263 1547 if( (wctrlFlags & WHERE_ONEPASS_DESIRED)!=0 ){
144134 34 229 if( bOnerow || (
27 7 if( bOnerow || (
144136 27 0 && 0==(wsFlags & WHERE_VIRTUALTABLE)
144137 0 27 && (0==(wsFlags & WHERE_MULTI_OR) || (wctrlFlags & WHERE_DUPLICATES_OK))
0 0 && (0==(wsFlags & WHERE_MULTI_OR) || (wctrlFlags & WHERE_DUPLICATES_OK))
144139 229 27 pWInfo->eOnePass = bOnerow ? ONEPASS_SINGLE : ONEPASS_MULTI;
144140 256 0 if( HasRowid(pTabList->a[0].pTab) && (wsFlags & WHERE_IDX_ONLY) ){
8 248 if( HasRowid(pTabList->a[0].pTab) && (wsFlags & WHERE_IDX_ONLY) ){
144141 8 0 if( wctrlFlags & WHERE_ONEPASS_MULTIROW ){
144152 1389 1810 for(ii=0, pLevel=pWInfo->a; ii
144161 1367 22 if( (pTab->tabFlags & TF_Ephemeral)!=0 || pTab->pSelect ){
1367 0 if( (pTab->tabFlags & TF_Ephemeral)!=0 || pTab->pSelect ){
144165 43 1324 if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)!=0 ){
144169 1324 0 }else if( IsVirtual(pTab) ){
144173 1313 11 if( (pLoop->wsFlags & WHERE_IDX_ONLY)==0
144174 1312 1 && (wctrlFlags & WHERE_OR_SUBCLAUSE)==0 ){
144176 256 1056 if( pWInfo->eOnePass!=ONEPASS_OFF ){
144184 1056 256 if( pWInfo->eOnePass==ONEPASS_OFF && pTab->nCol
1056 0 if( pWInfo->eOnePass==ONEPASS_OFF && pTab->nCol
1056 0 if( pWInfo->eOnePass==ONEPASS_OFF && pTab->nCol
144187 3514 1056 for(; b; b=b>>1, n++){}
144206 38 1351 if( pLoop->wsFlags & WHERE_INDEXED ){
144212 0 38 if( !HasRowid(pTab) && IsPrimaryKeyIndex(pIx)
0 0 if( !HasRowid(pTab) && IsPrimaryKeyIndex(pIx)
144213 0 0 && (wctrlFlags & WHERE_OR_SUBCLAUSE)!=0
144219 8 30 }else if( pWInfo->eOnePass!=ONEPASS_OFF ){
144223 8 0 while( ALWAYS(pJ) && pJ!=pIx ){
0 8 while( ALWAYS(pJ) && pJ!=pIx ){
144229 23 7 }else if( iAuxArg && (wctrlFlags & WHERE_OR_SUBCLAUSE)!=0 ){
4 19 }else if( iAuxArg && (wctrlFlags & WHERE_OR_SUBCLAUSE)!=0 ){
144238 38 0 if( op ){
144241 38 0 if( (pLoop->wsFlags & WHERE_CONSTRAINT)!=0
144242 21 17 && (pLoop->wsFlags & (WHERE_COLUMN_RANGE|WHERE_SKIPSCAN))==0
144243 21 0 && (pWInfo->wctrlFlags&WHERE_ORDERBY_MIN)==0
144244 21 0 && pWInfo->eDistinct!=WHERE_DISTINCT_ORDERED
144266 1367 22 if( iDb>=0 ) sqlite3CodeVerifySchema(pParse, iDb);
144269 0 1810 if( db->mallocFailed ) goto whereBeginError;
144275 1389 1810 for(ii=0; ii
144281 1 1388 if( (pLevel->pWLoop->wsFlags & WHERE_AUTO_INDEX)!=0 ){
144284 0 1 if( db->mallocFailed ) goto whereBeginError;
144293 1387 2 if( (wsFlags&WHERE_MULTI_OR)==0 && (wctrlFlags&WHERE_OR_SUBCLAUSE)==0 ){
144304 0 0 if( pWInfo ){
144347 1389 1810 for(i=pWInfo->nLevel-1; i>=0; i--){
144351 953 436 if( pLevel->op!=OP_Noop ){
144356 0 953 if( pWInfo->eDistinct==WHERE_DISTINCT_ORDERED
144357 0 0 && i==pWInfo->nLevel-1 /* Ticket [ef9318757b152e3] 2017-10-21 */
144358 0 0 && (pLoop->wsFlags & WHERE_INDEXED)!=0
144359 0 0 && (pIdx = pLoop->u.btree.pIndex)->hasStat1
144360 0 0 && (n = pLoop->u.btree.nIdxCol)>0
144361 0 0 && pIdx->aiRowLogEst[n]>=36
144365 0 0 for(j=0; j
144369 0 0 op = pLevel->op==OP_Prev ? OP_SeekLT : OP_SeekGT;
144385 0 953 if( addrSeek ) sqlite3VdbeJumpHere(v, addrSeek);
144390 0 1389 if( pLoop->wsFlags & WHERE_IN_ABLE && pLevel->u.in.nIn>0 ){
0 0 if( pLoop->wsFlags & WHERE_IN_ABLE && pLevel->u.in.nIn>0 ){
144394 0 0 for(j=pLevel->u.in.nIn, pIn=&pLevel->u.in.aInLoop[j-1]; j>0; j--, pIn--){
144396 0 0 if( pIn->eEndLoopOp!=OP_Noop ){
144397 0 0 if( pIn->nPrefix ){
144413 0 1389 if( pLevel->addrSkip ){
144420 0 1389 if( pLevel->addrLikeRep ){
144426 0 1389 if( pLevel->iLeftJoin ){
144430 0 0 if( (ws & WHERE_IDX_ONLY)==0 ){
144434 0 0 if( (ws & WHERE_INDEXED)
144435 0 0 || ((ws & WHERE_MULTI_OR) && pLevel->u.pCovidx)
0 0 || ((ws & WHERE_MULTI_OR) && pLevel->u.pCovidx)
144439 0 0 if( pLevel->op==OP_Return ){
144456 1389 1810 for(i=0, pLevel=pWInfo->a; inLevel; i++, pLevel++){
144469 22 1367 if( pTabItem->fg.viaCoroutine ){
144487 39 1328 if( pLoop->wsFlags & (WHERE_INDEXED|WHERE_IDX_ONLY) ){
144489 2 1326 }else if( pLoop->wsFlags & WHERE_MULTI_OR ){
144492 39 1328 if( pIdx
144493 8 31 && (pWInfo->eOnePass==ONEPASS_OFF || !HasRowid(pIdx->pTable))
0 8 && (pWInfo->eOnePass==ONEPASS_OFF || !HasRowid(pIdx->pTable))
144494 31 0 && !db->mallocFailed
144504 483 31 for(; k
144505 373 110 if( pOp->p1!=pLevel->iTabCur ) continue;
144506 84 26 if( pOp->opcode==OP_Column
144513 0 84 if( !HasRowid(pTab) ){
144519 44 40 if( x>=0 ){
144526 4 22 }else if( pOp->opcode==OP_Rowid ){
144530 0 22 }else if( pOp->opcode==OP_IfNullRow ){
144702 0 0 if( p ) (*p)++;
144708 0 0 sqlite3_result_int64(pCtx, (p ? *p : 0));
144734 0 0 if( p ) p->nStep = 1;
144741 0 0 if( p ){
144742 0 0 if( p->nStep ){
144763 0 0 if( p ){
144765 0 0 if( p->nValue==0 ){
144775 0 0 if( p ){
144796 0 0 if( p ){
144797 0 0 if( p->nTotal==0 ){
144801 0 0 if( p->nValue==0 ){
144809 0 0 if( p ){
144810 0 0 if( p->nTotal>1 ){
144835 0 0 if( p ){
144836 0 0 if( p->nTotal==0 ){
144845 0 0 if( p && p->nTotal ){
0 0 if( p && p->nTotal ){
144874 0 0 if( p ){
144875 0 0 if( p->nTotal==0 ){
144878 0 0 if( p->nParam<=0 ){
144890 0 0 if( p && p->nParam>0 ){
0 0 if( p && p->nParam>0 ){
144892 0 0 if( nSize==0 ){
144901 0 0 if( iRow
144929 0 0 if( p ){
144932 0 0 if( p->pVal==0 ){
144948 0 0 if( ALWAYS(p) ){
144950 0 0 if( p->nVal==0 ){
144959 0 0 if( p && p->pVal ){
0 0 if( p && p->pVal ){
144966 0 0 if( p && p->pVal ){
0 0 if( p && p->pVal ){
145087 0 0 if( pWin->zName && pWin->eType==0 ){
0 0 if( pWin->zName && pWin->eType==0 ){
145089 0 0 for(p=pList; p; p=p->pNextWin){
145090 0 0 if( sqlite3StrICmp(p->zName, pWin->zName)==0 ) break;
145092 0 0 if( p==0 ){
145104 0 0 if( pFunc->funcFlags & SQLITE_FUNC_WINDOW ){
145106 0 0 if( pWin->pFilter ){
145111 0 0 if( pFunc->zName==row_numberName || pFunc->zName==ntileName ){
0 0 if( pFunc->zName==row_numberName || pFunc->zName==ntileName ){
145120 0 0 if( pFunc->zName==dense_rankName || pFunc->zName==rankName
0 0 if( pFunc->zName==dense_rankName || pFunc->zName==rankName
145121 0 0 || pFunc->zName==percent_rankName || pFunc->zName==cume_distName
0 0 || pFunc->zName==percent_rankName || pFunc->zName==cume_distName
145160 0 0 if( p->pSubSelect ){
145161 0 0 if( pExpr->op!=TK_COLUMN ){
145166 0 0 for(i=0; i
145167 0 0 if( pExpr->iTable==p->pSrc->a[i].iCursor ) break;
145169 0 0 if( i==nSrc ) return WRC_Continue;
145176 0 0 if( !ExprHasProperty(pExpr, EP_WinFunc) ){
145180 0 0 for(pWin=p->pWin; pWin; pWin=pWin->pNextWin){
145181 0 0 if( pExpr->y.pWin==pWin ){
145193 0 0 if( p->pSub ){
145217 0 0 if( pSave==pSelect ){
145277 0 0 if( pAppend ){
145279 0 0 int nInit = pList ? pList->nExpr : 0;
145280 0 0 for(i=0; inExpr; i++){
145283 0 0 if( pList ) pList->a[nInit+i].sortOrder = pAppend->a[i].sortOrder;
145298 0 1628 if( p->pWin && p->pPrior==0 ){
0 0 if( p->pWin && p->pPrior==0 ){
145322 0 0 if( pSort && p->pOrderBy ){
0 0 if( pSort && p->pOrderBy ){
145323 0 0 if( sqlite3ExprListCompare(pSort, p->pOrderBy, -1)==0 ){
145336 0 0 pMWin->nBufferCol = (pSublist ? pSublist->nExpr : 0);
145348 0 0 for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
145349 0 0 pWin->iArgCol = (pSublist ? pSublist->nExpr : 0);
145351 0 0 if( pWin->pFilter ){
145366 0 0 if( pSublist==0 ){
145377 0 0 if( p->pSrc ){
145380 0 0 if( sqlite3ExpandSubquery(pParse, &p->pSrc->a[0]) ){
145392 0 0 if( db->mallocFailed ) rc = SQLITE_NOMEM;
145402 0 0 if( p ){
145417 0 0 while( p ){
145432 0 0 if( 0==sqlite3ExprIsConstant(pExpr) ){
145465 0 0 if( eType==TK_RANGE && (pStart!=0 || pEnd!=0) ){
0 0 if( eType==TK_RANGE && (pStart!=0 || pEnd!=0) ){
0 0 if( eType==TK_RANGE && (pStart!=0 || pEnd!=0) ){
145484 0 0 if( (eStart==TK_CURRENT && eEnd==TK_PRECEDING)
0 0 if( (eStart==TK_CURRENT && eEnd==TK_PRECEDING)
145485 0 0 || (eStart==TK_FOLLOWING && (eEnd==TK_PRECEDING || eEnd==TK_CURRENT))
0 0 || (eStart==TK_FOLLOWING && (eEnd==TK_PRECEDING || eEnd==TK_CURRENT))
0 0 || (eStart==TK_FOLLOWING && (eEnd==TK_PRECEDING || eEnd==TK_CURRENT))
145492 0 0 if( pWin==0 ) goto windowAllocErr;
145510 0 0 if( p ){
145515 0 0 if( ALWAYS(pWin) ){
145519 0 0 if( p->flags & EP_Distinct ){
145534 0 0 if( p1->eType!=p2->eType ) return 1;
145535 0 0 if( p1->eStart!=p2->eStart ) return 1;
145536 0 0 if( p1->eEnd!=p2->eEnd ) return 1;
145537 0 0 if( sqlite3ExprCompare(pParse, p1->pStart, p2->pStart, -1) ) return 1;
145538 0 0 if( sqlite3ExprCompare(pParse, p1->pEnd, p2->pEnd, -1) ) return 1;
145539 0 0 if( sqlite3ExprListCompare(p1->pPartition, p2->pPartition, -1) ) return 1;
145540 0 0 if( sqlite3ExprListCompare(p1->pOrderBy, p2->pOrderBy, -1) ) return 1;
145553 0 0 int nPart = (pMWin->pPartition ? pMWin->pPartition->nExpr : 0);
145554 0 0 nPart += (pMWin->pOrderBy ? pMWin->pOrderBy->nExpr : 0);
145555 0 0 if( nPart ){
145561 0 0 for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
145563 0 0 if( (p->funcFlags & SQLITE_FUNC_MINMAX) && pWin->eStart!=TK_UNBOUNDED ){
0 0 if( (p->funcFlags & SQLITE_FUNC_MINMAX) && pWin->eStart!=TK_UNBOUNDED ){
145576 0 0 if( pKeyInfo && pWin->pFunc->zName[1]=='i' ){
0 0 if( pKeyInfo && pWin->pFunc->zName[1]=='i' ){
145584 0 0 else if( p->zName==nth_valueName || p->zName==first_valueName ){
0 0 else if( p->zName==nth_valueName || p->zName==first_valueName ){
145593 0 0 else if( p->zName==leadName || p->zName==lagName ){
0 0 else if( p->zName==leadName || p->zName==lagName ){
145638 0 0 return (pList ? pList->nExpr : 0);
145670 0 0 for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
145675 0 0 if( csr>=0 ){
145677 0 0 for(i=0; i
145681 0 0 if( flags & SQLITE_FUNC_WINDOW_SIZE ){
145682 0 0 if( nArg==0 ){
145694 0 0 if( (pWin->pFunc->funcFlags & SQLITE_FUNC_MINMAX)
145695 0 0 && pWin->eStart!=TK_UNBOUNDED
145699 0 0 if( bInverse==0 ){
145711 0 0 }else if( pWin->regApp ){
145717 0 0 }else if( pWin->pFunc->zName==leadName
145718 0 0 || pWin->pFunc->zName==lagName
145723 0 0 if( pWin->pFilter ){
145727 0 0 if( csr>0 ){
145735 0 0 if( csr>0 ){
145739 0 0 if( pWin->pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL ){
145745 0 0 sqlite3VdbeAddOp3(v, bInverse? OP_AggInverse : OP_AggStep,
145749 0 0 if( addrIf ) sqlite3VdbeJumpHere(v, addrIf);
145764 0 0 for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
145765 0 0 if( (pWin->pFunc->funcFlags & SQLITE_FUNC_MINMAX)
145766 0 0 && pWin->eStart!=TK_UNBOUNDED
145773 0 0 if( bFinal ){
145776 0 0 }else if( pWin->regApp ){
145778 0 0 if( bFinal ){
145820 0 0 for(k=0; k
145827 0 0 if( pMWin->pPartition ){
145876 0 0 for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
145878 0 0 if( pFunc->zName==nth_valueName
145879 0 0 || pFunc->zName==first_valueName
145886 0 0 if( pFunc->zName==nth_valueName ){
145901 0 0 else if( pFunc->zName==leadName || pFunc->zName==lagName ){
0 0 else if( pFunc->zName==leadName || pFunc->zName==lagName ){
145908 0 0 if( nArg<3 ){
145914 0 0 if( nArg<2 ){
145915 0 0 int val = (pFunc->zName==leadName ? 1 : -1);
145918 0 0 int op = (pFunc->zName==leadName ? OP_Add : OP_Subtract);
145966 0 0 if( regInvArg ){
145985 0 0 for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
145988 0 0 nArg = MAX(nArg, windowArgCount(pWin));
145989 0 0 if( pFunc->zName==nth_valueName
145990 0 0 || pFunc->zName==first_valueName
145996 0 0 if( (pFunc->funcFlags & SQLITE_FUNC_MINMAX) && pWin->csrApp ){
0 0 if( (pFunc->funcFlags & SQLITE_FUNC_MINMAX) && pWin->csrApp ){
146186 0 0 if( pMWin->pStart ){
146190 0 0 if( pMWin->pEnd ){
146203 0 0 if( pMWin->pEnd && pMWin->eStart==TK_FOLLOWING ){
0 0 if( pMWin->pEnd && pMWin->eStart==TK_FOLLOWING ){
146212 0 0 if( pMWin->pStart && pMWin->eEnd==TK_PRECEDING ){
0 0 if( pMWin->pStart && pMWin->eEnd==TK_PRECEDING ){
146237 0 0 if( pMWin->eEnd==TK_PRECEDING ){
146245 0 0 if( pMWin->eEnd==TK_UNBOUNDED ){
146251 0 0 if( pMWin->eEnd==TK_PRECEDING ){
146256 0 0 if( pMWin->eEnd==TK_FOLLOWING ){
146260 0 0 if( pMWin->eStart==TK_FOLLOWING ){
146269 0 0 if( pMWin->eStart==TK_FOLLOWING ){
146273 0 0 if( pMWin->eStart==TK_CURRENT
146274 0 0 || pMWin->eStart==TK_PRECEDING
146275 0 0 || pMWin->eStart==TK_FOLLOWING
146278 0 0 if( pMWin->eStart==TK_PRECEDING ){
146282 0 0 if( pMWin->eStart==TK_FOLLOWING ){
146293 0 0 if( pMWin->eEnd==TK_FOLLOWING ){
146421 0 0 int nPeer = pOrderBy ? pOrderBy->nExpr : 0;
146433 0 0 int bReverse = pMWin->pOrderBy && pMWin->eStart==TK_CURRENT
146434 0 0 && pMWin->eEnd==TK_UNBOUNDED;
0 0 && pMWin->eEnd==TK_UNBOUNDED;
146471 0 0 if( bReverse ){
146481 0 0 if( pOrderBy && (pMWin->eEnd==TK_CURRENT || pMWin->eStart==TK_CURRENT) ){
0 0 if( pOrderBy && (pMWin->eEnd==TK_CURRENT || pMWin->eStart==TK_CURRENT) ){
0 0 if( pOrderBy && (pMWin->eEnd==TK_CURRENT || pMWin->eStart==TK_CURRENT) ){
146484 0 0 if( pMWin->eType==TK_RANGE ){
146485 0 0 int iOff = pMWin->nBufferCol + (pPart ? pPart->nExpr : 0);
146486 0 0 int regPeer = pMWin->regPart + (pPart ? pPart->nExpr : 0);
146488 0 0 for(k=0; k
146498 0 0 windowReturnRows(pParse, pMWin, regCtr, regGosub, addrGosub,
0 0 windowReturnRows(pParse, pMWin, regCtr, regGosub, addrGosub,
146501 0 0 if( addrJump ) sqlite3VdbeJumpHere(v, addrJump);
146504 0 0 if( bReverse==0 ){
146585 0 0 if( pMWin->eEnd==TK_UNBOUNDED ){
146593 0 0 for(k=0; k
146598 0 0 if( pPart || pOrderBy ){
0 0 if( pPart || pOrderBy ){
146599 0 0 int nPart = (pPart ? pPart->nExpr : 0);
146602 0 0 int nPeer = (pOrderBy ? pOrderBy->nExpr : 0);
146604 0 0 if( pPart ){
146612 0 0 if( pOrderBy ){
146617 0 0 if( pOrderBy ){
146621 0 0 if( addrJump ) sqlite3VdbeJumpHere(v, addrJump);
146622 0 0 if( pMWin->eType==TK_RANGE ){
146632 0 0 if( addrGoto ) sqlite3VdbeJumpHere(v, addrGoto);
146646 0 0 if( addrJump ) sqlite3VdbeJumpHere(v, addrJump);
146653 0 0 if( pMWin->nBufferCol>0 ){
146680 0 0 if( ALWAYS(p) ){
146682 0 0 if( pNew ){
146707 0 0 for(pWin=p; pWin; pWin=pWin->pNextWin){
146709 0 0 if( *pp==0 ) break;
146766 0 0 if( pMWin->eType==TK_ROWS
146767 0 0 && (pMWin->eStart!=TK_UNBOUNDED||pMWin->eEnd!=TK_CURRENT||!pMWin->pOrderBy)
0 0 && (pMWin->eStart!=TK_UNBOUNDED||pMWin->eEnd!=TK_CURRENT||!pMWin->pOrderBy)
0 0 && (pMWin->eStart!=TK_UNBOUNDED||pMWin->eEnd!=TK_CURRENT||!pMWin->pOrderBy)
146775 0 0 if( pMWin->eStart==TK_CURRENT && pMWin->eEnd==TK_UNBOUNDED ){
0 0 if( pMWin->eStart==TK_CURRENT && pMWin->eEnd==TK_UNBOUNDED ){
146778 0 0 for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
146780 0 0 if( (pFunc->funcFlags & SQLITE_FUNC_WINDOW_SIZE)
146781 0 0 || (pFunc->zName==nth_valueName)
146782 0 0 || (pFunc->zName==first_valueName)
146783 0 0 || (pFunc->zName==leadName)
146784 0 0 || (pFunc->zName==lagName)
146793 0 0 if( bCache ){
146902 24 4115 if( p->pPrior ){
146905 107 24 for(pLoop=p; pLoop; pNext=pLoop, pLoop=pLoop->pPrior, cnt++){
146909 22 2 if( (p->selFlags & SF_MultiValue)==0 &&
22 0 if( (p->selFlags & SF_MultiValue)==0 &&
146910 0 22 (mxSelect = pParse->db->aLimit[SQLITE_LIMIT_COMPOUND_SELECT])>0 &&
146925 9254 0 if( p ){
146941 2058 7196 if( sqlite3Isquote(p->u.zToken[0]) ){
146942 57 2001 if( p->u.zToken[0]=='"' ) p->flags |= EP_DblQuoted;
146948 0 9254 if( IN_RENAME_OBJECT ){
146960 18 0 if( pA && pY && pY->op==TK_NULL && !IN_RENAME_OBJECT ){
18 0 if( pA && pY && pY->op==TK_NULL && !IN_RENAME_OBJECT ){
17 1 if( pA && pY && pY->op==TK_NULL && !IN_RENAME_OBJECT ){
17 0 if( pA && pY && pY->op==TK_NULL && !IN_RENAME_OBJECT ){
146980 24 0 if( (hasCollate || sortOrder!=SQLITE_SO_UNDEFINED)
0 24 if( (hasCollate || sortOrder!=SQLITE_SO_UNDEFINED)
146981 0 0 && pParse->db->init.busy==0
148823 10846 5710 while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser);
148907 56525 145720 if( stateno>YY_MAX_SHIFT ) return stateno;
148919 137533 8322 if( i>=YY_NLOOKAHEAD || yy_lookahead[i]!=iLookAhead ){
65971 71562 if( i>=YY_NLOOKAHEAD || yy_lookahead[i]!=iLookAhead ){
148922 53911 20382 if( iLookAhead
148923 135 53776 && (iFallback = yyFallback[iLookAhead])!=0 ){
148938 65836 8322 if(
148945 88 65748 j<(int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])) &&
148946 88 0 yy_lookahead[j]==YYWILDCARD && iLookAhead>0
149007 0 0 while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
149057 0 71208 if( yypParser->yytos>yypParser->yystackEnd ){
149071 33440 37768 if( yyNewState > YY_MAX_SHIFT ){
149501 42794 87955 if( yyRuleInfo[yyruleno].nrhs==0 ){
149509 0 42794 if( yypParser->yytos>=yypParser->yystackEnd ){
149619 0 0 if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
0 0 if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
149676 0 0 if( p ){
149814 0 0 if( p ){
149826 0 0 if( p ){
149838 4139 0 if( p ){
149848 75 0 if( pRhs && pRhs->pPrior ){
0 75 if( pRhs && pRhs->pPrior ){
149856 75 0 if( pRhs ){
149859 75 0 if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue;
149861 4 71 if( yymsp[-1].minor.yy70!=TK_ALL ) pParse->hasCompound = 1;
149883 0 0 if( yymsp[-9].minor.yy489 ){
149899 8 0 if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue;
149900 8 0 if( pRight ){
149926 304 2387 if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy420, &yymsp[0].minor.yy0, 1);
149961 3 0 if( ALWAYS(yymsp[-1].minor.yy135 && yymsp[-1].minor.yy135->nSrc>0) ) yymsp[-1].minor.yy135->a[yymsp[-1].minor.yy135->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy70;
3 0 if( ALWAYS(yymsp[-1].minor.yy135 && yymsp[-1].minor.yy135->nSrc>0) ) yymsp[-1].minor.yy135->a[yymsp[-1].minor.yy135->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy70;
149986 0 0 if( yymsp[-6].minor.yy135==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy18==0 && yymsp[0].minor.yy48==0 ){
0 0 if( yymsp[-6].minor.yy135==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy18==0 && yymsp[0].minor.yy48==0 ){
0 0 if( yymsp[-6].minor.yy135==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy18==0 && yymsp[0].minor.yy48==0 ){
0 0 if( yymsp[-6].minor.yy135==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy18==0 && yymsp[0].minor.yy48==0 ){
149988 0 0 }else if( yymsp[-4].minor.yy135->nSrc==1 ){
149990 0 0 if( yymsp[-6].minor.yy135 ){
150015 0 12 if( IN_RENAME_OBJECT && yylhsminor.yy135 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy135->a[0].zName, &yymsp[0].minor.yy0);
0 0 if( IN_RENAME_OBJECT && yylhsminor.yy135 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy135->a[0].zName, &yymsp[0].minor.yy0);
150022 0 0 if( IN_RENAME_OBJECT && yylhsminor.yy135 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy135->a[0].zName, &yymsp[0].minor.yy0);
0 0 if( IN_RENAME_OBJECT && yylhsminor.yy135 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy135->a[0].zName, &yymsp[0].minor.yy0);
150035 0 0 if( yymsp[-4].minor.yy135 ) yymsp[-4].minor.yy135->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
150041 0 0 if( yymsp[-2].minor.yy135 ) yymsp[-2].minor.yy135->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0);
150195 0 49 if( IN_RENAME_OBJECT ){
150209 0 0 if( IN_RENAME_OBJECT ){
150229 488 1079 if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
0 488 if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
150239 0 488 if( pParse->nested==0 ){
150244 488 0 if( yymsp[0].minor.yy18 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy18->iTable);
150296 0 0 if( yymsp[-4].minor.yy18 ){
150324 12 85 if( bNot ) yymsp[-2].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy18, 0);
150325 97 0 if( yymsp[-2].minor.yy18 ) yymsp[-2].minor.yy18->flags |= EP_InfixFunc;
150337 0 0 if( bNot ) yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy18, 0);
150338 0 0 if( yymsp[-4].minor.yy18 ) yymsp[-4].minor.yy18->flags |= EP_InfixFunc;
150365 0 0 yymsp[-1].minor.yy18 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy18, 0);
150378 14 0 if( yymsp[-4].minor.yy18 ){
150383 0 14 if( yymsp[-3].minor.yy70 ) yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy18, 0);
150388 0 17 if( yymsp[-1].minor.yy420==0 ){
150399 1 16 }else if( yymsp[-1].minor.yy420->nExpr==1 ){
150421 1 0 if( ALWAYS(pRHS) ){
150425 0 1 yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, yymsp[-3].minor.yy70 ? TK_NE : TK_EQ, yymsp[-4].minor.yy18, pRHS);
150428 16 0 if( yymsp[-4].minor.yy18 ){
150434 0 16 if( yymsp[-3].minor.yy70 ) yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy18, 0);
150448 0 0 if( yymsp[-3].minor.yy70 ) yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy18, 0);
150455 0 0 if( yymsp[0].minor.yy420 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy420);
0 0 if( yymsp[0].minor.yy420 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy420);
150458 0 0 if( yymsp[-3].minor.yy70 ) yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy18, 0);
150471 0 0 if( yymsp[-4].minor.yy18 ){
150472 0 0 yymsp[-4].minor.yy18->x.pList = yymsp[-1].minor.yy18 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy420,yymsp[-1].minor.yy18) : yymsp[-2].minor.yy420;
150510 0 10 if( IN_RENAME_OBJECT && pParse->pNewIndex ){
0 0 if( IN_RENAME_OBJECT && pParse->pNewIndex ){
150567 0 0 yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
150651 0 0 if( yymsp[-3].minor.yy18 ){
150659 0 0 if( yymsp[-5].minor.yy18 ) {
150766 0 0 if( ALWAYS(yymsp[0].minor.yy327) ){
150776 0 0 if( ALWAYS(yymsp[-4].minor.yy327) ){
150845 0 0 if( yylhsminor.yy327 ){
150977 2 0 if( TOKEN.z[0] ){
151070 130749 71496 if( yyact >= YY_MIN_REDUCE ){
151073 71208 288 }else if( yyact <= YY_MAX_SHIFTREDUCE ){
151079 286 2 }else if( yyact==YY_ACCEPT_ACTION ){
151185 130749 0 }while( yypParser->yytos>yypParser->yystack );
151207 0 0 if( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ){
151523 34698 394 if( n>=2 ){
151525 39172 17195 for(i=((int)aKWHash[i])-1; i>=0; i=((int)aKWNext[i])-1){
151526 21425 17747 if( aKWLen[i]!=n ) continue;
151530 90872 17503 while( j
90628 244 while( j
151535 244 17503 if( j
151685 0 0 if( i<0 || i>=SQLITE_N_KEYWORD ) return SQLITE_ERROR;
0 0 if( i<0 || i>=SQLITE_N_KEYWORD ) return SQLITE_ERROR;
151750 0 0 }while( t==TK_SPACE );
151751 0 0 if( t==TK_ID
151752 0 0 || t==TK_STRING
151753 0 0 || t==TK_JOIN_KW
151754 0 0 || t==TK_WINDOW
151755 0 0 || t==TK_OVER
151756 0 0 || sqlite3ParserFallback(t)==TK_ID
151797 0 0 if( t!=TK_ID ) return TK_ID;
151799 0 0 if( t!=TK_AS ) return TK_ID;
151803 0 0 if( lastToken==TK_RP ){
151805 0 0 if( t==TK_LP || t==TK_ID ) return TK_OVER;
0 0 if( t==TK_LP || t==TK_ID ) return TK_OVER;
151810 0 0 if( lastToken==TK_RP && getToken(&z)==TK_LP ){
0 0 if( lastToken==TK_RP && getToken(&z)==TK_LP ){
151832 2360 36145 for(i=1; sqlite3Isspace(z[i]); i++){}
151837 3 0 if( z[1]=='-' ){
151838 51 1 for(i=2; (c=z[i])!=0 && c!='\n'; i++){}
49 2 for(i=2; (c=z[i])!=0 && c!='\n'; i++){}
151866 1 0 if( z[1]!='*' || z[2]==0 ){
0 1 if( z[1]!='*' || z[2]==0 ){
151870 1 25 for(i=3, c=z[2]; (c!='*' || z[i]!='/') && (c=z[i])!=0; i++){}
0 1 for(i=3, c=z[2]; (c!='*' || z[i]!='/') && (c=z[i])!=0; i++){}
25 0 for(i=3, c=z[2]; (c!='*' || z[i]!='/') && (c=z[i])!=0; i++){}
151871 1 0 if( c ) i++;
151881 0 2003 return 1 + (z[1]=='=');
151884 12 2 if( (c=z[1])=='=' ){
151887 0 2 }else if( c=='>' ){
151890 0 2 }else if( c=='<' ){
151899 14 16 if( (c=z[1])=='=' ){
151902 0 16 }else if( c=='>' ){
151911 0 208 if( z[1]!='=' ){
151920 0 0 if( z[1]!='|' ){
151945 37933 0 for(i=1; (c=z[i])!=0; i++){
151946 3523 34410 if( c==delim ){
151947 140 3383 if( z[i+1]==delim ){
151954 2782 601 if( c=='\'' ){
151957 601 0 }else if( c!=0 ){
151967 967 0 if( !sqlite3Isdigit(z[1]) )
151983 2178 591 if( z[0]=='0' && (z[1]=='x' || z[1]=='X') && sqlite3Isxdigit(z[2]) ){
2178 0 if( z[0]=='0' && (z[1]=='x' || z[1]=='X') && sqlite3Isxdigit(z[2]) ){
0 2178 if( z[0]=='0' && (z[1]=='x' || z[1]=='X') && sqlite3Isxdigit(z[2]) ){
0 0 if( z[0]=='0' && (z[1]=='x' || z[1]=='X') && sqlite3Isxdigit(z[2]) ){
151984 0 0 for(i=3; sqlite3Isxdigit(z[i]); i++){}
151988 3274 2769 for(i=0; sqlite3Isdigit(z[i]); i++){}
151990 2166 603 if( z[i]=='.' ){
151992 32431 2166 while( sqlite3Isdigit(z[i]) ){ i++; }
151995 2768 1 if( (z[i]=='e' || z[i]=='E') &&
0 2768 if( (z[i]=='e' || z[i]=='E') &&
1 0 if( (z[i]=='e' || z[i]=='E') &&
151997 1 0 || ((z[i+1]=='+' || z[i+1]=='-') && sqlite3Isdigit(z[i+2]))
1 0 || ((z[i+1]=='+' || z[i+1]=='-') && sqlite3Isdigit(z[i+2]))
1 0 || ((z[i+1]=='+' || z[i+1]=='-') && sqlite3Isdigit(z[i+2]))
152001 2 1 while( sqlite3Isdigit(z[i]) ){ i++; }
152005 0 2769 while( IdChar(z[i]) ){
152012 18 6 for(i=1, c=z[0]; c!=']' && (c=z[i])!=0; i++){}
18 0 for(i=1, c=z[0]; c!=']' && (c=z[i])!=0; i++){}
152013 6 0 *tokenType = c==']' ? TK_ID : TK_ILLEGAL;
152018 13 1071 for(i=1; sqlite3Isdigit(z[i]); i++){}
152027 803 236 for(i=1; (c=z[i])!=0; i++){
152028 533 270 if( IdChar(c) ){
152031 0 270 }else if( c=='(' && n>0 ){
0 0 }else if( c=='(' && n>0 ){
152034 0 0 }while( (c=z[i])!=0 && !sqlite3Isspace(c) && c!=')' );
0 0 }while( (c=z[i])!=0 && !sqlite3Isspace(c) && c!=')' );
0 0 }while( (c=z[i])!=0 && !sqlite3Isspace(c) && c!=')' );
152035 0 0 if( c==')' ){
152041 0 270 }else if( c==':' && z[i+1]==':' ){
0 0 }else if( c==':' && z[i+1]==':' ){
152048 0 506 if( n==0 ) *tokenType = TK_ILLEGAL;
152052 166226 35627 for(i=1; aiClass[z[i]]<=CC_KYWD; i++){}
152053 535 35092 if( IdChar(z[i]) ){
152066 0 382 if( z[1]=='\'' ){
152068 0 0 for(i=2; sqlite3Isxdigit(z[i]); i++){}
152069 0 0 if( z[i]!='\'' || i%2 ){
0 0 if( z[i]!='\'' || i%2 ){
152071 0 0 while( z[i] && z[i]!='\'' ){ i++; }
0 0 while( z[i] && z[i]!='\'' ){ i++; }
152073 0 0 if( z[i] ) i++;
152093 2484 921 while( IdChar(z[i]) ){ i++; }
152186 5024 686 if( db->nVdbeActive==0 ){
152210 0 107891 if( mxSqlLen<0 ){
152215 42290 65601 if( tokenType>=TK_WINDOW ){
152223 0 42290 if( db->u1.isInterrupted ){
152227 36109 6181 if( tokenType==TK_SPACE ){
152231 6181 0 if( zSql[0]==0 ){
152234 286 5895 if( lastTokenParsed==TK_SEMI ){
152236 286 5609 }else if( lastTokenParsed==0 ){
152243 0 0 }else if( tokenType==TK_WINDOW ){
152246 0 0 }else if( tokenType==TK_OVER ){
152249 0 0 }else if( tokenType==TK_FILTER ){
152263 66072 5424 if( pParse->rc!=SQLITE_OK || db->mallocFailed ) break;
66072 0 if( pParse->rc!=SQLITE_OK || db->mallocFailed ) break;
152278 0 5710 if( db->mallocFailed ){
152281 5424 286 if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){
10 5414 if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){
0 10 if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){
152285 10 5700 if( pParse->zErrMsg ){
152293 5692 18 if( pParse->pVdbe && pParse->nErr>0 && pParse->nested==0 ){
0 5692 if( pParse->pVdbe && pParse->nErr>0 && pParse->nested==0 ){
0 0 if( pParse->pVdbe && pParse->nErr>0 && pParse->nested==0 ){
152298 5432 278 if( pParse->nested==0 ){
152308 5701 9 if( !IN_SPECIAL_PARSE ){
152315 5710 0 if( !IN_RENAME_OBJECT ){
152319 0 5710 if( pParse->pWithToFree ) sqlite3WithDelete(db, pParse->pWithToFree);
152321 2 5710 while( pParse->pAinc ){
152326 13 5710 while( pParse->pZombieTab ){
152480 0 0 while( *zSql ){
152495 0 0 if( zSql[1]!='*' ){
152500 0 0 while( zSql[0] && (zSql[0]!='*' || zSql[1]!='/') ){ zSql++; }
0 0 while( zSql[0] && (zSql[0]!='*' || zSql[1]!='/') ){ zSql++; }
0 0 while( zSql[0] && (zSql[0]!='*' || zSql[1]!='/') ){ zSql++; }
152501 0 0 if( zSql[0]==0 ) return 0;
152507 0 0 if( zSql[1]!='-' ){
152511 0 0 while( *zSql && *zSql!='\n' ){ zSql++; }
0 0 while( *zSql && *zSql!='\n' ){ zSql++; }
152512 0 0 if( *zSql==0 ) return state==1;
152518 0 0 while( *zSql && *zSql!=']' ){ zSql++; }
0 0 while( *zSql && *zSql!=']' ){ zSql++; }
152519 0 0 if( *zSql==0 ) return 0;
152528 0 0 while( *zSql && *zSql!=c ){ zSql++; }
0 0 while( *zSql && *zSql!=c ){ zSql++; }
152529 0 0 if( *zSql==0 ) return 0;
152537 0 0 if( IdChar((u8)*zSql) ){
152540 0 0 for(nId=1; IdChar(zSql[nId]); nId++){}
152546 0 0 if( nId==6 && sqlite3StrNICmp(zSql, "create", 6)==0 ){
0 0 if( nId==6 && sqlite3StrNICmp(zSql, "create", 6)==0 ){
152554 0 0 if( nId==7 && sqlite3StrNICmp(zSql, "trigger", 7)==0 ){
0 0 if( nId==7 && sqlite3StrNICmp(zSql, "trigger", 7)==0 ){
152556 0 0 }else if( nId==4 && sqlite3StrNICmp(zSql, "temp", 4)==0 ){
0 0 }else if( nId==4 && sqlite3StrNICmp(zSql, "temp", 4)==0 ){
152558 0 0 }else if( nId==9 && sqlite3StrNICmp(zSql, "temporary", 9)==0 ){
0 0 }else if( nId==9 && sqlite3StrNICmp(zSql, "temporary", 9)==0 ){
152566 0 0 if( nId==3 && sqlite3StrNICmp(zSql, "end", 3)==0 ){
0 0 if( nId==3 && sqlite3StrNICmp(zSql, "end", 3)==0 ){
152570 0 0 if( nId==7 && sqlite3StrNICmp(zSql, "explain", 7)==0 ){
0 0 if( nId==7 && sqlite3StrNICmp(zSql, "explain", 7)==0 ){
152612 0 0 if( rc ) return rc;
152617 0 0 if( zSql8 ){
152888 20664 570 if( sqlite3GlobalConfig.isInit ) return SQLITE_OK;
152899 0 570 if( rc ) return rc;
152910 95 475 if( !sqlite3GlobalConfig.isMallocInit ){
152913 570 0 if( rc==SQLITE_OK ){
152915 95 475 if( !sqlite3GlobalConfig.pInitMutex ){
152918 95 0 if( sqlite3GlobalConfig.bCoreMutex && !sqlite3GlobalConfig.pInitMutex ){
0 95 if( sqlite3GlobalConfig.bCoreMutex && !sqlite3GlobalConfig.pInitMutex ){
152923 570 0 if( rc==SQLITE_OK ){
152931 0 570 if( rc!=SQLITE_OK ){
152949 570 0 if( sqlite3GlobalConfig.isInit==0 && sqlite3GlobalConfig.inProgress==0 ){
95 475 if( sqlite3GlobalConfig.isInit==0 && sqlite3GlobalConfig.inProgress==0 ){
152959 95 0 if( sqlite3GlobalConfig.isPCacheInit==0 ){
152962 95 0 if( rc==SQLITE_OK ){
152971 95 0 if( rc==SQLITE_OK ){
152988 95 475 if( sqlite3GlobalConfig.nRefInitMutex<=0 ){
153043 0 0 if( sqlite3GlobalConfig.isInit ){
153052 0 0 if( sqlite3GlobalConfig.isPCacheInit ){
153056 0 0 if( sqlite3GlobalConfig.isMallocInit ){
153072 0 0 if( sqlite3GlobalConfig.isMutexInit ){
153095 0 190 if( sqlite3GlobalConfig.isInit ) return SQLITE_MISUSE_BKPT;
153151 95 0 sqlite3GlobalConfig.m = *va_arg(ap, sqlite3_mem_methods*);
153159 0 0 if( sqlite3GlobalConfig.m.xMalloc==0 ) sqlite3MemSetDefault();
153160 0 0 *va_arg(ap, sqlite3_mem_methods*) = sqlite3GlobalConfig.m;
153167 0 0 sqlite3GlobalConfig.bMemstat = va_arg(ap, int);
153171 0 0 sqlite3GlobalConfig.bSmallMalloc = va_arg(ap, int);
153179 0 0 sqlite3GlobalConfig.pPage = va_arg(ap, void*);
153180 0 0 sqlite3GlobalConfig.szPage = va_arg(ap, int);
153181 0 0 sqlite3GlobalConfig.nPage = va_arg(ap, int);
153189 0 0 *va_arg(ap, int*) =
153211 95 0 sqlite3GlobalConfig.pcache2 = *va_arg(ap, sqlite3_pcache_methods2*);
153219 0 0 if( sqlite3GlobalConfig.pcache2.xInit==0 ){
153222 0 0 *va_arg(ap, sqlite3_pcache_methods2*) = sqlite3GlobalConfig.pcache2;
153272 0 0 sqlite3GlobalConfig.szLookaside = va_arg(ap, int);
153273 0 0 sqlite3GlobalConfig.nLookaside = va_arg(ap, int);
153287 0 0 sqlite3GlobalConfig.xLog = va_arg(ap, LOGFUNC_t);
153288 0 0 sqlite3GlobalConfig.pLogArg = va_arg(ap, void*);
153302 0 0 sqlite3GlobalConfig.bOpenUri = va_arg(ap, int);
153311 0 0 sqlite3GlobalConfig.bUseCis = va_arg(ap, int);
153329 0 0 sqlite3_int64 szMmap = va_arg(ap, sqlite3_int64);
153330 0 0 sqlite3_int64 mxMmap = va_arg(ap, sqlite3_int64);
153339 0 0 if( mxMmap<0 || mxMmap>SQLITE_MAX_MMAP_SIZE ){
0 0 if( mxMmap<0 || mxMmap>SQLITE_MAX_MMAP_SIZE ){
153342 0 0 if( szMmap<0 ) szMmap = SQLITE_DEFAULT_MMAP_SIZE;
153343 0 0 if( szMmap>mxMmap) szMmap = mxMmap;
153360 0 0 sqlite3GlobalConfig.szPma = va_arg(ap, unsigned int);
153365 0 0 sqlite3GlobalConfig.nStmtSpill = va_arg(ap, int);
153404 0 251 if( sqlite3LookasideUsed(db,0)>0 ){
153411 0 251 if( db->lookaside.bMalloced ){
153418 0 251 if( sz<=(int)sizeof(LookasideSlot*) ) sz = 0;
153419 0 251 if( cnt<0 ) cnt = 0;
153420 251 0 if( sz==0 || cnt==0 ){
0 251 if( sz==0 || cnt==0 ){
153423 251 0 }else if( pBuf==0 ){
153427 251 0 if( pStart ) cnt = sqlite3MallocSize(pStart)/sz;
153435 251 0 if( pStart ){
153441 25100 251 for(i=cnt-1; i>=0; i--){
153485 0 0 for(i=0; inDb; i++){
153487 0 0 if( pBt ){
153511 0 0 for(i=0; rc==SQLITE_OK && inDb; i++){
0 0 for(i=0; rc==SQLITE_OK && inDb; i++){
153513 0 0 if( pBt && sqlite3BtreeIsInTrans(pBt) ){
0 0 if( pBt && sqlite3BtreeIsInTrans(pBt) ){
153516 0 0 if( rc==SQLITE_BUSY ){
153524 0 0 return ((rc==SQLITE_OK && bSeenBusy) ? SQLITE_BUSY : rc);
0 0 return ((rc==SQLITE_OK && bSeenBusy) ? SQLITE_BUSY : rc);
153538 0 0 db->aDb[0].zDbSName = va_arg(ap,char*);
153543 0 0 void *pBuf = va_arg(ap, void*); /* IMP: R-26835-10964 */
153544 0 0 int sz = va_arg(ap, int); /* IMP: R-47871-25994 */
153545 0 0 int cnt = va_arg(ap, int); /* IMP: R-04460-53386 */
153566 1482 0 for(i=0; i
153567 494 988 if( aFlagOp[i].op==op ){
153568 494 0 int onoff = va_arg(ap, int);
153569 494 0 int *pRes = va_arg(ap, int*);
153571 247 247 if( onoff>0 ){
153573 0 247 }else if( onoff==0 ){
153576 247 247 if( oldFlags!=db->flags ){
153579 247 247 if( pRes ){
153598 0 0 while( n>0 && z[n-1]==' ' ){ n--; }
0 0 while( n>0 && z[n-1]==' ' ){ n--; }
153621 477 548 if( rc==0 ){
153622 0 477 if( padFlag
153623 0 0 && allSpaces(((char*)pKey1)+n, nKey1-n)
153624 0 0 && allSpaces(((char*)pKey2)+n, nKey2-n)
153644 9 0 return p==0 || (p->xCmp==binCollFunc && p->pUser==0);
9 0 return p==0 || (p->xCmp==binCollFunc && p->pUser==0);
9 0 return p==0 || (p->xCmp==binCollFunc && p->pUser==0);
153664 0 0 if( 0==r ){
153730 13 473 while( db->pSavepoint ){
153748 1992 20184 if( pDestructor ){
153750 1992 0 if( pDestructor->nRef==0 ){
153766 535 265 for(i=0; inDb; i++){
153768 523 12 if( pSchema ){
153769 617 523 for(p=sqliteHashFirst(&pSchema->tblHash); p; p=sqliteHashNext(p)){
153771 10 607 if( IsVirtual(pTab) ) sqlite3VtabDisconnect(db, pTab);
153775 2590 265 for(p=sqliteHashFirst(&db->aModule); p; p=sqliteHashNext(p)){
153777 0 2590 if( pMod->pEpoTab ){
153795 10 510 if( db->pVdbe ) return 1;
153796 1030 510 for(j=0; jnDb; j++){
153798 568 462 if( pBt && sqlite3BtreeIsInBackup(pBt) ) return 1;
0 568 if( pBt && sqlite3BtreeIsInBackup(pBt) ) return 1;
153807 0 265 if( !db ){
153812 0 265 if( !sqlite3SafetyCheckSickOrOk(db) ){
153816 0 265 if( db->mTrace & SQLITE_TRACE_CLOSE ){
153835 265 0 if( !forceZombie && connectionIsBusy(db) ){
10 255 if( !forceZombie && connectionIsBusy(db) ){
153885 255 2068 if( db->magic!=SQLITE_MAGIC_ZOMBIE || connectionIsBusy(db) ){
0 255 if( db->magic!=SQLITE_MAGIC_ZOMBIE || connectionIsBusy(db) ){
153906 515 255 for(j=0; jnDb; j++){
153908 284 231 if( pDb->pBt ){
153911 254 30 if( j!=1 ){
153917 249 6 if( db->aDb[1].pSchema ){
153932 9052 255 for(i=sqliteHashFirst(&db->aFunc); i; i=sqliteHashNext(i)){
153940 1992 9052 }while( p );
153943 781 255 for(i=sqliteHashFirst(&db->aCollSeq); i; i=sqliteHashNext(i)){
153946 2343 781 for(j=0; j<3; j++){
153947 0 2343 if( pColl[j].xDel ){
153955 2490 255 for(i=sqliteHashFirst(&db->aModule); i; i=sqliteHashNext(i)){
153957 498 1992 if( pMod->xDestroy ){
153987 249 6 if( db->lookaside.bMalloced ){
154014 5 301 schemaChange = (db->mDbFlags & DBFLAG_SchemaChange)!=0 && db->init.busy==0;
5 0 schemaChange = (db->mDbFlags & DBFLAG_SchemaChange)!=0 && db->init.busy==0;
154016 617 306 for(i=0; inDb; i++){
154018 339 278 if( p ){
154019 44 295 if( sqlite3BtreeIsInTrans(p) ){
154028 5 301 if( schemaChange ){
154040 2 304 if( db->xRollbackCallback && (inTrans || !db->autoCommit) ){
0 2 if( db->xRollbackCallback && (inTrans || !db->autoCommit) ){
0 0 if( db->xRollbackCallback && (inTrans || !db->autoCommit) ){
154212 23 0 if( ALWAYS(rc>=0) && rc
23 0 if( ALWAYS(rc>=0) && rc
23 0 if( ALWAYS(rc>=0) && rc
154261 120 59 if( count < NDELAY ){
154268 14 165 if( prior + delay > tmout ){
154270 7 7 if( delay<=0 ) return 0;
154299 181 0 if( p->xBusyHandler==0 || p->nBusy<0 ) return 0;
2 179 if( p->xBusyHandler==0 || p->nBusy<0 ) return 0;
154300 179 0 if( p->bExtraFileArg ){
154310 7 172 if( rc==0 ){
154359 2 2 if( nOps>0 ){
154381 261 2 if( ms>0 ){
154431 11132 0 if( zFunctionName==0 /* Must have a valid name */
154432 10594 538 || (xSFunc!=0 && xFinal!=0) /* Not both xSFunc and xFinal */
10594 0 || (xSFunc!=0 && xFinal!=0) /* Not both xSFunc and xFinal */
154433 11132 0 || ((xFinal==0)!=(xStep==0)) /* Both or neither of xFinal and xStep */
154434 11132 0 || ((xValue==0)!=(xInverse==0)) /* Both or neither of xValue, xInverse */
154435 11132 0 || (nArg<-1 || nArg>SQLITE_MAX_FUNCTION_ARG)
11132 0 || (nArg<-1 || nArg>SQLITE_MAX_FUNCTION_ARG)
154436 0 11132 || (255<(nName = sqlite3Strlen30( zFunctionName)))
154453 0 11132 if( enc==SQLITE_UTF16 ){
154455 502 10630 }else if( enc==SQLITE_ANY ){
154459 502 0 if( rc==SQLITE_OK ){
154463 0 502 if( rc!=SQLITE_OK ){
154478 1004 10128 if( p && (p->funcFlags & SQLITE_FUNC_ENCMASK)==(u32)enc && p->nArg==nArg ){
0 1004 if( p && (p->funcFlags & SQLITE_FUNC_ENCMASK)==(u32)enc && p->nArg==nArg ){
0 0 if( p && (p->funcFlags & SQLITE_FUNC_ENCMASK)==(u32)enc && p->nArg==nArg ){
154479 0 0 if( db->nVdbeActive ){
154491 0 11132 if( !p ){
154499 2008 9124 if( pDestructor ){
154505 10594 538 p->xSFunc = xSFunc ? xSFunc : xStep;
154543 2008 8120 if( xDestroy ){
154545 0 2008 if( !pArg ){
154557 2008 8120 if( pArg && pArg->nRef==0 ){
0 2008 if( pArg && pArg->nRef==0 ){
154694 251 2008 if( rc ) return SQLITE_OK;
154696 0 2008 if( zCopy==0 ) return SQLITE_NOMEM;
154722 4 2 db->mTrace = xTrace ? SQLITE_TRACE_LEGACY : 0;
154744 0 0 if( mTrace==0 ) xTrace = 0;
154745 0 0 if( xTrace==0 ) mTrace = 0;
154895 0 0 if( nFrame>=SQLITE_PTR_TO_INT(pClientData) ){
154923 251 0 if( nFrame>0 ){
154981 0 0 if( pnLog ) *pnLog = -1;
154982 0 0 if( pnCkpt ) *pnCkpt = -1;
154988 0 0 if( eModeSQLITE_CHECKPOINT_TRUNCATE ){
0 0 if( eModeSQLITE_CHECKPOINT_TRUNCATE ){
154995 0 0 if( zDb && zDb[0] ){
0 0 if( zDb && zDb[0] ){
154998 0 0 if( iDb<0 ){
155010 0 0 if( db->nVdbeActive==0 ){
155061 0 0 for(i=0; inDb && rc==SQLITE_OK; i++){
0 0 for(i=0; inDb && rc==SQLITE_OK; i++){
155062 0 0 if( i==iDb || iDb==SQLITE_MAX_ATTACHED ){
0 0 if( i==iDb || iDb==SQLITE_MAX_ATTACHED ){
155066 0 0 if( rc==SQLITE_BUSY ){
155073 0 0 return (rc==SQLITE_OK && bBusy) ? SQLITE_BUSY : rc;
0 0 return (rc==SQLITE_OK && bBusy) ? SQLITE_BUSY : rc;
155119 0 107 if( !db ){
155122 0 107 if( !sqlite3SafetyCheckSickOrOk(db) ){
155126 0 107 if( db->mallocFailed ){
155132 17 90 if( z==0 ){
155156 0 0 if( !db ){
155159 0 0 if( !sqlite3SafetyCheckSickOrOk(db) ){
155163 0 0 if( db->mallocFailed ){
155167 0 0 if( z==0 ){
155188 763 0 if( db && !sqlite3SafetyCheckSickOrOk(db) ){
0 763 if( db && !sqlite3SafetyCheckSickOrOk(db) ){
155191 763 0 if( !db || db->mallocFailed ){
0 763 if( !db || db->mallocFailed ){
155197 0 0 if( db && !sqlite3SafetyCheckSickOrOk(db) ){
0 0 if( db && !sqlite3SafetyCheckSickOrOk(db) ){
155200 0 0 if( !db || db->mallocFailed ){
0 0 if( !db || db->mallocFailed ){
155206 0 0 return db ? db->iSysErrno : 0;
155242 1301 0 if( enc2==SQLITE_UTF16 || enc2==SQLITE_UTF16_ALIGNED ){
0 1301 if( enc2==SQLITE_UTF16 || enc2==SQLITE_UTF16_ALIGNED ){
155245 1301 0 if( enc2SQLITE_UTF16BE ){
0 1301 if( enc2SQLITE_UTF16BE ){
155254 514 787 if( pColl && pColl->xCmp ){
0 514 if( pColl && pColl->xCmp ){
155255 0 0 if( db->nVdbeActive ){
155268 0 0 if( (pColl->enc & ~SQLITE_UTF16_ALIGNED)==enc2 ){
155271 0 0 for(j=0; j<3; j++){
155273 0 0 if( p->enc==pColl->enc ){
155274 0 0 if( p->xDel ){
155284 0 1301 if( pColl==0 ) return SQLITE_NOMEM_BKPT;
155393 0 0 if( limitId<0 || limitId>=SQLITE_N_LIMIT ){
0 0 if( limitId<0 || limitId>=SQLITE_N_LIMIT ){
155397 0 0 if( newLimit>=0 ){ /* IMP: R-52476-28732 */
155398 0 0 if( newLimit>aHardLimit[limitId] ){
155447 250 12 if( ((flags & SQLITE_OPEN_URI) /* IMP: R-48725-32206 */
155448 0 250 || sqlite3GlobalConfig.bOpenUri) /* IMP: R-51689-46548 */
155449 12 0 && nUri>=5 && memcmp(zUri, "file:", 5)==0 /* IMP: R-57884-37496 */
12 0 && nUri>=5 && memcmp(zUri, "file:", 5)==0 /* IMP: R-57884-37496 */
155461 214 12 for(iIn=0; iIn
155463 0 12 if( !zFile ) return SQLITE_NOMEM_BKPT;
155480 0 12 if( zUri[5]=='/' && zUri[6]=='/' ){
0 0 if( zUri[5]=='/' && zUri[6]=='/' ){
155482 0 0 while( zUri[iIn] && zUri[iIn]!='/' ) iIn++;
0 0 while( zUri[iIn] && zUri[iIn]!='/' ) iIn++;
155483 0 0 if( iIn!=7 && (iIn!=16 || memcmp("localhost", &zUri[7], 9)) ){
0 0 if( iIn!=7 && (iIn!=16 || memcmp("localhost", &zUri[7], 9)) ){
0 0 if( iIn!=7 && (iIn!=16 || memcmp("localhost", &zUri[7], 9)) ){
155503 154 12 while( (c = zUri[iIn])!=0 && c!='#' ){
154 0 while( (c = zUri[iIn])!=0 && c!='#' ){
155505 0 154 if( c=='%'
155506 0 0 && sqlite3Isxdigit(zUri[iIn])
155507 0 0 && sqlite3Isxdigit(zUri[iIn+1])
155513 0 0 if( octet==0 ){
155519 0 0 while( (c = zUri[iIn])!=0 && c!='#'
0 0 while( (c = zUri[iIn])!=0 && c!='#'
155520 0 0 && (eState!=0 || c!='?')
0 0 && (eState!=0 || c!='?')
155521 0 0 && (eState!=1 || (c!='=' && c!='&'))
0 0 && (eState!=1 || (c!='=' && c!='&'))
0 0 && (eState!=1 || (c!='=' && c!='&'))
155522 0 0 && (eState!=2 || c!='&')
0 0 && (eState!=2 || c!='&')
155535 50 104 }else if( eState==1 && (c=='&' || c=='=') ){
50 0 }else if( eState==1 && (c=='&' || c=='=') ){
10 40 }else if( eState==1 && (c=='&' || c=='=') ){
155536 0 10 if( zFile[iOut-1]==0 ){
155538 0 0 while( zUri[iIn] && zUri[iIn]!='#' && zUri[iIn-1]!='&' ) iIn++;
0 0 while( zUri[iIn] && zUri[iIn]!='#' && zUri[iIn-1]!='&' ) iIn++;
0 0 while( zUri[iIn] && zUri[iIn]!='#' && zUri[iIn-1]!='&' ) iIn++;
155541 0 10 if( c=='&' ){
155547 82 62 }else if( (eState==0 && c=='?') || (eState==2 && c=='&') ){
72 10 }else if( (eState==0 && c=='?') || (eState==2 && c=='&') ){
22 112 }else if( (eState==0 && c=='?') || (eState==2 && c=='&') ){
0 22 }else if( (eState==0 && c=='?') || (eState==2 && c=='&') ){
155553 0 12 if( eState==1 ) zFile[iOut++] = '\0';
155562 10 12 while( zOpt[0] ){
155567 0 10 if( nOpt==3 && memcmp("vfs", zOpt, 3)==0 ){
0 0 if( nOpt==3 && memcmp("vfs", zOpt, 3)==0 ){
155578 0 10 if( nOpt==5 && memcmp("cache", zOpt, 5)==0 ){
0 0 if( nOpt==5 && memcmp("cache", zOpt, 5)==0 ){
155590 10 0 if( nOpt==4 && memcmp("mode", zOpt, 4)==0 ){
10 0 if( nOpt==4 && memcmp("mode", zOpt, 4)==0 ){
155606 10 0 if( aMode ){
155609 18 0 for(i=0; aMode[i].z; i++){
155611 14 4 if( nVal==sqlite3Strlen30(z) && 0==memcmp(zVal, z, nVal) ){
10 4 if( nVal==sqlite3Strlen30(z) && 0==memcmp(zVal, z, nVal) ){
155616 0 10 if( mode==0 ){
155621 0 10 if( (mode & ~SQLITE_OPEN_MEMORY)>limit ){
155636 0 250 if( !zFile ) return SQLITE_NOMEM_BKPT;
155637 247 3 if( nUri ){
155646 0 262 if( *ppVfs==0 ){
155651 0 262 if( rc!=SQLITE_OK ){
155684 0 257 if( rc ) return rc;
155687 0 257 if( sqlite3GlobalConfig.bCoreMutex==0 ){
155689 0 257 }else if( flags & SQLITE_OPEN_NOMUTEX ){
155691 0 257 }else if( flags & SQLITE_OPEN_FULLMUTEX ){
155697 0 257 if( flags & SQLITE_OPEN_PRIVATECACHE ){
155699 0 257 }else if( sqlite3GlobalConfig.sharedCacheEnabled ){
155728 0 257 if( db==0 ) goto opendb_out;
155729 0 257 if( isThreadsafe
155735 0 0 if( db->mutex==0 ){
155811 0 257 if( db->mallocFailed ){
155839 0 257 if( ((1<<(flags&7)) & 0x46)==0 ){
155844 0 257 if( rc!=SQLITE_OK ){
155845 0 0 if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);
155846 0 0 sqlite3ErrorWithMsg(db, rc, zErrMsg ? "%s" : 0, zErrMsg);
155854 6 251 if( rc!=SQLITE_OK ){
155855 0 6 if( rc==SQLITE_IOERR_NOMEM ){
155863 251 0 if( !db->mallocFailed ) ENC(db) = SCHEMA_ENC(db);
155876 0 251 if( db->mallocFailed ){
155892 251 0 if( !db->mallocFailed && rc==SQLITE_OK ){
251 0 if( !db->mallocFailed && rc==SQLITE_OK ){
155900 251 0 if( rc==SQLITE_OK ){
155903 0 251 if( rc!=SQLITE_OK ){
155923 251 0 if( !db->mallocFailed && rc==SQLITE_OK ){
251 0 if( !db->mallocFailed && rc==SQLITE_OK ){
155935 251 0 if( !db->mallocFailed && rc==SQLITE_OK){
251 0 if( !db->mallocFailed && rc==SQLITE_OK){
155953 251 0 if( !db->mallocFailed && rc==SQLITE_OK){
251 0 if( !db->mallocFailed && rc==SQLITE_OK){
155974 0 251 if( rc ) sqlite3Error(db, rc);
155990 0 257 if( rc==SQLITE_NOMEM ){
155993 6 251 }else if( rc!=SQLITE_OK ){
156062 0 0 if( rc ) return rc;
156064 0 0 if( zFilename==0 ) zFilename = "\000\000";
156068 0 0 if( zFilename8 ){
156072 0 0 if( rc==SQLITE_OK && !DbHasProperty(*ppDb, 0, DB_SchemaLoaded) ){
0 0 if( rc==SQLITE_OK && !DbHasProperty(*ppDb, 0, DB_SchemaLoaded) ){
156141 0 0 if( zName8 ){
156313 0 13 if( SQLITE_OK!=rc ){
156319 10 3 if( !pTab || pTab->pSelect ){
0 10 if( !pTab || pTab->pSelect ){
156325 10 0 if( zColumnName==0 ){
156328 22 2 for(iCol=0; iColnCol; iCol++){
156330 8 14 if( 0==sqlite3StrICmp(pCol->zName, zColumnName) ){
156334 2 8 if( iCol==pTab->nCol ){
156335 2 0 if( HasRowid(pTab) && sqlite3IsRowid(zColumnName) ){
0 2 if( HasRowid(pTab) && sqlite3IsRowid(zColumnName) ){
156337 0 0 pCol = iCol>=0 ? &pTab->aCol[iCol] : 0;
156355 8 0 if( pCol ){
156360 3 5 autoinc = pTab->iPKey==iCol && (pTab->tabFlags & TF_Autoincrement)!=0;
2 1 autoinc = pTab->iPKey==iCol && (pTab->tabFlags & TF_Autoincrement)!=0;
156365 8 0 if( !zCollSeq ){
156376 12 1 if( pzDataType ) *pzDataType = zDataType;
156377 12 1 if( pzCollSeq ) *pzCollSeq = zCollSeq;
156378 12 1 if( pNotNull ) *pNotNull = notnull;
156379 12 1 if( pPrimaryKey ) *pPrimaryKey = primarykey;
156380 12 1 if( pAutoinc ) *pAutoinc = autoinc;
156382 13 0 if( SQLITE_OK==rc && !pTab ){
5 8 if( SQLITE_OK==rc && !pTab ){
156388 5 8 sqlite3ErrorWithMsg(db, rc, (zErrMsg?"%s":0), zErrMsg);
156402 0 0 if( pVfs==0 ) return 0;
156419 0 0 db->errMask = onoff ? 0xffffffff : 0xff;
156436 175 0 if( pBtree ){
156444 0 175 if( op==SQLITE_FCNTL_FILE_POINTER ){
156447 0 175 }else if( op==SQLITE_FCNTL_VFS_POINTER ){
156450 0 175 }else if( op==SQLITE_FCNTL_JOURNAL_POINTER ){
156453 0 175 }else if( op==SQLITE_FCNTL_DATA_VERSION ){
156514 0 0 int sz = va_arg(ap, int);
156515 0 0 int *aProg = va_arg(ap, int*);
156537 0 0 sqlite3GlobalConfig.xTestCallback = va_arg(ap, TESTCALLBACKFUNC_t);
156552 0 0 xBenignBegin = va_arg(ap, void_function);
156553 0 0 xBenignEnd = va_arg(ap, void_function);
156574 0 0 unsigned int newVal = va_arg(ap, unsigned int);
156575 0 0 if( newVal ) sqlite3PendingByte = newVal;
156628 0 0 int x = va_arg(ap,int);
156655 0 0 sqlite3 *db = va_arg(ap, sqlite3*);
156656 0 0 int x = va_arg(ap,int);
156673 0 0 sqlite3 *db = va_arg(ap, sqlite3*);
156674 0 0 db->dbOptFlags = (u16)(va_arg(ap, int) & 0xffff);
156684 0 0 sqlite3GlobalConfig.bLocaltimeFault = va_arg(ap, int);
156696 0 0 sqlite3GlobalConfig.bInternalFunctions = va_arg(ap, int);
156709 0 0 sqlite3GlobalConfig.neverCorrupt = va_arg(ap, int);
156719 0 0 sqlite3GlobalConfig.iOnceResetThreshold = va_arg(ap, int);
156740 0 0 sqlite3 *db = va_arg(ap, sqlite3*);
156741 0 0 db->nMaxSorterMmap = va_arg(ap, int);
156751 0 0 if( sqlite3GlobalConfig.isInit==0 ) rc = SQLITE_ERROR;
156772 0 0 sqlite3 *db = va_arg(ap, sqlite3*);
156774 0 0 db->init.iDb = sqlite3FindDbName(db, va_arg(ap,const char*));
156775 0 0 db->init.busy = db->init.imposterTable = va_arg(ap,int);
156776 0 0 db->init.newTnum = va_arg(ap,int);
156777 0 0 if( db->init.busy==0 && db->init.newTnum>0 ){
0 0 if( db->init.busy==0 && db->init.newTnum>0 ){
156817 220 166 if( zFilename==0 || zParam==0 ) return 0;
0 220 if( zFilename==0 || zParam==0 ) return 0;
156819 28 220 while( zFilename[0] ){
156822 0 28 if( x==0 ) return zFilename;
156834 0 374 return z ? sqlite3GetBoolean(z, bDflt) : bDflt;
156847 0 0 if( z && sqlite3DecOrHexToI64(z, &v)==0 ){
0 0 if( z && sqlite3DecOrHexToI64(z, &v)==0 ){
156857 112 76 int iDb = zDbName ? sqlite3FindDbName(db, zDbName) : 0;
156858 188 0 return iDb<0 ? 0 : db->aDb[iDb].pBt;
156874 9 0 return pBt ? sqlite3BtreeGetFilename(pBt) : 0;
156890 4 0 return pBt ? sqlite3BtreeIsReadonly(pBt) : -1;
157048 0 0 if( sqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7;
157053 0 0 for(i=0; i
157054 0 0 if( sqlite3StrNICmp(zOptName, azCompileOpt[i], n)==0
157055 0 0 && sqlite3IsIdChar((unsigned char)azCompileOpt[i][n])==0
157071 117 0 if( N>=0 && N
104 13 if( N>=0 && N
158652 0 708 }while( vu!=0 );
158677 171 0 GETVARINT_INIT(a, p, 0, 0x00, 0x80, *v, 1);
158678 0 0 GETVARINT_STEP(a, p, 7, 0x7F, 0x4000, *v, 2);
158679 0 0 GETVARINT_STEP(a, p, 14, 0x3FFF, 0x200000, *v, 3);
158680 0 0 GETVARINT_STEP(a, p, 21, 0x1FFFFF, 0x10000000, *v, 4);
158683 0 0 for(shift=28; shift<=63; shift+=7){
158686 0 0 if( (c & 0x80)==0 ) break;
158706 0 0 GETVARINT_STEP(a, p, 7, 0x7F, 0x4000, *pi, 2);
158707 0 0 GETVARINT_STEP(a, p, 14, 0x3FFF, 0x200000, *pi, 3);
158708 0 0 GETVARINT_STEP(a, p, 21, 0x1FFFFF, 0x10000000, *pi, 4);
158724 0 336 }while( v!=0 );
158746 24 0 if( quote=='[' || quote=='\'' || quote=='"' || quote=='`' ){
20 4 if( quote=='[' || quote=='\'' || quote=='"' || quote=='`' ){
19 1 if( quote=='[' || quote=='\'' || quote=='"' || quote=='`' ){
0 19 if( quote=='[' || quote=='\'' || quote=='"' || quote=='`' ){
158751 0 5 if( quote=='[' ) quote = ']';
158753 93 0 while( z[iIn] ){
158754 5 88 if( z[iIn]==quote ){
158755 5 0 if( z[iIn+1]!=quote ) break;
158797 0 0 for(p = (*pp)-2; p>=pStart && *p&0x80; p--);
0 0 for(p = (*pp)-2; p>=pStart && *p&0x80; p--);
158817 280 7 for(i=0; iaStmt); i++){
158859 0 28 if( *pRc ) return;
158863 0 28 if( zSql==0 ){
158881 0 0 if( p->zContentTbl==0 ){
158893 0 0 return (rc==SQLITE_OK ? fts3DisconnectMethod(pVtab) : rc);
158907 7 0 if( *pRc==SQLITE_OK ){
158914 0 7 zLanguageid = (p->zLanguageid ? p->zLanguageid : "__langid");
158919 10 0 for(i=1; zCols && inColumn; i++){
3 7 for(i=1; zCols && inColumn; i++){
158928 7 0 if( !zCols || !zSql ){
0 7 if( !zCols || !zSql ){
158949 4 0 if( (*pRc)==SQLITE_OK ) p->bHasStat = 1;
158966 6 1 if( p->zContentTbl==0 ){
158972 14 0 for(i=0; zContentCols && inColumn; i++){
8 6 for(i=0; zContentCols && inColumn; i++){
158976 0 6 if( zLanguageid && zContentCols ){
0 0 if( zLanguageid && zContentCols ){
158979 0 6 if( zContentCols==0 ) rc = SQLITE_NOMEM;
159006 4 3 if( p->bHasDocsize ){
159013 4 3 if( p->bHasStat ){
159027 7 0 if( *pRc==SQLITE_OK ){
159033 0 7 if( !zSql ){
159037 7 0 if( rc==SQLITE_OK ){
159041 0 0 }else if( rc==SQLITE_AUTH ){
159068 37 1 while( *zCsr!='=' ){
159069 6 31 if( *zCsr=='\0' ) return 0;
159075 1 0 if( zValue ){
159091 41 0 if( *pRc==SQLITE_OK ){
159097 41 0 if( z && *pz ){
27 14 if( z && *pz ){
159102 0 41 if( z==0 ) *pRc = SQLITE_NOMEM;
159123 0 0 if( zRet ){
159127 0 0 for(i=0; zInput[i]; i++){
159128 0 0 if( zInput[i]=='"' ) *(z++) = '"';
159166 6 1 if( p->zContentTbl==0 ){
159167 6 0 if( !zFunc ){
159173 8 6 for(i=0; inColumn; i++){
159176 0 6 if( p->zLanguageid ){
159182 2 1 for(i=0; inColumn; i++){
159185 0 1 if( p->zLanguageid ){
159189 1 6 fts3Appendf(pRc, &zRet, " FROM '%q'.'%q%s' AS x",
1 6 fts3Appendf(pRc, &zRet, " FROM '%q'.'%q%s' AS x",
159223 7 0 if( !zFunc ){
159229 10 7 for(i=0; inColumn; i++){
159232 0 7 if( p->zLanguageid ){
159257 0 0 for(p=*pp; p[0]>='0' && p[0]<='9'; p++){
0 0 for(p=*pp; p[0]>='0' && p[0]<='9'; p++){
159259 0 0 if( nInt>MAX_NPREFIX ){
159264 0 0 if( p==*pp ) return SQLITE_ERROR;
159295 0 7 if( zParam && zParam[0] ){
0 0 if( zParam && zParam[0] ){
159298 0 0 for(p=zParam; *p; p++){
159299 0 0 if( *p==',' ) nIndex++;
159305 0 7 if( !aIndex ){
159310 0 7 if( zParam ){
159313 0 0 for(i=1; i
159315 0 0 if( fts3GobbleInt(&p, &nPrefix) ) return SQLITE_ERROR;
159317 0 0 if( nPrefix==0 ){
159370 0 0 if( !zSql ){
159374 0 0 if( rc!=SQLITE_OK ){
159380 0 0 if( rc==SQLITE_OK ){
159390 0 0 for(i=0; i
159397 0 0 if( azCol==0 ){
159401 0 0 for(i=0; i
159479 8 0 if( aCol ){
159483 8 0 if( azNotindexed ){
159486 8 0 if( !aCol || !azNotindexed ){
0 8 if( !aCol || !azNotindexed ){
159502 25 1 for(i=3; rc==SQLITE_OK && i
18 7 for(i=3; rc==SQLITE_OK && i
159508 18 0 if( !pTokenizer
159509 9 9 && strlen(z)>8
159510 6 3 && 0==sqlite3_strnicmp(z, "tokenize", 8)
159511 6 0 && 0==sqlite3Fts3IsIdChar(z[8])
159517 7 5 else if( isFts4 && fts3IsSpecialColumn(z, &nKey, &zVal) ){
1 6 else if( isFts4 && fts3IsSpecialColumn(z, &nKey, &zVal) ){
159533 0 1 if( !zVal ){
159536 6 0 for(iOpt=0; iOpt
159538 1 5 if( nKey==pOp->nOpt && !sqlite3_strnicmp(z, pOp->zOpt, pOp->nOpt) ){
1 0 if( nKey==pOp->nOpt && !sqlite3_strnicmp(z, pOp->zOpt, pOp->nOpt) ){
159544 0 0 if( strlen(zVal)!=4 || sqlite3_strnicmp(zVal, "fts3", 4) ){
0 0 if( strlen(zVal)!=4 || sqlite3_strnicmp(zVal, "fts3", 4) ){
159570 0 0 if( (strlen(zVal)!=3 || sqlite3_strnicmp(zVal, "asc", 3))
0 0 if( (strlen(zVal)!=3 || sqlite3_strnicmp(zVal, "asc", 3))
159571 0 0 && (strlen(zVal)!=4 || sqlite3_strnicmp(zVal, "desc", 4))
0 0 && (strlen(zVal)!=4 || sqlite3_strnicmp(zVal, "desc", 4))
159576 0 0 bDescIdx = (zVal[0]=='d' || zVal[0]=='D');
0 0 bDescIdx = (zVal[0]=='d' || zVal[0]=='D');
159621 7 1 if( rc==SQLITE_OK && zContent ){
1 6 if( rc==SQLITE_OK && zContent ){
159626 0 1 if( nCol==0 ){
159633 0 0 if( rc==SQLITE_OK && zLanguageid ){
0 0 if( rc==SQLITE_OK && zLanguageid ){
159635 0 0 for(j=0; j
159636 0 0 if( sqlite3_stricmp(zLanguageid, aCol[j])==0 ){
159638 0 0 for(k=j; k
159646 1 7 if( rc!=SQLITE_OK ) goto fts3_init_out;
159648 0 7 if( nCol==0 ){
159655 2 5 if( pTokenizer==0 ){
159657 0 2 if( rc!=SQLITE_OK ) goto fts3_init_out;
159662 0 7 if( rc==SQLITE_ERROR ){
159666 0 7 if( rc!=SQLITE_OK ) goto fts3_init_out;
159677 0 7 if( p==0 ){
159688 4 3 p->bHasDocsize = (isFts4 && bNoDocsize==0);
4 0 p->bHasDocsize = (isFts4 && bNoDocsize==0);
159703 7 7 for(i=0; i
159718 10 7 for(iCol=0; iCol
159722 10 0 if( n>0 ){
159733 10 7 for(iCol=0; iCol
159735 0 10 for(i=0; i
159737 0 0 if( zNot && n==(int)strlen(zNot)
0 0 if( zNot && n==(int)strlen(zNot)
159738 0 0 && 0==sqlite3_strnicmp(p->azColumn[iCol], zNot, n)
159746 0 7 for(i=0; i
159747 0 0 if( azNotindexed[i] ){
159753 7 0 if( rc==SQLITE_OK && (zCompress==0)!=(zUncompress==0) ){
0 7 if( rc==SQLITE_OK && (zCompress==0)!=(zUncompress==0) ){
159754 0 0 char const *zMiss = (zCompress==0 ? "compress" : "uncompress");
159760 0 7 if( rc!=SQLITE_OK ) goto fts3_init_out;
159765 7 0 if( isCreate ){
159772 3 4 if( !isFts4 && !isCreate ){
0 3 if( !isFts4 && !isCreate ){
159791 0 8 for(i=0; i
159794 1 7 if( rc!=SQLITE_OK ){
159795 0 1 if( p ){
159797 0 1 }else if( pTokenizer ){
159839 0 0 if( sqlite3_libversion_number()>=3008002 ){
159852 0 0 if( sqlite3_libversion_number()>=3008012 ){
159882 34 34 for(i=0; inConstraint; i++){
159885 0 34 if( pCons->usable==0 ){
159886 0 0 if( pCons->op==SQLITE_INDEX_CONSTRAINT_MATCH ){
159900 34 0 bDocid = (pCons->iColumn<0 || pCons->iColumn==p->nColumn+1);
0 34 bDocid = (pCons->iColumn<0 || pCons->iColumn==p->nColumn+1);
159903 34 0 if( iCons<0 && pCons->op==SQLITE_INDEX_CONSTRAINT_EQ && bDocid ){
0 34 if( iCons<0 && pCons->op==SQLITE_INDEX_CONSTRAINT_EQ && bDocid ){
0 0 if( iCons<0 && pCons->op==SQLITE_INDEX_CONSTRAINT_EQ && bDocid ){
159918 34 0 if( pCons->op==SQLITE_INDEX_CONSTRAINT_MATCH
159919 34 0 && pCons->iColumn>=0 && pCons->iColumn<=p->nColumn
34 0 && pCons->iColumn>=0 && pCons->iColumn<=p->nColumn
159927 0 34 if( pCons->op==SQLITE_INDEX_CONSTRAINT_EQ
159928 0 0 && pCons->iColumn==p->nColumn + 2
159933 0 34 if( bDocid ){
159949 0 34 if( pInfo->idxNum==FTS3_DOCID_SEARCH ) fts3SetUniqueFlag(pInfo);
159952 34 0 if( iCons>=0 ){
159956 0 34 if( iLangidCons>=0 ){
159960 0 34 if( iDocidGe>=0 ){
159964 0 34 if( iDocidLe>=0 ){
159972 0 34 if( pInfo->nOrderBy==1 ){
159974 0 0 if( pOrder->iColumn<0 || pOrder->iColumn==p->nColumn+1 ){
0 0 if( pOrder->iColumn<0 || pOrder->iColumn==p->nColumn+1 ){
159975 0 0 if( pOrder->desc ){
160001 0 34 if( !pCsr ){
160016 2 100 if( pCsr->bSeekStmt ){
160018 2 0 if( p->pSeekStmt==0 ){
160065 2 5 if( pCsr->pStmt==0 ){
160068 0 2 if( p->pSeekStmt ){
160073 0 2 if( !zSql ) return SQLITE_NOMEM;
160077 2 0 if( rc==SQLITE_OK ) pCsr->bSeekStmt = 1;
160089 7 7 if( pCsr->isRequireSeek ){
160091 7 0 if( rc==SQLITE_OK ){
160094 7 0 if( SQLITE_ROW==sqlite3_step(pCsr->pStmt) ){
160098 0 0 if( rc==SQLITE_OK && ((Fts3Table *)pCsr->base.pVtab)->zContentTbl==0 ){
0 0 if( rc==SQLITE_OK && ((Fts3Table *)pCsr->base.pVtab)->zContentTbl==0 ){
160109 0 7 if( rc!=SQLITE_OK && pContext ){
0 0 if( rc!=SQLITE_OK && pContext ){
160161 0 0 if( zCsr>zEnd ){
160165 0 0 while( zCsr
0 0 while( zCsr
0 0 while( zCsr
160173 0 0 if( !isFirstTerm ){
160174 0 0 zCsr += fts3GetVarint32(zCsr, &nPrefix);
160177 0 0 zCsr += fts3GetVarint32(zCsr, &nSuffix);
160180 0 0 if( nPrefix>zCsr-zNode || nSuffix>zEnd-zCsr ){
0 0 if( nPrefix>zCsr-zNode || nSuffix>zEnd-zCsr ){
160184 0 0 if( (i64)nPrefix+nSuffix>nAlloc ){
160188 0 0 if( !zNew ){
160209 0 0 if( piFirst && (cmp<0 || (cmp==0 && nBuffer>nTerm)) ){
0 0 if( piFirst && (cmp<0 || (cmp==0 && nBuffer>nTerm)) ){
0 0 if( piFirst && (cmp<0 || (cmp==0 && nBuffer>nTerm)) ){
0 0 if( piFirst && (cmp<0 || (cmp==0 && nBuffer>nTerm)) ){
160214 0 0 if( piLast && cmp<0 ){
0 0 if( piLast && cmp<0 ){
160222 0 0 if( piFirst ) *piFirst = iChild;
160223 0 0 if( piLast ) *piLast = iChild;
160266 0 0 fts3GetVarint32(zNode, &iHeight);
160270 0 0 if( rc==SQLITE_OK && iHeight>1 ){
0 0 if( rc==SQLITE_OK && iHeight>1 ){
160274 0 0 if( piLeaf && piLeaf2 && (*piLeaf!=*piLeaf2) ){
0 0 if( piLeaf && piLeaf2 && (*piLeaf!=*piLeaf2) ){
0 0 if( piLeaf && piLeaf2 && (*piLeaf!=*piLeaf2) ){
160276 0 0 if( rc==SQLITE_OK ){
160284 0 0 if( rc==SQLITE_OK ){
160285 0 0 rc = sqlite3Fts3ReadBlock(p, piLeaf?*piLeaf:*piLeaf2, &zBlob, &nBlob, 0);
160287 0 0 if( rc==SQLITE_OK ){
160338 20 28 while( *pEnd | c ){
160344 8 20 if( pp ){
160378 0 8 while( 0xFE & (*pEnd | c) ){
160382 0 8 if( pp ){
160420 0 0 if( (**pp)&0xFE ){
160439 0 0 if( iCol ){
160464 0 0 while( *p1 || *p2 ){
0 0 while( *p1 || *p2 ){
160468 0 0 if( *p1==POS_COLUMN ) fts3GetVarint32(&p1[1], &iCol1);
0 0 if( *p1==POS_COLUMN ) fts3GetVarint32(&p1[1], &iCol1);
160469 0 0 else if( *p1==POS_END ) iCol1 = POSITION_LIST_END;
160472 0 0 if( *p2==POS_COLUMN ) fts3GetVarint32(&p2[1], &iCol2);
0 0 if( *p2==POS_COLUMN ) fts3GetVarint32(&p2[1], &iCol2);
160473 0 0 else if( *p2==POS_END ) iCol2 = POSITION_LIST_END;
160476 0 0 if( iCol1==iCol2 ){
160498 0 0 if( i1==i2 ){
160501 0 0 }else if( i1
160506 0 0 }while( i1!=POSITION_LIST_END || i2!=POSITION_LIST_END );
0 0 }while( i1!=POSITION_LIST_END || i2!=POSITION_LIST_END );
160507 0 0 }else if( iCol1
160563 0 4 if( *p1==POS_COLUMN ){
160565 0 0 p1 += fts3GetVarint32(p1, &iCol1);
160567 0 4 if( *p2==POS_COLUMN ){
160569 0 0 p2 += fts3GetVarint32(p2, &iCol2);
160573 4 0 if( iCol1==iCol2 ){
160579 0 4 if( iCol1 ){
160590 0 4 if( iPos2==iPos1+nToken
160591 0 0 || (isExact==0 && iPos2>iPos1 && iPos2<=iPos1+nToken)
0 0 || (isExact==0 && iPos2>iPos1 && iPos2<=iPos1+nToken)
0 0 || (isExact==0 && iPos2>iPos1 && iPos2<=iPos1+nToken)
160594 0 4 iSave = isSaveLeft ? iPos1 : iPos2;
160599 4 0 if( (!isSaveLeft && iPos2<=(iPos1+nToken)) || iPos2<=iPos1 ){
0 4 if( (!isSaveLeft && iPos2<=(iPos1+nToken)) || iPos2<=iPos1 ){
0 0 if( (!isSaveLeft && iPos2<=(iPos1+nToken)) || iPos2<=iPos1 ){
160600 4 0 if( (*p2&0xFE)==0 ) break;
160603 0 0 if( (*p1&0xFE)==0 ) break;
160608 0 4 if( pSave ){
160616 0 4 if( 0==*p1 || 0==*p2 ) break;
0 0 if( 0==*p1 || 0==*p2 ) break;
160619 0 0 p1 += fts3GetVarint32(p1, &iCol1);
160621 0 0 p2 += fts3GetVarint32(p2, &iCol2);
160629 0 0 else if( iCol1
160631 0 0 if( 0==*p1 ) break;
160633 0 0 p1 += fts3GetVarint32(p1, &iCol1);
160636 0 0 if( 0==*p2 ) break;
160638 0 0 p2 += fts3GetVarint32(p2, &iCol2);
160646 0 4 if( *pp==p ){
160690 0 0 if( pTmp1!=aTmp && pTmp2!=aTmp2 ){
0 0 if( pTmp1!=aTmp && pTmp2!=aTmp2 ){
160692 0 0 }else if( pTmp1!=aTmp ){
160694 0 0 }else if( pTmp2!=aTmp2 ){
160733 8 8 if( *pp>=pEnd ){
160738 0 8 if( bDescIdx ){
160769 0 8 if( bDescIdx==0 || *pbFirst==0 ){
0 0 if( bDescIdx==0 || *pbFirst==0 ){
160857 0 4 if( !aOut ) return SQLITE_NOMEM;
160862 4 8 while( p1 || p2 ){
4 4 while( p1 || p2 ){
160863 0 8 sqlite3_int64 iDiff = DOCID_CMP(i1, i2);
160865 8 0 if( p2 && p1 && iDiff==0 ){
4 4 if( p2 && p1 && iDiff==0 ){
0 4 if( p2 && p1 && iDiff==0 ){
160870 8 0 }else if( !p2 || (p1 && iDiff<0) ){
4 4 }else if( !p2 || (p1 && iDiff<0) ){
4 0 }else if( !p2 || (p1 && iDiff<0) ){
160918 0 0 if( bDescDoclist ){
160920 0 0 if( aOut==0 ) return SQLITE_NOMEM;
160929 0 0 while( p1 && p2 ){
0 0 while( p1 && p2 ){
160930 0 0 sqlite3_int64 iDiff = DOCID_CMP(i1, i2);
160931 0 0 if( iDiff==0 ){
160937 0 0 if( 0==fts3PoslistPhraseMerge(&p, nDist, 0, 1, &p1, &p2) ){
160944 0 0 }else if( iDiff<0 ){
160954 0 0 if( bDescDoclist ){
160981 0 0 if( *p!=0x01 ){
160982 0 0 if( *p==0x02 ){
160990 0 0 while( p
160994 0 0 if( *p==0x02 ){
160995 0 0 if( bWritten==0 ){
161005 0 0 if( bWritten ){
161030 128 8 for(i=0; iaaOutput); i++){
161031 8 120 if( pTS->aaOutput[i] ){
161032 8 0 if( !aOut ){
161043 0 0 if( rc!=SQLITE_OK ){
161082 8 4 if( pTS->aaOutput[0]==0 ){
161101 8 0 if( pTS->aaOutput[0] ){
161111 8 0 for(iOut=0; iOutaaOutput); iOut++){
161112 4 4 if( pTS->aaOutput[iOut]==0 ){
161124 0 4 if( rc!=SQLITE_OK ){
161125 0 0 if( aMerge!=aDoclist ) sqlite3_free(aMerge);
161129 0 4 if( aMerge!=aDoclist ) sqlite3_free(aMerge);
161135 0 4 if( (iOut+1)==SizeofArray(pTS->aaOutput) ){
161152 83 173 if( (pCsr->nSegment%16)==0 ){
161156 0 83 if( !apNew ){
161194 89 0 if( iLevel<0 && p->aIndex ){
88 1 if( iLevel<0 && p->aIndex ){
161196 50 38 rc = sqlite3Fts3SegReaderPending(p, iIndex, zTerm, nTerm, isPrefix||isScan, &pSeg);
0 50 rc = sqlite3Fts3SegReaderPending(p, iIndex, zTerm, nTerm, isPrefix||isScan, &pSeg);
161197 88 0 if( rc==SQLITE_OK && pSeg ){
25 63 if( rc==SQLITE_OK && pSeg ){
161202 59 30 if( iLevel!=FTS3_SEGCURSOR_PENDING ){
161203 59 0 if( rc==SQLITE_OK ){
161207 290 0 while( rc==SQLITE_OK && SQLITE_ROW==(rc = sqlite3_step(pStmt)) ){
231 59 while( rc==SQLITE_OK && SQLITE_ROW==(rc = sqlite3_step(pStmt)) ){
161219 0 231 if( iStartBlock && zTerm ){
0 0 if( iStartBlock && zTerm ){
161220 0 0 sqlite3_int64 *pi = (isPrefix ? &iLeavesEndBlock : 0);
161222 0 0 if( rc!=SQLITE_OK ) goto finished;
161223 0 0 if( isPrefix==0 && isScan==0 ) iLeavesEndBlock = iStartBlock;
0 0 if( isPrefix==0 && isScan==0 ) iLeavesEndBlock = iStartBlock;
161226 199 32 rc = sqlite3Fts3SegReaderNew(pCsr->nSegment+1,
196 3 rc = sqlite3Fts3SegReaderNew(pCsr->nSegment+1,
161231 0 231 if( rc!=SQLITE_OK ) goto finished;
161238 59 30 if( rc==SQLITE_DONE ) rc = rc2;
161315 58 0 if( pSegcsr ){
161320 8 50 if( isPrefix ){
161321 8 0 for(i=1; bFound==0 && inIndex; i++){
0 8 for(i=1; bFound==0 && inIndex; i++){
161322 0 0 if( p->aIndex[i].nPrefix==nTerm ){
161331 8 0 for(i=1; bFound==0 && inIndex; i++){
0 8 for(i=1; bFound==0 && inIndex; i++){
161332 0 0 if( p->aIndex[i].nPrefix==nTerm+1 ){
161337 0 0 if( rc==SQLITE_OK ){
161346 58 0 if( bFound==0 ){
161386 8 0 | (pTok->isPrefix ? FTS3_SEGMENT_PREFIX : 0)
161387 0 8 | (pTok->bFirst ? FTS3_SEGMENT_FIRST : 0)
161388 8 0 | (iColumnnColumn ? FTS3_SEGMENT_COLUMN_FILTER : 0);
161394 20 0 while( SQLITE_OK==rc
161395 12 8 && SQLITE_ROW==(rc = sqlite3Fts3SegReaderStep(p, pSegcsr))
161400 8 0 if( rc==SQLITE_OK ){
161403 8 0 if( rc==SQLITE_OK ){
161408 0 0 for(i=0; i
161429 0 0 if( aList ){
161432 0 0 while( p
161434 0 0 while( (*p++)&0x80 ); /* Skip docid varint */
161456 77 0 if( pCsr->eSearch==FTS3_DOCID_SEARCH || pCsr->eSearch==FTS3_FULLSCAN_SEARCH ){
0 77 if( pCsr->eSearch==FTS3_DOCID_SEARCH || pCsr->eSearch==FTS3_FULLSCAN_SEARCH ){
161457 0 0 if( SQLITE_ROW!=sqlite3_step(pCsr->pStmt) ){
161489 0 68 if( pVal ){
161491 0 0 if( eType==SQLITE_INTEGER ){
161542 34 0 if( eSearch!=FTS3_FULLSCAN_SEARCH ) pCons = apVal[iIdx++];
161543 0 34 if( idxNum & FTS3_HAVE_LANGID ) pLangid = apVal[iIdx++];
161544 0 34 if( idxNum & FTS3_HAVE_DOCID_GE ) pDocidGe = apVal[iIdx++];
161545 0 34 if( idxNum & FTS3_HAVE_DOCID_LE ) pDocidLe = apVal[iIdx++];
161555 0 34 if( idxStr ){
161562 34 0 if( eSearch!=FTS3_DOCID_SEARCH && eSearch!=FTS3_FULLSCAN_SEARCH ){
34 0 if( eSearch!=FTS3_DOCID_SEARCH && eSearch!=FTS3_FULLSCAN_SEARCH ){
161566 0 34 if( zQuery==0 && sqlite3_value_type(pCons)!=SQLITE_NULL ){
0 0 if( zQuery==0 && sqlite3_value_type(pCons)!=SQLITE_NULL ){
161571 0 34 if( pLangid ) pCsr->iLangid = sqlite3_value_int(pLangid);
161578 0 34 if( rc!=SQLITE_OK ){
161584 0 34 if( rc!=SQLITE_OK ) return rc;
161594 0 34 if( eSearch==FTS3_FULLSCAN_SEARCH ){
161595 0 0 if( pDocidGe || pDocidLe ){
0 0 if( pDocidGe || pDocidLe ){
161596 0 0 zSql = sqlite3_mprintf(
161602 0 0 zSql = sqlite3_mprintf("SELECT %s ORDER BY rowid %s",
161606 0 0 if( zSql ){
161612 0 34 }else if( eSearch==FTS3_DOCID_SEARCH ){
161614 0 0 if( rc==SQLITE_OK ){
161618 0 34 if( rc!=SQLITE_OK ) return rc;
161629 34 43 if( pCsr->isEof ){
161683 0 0 if( pCsr->pExpr ){
161686 0 0 }else if( p->zLanguageid==0 ){
161698 14 0 if( rc==SQLITE_OK && sqlite3_data_count(pCsr->pStmt)-1>iCol ){
14 0 if( rc==SQLITE_OK && sqlite3_data_count(pCsr->pStmt)-1>iCol ){
161754 30 0 if( rc==SQLITE_OK
161755 0 30 && p->nLeafAdd>(nMinMerge/16)
161756 0 0 && p->nAutoincrmerge && p->nAutoincrmerge!=0xff
0 0 && p->nAutoincrmerge && p->nAutoincrmerge!=0xff
161765 0 0 if( A>(int)nMinMerge ) rc = sqlite3Fts3Incrmerge(p, A, p->nAutoincrmerge);
161780 0 23 if( p->bHasStat==2 ){
161782 0 0 if( zTbl ){
161848 0 0 while( p>pStart && (c=*p--)==0 );
0 0 while( p>pStart && (c=*p--)==0 );
161853 0 0 while( p>pStart && (*p & 0x80) | c ){
0 0 while( p>pStart && (*p & 0x80) | c ){
161871 0 0 if( p>pStart || (c==0 && *ppPoslist>&p[2]) ){ p = &p[2]; }
0 0 if( p>pStart || (c==0 && *ppPoslist>&p[2]) ){ p = &p[2]; }
0 0 if( p>pStart || (c==0 && *ppPoslist>&p[2]) ){ p = &p[2]; }
161872 0 0 while( *p++&0x80 );
161894 0 0 if( (*ppCsr)!=0 ){
161925 0 0 if( nVal>6 ){
161930 0 0 if( fts3FunctionArg(pContext, "snippet", apVal[0], &pCsr) ) return;
161939 0 0 if( !zEllipsis || !zEnd || !zStart ){
0 0 if( !zEllipsis || !zEnd || !zStart ){
0 0 if( !zEllipsis || !zEnd || !zStart ){
161941 0 0 }else if( nToken==0 ){
161943 0 0 }else if( SQLITE_OK==fts3CursorSeek(pContext, pCsr) ){
161961 0 0 if( fts3FunctionArg(pContext, "offsets", apVal[0], &pCsr) ) return;
161963 0 0 if( SQLITE_OK==fts3CursorSeek(pContext, pCsr) ){
161989 0 0 if( fts3FunctionArg(pContext, "optimize", apVal[0], &pCursor) ) return;
162018 0 0 if( SQLITE_OK==fts3FunctionArg(pContext, "matchinfo", apVal[0], &pCsr) ){
162020 0 0 if( nVal>1 ){
162053 0 0 for(i=0; i
162054 0 0 if( strcmp(zName, aOverload[i].zName)==0 ){
162086 0 0 if( rc==SQLITE_OK ){
162090 0 0 if( p->zContentTbl==0 ){
162097 0 0 if( p->bHasDocsize ){
162103 0 0 if( p->bHasStat ){
162131 0 0 if( ((Fts3Table *)pVtab)->bIgnoreSavepoint==0 ){
162176 166 0 for(i=0; i
162177 56 110 if( sqlite3_stricmp(zName, azName[i])==0 ) return 1;
162269 0 251 if( rc!=SQLITE_OK ) return rc;
162276 0 251 if( !pHash ){
162283 251 0 if( rc==SQLITE_OK ){
162284 251 0 if( sqlite3Fts3HashInsert(pHash, "simple", 7, (void *)pSimple)
162285 251 0 || sqlite3Fts3HashInsert(pHash, "porter", 7, (void *)pPorter)
162288 0 251 || sqlite3Fts3HashInsert(pHash, "unicode61", 10, (void *)pUnicode)
162308 251 0 if( SQLITE_OK==rc
162309 251 0 && SQLITE_OK==(rc = sqlite3Fts3InitHashTable(db, pHash, "fts3_tokenizer"))
162310 251 0 && SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
162311 251 0 && SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1))
162312 251 0 && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1))
162313 251 0 && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 2))
162314 251 0 && SQLITE_OK==(rc = sqlite3_overload_function(db, "optimize", 1))
162319 251 0 if( rc==SQLITE_OK ){
162324 251 0 if( rc==SQLITE_OK ){
162333 0 0 if( pHash ){
162362 74 0 if( pExpr && SQLITE_OK==*pRc ){
74 0 if( pExpr && SQLITE_OK==*pRc ){
162363 54 20 if( pExpr->eType==FTSQUERY_PHRASE ){
162367 58 54 for(i=0; i
162372 0 58 if( rc!=SQLITE_OK ){
162407 0 8 if( pList==0 ){
162413 8 0 else if( p->iDoclistToken<0 ){
162418 0 0 else if( p->doclist.aAll==0 ){
162429 0 0 if( p->iDoclistToken
162451 8 0 if( iToken>p->iDoclistToken ) p->iDoclistToken = iToken;
162469 16 0 for(iToken=0; rc==SQLITE_OK && iTokennToken; iToken++){
8 8 for(iToken=0; rc==SQLITE_OK && iTokennToken; iToken++){
162473 8 0 if( pToken->pSegcsr ){
162477 8 0 if( rc==SQLITE_OK ){
162506 0 0 for(iToken=0; iTokennToken; iToken++){
162510 0 0 if( pDeferred ){
162514 0 0 if( rc!=SQLITE_OK ) return rc;
162516 0 0 if( pList==0 ){
162522 0 0 }else if( aPoslist==0 ){
162536 0 0 if( nPoslist==0 ){
162547 0 0 if( iPrev>=0 ){
162549 0 0 if( nMaxUndeferred<0 ){
162560 0 0 if( nMaxUndeferred>iPrev ){
162571 0 0 if( !aOut ){
162577 0 0 if( fts3PoslistPhraseMerge(&aOut, nDistance, 0, 1, &p1, &p2) ){
162623 54 0 && pCsr->bDesc==pTab->bDescIdx
162624 54 0 && p->nToken<=MAX_INCR_PHRASE_TOKENS && p->nToken>0
54 0 && p->nToken<=MAX_INCR_PHRASE_TOKENS && p->nToken>0
54 0 && p->nToken<=MAX_INCR_PHRASE_TOKENS && p->nToken>0
162629 104 8 for(i=0; bIncrOk==1 && inToken; i++){
58 46 for(i=0; bIncrOk==1 && inToken; i++){
162631 58 0 if( pToken->bFirst || (pToken->pSegcsr!=0 && !pToken->pSegcsr->bLookup) ){
58 0 if( pToken->bFirst || (pToken->pSegcsr!=0 && !pToken->pSegcsr->bLookup) ){
8 50 if( pToken->bFirst || (pToken->pSegcsr!=0 && !pToken->pSegcsr->bLookup) ){
162634 58 0 if( pToken->pSegcsr ) bHaveIncr = 1;
162637 46 8 if( bIncrOk && bHaveIncr ){
46 0 if( bIncrOk && bHaveIncr ){
162639 46 0 int iCol = (p->iColumn >= pTab->nColumn ? -1 : p->iColumn);
162640 96 0 for(i=0; rc==SQLITE_OK && inToken; i++){
50 46 for(i=0; rc==SQLITE_OK && inToken; i++){
162643 50 0 if( pSegcsr ){
162684 0 0 if( p==0 ){
162691 0 0 while( pDocid
162697 0 0 while( pDocid
0 0 while( pDocid
162698 0 0 iMul = (bDescIdx ? -1 : 1);
162705 0 0 int iMul = (bDescIdx ? -1 : 1);
162710 0 0 if( p==aDoclist ){
162739 0 0 if( p==0 ){
162744 0 0 while( p<&aDoclist[nDoclist] && *p==0 ) p++;
0 0 while( p<&aDoclist[nDoclist] && *p==0 ) p++;
162745 0 0 if( p>=&aDoclist[nDoclist] ){
162750 0 0 *piDocid += ((bDescIdx ? -1 : 1) * iVar);
162769 12 8 if( pDL->pNextDocid ){
162775 8 12 if( pIter>=pEnd ){
162781 0 12 if( pTab->bDescIdx==0 || pDL->pNextDocid==0 ){
0 0 if( pTab->bDescIdx==0 || pDL->pNextDocid==0 ){
162796 4 8 while( pIter
0 4 while( pIter
162833 0 12 if( pPhrase->iDoclistToken==iToken ){
162844 12 0 if( pToken->pSegcsr ){
162849 4 8 if( p->pList==0 ) *pbEof = 1;
162890 89 8 if( p->nToken==1 ){
162894 38 51 if( pDL->pList==0 ) bEof = 1;
162903 8 4 while( bEof==0 ){
162909 20 0 for(i=0; rc==SQLITE_OK && inToken && bEof==0; i++){
16 4 for(i=0; rc==SQLITE_OK && inToken && bEof==0; i++){
12 4 for(i=0; rc==SQLITE_OK && inToken && bEof==0; i++){
162911 12 0 if( a[i].bIgnore==0 && (bMaxSet==0 || DOCID_CMP(iMax, a[i].iDocid)<0) ){
4 8 if( a[i].bIgnore==0 && (bMaxSet==0 || DOCID_CMP(iMax, a[i].iDocid)<0) ){
0 4 if( a[i].bIgnore==0 && (bMaxSet==0 || DOCID_CMP(iMax, a[i].iDocid)<0) ){
0 4 if( a[i].bIgnore==0 && (bMaxSet==0 || DOCID_CMP(iMax, a[i].iDocid)<0) ){
162920 16 8 for(i=0; inToken; i++){
162921 16 0 while( rc==SQLITE_OK && bEof==0
8 8 while( rc==SQLITE_OK && bEof==0
162922 8 0 && a[i].bIgnore==0 && DOCID_CMP(a[i].iDocid, iMax)<0
0 8 && a[i].bIgnore==0 && DOCID_CMP(a[i].iDocid, iMax)<0
0 8 && a[i].bIgnore==0 && DOCID_CMP(a[i].iDocid, iMax)<0
162925 0 0 if( DOCID_CMP(a[i].iDocid, iMax)>0 ){
0 0 if( DOCID_CMP(a[i].iDocid, iMax)>0 ){
162933 4 4 if( bEof==0 ){
162937 0 4 if( !aDoclist ) return SQLITE_NOMEM;
162940 4 4 for(i=0; i<(p->nToken-1); i++){
162941 4 0 if( a[i].bIgnore==0 ){
162947 0 4 if( res==0 ) break;
162951 4 0 if( i==(p->nToken-1) ){
162985 97 20 if( p->bIncr ){
162987 0 20 }else if( pCsr->bDesc!=pTab->bDescIdx && pDL->nAll ){
0 0 }else if( pCsr->bDesc!=pTab->bDescIdx && pDL->nAll ){
163020 74 0 if( pExpr && SQLITE_OK==*pRc ){
74 0 if( pExpr && SQLITE_OK==*pRc ){
163021 54 20 if( pExpr->eType==FTSQUERY_PHRASE ){
163023 54 0 if( nToken ){
163025 54 0 for(i=0; i
163026 54 0 if( pExpr->pPhrase->aToken[i].pDeferred==0 ) break;
163034 0 20 pExpr->bDeferred = (pExpr->pLeft->bDeferred && pExpr->pRight->bDeferred);
0 0 pExpr->bDeferred = (pExpr->pLeft->bDeferred && pExpr->pRight->bDeferred);
163076 26 0 if( *pRc==SQLITE_OK ){
163077 16 10 if( pExpr->eType==FTSQUERY_PHRASE ){
163080 34 0 for(i=0; *pRc==SQLITE_OK && inToken; i++){
18 16 for(i=0; *pRc==SQLITE_OK && inToken; i++){
163089 8 2 }else if( pExpr->eType!=FTSQUERY_NOT ){
163095 2 6 if( pExpr->eType==FTSQUERY_OR ){
163101 2 6 if( pExpr->eType==FTSQUERY_OR ){
163124 0 0 if( pCsr->nRowAvg==0 ){
163144 0 0 if( rc!=SQLITE_OK ) return rc;
163150 0 0 while( a
163153 0 0 if( nDoc==0 || nByte==0 ){
0 0 if( nDoc==0 || nByte==0 ){
163203 0 14 if( pTab->zContentTbl ){
163210 30 14 for(ii=0; ii
163211 18 12 if( aTC[ii].pRoot==pRoot ){
163216 0 14 if( nOvfl==0 || nToken<2 ) return SQLITE_OK;
0 0 if( nOvfl==0 || nToken<2 ) return SQLITE_OK;
163245 0 0 for(ii=0; ii
0 0 for(ii=0; ii
163250 0 0 for(iTC=0; iTC
163251 0 0 if( aTC[iTC].pToken && aTC[iTC].pRoot==pRoot
0 0 if( aTC[iTC].pToken && aTC[iTC].pRoot==pRoot
163252 0 0 && (!pTC || aTC[iTC].nOvflnOvfl)
0 0 && (!pTC || aTC[iTC].nOvflnOvfl)
163259 0 0 if( ii && pTC->nOvfl>=((nMinEst+(nLoad4/4)-1)/(nLoad4/4))*nDocSize ){
0 0 if( ii && pTC->nOvfl>=((nMinEst+(nLoad4/4)-1)/(nLoad4/4))*nDocSize ){
163272 0 0 if( ii<12 ) nLoad4 = nLoad4*4;
163274 0 0 if( ii==0 || (pTC->pPhrase->nToken>1 && ii!=nToken-1) ){
0 0 if( ii==0 || (pTC->pPhrase->nToken>1 && ii!=nToken-1) ){
0 0 if( ii==0 || (pTC->pPhrase->nToken>1 && ii!=nToken-1) ){
163283 0 0 if( rc==SQLITE_OK ){
163288 0 0 if( rc==SQLITE_OK ){
163293 0 0 if( ii==0 || nCount
0 0 if( ii==0 || nCount
163326 34 0 if( rc==SQLITE_OK && nToken>1 && pTab->bFts4 ){
20 14 if( rc==SQLITE_OK && nToken>1 && pTab->bFts4 ){
10 10 if( rc==SQLITE_OK && nToken>1 && pTab->bFts4 ){
163335 0 10 if( !aTC ){
163346 10 0 if( rc==SQLITE_OK ){
163348 14 0 for(ii=0; rc==SQLITE_OK && ii
4 10 for(ii=0; rc==SQLITE_OK && ii
163366 4 167 if( pPhrase->doclist.bFreeList ){
163416 0 0 if( res ){
163475 169 0 if( *pRc==SQLITE_OK ){
163487 0 28 if( pLeft->bDeferred ){
163493 0 28 }else if( pRight->bDeferred ){
163503 16 12 while( !pLeft->bEof && !pRight->bEof && *pRc==SQLITE_OK ){
16 0 while( !pLeft->bEof && !pRight->bEof && *pRc==SQLITE_OK ){
16 0 while( !pLeft->bEof && !pRight->bEof && *pRc==SQLITE_OK ){
163504 0 16 sqlite3_int64 iDiff = DOCID_CMP(pLeft->iDocid, pRight->iDocid);
163505 16 0 if( iDiff==0 ) break;
163506 0 0 if( iDiff<0 ){
163513 16 12 pExpr->bEof = (pLeft->bEof || pRight->bEof);
0 16 pExpr->bEof = (pLeft->bEof || pRight->bEof);
163514 0 28 if( pExpr->eType==FTSQUERY_NEAR && pExpr->bEof ){
0 0 if( pExpr->eType==FTSQUERY_NEAR && pExpr->bEof ){
163516 0 0 if( pRight->pPhrase->doclist.aAll ){
163518 0 0 while( *pRc==SQLITE_OK && pRight->bEof==0 ){
0 0 while( *pRc==SQLITE_OK && pRight->bEof==0 ){
163523 0 0 if( pLeft->pPhrase && pLeft->pPhrase->doclist.aAll ){
0 0 if( pLeft->pPhrase && pLeft->pPhrase->doclist.aAll ){
163525 0 0 while( *pRc==SQLITE_OK && pLeft->bEof==0 ){
0 0 while( *pRc==SQLITE_OK && pLeft->bEof==0 ){
163538 0 12 sqlite3_int64 iCmp = DOCID_CMP(pLeft->iDocid, pRight->iDocid);
163543 12 0 if( pRight->bEof || (pLeft->bEof==0 && iCmp<0) ){
8 4 if( pRight->bEof || (pLeft->bEof==0 && iCmp<0) ){
4 4 if( pRight->bEof || (pLeft->bEof==0 && iCmp<0) ){
163545 4 4 }else if( pLeft->bEof || iCmp>0 ){
0 4 }else if( pLeft->bEof || iCmp>0 ){
163552 8 4 pExpr->bEof = (pLeft->bEof && pRight->bEof);
4 4 pExpr->bEof = (pLeft->bEof && pRight->bEof);
163553 0 12 iCmp = DOCID_CMP(pLeft->iDocid, pRight->iDocid);
163554 8 4 if( pRight->bEof || (pLeft->bEof==0 && iCmp<0) ){
4 4 if( pRight->bEof || (pLeft->bEof==0 && iCmp<0) ){
4 0 if( pRight->bEof || (pLeft->bEof==0 && iCmp<0) ){
163567 4 8 if( pRight->bStart==0 ){
163573 8 4 if( pLeft->bEof==0 ){
163574 8 0 while( !*pRc
163575 8 0 && !pRight->bEof
163576 0 8 && DOCID_CMP(pLeft->iDocid, pRight->iDocid)>0
0 8 && DOCID_CMP(pLeft->iDocid, pRight->iDocid)>0
163635 16 0 if( *pRc==SQLITE_OK
163636 0 16 && pExpr->eType==FTSQUERY_NEAR
163637 0 0 && (pExpr->pParent==0 || pExpr->pParent->eType!=FTSQUERY_NEAR)
0 0 && (pExpr->pParent==0 || pExpr->pParent->eType!=FTSQUERY_NEAR)
163644 0 0 for(p=pExpr; p->pLeft; p=p->pLeft){
163650 0 0 if( !aTmp ){
163657 0 0 for(p=p->pParent;res && p && p->eType==FTSQUERY_NEAR; p=p->pParent){
0 0 for(p=p->pParent;res && p && p->eType==FTSQUERY_NEAR; p=p->pParent){
0 0 for(p=p->pParent;res && p && p->eType==FTSQUERY_NEAR; p=p->pParent){
163665 0 0 for(p=pExpr->pLeft; p && res; p=p->pLeft){
0 0 for(p=pExpr->pLeft; p && res; p=p->pLeft){
163671 0 0 p->eType==FTSQUERY_NEAR ? p->pRight->pPhrase : p->pPhrase
163700 111 0 if( *pRc==SQLITE_OK ){
163706 16 0 && fts3EvalTestExpr(pCsr, pExpr->pRight, pRc)
163707 16 0 && fts3EvalNearTest(pExpr, pRc)
16 0 && fts3EvalNearTest(pExpr, pRc)
163725 0 16 if( bHit==0
163726 0 0 && pExpr->eType==FTSQUERY_NEAR
163727 0 0 && (pExpr->pParent==0 || pExpr->pParent->eType!=FTSQUERY_NEAR)
0 0 && (pExpr->pParent==0 || pExpr->pParent->eType!=FTSQUERY_NEAR)
163730 0 0 for(p=pExpr; p->pPhrase==0; p=p->pLeft){
163731 0 0 if( p->pRight->iDocid==pCsr->iPrevId ){
163735 0 0 if( p->iDocid==pCsr->iPrevId ){
163745 4 4 bHit = bHit1 || bHit2;
4 0 bHit = bHit1 || bHit2;
163752 8 0 && !fts3EvalTestExpr(pCsr, pExpr->pRight, pRc)
4 4 && !fts3EvalTestExpr(pCsr, pExpr->pRight, pRc)
163758 0 79 if( pCsr->pDeferred
163759 0 0 && (pExpr->iDocid==pCsr->iPrevId || pExpr->bDeferred)
0 0 && (pExpr->iDocid==pCsr->iPrevId || pExpr->bDeferred)
163763 0 0 if( pExpr->bDeferred ){
163772 75 4 bHit = (pExpr->bEof==0 && pExpr->iDocid==pCsr->iPrevId);
67 8 bHit = (pExpr->bEof==0 && pExpr->iDocid==pCsr->iPrevId);
163808 47 0 if( rc==SQLITE_OK ){
163816 0 47 if( pCsr->pDeferred ){
163818 0 0 if( rc==SQLITE_OK ){
163828 47 0 return (rc==SQLITE_OK && bMiss);
4 43 return (rc==SQLITE_OK && bMiss);
163839 0 77 if( pExpr==0 ){
163843 41 40 if( pCsr->isRequireSeek==0 ){
163852 47 34 }while( pCsr->isEof==0 && sqlite3Fts3EvalTestDeferred(pCsr, &rc) );
4 43 }while( pCsr->isEof==0 && sqlite3Fts3EvalTestDeferred(pCsr, &rc) );
163857 77 0 if( rc==SQLITE_OK && (
77 0 if( rc==SQLITE_OK && (
163858 77 0 (pCsr->bDesc==0 && pCsr->iPrevId>pCsr->iMaxDocid)
163859 0 77 || (pCsr->bDesc!=0 && pCsr->iPrevIdiMinDocid)
0 0 || (pCsr->bDesc!=0 && pCsr->iPrevIdiMinDocid)
163881 0 0 if( pExpr && *pRc==SQLITE_OK ){
0 0 if( pExpr && *pRc==SQLITE_OK ){
163884 0 0 if( pPhrase ){
163886 0 0 if( pPhrase->bIncr ){
163888 0 0 for(i=0; inToken; i++){
163891 0 0 if( pToken->pSegcsr ){
163920 0 0 if( pExpr ){
163922 0 0 if( pPhrase && pPhrase->doclist.pList ){
0 0 if( pPhrase && pPhrase->doclist.pList ){
163930 0 0 while( 0xFE & (*p | c) ){
163931 0 0 if( (c&0x80)==0 ) iCnt++;
163940 0 0 if( *p==0x00 ) break;
163942 0 0 p += fts3GetVarint32(p, &iCol);
163969 0 0 if( pExpr->aMI==0 ){
163980 0 0 while( pRoot->pParent && pRoot->pParent->eType==FTSQUERY_NEAR ){
0 0 while( pRoot->pParent && pRoot->pParent->eType==FTSQUERY_NEAR ){
163988 0 0 for(p=pRoot; p; p=p->pLeft){
163989 0 0 Fts3Expr *pE = (p->eType==FTSQUERY_PHRASE?p:p->pRight);
163992 0 0 if( !pE->aMI ) return SQLITE_NOMEM;
163998 0 0 while( pCsr->isEof==0 && rc==SQLITE_OK ){
0 0 while( pCsr->isEof==0 && rc==SQLITE_OK ){
164002 0 0 if( pCsr->isRequireSeek==0 ) sqlite3_reset(pCsr->pStmt);
164012 0 0 && pRoot->eType==FTSQUERY_NEAR
164013 0 0 && sqlite3Fts3EvalTestDeferred(pCsr, &rc)
164014 0 0 );
164016 0 0 if( rc==SQLITE_OK && pCsr->isEof==0 ){
0 0 if( rc==SQLITE_OK && pCsr->isEof==0 ){
164024 0 0 if( bEof ){
164037 0 0 }while( pRoot->iDocid!=iDocid && rc==SQLITE_OK );
0 0 }while( pRoot->iDocid!=iDocid && rc==SQLITE_OK );
164082 0 0 if( pExpr->bDeferred && pExpr->pParent->eType!=FTSQUERY_NEAR ){
0 0 if( pExpr->bDeferred && pExpr->pParent->eType!=FTSQUERY_NEAR ){
164084 0 0 for(iCol=0; iColnColumn; iCol++){
164090 0 0 if( rc==SQLITE_OK ){
164092 0 0 for(iCol=0; iColnColumn; iCol++){
164137 0 0 if( (pPhrase->iColumnnColumn && pPhrase->iColumn!=iCol) ){
0 0 if( (pPhrase->iColumnnColumn && pPhrase->iColumn!=iCol) ){
164143 0 0 if( iDocid!=pCsr->iPrevId || pExpr->bEof ){
0 0 if( iDocid!=pCsr->iPrevId || pExpr->bEof ){
164158 0 0 for(p=pExpr->pParent; p; p=p->pParent){
164159 0 0 if( p->eType==FTSQUERY_OR ) bOr = 1;
164160 0 0 if( p->eType==FTSQUERY_NEAR ) pNear = p;
164161 0 0 if( p->bEof ) bTreeEof = 1;
164163 0 0 if( bOr==0 ) return SQLITE_OK;
164168 0 0 if( pPhrase->bIncr ){
164171 0 0 while( rc==SQLITE_OK && !pNear->bEof ){
0 0 while( rc==SQLITE_OK && !pNear->bEof ){
164173 0 0 if( bEofSave==0 && pNear->iDocid==iDocid ) break;
0 0 if( bEofSave==0 && pNear->iDocid==iDocid ) break;
164177 0 0 if( bTreeEof ){
164178 0 0 while( rc==SQLITE_OK && !pNear->bEof ){
0 0 while( rc==SQLITE_OK && !pNear->bEof ){
164182 0 0 if( rc!=SQLITE_OK ) return rc;
164185 0 0 for(p=pNear; p; p=p->pLeft){
164190 0 0 if( pTest->eType==FTSQUERY_NEAR ) pTest = pTest->pRight;
164196 0 0 if( pCsr->bDesc==bDescDoclist ){
164197 0 0 bEof = !pPh->doclist.nAll ||
0 0 bEof = !pPh->doclist.nAll ||
164199 0 0 while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)<0 ) && bEof==0 ){
0 0 while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)<0 ) && bEof==0 ){
0 0 while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)<0 ) && bEof==0 ){
0 0 while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)<0 ) && bEof==0 ){
164206 0 0 bEof = !pPh->doclist.nAll || (pIter && pIter<=pPh->doclist.aAll);
0 0 bEof = !pPh->doclist.nAll || (pIter && pIter<=pPh->doclist.aAll);
0 0 bEof = !pPh->doclist.nAll || (pIter && pIter<=pPh->doclist.aAll);
164207 0 0 while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)>0 ) && bEof==0 ){
0 0 while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)>0 ) && bEof==0 ){
0 0 while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)>0 ) && bEof==0 ){
0 0 while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)>0 ) && bEof==0 ){
164217 0 0 if( bEof || iDocid!=pCsr->iPrevId ) bMatch = 0;
0 0 if( bEof || iDocid!=pCsr->iPrevId ) bMatch = 0;
164220 0 0 if( bMatch ){
164226 0 0 if( pIter==0 ) return SQLITE_OK;
164228 0 0 if( *pIter==0x01 ){
164230 0 0 pIter += fts3GetVarint32(pIter, &iThis);
164234 0 0 while( iThis
164236 0 0 if( *pIter==0x00 ) return SQLITE_OK;
164238 0 0 pIter += fts3GetVarint32(pIter, &iThis);
164240 0 0 if( *pIter==0x00 ){
164244 0 0 *ppOut = ((iCol==iThis)?pIter:0);
164256 54 20 if( pPhrase ){
164261 58 54 for(i=0; inToken; i++){
164378 0 1 if( argc!=4 && argc!=5 ) goto bad_args;
0 0 if( argc!=4 && argc!=5 ) goto bad_args;
164382 0 1 if( argc==5 ){
164383 0 0 if( nDb==4 && 0==sqlite3_strnicmp("temp", zDb, 4) ){
0 0 if( nDb==4 && 0==sqlite3_strnicmp("temp", zDb, 4) ){
164396 0 1 if( rc!=SQLITE_OK ) return rc;
164400 0 1 if( !p ) return SQLITE_NOMEM;
164432 40 1 for(i=0; iaStmt); i++){
164461 0 1 if( pInfo->nOrderBy==1
164462 0 0 && pInfo->aOrderBy[0].iColumn==0
164463 0 0 && pInfo->aOrderBy[0].desc==0
164470 1 1 for(i=0; inConstraint; i++){
164471 1 0 if( pInfo->aConstraint[i].usable ){
164475 0 1 if( iCol==0 ){
164476 0 0 if( op==SQLITE_INDEX_CONSTRAINT_EQ ) iEq = i;
164477 0 0 if( op==SQLITE_INDEX_CONSTRAINT_LT ) iLe = i;
164478 0 0 if( op==SQLITE_INDEX_CONSTRAINT_LE ) iLe = i;
164479 0 0 if( op==SQLITE_INDEX_CONSTRAINT_GT ) iGe = i;
164480 0 0 if( op==SQLITE_INDEX_CONSTRAINT_GE ) iGe = i;
164482 0 1 if( iCol==4 ){
164483 0 0 if( op==SQLITE_INDEX_CONSTRAINT_EQ ) iLangid = i;
164488 0 1 if( iEq>=0 ){
164495 0 1 if( iGe>=0 ){
164500 0 1 if( iLe>=0 ){
164506 0 1 if( iLangid>=0 ){
164523 0 1 if( !pCsr ) return SQLITE_NOMEM;
164547 2 7 if( nSize>pCsr->nStat ){
164552 0 2 if( aNew==0 ) return SQLITE_NOMEM;
164573 9 7 for(pCsr->iCol++; pCsr->iColnStat; pCsr->iCol++){
164574 6 3 if( pCsr->aStat[pCsr->iCol].nDoc>0 ) return SQLITE_OK;
164578 6 1 if( rc==SQLITE_ROW ){
164586 0 6 if( pCsr->zStop ){
164589 0 0 if( mc<0 || (mc==0 && pCsr->csr.nTerm>pCsr->nStop) ){
0 0 if( mc<0 || (mc==0 && pCsr->csr.nTerm>pCsr->nStop) ){
0 0 if( mc<0 || (mc==0 && pCsr->csr.nTerm>pCsr->nStop) ){
164595 0 6 if( fts3auxGrowStatArray(pCsr, 2) ) return SQLITE_NOMEM;
164599 24 6 while( i
164621 3 3 if( v>1 ){
164628 6 9 if( v==0 ){ /* 0x00. Next integer will be a docid. */
164630 3 6 }else if( v==1 ){ /* 0x01. Next integer will be a column number. */
164641 0 3 if( fts3auxGrowStatArray(pCsr, iCol+2) ) return SQLITE_NOMEM;
164687 0 1 if( idxNum==FTS4AUX_EQ_CONSTRAINT ){
164691 0 1 if( idxNum & FTS4AUX_GE_CONSTRAINT ){
164694 0 1 if( idxNum & FTS4AUX_LE_CONSTRAINT ){
164698 0 1 if( iNext
164710 1 0 if( isScan ) pCsr->filter.flags |= FTS3_SEGMENT_SCAN;
164712 1 0 if( iEq>=0 || iGe>=0 ){
0 1 if( iEq>=0 || iGe>=0 ){
164715 0 0 if( zStr ){
164718 0 0 if( pCsr->filter.zTerm==0 ) return SQLITE_NOMEM;
164722 0 1 if( iLe>=0 ){
164725 0 0 if( pCsr->zStop==0 ) return SQLITE_NOMEM;
164728 0 1 if( iLangid>=0 ){
164736 0 0 if( iLangVal<0 ) iLangVal = 0;
164743 1 0 if( rc==SQLITE_OK ){
164747 1 0 if( rc==SQLITE_OK ) rc = fts3auxNextMethod(pCursor);
164776 6 6 if( p->iCol ){
164969 74 40 return c==' ' || c=='\t' || c=='\n' || c=='\r' || c=='\v' || c=='\f';
74 0 return c==' ' || c=='\t' || c=='\n' || c=='\r' || c=='\v' || c=='\f';
74 0 return c==' ' || c=='\t' || c=='\n' || c=='\r' || c=='\v' || c=='\f';
74 0 return c==' ' || c=='\t' || c=='\n' || c=='\r' || c=='\v' || c=='\f';
74 0 return c==' ' || c=='\t' || c=='\n' || c=='\r' || c=='\v' || c=='\f';
0 74 return c==' ' || c=='\t' || c=='\n' || c=='\r' || c=='\v' || c=='\f';
164979 70 0 if( pRet ) memset(pRet, 0, nByte);
164996 94 0 if( rc==SQLITE_OK ){
164998 0 94 if( pModule->iVersion>=1 ){
165000 0 0 if( rc!=SQLITE_OK ){
165043 398 42 for(i=0; i
165044 398 0 if( sqlite3_fts3_enable_parentheses && (z[i]=='(' || z[i]==')') ) break;
390 8 if( sqlite3_fts3_enable_parentheses && (z[i]=='(' || z[i]==')') ) break;
165045 0 390 if( z[i]=='"' ) break;
165050 50 0 if( rc==SQLITE_OK ){
165056 50 0 if( rc==SQLITE_OK ){
165059 0 50 if( !pRet ){
165070 28 22 if( iEnd
8 20 if( iEnd
165081 25 25 }else if( pParse->bFts4 && iStart>0 && z[iStart-1]=='^' ){
10 15 }else if( pParse->bFts4 && iStart>0 && z[iStart-1]=='^' ){
0 10 }else if( pParse->bFts4 && iStart>0 && z[iStart-1]=='^' ){
165091 0 0 }else if( i && rc==SQLITE_DONE ){
0 0 }else if( i && rc==SQLITE_DONE ){
165109 0 20 if( !pRet ){
165164 4 0 if( rc==SQLITE_OK ){
165166 12 4 for(ii=0; rc==SQLITE_OK; ii++){
165170 8 4 if( rc==SQLITE_OK ){
165174 0 8 if( !p ) goto no_mem;
165177 0 8 if( !zTemp ) goto no_mem;
165187 4 4 pToken->isPrefix = (iEnd
0 4 pToken->isPrefix = (iEnd
165188 4 4 pToken->bFirst = (iBegin>0 && zInput[iBegin-1]=='^');
0 4 pToken->bFirst = (iBegin>0 && zInput[iBegin-1]=='^');
165197 4 0 if( rc==SQLITE_DONE ){
165202 0 4 if( !p ) goto no_mem;
165210 4 0 if( zTemp ){
165217 8 4 for(jj=0; jjpPhrase->nToken; jj++){
165228 0 0 if( pCursor ){
165276 102 34 while( nInput>0 && fts3isspace(*zInput) ){
28 74 while( nInput>0 && fts3isspace(*zInput) ){
165280 34 74 if( nInput==0 ){
165285 272 62 for(ii=0; ii<(int)(sizeof(aKeyword)/sizeof(struct Fts3Keyword)); ii++){
165288 0 272 if( (pKey->parenOnly & ~sqlite3_fts3_enable_parentheses)!=0 ){
165292 266 6 if( nInput>=pKey->n && 0==memcmp(zInput, pKey->z, pKey->n) ){
12 254 if( nInput>=pKey->n && 0==memcmp(zInput, pKey->z, pKey->n) ){
165298 0 12 if( pKey->eType==FTSQUERY_NEAR ){
165300 0 0 if( zInput[4]=='/' && zInput[5]>='0' && zInput[5]<='9' ){
0 0 if( zInput[4]=='/' && zInput[5]>='0' && zInput[5]<='9' ){
0 0 if( zInput[4]=='/' && zInput[5]>='0' && zInput[5]<='9' ){
165302 0 0 for(nKey=5; zInput[nKey]>='0' && zInput[nKey]<='9'; nKey++){
0 0 for(nKey=5; zInput[nKey]>='0' && zInput[nKey]<='9'; nKey++){
165313 0 12 if( fts3isspace(cNext)
165314 0 0 || cNext=='"' || cNext=='(' || cNext==')' || cNext==0
0 0 || cNext=='"' || cNext=='(' || cNext==')' || cNext==0
0 0 || cNext=='"' || cNext=='(' || cNext==')' || cNext==0
0 0 || cNext=='"' || cNext=='(' || cNext==')' || cNext==0
165317 0 12 if( !pRet ){
165338 4 58 if( *zInput=='"' ){
165339 48 0 for(ii=1; ii
44 4 for(ii=1; ii
165341 0 4 if( ii==nInput ){
165348 4 54 if( *zInput=='(' ){
165352 4 0 if( rc==SQLITE_OK && !*ppExpr ){ rc = SQLITE_DONE; }
0 4 if( rc==SQLITE_OK && !*ppExpr ){ rc = SQLITE_DONE; }
165355 4 50 }else if( *zInput==')' ){
165376 52 50 for(ii=0; iinCol; ii++){
165379 24 28 if( nInput>nStr && zInput[nStr]==':'
0 24 if( nInput>nStr && zInput[nStr]==':'
165380 0 0 && sqlite3_strnicmp(zStr, zInput, nStr)==0
165438 0 20 while( pSplit->pParent && opPrecedence(pSplit->pParent)<=opPrecedence(pNew) ){
0 0 while( pSplit->pParent && opPrecedence(pSplit->pParent)<=opPrecedence(pNew) ){
165442 0 20 if( pSplit->pParent ){
165477 108 38 while( rc==SQLITE_OK ){
165483 70 38 if( rc==SQLITE_OK ){
165484 70 0 if( p ){
165508 16 54 isPhrase = (eType==FTSQUERY_PHRASE || p->pLeft);
4 12 isPhrase = (eType==FTSQUERY_PHRASE || p->pLeft);
165515 12 58 if( !isPhrase && isRequirePhrase ){
0 12 if( !isPhrase && isRequirePhrase ){
165521 58 12 if( isPhrase && !isRequirePhrase ){
8 50 if( isPhrase && !isRequirePhrase ){
165526 0 8 if( !pAnd ){
165545 32 38 if( pPrev && (
0 32 if( pPrev && (
165546 0 0 (eType==FTSQUERY_NEAR && !isPhrase && pPrev->eType!=FTSQUERY_PHRASE)
0 0 (eType==FTSQUERY_NEAR && !isPhrase && pPrev->eType!=FTSQUERY_PHRASE)
165547 12 20 || (eType!=FTSQUERY_PHRASE && isPhrase && pPrev->eType==FTSQUERY_NEAR)
0 12 || (eType!=FTSQUERY_PHRASE && isPhrase && pPrev->eType==FTSQUERY_NEAR)
0 0 || (eType!=FTSQUERY_PHRASE && isPhrase && pPrev->eType==FTSQUERY_NEAR)
165554 58 12 if( isPhrase ){
165555 20 38 if( pRet ){
165576 38 0 if( rc==SQLITE_DONE && pRet && isRequirePhrase ){
38 0 if( rc==SQLITE_DONE && pRet && isRequirePhrase ){
0 38 if( rc==SQLITE_DONE && pRet && isRequirePhrase ){
165580 38 0 if( rc==SQLITE_DONE ){
165599 0 38 if( rc!=SQLITE_OK ){
165614 74 108 if( p ){
165615 0 74 if( nMaxDepth<0 ){
165619 74 0 if( rc==SQLITE_OK ){
165644 0 74 if( nMaxDepth==0 ){
165648 74 0 if( rc==SQLITE_OK ){
165649 62 12 if( (eType==FTSQUERY_AND || eType==FTSQUERY_OR) ){
4 58 if( (eType==FTSQUERY_AND || eType==FTSQUERY_OR) ){
165652 0 16 if( 0==apLeaf ){
165658 16 0 if( rc==SQLITE_OK ){
165663 16 16 for(p=pRoot; p->eType==eType; p=p->pLeft){
165675 16 16 if( pParent ){
165681 0 32 if( rc!=SQLITE_OK ) break;
165683 48 32 for(iLvl=0; p && iLvl
48 0 for(iLvl=0; p && iLvl
165684 32 16 if( apLeaf[iLvl]==0 ){
165700 0 32 if( p ){
165707 16 16 if( pParent==0 ) break;
165710 0 16 for(p=pParent->pRight; p->eType==eType; p=p->pLeft);
165715 0 16 if( pParent->pParent ){
165728 16 0 if( rc==SQLITE_OK ){
165730 188 16 for(i=0; i
165731 16 172 if( apLeaf[i] ){
165732 16 0 if( p==0 ){
165754 0 0 for(i=0; i
165757 0 0 while( (pDel=pFree)!=0 ){
165766 4 54 }else if( eType==FTSQUERY_NOT ){
165776 4 0 if( rc==SQLITE_OK ){
165780 0 4 if( rc!=SQLITE_OK ){
165793 0 74 if( rc!=SQLITE_OK ){
165833 0 34 if( z==0 ){
165837 34 0 if( n<0 ){
165844 34 0 if( rc==SQLITE_OK && sParse.nNest ){
0 34 if( rc==SQLITE_OK && sParse.nNest ){
165892 34 0 if( rc==SQLITE_OK && *ppExpr ){
34 0 if( rc==SQLITE_OK && *ppExpr ){
165894 34 0 if( rc==SQLITE_OK ){
165899 0 34 if( rc!=SQLITE_OK ){
165902 0 0 if( rc==SQLITE_TOOBIG ){
165908 0 0 }else if( rc==SQLITE_ERROR ){
165936 20 0 for(p=pDel; p && (p->pLeft||p->pRight); p=(p->pLeft ? p->pLeft : p->pRight)){
54 68 for(p=pDel; p && (p->pLeft||p->pRight); p=(p->pLeft ? p->pLeft : p->pRight)){
20 34 for(p=pDel; p && (p->pLeft||p->pRight); p=(p->pLeft ? p->pLeft : p->pRight)){
0 34 for(p=pDel; p && (p->pLeft||p->pRight); p=(p->pLeft ? p->pLeft : p->pRight)){
165939 74 102 while( p ){
165942 40 34 if( pParent && p==pParent->pLeft && pParent->pRight ){
20 20 if( pParent && p==pParent->pLeft && pParent->pRight ){
20 0 if( pParent && p==pParent->pLeft && pParent->pRight ){
165944 20 0 while( p && (p->pLeft || p->pRight) ){
0 20 while( p && (p->pLeft || p->pRight) ){
0 20 while( p && (p->pLeft || p->pRight) ){
165946 0 0 p = (p->pLeft ? p->pLeft : p->pRight);
166187 2487 0 if( p ){
166230 1098 279 while( elem ){
166232 1098 0 if( pH->copyKey && elem->pKey ){
1098 0 if( pH->copyKey && elem->pKey ){
166247 0 1203 if( nKey<=0 ) nKey = (int) strlen(z);
166248 8037 1203 while( nKey > 0 ){
166255 32 318 if( n1!=n2 ) return 1;
166265 0 0 while( nKey-- > 0 ){
166271 0 0 if( n1!=n2 ) return 1;
166288 1478 0 if( keyClass==FTS3_HASH_STRING ){
166303 928 0 if( keyClass==FTS3_HASH_STRING ){
166320 282 824 if( pHead ){
166323 24 258 if( pHead->prev ){ pHead->prev->next = pNew; }
166328 549 275 if( pH->first ){ pH->first->prev = pNew; }
166350 0 275 if( new_ht==0 ) return 1;
166355 0 275 for(elem=pH->first, pH->first=0; elem; elem = next_elem){
166377 928 275 if( pH->ht ){
166382 350 913 while( count-- && elem ){
350 0 while( count-- && elem ){
166383 15 335 if( (*xCompare)(elem->pKey,elem->nKey,pKey,nKey)==0 ){
166401 0 0 if( elem->prev ){
166406 0 0 if( elem->next ){
166410 0 0 if( pEntry->chain==elem ){
166414 0 0 if( pEntry->count<=0 ){
166417 0 0 if( pH->copyKey && elem->pKey ){
0 0 if( pH->copyKey && elem->pKey ){
166422 0 0 if( pH->count<=0 ){
166437 170 0 if( pH==0 || pH->ht==0 ) return 0;
73 97 if( pH==0 || pH->ht==0 ) return 0;
166454 14 106 return pElem ? pElem->data : 0;
166491 0 1106 if( elem ){
166493 0 0 if( data==0 ){
166500 0 1106 if( data==0 ) return 0;
166501 275 831 if( (pH->htsize==0 && fts3Rehash(pH,8))
275 0 if( (pH->htsize==0 && fts3Rehash(pH,8))
166502 0 1106 || (pH->count>=pH->htsize && fts3Rehash(pH, pH->htsize*2))
0 0 || (pH->count>=pH->htsize && fts3Rehash(pH, pH->htsize*2))
166509 0 1106 if( new_elem==0 ) return data;
166510 1106 0 if( pH->copyKey && pKey!=0 ){
1106 0 if( pH->copyKey && pKey!=0 ){
166512 0 1106 if( new_elem->pKey==0 ){
166602 0 0 if( t==NULL ) return SQLITE_NOMEM;
166632 0 0 if( c==NULL ) return SQLITE_NOMEM;
166635 0 0 if( zInput==0 ){
166637 0 0 }else if( nInput<0 ){
166686 0 0 if( x==0 ) return 0;
166689 0 0 if( j<2 ) return j;
166690 0 0 return z[1]==0 || isVowel(z + 1);
0 0 return z[1]==0 || isVowel(z + 1);
166695 0 0 if( x==0 ) return 0;
166698 0 0 if( j<2 ) return 1-j;
166722 0 0 while( isVowel(z) ){ z++; }
166723 0 0 if( *z==0 ) return 0;
166724 0 0 while( isConsonant(z) ){ z++; }
166732 0 0 while( isVowel(z) ){ z++; }
166733 0 0 if( *z==0 ) return 0;
166734 0 0 while( isConsonant(z) ){ z++; }
166735 0 0 if( *z==0 ) return 0;
166736 0 0 while( isVowel(z) ){ z++; }
166737 0 0 if( *z==0 ) return 1;
166738 0 0 while( isConsonant(z) ){ z++; }
166746 0 0 while( isVowel(z) ){ z++; }
166747 0 0 if( *z==0 ) return 0;
166748 0 0 while( isConsonant(z) ){ z++; }
166749 0 0 if( *z==0 ) return 0;
166750 0 0 while( isVowel(z) ){ z++; }
166751 0 0 if( *z==0 ) return 0;
166752 0 0 while( isConsonant(z) ){ z++; }
166760 0 0 while( isConsonant(z) ){ z++; }
166771 0 0 return isConsonant(z) && z[0]==z[1];
0 0 return isConsonant(z) && z[0]==z[1];
166784 0 0 isConsonant(z) &&
166785 0 0 z[0]!='w' && z[0]!='x' && z[0]!='y' &&
166786 0 0 isVowel(z+1) &&
0 0 isVowel(z+1) &&
166809 0 0 while( *zFrom && *zFrom==*z ){ z++; zFrom++; }
0 0 while( *zFrom && *zFrom==*z ){ z++; zFrom++; }
166810 0 0 if( *zFrom!=0 ) return 0;
166811 0 0 if( xCond && !xCond(z) ) return 1;
0 0 if( xCond && !xCond(z) ) return 1;
166812 0 0 while( *zTo ){
166830 0 0 for(i=0; i
166832 0 0 if( c>='A' && c<='Z' ){
0 0 if( c>='A' && c<='Z' ){
166835 0 0 if( c>='0' && c<='9' ) hasDigit = 1;
0 0 if( c>='0' && c<='9' ) hasDigit = 1;
166839 0 0 mx = hasDigit ? 3 : 10;
166840 0 0 if( nIn>mx*2 ){
166841 0 0 for(j=mx, i=nIn-mx; i
166878 0 0 if( nIn<3 || nIn>=(int)sizeof(zReverse)-7 ){
0 0 if( nIn<3 || nIn>=(int)sizeof(zReverse)-7 ){
166884 0 0 for(i=0, j=sizeof(zReverse)-6; i
166886 0 0 if( c>='A' && c<='Z' ){
0 0 if( c>='A' && c<='Z' ){
166888 0 0 }else if( c>='a' && c<='z' ){
0 0 }else if( c>='a' && c<='z' ){
166902 0 0 if( z[0]=='s' ){
166903 0 0 if(
166904 0 0 !stem(&z, "sess", "ss", 0) &&
166905 0 0 !stem(&z, "sei", "i", 0) &&
166914 0 0 if( stem(&z, "dee", "ee", m_gt_0) ){
166916 0 0 }else if(
166917 0 0 (stem(&z, "gni", "", hasVowel) || stem(&z, "de", "", hasVowel))
166918 0 0 && z!=z2
166921 0 0 stem(&z, "lb", "ble", 0) ||
166924 0 0 }else if( doubleConsonant(z) && (*z!='l' && *z!='s' && *z!='z') ){
0 0 }else if( doubleConsonant(z) && (*z!='l' && *z!='s' && *z!='z') ){
0 0 }else if( doubleConsonant(z) && (*z!='l' && *z!='s' && *z!='z') ){
0 0 }else if( doubleConsonant(z) && (*z!='l' && *z!='s' && *z!='z') ){
166926 0 0 }else if( m_eq_1(z) && star_oh(z) ){
0 0 }else if( m_eq_1(z) && star_oh(z) ){
166932 0 0 if( z[0]=='y' && hasVowel(z+1) ){
0 0 if( z[0]=='y' && hasVowel(z+1) ){
166939 0 0 if( !stem(&z, "lanoita", "ate", m_gt_0) ){
166944 0 0 if( !stem(&z, "icne", "ence", m_gt_0) ){
166955 0 0 if( !stem(&z, "ilb", "ble", m_gt_0)
166956 0 0 && !stem(&z, "illa", "al", m_gt_0)
166957 0 0 && !stem(&z, "iltne", "ent", m_gt_0)
166958 0 0 && !stem(&z, "ile", "e", m_gt_0)
166964 0 0 if( !stem(&z, "noitazi", "ize", m_gt_0)
166965 0 0 && !stem(&z, "noita", "ate", m_gt_0)
166971 0 0 if( !stem(&z, "msila", "al", m_gt_0)
166972 0 0 && !stem(&z, "ssenevi", "ive", m_gt_0)
166973 0 0 && !stem(&z, "ssenluf", "ful", m_gt_0)
166979 0 0 if( !stem(&z, "itila", "al", m_gt_0)
166980 0 0 && !stem(&z, "itivi", "ive", m_gt_0)
166990 0 0 if( !stem(&z, "etaci", "ic", m_gt_0)
166991 0 0 && !stem(&z, "evita", "", m_gt_0)
167000 0 0 if( !stem(&z, "laci", "ic", m_gt_0) ){
167012 0 0 if( z[0]=='l' && m_gt_1(z+2) ){
0 0 if( z[0]=='l' && m_gt_1(z+2) ){
167017 0 0 if( z[0]=='e' && z[2]=='n' && (z[3]=='a' || z[3]=='e') && m_gt_1(z+4) ){
0 0 if( z[0]=='e' && z[2]=='n' && (z[3]=='a' || z[3]=='e') && m_gt_1(z+4) ){
0 0 if( z[0]=='e' && z[2]=='n' && (z[3]=='a' || z[3]=='e') && m_gt_1(z+4) ){
0 0 if( z[0]=='e' && z[2]=='n' && (z[3]=='a' || z[3]=='e') && m_gt_1(z+4) ){
0 0 if( z[0]=='e' && z[2]=='n' && (z[3]=='a' || z[3]=='e') && m_gt_1(z+4) ){
167022 0 0 if( z[0]=='r' && m_gt_1(z+2) ){
0 0 if( z[0]=='r' && m_gt_1(z+2) ){
167027 0 0 if( z[0]=='c' && m_gt_1(z+2) ){
0 0 if( z[0]=='c' && m_gt_1(z+2) ){
167032 0 0 if( z[0]=='e' && z[2]=='b' && (z[3]=='a' || z[3]=='i') && m_gt_1(z+4) ){
0 0 if( z[0]=='e' && z[2]=='b' && (z[3]=='a' || z[3]=='i') && m_gt_1(z+4) ){
0 0 if( z[0]=='e' && z[2]=='b' && (z[3]=='a' || z[3]=='i') && m_gt_1(z+4) ){
0 0 if( z[0]=='e' && z[2]=='b' && (z[3]=='a' || z[3]=='i') && m_gt_1(z+4) ){
0 0 if( z[0]=='e' && z[2]=='b' && (z[3]=='a' || z[3]=='i') && m_gt_1(z+4) ){
167037 0 0 if( z[0]=='t' ){
167038 0 0 if( z[2]=='a' ){
167039 0 0 if( m_gt_1(z+3) ){
167042 0 0 }else if( z[2]=='e' ){
167043 0 0 if( !stem(&z, "tneme", "", m_gt_1)
167044 0 0 && !stem(&z, "tnem", "", m_gt_1)
167052 0 0 if( z[0]=='u' ){
167053 0 0 if( m_gt_1(z+2) ){
167056 0 0 }else if( z[3]=='s' || z[3]=='t' ){
0 0 }else if( z[3]=='s' || z[3]=='t' ){
167061 0 0 if( z[0]=='m' && z[2]=='i' && m_gt_1(z+3) ){
0 0 if( z[0]=='m' && z[2]=='i' && m_gt_1(z+3) ){
0 0 if( z[0]=='m' && z[2]=='i' && m_gt_1(z+3) ){
167066 0 0 if( !stem(&z, "eta", "", m_gt_1) ){
167071 0 0 if( z[0]=='s' && z[2]=='o' && m_gt_1(z+3) ){
0 0 if( z[0]=='s' && z[2]=='o' && m_gt_1(z+3) ){
0 0 if( z[0]=='s' && z[2]=='o' && m_gt_1(z+3) ){
167077 0 0 if( z[0]=='e' && z[2]=='i' && m_gt_1(z+3) ){
0 0 if( z[0]=='e' && z[2]=='i' && m_gt_1(z+3) ){
0 0 if( z[0]=='e' && z[2]=='i' && m_gt_1(z+3) ){
167084 0 0 if( z[0]=='e' ){
167085 0 0 if( m_gt_1(z+1) ){
167087 0 0 }else if( m_eq_1(z+1) && !star_oh(z+1) ){
0 0 }else if( m_eq_1(z+1) && !star_oh(z+1) ){
167093 0 0 if( m_gt_1(z) && z[0]=='l' && z[1]=='l' ){
0 0 if( m_gt_1(z) && z[0]=='l' && z[1]=='l' ){
0 0 if( m_gt_1(z) && z[0]=='l' && z[1]=='l' ){
167102 0 0 while( *z ){
167138 0 0 while( c->iOffsetnInput ){
167142 0 0 while( c->iOffsetnInput && isDelim(z[c->iOffset]) ){
0 0 while( c->iOffsetnInput && isDelim(z[c->iOffset]) ){
0 0 while( c->iOffsetnInput && isDelim(z[c->iOffset]) ){
0 0 while( c->iOffsetnInput && isDelim(z[c->iOffset]) ){
167148 0 0 while( c->iOffsetnInput && !isDelim(z[c->iOffset]) ){
0 0 while( c->iOffsetnInput && !isDelim(z[c->iOffset]) ){
0 0 while( c->iOffsetnInput && !isDelim(z[c->iOffset]) ){
0 0 while( c->iOffsetnInput && !isDelim(z[c->iOffset]) ){
167152 0 0 if( c->iOffset>iStartOffset ){
167154 0 0 if( n>c->nAllocated ){
167158 0 0 if( !pNew ) return SQLITE_NOMEM;
167279 247 0 if( argc==2 ){
167280 247 0 if( fts3TokenizerEnabled(context) ){
167283 247 0 if( zName==0 || n!=sizeof(pPtr) ){
0 247 if( zName==0 || n!=sizeof(pPtr) ){
167289 0 247 if( pOld==pPtr ){
167297 0 0 if( zName ){
167300 0 0 if( !pPtr ){
167321 119 0 return (c&0x80 || isFtsIdChar[(int)(c)]);
95 24 return (c&0x80 || isFtsIdChar[(int)(c)]);
167330 22 22 while( z2==0 ){
167338 92 0 while( *++z2 && (*z2!=c || *++z2==c) );
88 4 while( *++z2 && (*z2!=c || *++z2==c) );
0 4 while( *++z2 && (*z2!=c || *++z2==c) );
167343 0 0 while( *z2 && z2[0]!=']' ) z2++;
0 0 while( *z2 && z2[0]!=']' ) z2++;
167344 0 0 if( *z2 ) z2++;
167348 18 0 if( sqlite3Fts3IsIdChar(*z1) ){
167350 77 18 while( sqlite3Fts3IsIdChar(*z2) ) z2++;
167375 0 8 if( !zCopy ) return SQLITE_NOMEM;
167379 0 8 if( z==0 ){
167387 0 8 if( !m ){
167394 4 8 while( z
4 0 while( z
167397 0 4 if( !aNew ){
167410 1 7 if( rc!=SQLITE_OK ){
167691 251 0 if( SQLITE_OK==rc ){
167694 251 0 if( SQLITE_OK==rc ){
167769 210 0 return c<0x80 && t->delim[c];
32 178 return c<0x80 && t->delim[c];
167772 240 141 return (x>='0' && x<='9') || (x>='A' && x<='Z') || (x>='a' && x<='z');
210 30 return (x>='0' && x<='9') || (x>='A' && x<='Z') || (x>='a' && x<='z');
189 162 return (x>='0' && x<='9') || (x>='A' && x<='Z') || (x>='a' && x<='z');
111 78 return (x>='0' && x<='9') || (x>='A' && x<='Z') || (x>='a' && x<='z');
93 180 return (x>='0' && x<='9') || (x>='A' && x<='Z') || (x>='a' && x<='z');
78 15 return (x>='0' && x<='9') || (x>='A' && x<='Z') || (x>='a' && x<='z');
167785 0 3 if( t==NULL ) return SQLITE_NOMEM;
167793 0 3 if( argc>1 ){
167795 0 0 for(i=0; i
167798 0 0 if( ch>=0x80 ){
167807 381 3 for(i=1; i<0x80; i++){
167808 195 186 t->delim[i] = !fts3_isalnum(i) ? -1 : 0;
167840 0 26 if( c==NULL ) return SQLITE_NOMEM;
167843 0 26 if( pInput==0 ){
167845 24 2 }else if( nBytes<0 ){
167886 42 24 while( c->iOffsetnBytes ){
167890 58 0 while( c->iOffsetnBytes && simpleDelim(t, p[c->iOffset]) ){
16 42 while( c->iOffsetnBytes && simpleDelim(t, p[c->iOffset]) ){
167896 152 26 while( c->iOffsetnBytes && !simpleDelim(t, p[c->iOffset]) ){
136 16 while( c->iOffsetnBytes && !simpleDelim(t, p[c->iOffset]) ){
167900 42 0 if( c->iOffset>iStartOffset ){
167902 26 16 if( n>c->nTokenAllocated ){
167906 0 26 if( !pNew ) return SQLITE_NOMEM;
167909 136 42 for(i=0; i
167914 106 30 c->pToken[i] = (char)((ch>='A' && ch<='Z') ? ch-'A'+'a' : ch);
0 106 c->pToken[i] = (char)((ch>='A' && ch<='Z') ? ch-'A'+'a' : ch);
168041 0 0 if( !p ){
168068 0 0 if( argc==0 ){
168075 0 0 for(i=0; i
168080 0 0 if( azDequote==0 ){
168084 0 0 for(i=0; i
168128 0 0 if( rc!=SQLITE_OK ) return rc;
168133 0 0 if( rc==SQLITE_OK ){
168135 0 0 if( nDequote<1 ){
168144 0 0 if( rc==SQLITE_OK ){
168146 0 0 rc = pMod->xCreate((nDequote>1 ? nDequote-1 : 0), azArg, &pTok);
168149 0 0 if( rc==SQLITE_OK ){
168151 0 0 if( pTab==0 ){
168156 0 0 if( rc==SQLITE_OK ){
168162 0 0 if( pTok ){
168194 0 0 for(i=0; inConstraint; i++){
168195 0 0 if( pInfo->aConstraint[i].usable
168196 0 0 && pInfo->aConstraint[i].iColumn==0
168197 0 0 && pInfo->aConstraint[i].op==SQLITE_INDEX_CONSTRAINT_EQ
168221 0 0 if( pCsr==0 ){
168235 0 0 if( pCsr->pCsr ){
168275 0 0 if( rc!=SQLITE_OK ){
168277 0 0 if( rc==SQLITE_DONE ) rc = SQLITE_OK;
168300 0 0 if( idxNum==1 ){
168304 0 0 if( pCsr->zInput==0 ){
168310 0 0 if( rc==SQLITE_OK ){
168316 0 0 if( rc!=SQLITE_OK ) return rc;
168810 60 196 if( !pStmt ){
168812 6 54 if( eStmt==SQL_CONTENT_INSERT ){
168814 0 54 }else if( eStmt==SQL_SELECT_CONTENT_BY_ROWID ){
168819 0 60 if( !zSql ){
168829 25 231 if( apVal ){
168832 84 0 for(i=0; rc==SQLITE_OK && i
59 25 for(i=0; rc==SQLITE_OK && i
168850 0 0 if( rc==SQLITE_OK ){
168853 0 0 if( rc!=SQLITE_ROW || sqlite3_column_type(pStmt, 0)!=SQLITE_BLOB ){
0 0 if( rc!=SQLITE_ROW || sqlite3_column_type(pStmt, 0)!=SQLITE_BLOB ){
168855 0 0 if( rc==SQLITE_OK ) rc = FTS_CORRUPT_VTAB;
168873 0 0 if( rc==SQLITE_OK ){
168875 0 0 if( sqlite3_step(pStmt)!=SQLITE_ROW
168876 0 0 || sqlite3_column_type(pStmt, 0)!=SQLITE_BLOB
168879 0 0 if( rc==SQLITE_OK ) rc = FTS_CORRUPT_VTAB;
168911 0 0 if( *pRC ) return;
168913 0 0 if( rc==SQLITE_OK ){
168938 24 4 if( p->nPendingData==0 ){
168941 24 0 if( rc==SQLITE_OK ){
169020 59 0 if( iLevel<0 ){
169023 59 0 if( rc==SQLITE_OK ){
169032 0 0 if( rc==SQLITE_OK ){
169060 106 174 if( !p ){
169062 0 106 if( !p ){
169069 0 174 else if( p->nData+FTS3_VARINT_MAX+1>p->nSpace ){
169072 0 0 if( !p ){
169109 6 106 if( !p || p->iLastDocid!=iDocid ){
6 0 if( !p || p->iLastDocid!=iDocid ){
169110 6 106 sqlite3_int64 iDelta = iDocid - (p ? p->iLastDocid : 0);
169111 6 106 if( p ){
169116 0 112 if( SQLITE_OK!=(rc = fts3PendingListAppendVarint(&p, iDelta)) ){
169123 28 84 if( iCol>0 && p->iLastCol!=iCol ){
28 0 if( iCol>0 && p->iLastCol!=iCol ){
169124 28 0 if( SQLITE_OK!=(rc = fts3PendingListAppendVarint(&p, 1))
169125 28 0 || SQLITE_OK!=(rc = fts3PendingListAppendVarint(&p, iCol))
169132 112 0 if( iCol>=0 ){
169135 112 0 if( rc==SQLITE_OK ){
169142 106 6 if( p!=*pp ){
169171 6 106 if( pList ){
169174 106 6 if( fts3PendingListAppend(&pList, p->iPrevDocid, iCol, iPos, &rc) ){
169175 0 106 if( pList==fts3HashInsert(pHash, zToken, nToken, pList) ){
169184 112 0 if( rc==SQLITE_OK ){
169224 0 40 if( zText==0 ){
169230 0 40 if( rc!=SQLITE_OK ){
169235 152 0 while( SQLITE_OK==rc
169236 112 40 && SQLITE_OK==(rc = xNext(pCsr, &zToken, &nToken, &iStart, &iEnd, &iPos))
169239 112 0 if( iPos>=nWord ) nWord = iPos+1;
169244 112 0 if( iPos<0 || !zToken || nToken<=0 ){
112 0 if( iPos<0 || !zToken || nToken<=0 ){
0 112 if( iPos<0 || !zToken || nToken<=0 ){
169256 112 0 for(i=1; rc==SQLITE_OK && inIndex; i++){
0 112 for(i=1; rc==SQLITE_OK && inIndex; i++){
169258 0 0 if( nTokennPrefix ) continue;
169267 0 40 return (rc==SQLITE_DONE ? SQLITE_OK : rc);
169290 28 0 if( iDocidiPrevDocid
169291 0 28 || (iDocid==p->iPrevDocid && p->bPrevDelete==0)
0 0 || (iDocid==p->iPrevDocid && p->bPrevDelete==0)
169292 28 0 || p->iPrevLangid!=iLangid
169293 0 28 || p->nPendingData>p->nMaxPendingData
169296 0 0 if( rc!=SQLITE_OK ) return rc;
169309 30 30 for(i=0; inIndex; i++){
169312 106 30 for(pElem=fts3HashFirst(pHash); pElem; pElem=fts3HashNext(pElem)){
169336 40 28 for(i=2; inColumn+2; i++){
169338 40 0 if( p->abNotindexed[iCol]==0 ){
169341 0 40 if( rc!=SQLITE_OK ){
169372 3 25 if( p->zContentTbl ){
169374 0 3 if( sqlite3_value_type(pRowid)==SQLITE_NULL ){
169377 0 3 if( sqlite3_value_type(pRowid)!=SQLITE_INTEGER ){
169393 25 0 if( rc==SQLITE_OK && p->zLanguageid ){
0 25 if( rc==SQLITE_OK && p->zLanguageid ){
169399 0 25 if( rc!=SQLITE_OK ) return rc;
169411 0 25 if( SQLITE_NULL!=sqlite3_value_type(apVal[3+p->nColumn]) ){
169412 0 0 if( SQLITE_NULL==sqlite3_value_type(apVal[0])
169413 0 0 && SQLITE_NULL!=sqlite3_value_type(apVal[1])
169419 0 0 if( rc!=SQLITE_OK ) return rc;
169447 0 0 if( bContent ) fts3SqlExec(&rc, p, SQL_DELETE_ALL_CONTENT, 0);
169450 0 0 if( p->bHasDocsize ){
169453 0 0 if( p->bHasStat ){
169464 0 0 if( p->zLanguageid ) iLangid = sqlite3_column_int(pSelect, p->nColumn+1);
169484 0 0 if( *pRC ) return;
169486 0 0 if( rc==SQLITE_OK ){
169487 0 0 if( SQLITE_ROW==sqlite3_step(pSelect) ){
169492 0 0 for(i=1; rc==SQLITE_OK && i<=p->nColumn; i++){
0 0 for(i=1; rc==SQLITE_OK && i<=p->nColumn; i++){
169494 0 0 if( p->abNotindexed[iCol]==0 ){
169500 0 0 if( rc!=SQLITE_OK ){
169551 24 0 if( rc==SQLITE_OK ){
169555 24 0 if( SQLITE_ROW==sqlite3_step(pNextIdx) ){
169561 24 0 if( rc==SQLITE_OK ){
169567 0 24 if( iNext>=FTS3_MERGE_COUNT ){
169618 0 0 if( p->pSegments ){
169621 0 0 if( 0==p->zSegmentsTbl ){
169623 0 0 if( 0==p->zSegmentsTbl ) return SQLITE_NOMEM;
169630 0 0 if( rc==SQLITE_OK ){
169633 0 0 if( paBlob ){
169635 0 0 if( !aByte ){
169638 0 0 if( pnLoad && nByte>(FTS3_NODE_CHUNK_THRESHOLD) ){
0 0 if( pnLoad && nByte>(FTS3_NODE_CHUNK_THRESHOLD) ){
169644 0 0 if( rc!=SQLITE_OK ){
169677 0 0 if( rc==SQLITE_OK ){
169680 0 0 if( pReader->nPopulate==pReader->nNode ){
169694 0 1393 while( pReader->pBlob && rc==SQLITE_OK
0 0 while( pReader->pBlob && rc==SQLITE_OK
169695 0 0 && (pFrom - pReader->aNode + nByte)>pReader->nPopulate
169706 0 159 if( !fts3SegReaderIsRootOnly(pSeg) ){
169729 256 560 if( !pReader->aDoclist ){
169735 791 25 if( !pNext || pNext>=&pReader->aNode[pReader->nNode] ){
133 658 if( !pNext || pNext>=&pReader->aNode[pReader->nNode] ){
169737 131 27 if( fts3SegReaderIsPending(pReader) ){
169741 107 24 if( pElem ){
169748 0 107 if( !aCopy ) return SQLITE_NOMEM;
169763 27 0 if( pReader->iCurrentBlock>=pReader->iLeafEndBlock ){
169767 0 0 rc = sqlite3Fts3ReadBlock(
169771 0 0 if( rc!=SQLITE_OK ) return rc;
169773 0 0 if( bIncr && pReader->nPopulatenNode ){
0 0 if( bIncr && pReader->nPopulatenNode ){
169783 0 658 if( rc!=SQLITE_OK ) return rc;
169787 0 658 pNext += fts3GetVarint32(pNext, &nPrefix);
169788 0 658 pNext += fts3GetVarint32(pNext, &nSuffix);
169789 658 0 if( nSuffix<=0
169790 658 0 || (&pReader->aNode[pReader->nNode] - pNext)
169791 0 658 || nPrefix>pReader->nTermAlloc
169799 255 403 if( (i64)nPrefix+nSuffix>(i64)pReader->nTermAlloc ){
169802 0 255 if( !zNew ){
169810 0 658 if( rc!=SQLITE_OK ) return rc;
169815 0 658 pNext += fts3GetVarint32(pNext, &pReader->nDoclist);
169823 658 0 if( (&pReader->aNode[pReader->nNode] - pReader->aDoclist)nDoclist
169824 658 0 || (pReader->nPopulate==0 && pReader->aDoclist[pReader->nDoclist-1])
0 658 || (pReader->nPopulate==0 && pReader->aDoclist[pReader->nDoclist-1])
169839 0 75 if( pTab->bDescIdx && fts3SegReaderIsPending(pReader) ){
0 0 if( pTab->bDescIdx && fts3SegReaderIsPending(pReader) ){
169849 75 0 if( rc==SQLITE_OK ){
169879 0 77 if( pTab->bDescIdx && fts3SegReaderIsPending(pReader) ){
0 0 if( pTab->bDescIdx && fts3SegReaderIsPending(pReader) ){
169884 0 0 if( ppOffsetList ){
169892 0 0 if( bEof ){
169911 97 77 while( *p | c ) c = *p++ & 0x80;
169914 0 77 if( pReader->pBlob==0 || p<&pReader->aNode[pReader->nPopulate] ) break;
0 0 if( pReader->pBlob==0 || p<&pReader->aNode[pReader->nPopulate] ) break;
169916 0 0 if( rc!=SQLITE_OK ) return rc;
169923 77 0 if( ppOffsetList ){
169929 2 75 while( p
0 2 while( p
169936 75 2 if( p>=pEnd ){
169940 2 0 if( rc==SQLITE_OK ){
169943 0 2 if( pTab->bDescIdx ){
169970 90 0 for(ii=0; rc==SQLITE_OK && iinSegment; ii++){
72 18 for(ii=0; rc==SQLITE_OK && iinSegment; ii++){
169972 72 0 if( !fts3SegReaderIsPending(pReader)
169973 0 72 && !fts3SegReaderIsRootOnly(pReader)
169976 0 0 for(jj=pReader->iStartBlock; jj<=pReader->iLeafEndBlock; jj++){
169979 0 0 if( rc!=SQLITE_OK ) break;
169980 0 0 if( (nBlob+35)>pgsz ){
169995 256 0 if( pReader ){
169996 231 25 if( !fts3SegReaderIsPending(pReader) ){
169999 25 231 if( !fts3SegReaderIsRootOnly(pReader) ){
170024 231 0 if( iStartLeaf==0 ){
170029 0 231 if( !pReader ){
170039 231 0 if( nExtra ){
170069 0 136 if( c==0 ){
170110 38 50 if( bPrefix ){
170113 106 38 for(pE=fts3HashFirst(pHash); pE; pE=fts3HashNext(pE)){
170116 0 106 if( nTerm==0 || (nKey>=nTerm && 0==memcmp(zKey, zTerm, nTerm)) ){
0 0 if( nTerm==0 || (nKey>=nTerm && 0==memcmp(zKey, zTerm, nTerm)) ){
0 0 if( nTerm==0 || (nKey>=nTerm && 0==memcmp(zKey, zTerm, nTerm)) ){
170117 24 82 if( nElem==nAlloc ){
170123 0 24 if( !aElem2 ){
170139 24 14 if( nElem>1 ){
170152 1 49 if( pE ){
170158 25 63 if( nElem>0 ){
170161 0 25 if( !pReader ){
170171 38 50 if( bPrefix ){
170192 102 229 if( pLhs->aNode && pRhs->aNode ){
54 48 if( pLhs->aNode && pRhs->aNode ){
170194 13 41 if( rc2<0 ){
170199 23 31 if( rc==0 ){
170205 180 151 if( rc==0 ){
170225 28 14 if( rc==0 ){
170226 0 28 if( pLhs->iDocid==pRhs->iDocid ){
170229 28 0 rc = (pLhs->iDocid > pRhs->iDocid) ? 1 : -1;
170237 0 0 if( rc==0 ){
170238 0 0 if( pLhs->iDocid==pRhs->iDocid ){
170241 0 0 rc = (pLhs->iDocid < pRhs->iDocid) ? 1 : -1;
170262 706 16 if( pSeg->aNode ){
170263 228 478 if( pSeg->nTerm>nTerm ){
170268 126 580 if( res==0 ){
170291 314 71 if( nSuspect==nSegment ) nSuspect--;
170292 222 385 for(i=nSuspect-1; i>=0; i--){
170294 373 162 for(j=i; j<(nSegment-1); j++){
170296 60 313 if( xCmp(apSegment[j], apSegment[j+1])<0 ) break;
170322 0 0 if( rc==SQLITE_OK ){
170343 0 0 if( rc==SQLITE_OK ){
170344 0 0 if( SQLITE_ROW==sqlite3_step(pStmt) ){
170369 24 0 if( rc==SQLITE_OK ){
170374 0 24 if( nLeafData==0 ){
170378 0 24 if( !zEnd ) return SQLITE_NOMEM;
170405 98 24 for(n=0; n
16 82 for(n=0; n
170427 0 0 if( pTree ){
170437 0 0 if( nReq<=p->nNodeSize || !pTree->zTerm ){
0 0 if( nReq<=p->nNodeSize || !pTree->zTerm ){
170439 0 0 if( nReq>p->nNodeSize ){
170449 0 0 if( !pTree->aData ){
170454 0 0 if( pTree->zTerm ){
170464 0 0 if( isCopyTerm ){
170465 0 0 if( pTree->nMalloc
170467 0 0 if( !zNew ){
170493 0 0 if( !pNew ){
170500 0 0 if( pTree ){
170503 0 0 if( pTree->pParent==0 ){
170562 0 0 if( !pTree->pParent ){
170572 0 0 for(pIter=pTree->pLeftmost; pIter && rc==SQLITE_OK; pIter=pIter->pRight){
0 0 for(pIter=pTree->pLeftmost; pIter && rc==SQLITE_OK; pIter=pIter->pRight){
170580 0 0 if( rc==SQLITE_OK ){
170595 0 24 if( pTree ){
170598 0 0 while( p ){
170600 0 0 if( p->aData!=(char *)&p[1] ){
170634 24 82 if( !pWriter ){
170640 0 24 if( !pWriter ) return SQLITE_NOMEM;
170646 0 24 if( !pWriter->aData ) return SQLITE_NOMEM;
170651 0 24 if( rc!=SQLITE_OK ) return rc;
170652 24 0 if( SQLITE_ROW==sqlite3_step(pStmt) ){
170657 0 24 if( rc!=SQLITE_OK ) return rc;
170671 82 24 if( nData>0 && nData+nReq>p->nNodeSize ){
0 82 if( nData>0 && nData+nReq>p->nNodeSize ){
170676 0 0 if( rc!=SQLITE_OK ) return rc;
170693 0 0 if( rc!=SQLITE_OK ) return rc;
170713 0 106 if( nReq>pWriter->nSize ){
170715 0 0 if( !aNew ) return SQLITE_NOMEM;
170735 106 0 if( isCopyTerm ){
170736 28 78 if( nTerm>pWriter->nMalloc ){
170738 0 28 if( !zNew ){
170768 0 24 if( pWriter->pTree ){
170776 0 0 if( rc==SQLITE_OK ){
170780 0 0 if( rc==SQLITE_OK ){
170798 24 6 if( pWriter ){
170819 0 0 if( p->zContentTbl ){
170825 0 0 if( rc==SQLITE_OK ){
170826 0 0 if( SQLITE_ROW==sqlite3_step(pStmt) ){
170860 0 0 if( rc!=SQLITE_OK ) return rc;
170865 0 0 if( SQLITE_ROW==sqlite3_step(pStmt) ){
170889 0 0 if( rc!=SQLITE_OK ) return rc;
170896 0 0 if( SQLITE_ROW==sqlite3_step(pStmt) ){
170912 0 0 if( pSeg->iStartBlock ){
170915 0 0 if( rc==SQLITE_OK ){
170951 0 0 for(i=0; rc==SQLITE_OK && i
0 0 for(i=0; rc==SQLITE_OK && i
170954 0 0 if( rc!=SQLITE_OK ){
170959 0 0 if( iLevel==FTS3_SEGCURSOR_ALL ){
170961 0 0 if( rc==SQLITE_OK ){
170969 0 0 if( rc==SQLITE_OK ){
170976 0 0 if( rc==SQLITE_OK ){
171011 78 71 while( p
71 7 while( p
171013 71 7 if( iCol==iCurrent ){
171020 0 7 if( nList==0 ){
171024 0 7 p += fts3GetVarint32(p, &iCurrent);
171027 59 12 if( bZero && &pList[nList]!=pEnd ){
0 59 if( bZero && &pList[nList]!=pEnd ){
171046 25 84 if( nList>pMsr->nBuffer ){
171050 0 25 if( !pNew ) return SQLITE_NOMEM;
171068 0 101 p->bDescIdx ? fts3SegReaderDoclistCmpRev : fts3SegReaderDoclistCmp
171071 4 97 if( nMerge==0 ){
171080 38 59 if( pSeg->pOffsetList==0 ){
171092 59 0 while( rc==SQLITE_OK
171093 20 39 && j
171094 11 9 && apSegment[j]->pOffsetList
171095 0 11 && apSegment[j]->iDocid==iDocid
171100 0 59 if( rc!=SQLITE_OK ) return rc;
171103 59 0 if( nList>0 && fts3SegReaderIsPending(apSegment[0]) ){
3 56 if( nList>0 && fts3SegReaderIsPending(apSegment[0]) ){
171105 0 3 if( rc!=SQLITE_OK ) return rc;
171110 59 0 if( pMsr->iColFilter>=0 ){
171114 59 0 if( nList>0 ){
171141 339 0 for(i=0; pCsr->bRestart==0 && inSegment; i++){
256 83 for(i=0; pCsr->bRestart==0 && inSegment; i++){
171146 0 692 if( rc!=SQLITE_OK ) return rc;
171147 665 27 }while( zTerm && (res = fts3SegReaderTermCmp(pSeg, zTerm, nTerm))<0 );
436 229 }while( zTerm && (res = fts3SegReaderTermCmp(pSeg, zTerm, nTerm))<0 );
171149 196 60 if( pSeg->bLookup && res!=0 ){
132 64 if( pSeg->bLookup && res!=0 ){
171178 0 50 p->bDescIdx ? fts3SegReaderDoclistCmpRev : fts3SegReaderDoclistCmp
171186 0 50 if( rc!=SQLITE_OK ) return rc;
171189 105 2 for(i=0; i
171191 57 48 if( !pSeg->aNode || fts3SegReaderTermCmp(pSeg, zTerm, nTerm) ){
57 0 if( !pSeg->aNode || fts3SegReaderTermCmp(pSeg, zTerm, nTerm) ){
171198 57 50 for(i=0; inAdvance; i++){
171200 0 57 if( rc!=SQLITE_OK ) return rc;
171232 0 0 for(i=0; inSegment; i++){
171259 0 157 p->bDescIdx ? fts3SegReaderDoclistCmpRev : fts3SegReaderDoclistCmp
171262 0 157 if( pCsr->nSegment==0 ) return SQLITE_OK;
171271 124 157 for(i=0; inAdvance; i++){
171273 0 124 if( pSeg->bLookup ){
171278 0 124 if( rc!=SQLITE_OK ) return rc;
171285 29 128 if( apSegment[0]->aNode==0 ) break;
171297 16 112 if( pFilter->zTerm && !isScan ){
16 0 if( pFilter->zTerm && !isScan ){
171298 12 4 if( pCsr->nTermnTerm
171299 0 12 || (!isPrefix && pCsr->nTerm>pFilter->nTerm)
0 0 || (!isPrefix && pCsr->nTerm>pFilter->nTerm)
171300 12 0 || memcmp(pCsr->zTerm, pFilter->zTerm, pFilter->nTerm)
171307 18 106 while( nMerge
171308 13 5 && apSegment[nMerge]->aNode
171309 0 13 && apSegment[nMerge]->nTerm==pCsr->nTerm
171310 0 0 && 0==memcmp(pCsr->zTerm, apSegment[nMerge]->zTerm, pCsr->nTerm)
171316 124 0 if( nMerge==1
171317 106 18 && !isIgnoreEmpty
171318 106 0 && !isFirst
171319 0 106 && (p->bDescIdx==0 || fts3SegReaderIsPending(apSegment[0])==0)
0 0 && (p->bDescIdx==0 || fts3SegReaderIsPending(apSegment[0])==0)
171322 106 0 if( fts3SegReaderIsPending(apSegment[0]) ){
171328 106 0 if( rc==SQLITE_OK ) rc = SQLITE_ROW;
171337 18 18 for(i=0; i
171341 18 18 while( apSegment[0]->pOffsetList ){
171349 0 18 while( j
171350 0 0 && apSegment[j]->pOffsetList
171351 0 0 && apSegment[j]->iDocid==iDocid
171357 12 6 if( isColFilter ){
171361 18 0 if( !isIgnoreEmpty || nList>0 ){
18 0 if( !isIgnoreEmpty || nList>0 ){
171366 0 18 if( p->bDescIdx && nDoclist>0 ){
0 0 if( p->bDescIdx && nDoclist>0 ){
171374 18 0 nByte = sqlite3Fts3VarintLen(iDelta) + (isRequirePos?nList+1:0);
171375 9 9 if( nDoclist+nByte>pCsr->nBuffer ){
171379 0 9 if( !aNew ){
171385 0 18 if( isFirst ){
171390 0 0 if( nWrite ){
171397 18 0 if( isRequirePos ){
171407 18 0 if( nDoclist>0 ){
171414 0 124 }while( rc==SQLITE_OK );
171423 90 8 if( pCsr ){
171425 256 90 for(i=0; inSegment; i++){
171454 0 0 if( zText ){
171458 0 0 for(i=0; zText[i]>='0' && zText[i]<='9'; i++){
0 0 for(i=0; zText[i]>='0' && zText[i]<='9'; i++){
171462 0 0 while( zText[i]==' ' ) i++;
171464 0 0 if( zText[i]=='-' ){
171468 0 0 for(/* no-op */; zText[i]>='0' && zText[i]<='9'; i++){
0 0 for(/* no-op */; zText[i]>='0' && zText[i]<='9'; i++){
171490 24 0 if( rc==SQLITE_OK ){
171502 0 24 while( SQLITE_ROW==sqlite3_step(pRange) ){
171505 0 0 if( nSize<=0 || nSize>nLimit ){
0 0 if( nSize<=0 || nSize>nLimit ){
171518 0 24 if( bOk ){
171523 0 0 if( rc==SQLITE_OK ){
171526 0 0 if( rc==SQLITE_OK ){
171530 0 0 if( rc==SQLITE_OK ){
171542 0 0 while( SQLITE_ROW==sqlite3_step(pRange) ){
171548 0 0 if( rc!=SQLITE_OK ){
171554 0 0 if( rc==SQLITE_OK ){
171559 0 0 if( rc==SQLITE_OK ){
171605 30 0 if( rc!=SQLITE_OK || csr.nSegment==0 ) goto finished;
24 6 if( rc!=SQLITE_OK || csr.nSegment==0 ) goto finished;
171607 0 24 if( iLevel!=FTS3_SEGCURSOR_PENDING ){
171609 0 0 if( rc!=SQLITE_OK ) goto finished;
171612 0 24 if( iLevel==FTS3_SEGCURSOR_ALL ){
171617 0 0 if( csr.nSegment==1 && 0==fts3SegReaderIsPending(csr.apSegment[0]) ){
0 0 if( csr.nSegment==1 && 0==fts3SegReaderIsPending(csr.apSegment[0]) ){
171632 0 24 bIgnoreEmpty = (iLevel!=FTS3_SEGCURSOR_PENDING) && (iNewLevel>iMaxLevel);
0 0 bIgnoreEmpty = (iLevel!=FTS3_SEGCURSOR_PENDING) && (iNewLevel>iMaxLevel);
171634 0 24 if( rc!=SQLITE_OK ) goto finished;
171642 0 24 filter.flags |= (bIgnoreEmpty ? FTS3_SEGMENT_IGNORE_EMPTY : 0);
171645 130 0 while( SQLITE_OK==rc ){
171647 24 106 if( rc!=SQLITE_ROW ) break;
171651 0 24 if( rc!=SQLITE_OK ) goto finished;
171654 0 24 if( iLevel!=FTS3_SEGCURSOR_PENDING ){
171658 0 0 if( rc!=SQLITE_OK ) goto finished;
171660 24 0 if( pWriter ){
171662 24 0 if( rc==SQLITE_OK ){
171663 0 24 if( iLevel==FTS3_SEGCURSOR_PENDING || iNewLevel
0 0 if( iLevel==FTS3_SEGCURSOR_PENDING || iNewLevel
171683 60 0 for(i=0; rc==SQLITE_OK && inIndex; i++){
30 30 for(i=0; rc==SQLITE_OK && inIndex; i++){
171685 0 30 if( rc==SQLITE_DONE ) rc = SQLITE_OK;
171692 30 0 if( rc==SQLITE_OK && p->bHasStat
15 15 if( rc==SQLITE_OK && p->bHasStat
171693 7 8 && p->nAutoincrmerge==0xff && p->nLeafAdd>0
4 3 && p->nAutoincrmerge==0xff && p->nLeafAdd>0
171697 4 0 if( rc==SQLITE_OK ){
171700 0 4 if( rc==SQLITE_ROW ){
171702 0 0 if( p->nAutoincrmerge==1 ) p->nAutoincrmerge = 8;
171703 4 0 }else if( rc==SQLITE_DONE ){
171722 80 32 for(i=j=0; i
171739 42 12 for(i=j=0; i
171762 0 16 if( *pRC ) return;
171764 0 16 if( pBlob==0 ){
171770 0 16 if( rc ){
171812 0 16 if( *pRC ) return;
171814 0 16 if( a==0 ){
171820 0 16 if( rc ){
171826 12 4 if( sqlite3_step(pStmt)==SQLITE_ROW ){
171834 0 16 if( rc!=SQLITE_OK ){
171839 0 16 if( nChng<0 && a[0]<(u32)(-nChng) ){
0 0 if( nChng<0 && a[0]<(u32)(-nChng) ){
171844 40 16 for(i=0; inColumn+1; i++){
171846 0 40 if( x+aSzIns[i] < aSzDel[i] ){
171855 0 16 if( rc ){
171878 0 0 if( rc==SQLITE_OK ){
171882 0 0 while( sqlite3_step(pAllLangid)==SQLITE_ROW ){
171885 0 0 for(i=0; rc==SQLITE_OK && inIndex; i++){
0 0 for(i=0; rc==SQLITE_OK && inIndex; i++){
171887 0 0 if( rc==SQLITE_DONE ){
171894 0 0 if( rc==SQLITE_OK ) rc = rc2;
171900 0 0 return (rc==SQLITE_OK && bReturnDone && bSeenDone) ? SQLITE_DONE : rc;
0 0 return (rc==SQLITE_OK && bReturnDone && bSeenDone) ? SQLITE_DONE : rc;
0 0 return (rc==SQLITE_OK && bReturnDone && bSeenDone) ? SQLITE_DONE : rc;
171917 0 0 if( rc==SQLITE_OK ){
171926 0 0 if( !zSql ){
171933 0 0 if( rc==SQLITE_OK ){
171936 0 0 if( aSz==0 ){
171945 0 0 while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){
0 0 while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){
171950 0 0 for(iCol=0; rc==SQLITE_OK && iColnColumn; iCol++){
0 0 for(iCol=0; rc==SQLITE_OK && iColnColumn; iCol++){
171951 0 0 if( p->abNotindexed[iCol]==0 ){
171957 0 0 if( p->bHasDocsize ){
171960 0 0 if( rc!=SQLITE_OK ){
171965 0 0 for(iCol=0; iCol<=p->nColumn; iCol++){
171970 0 0 if( p->bFts4 ){
171975 0 0 if( pStmt ){
171977 0 0 if( rc==SQLITE_OK ){
172008 0 0 if( pCsr->apSegment==0 ){
172014 0 0 if( rc==SQLITE_OK ){
172019 0 0 for(i=0; rc==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW && i
0 0 for(i=0; rc==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW && i
0 0 for(i=0; rc==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW && i
172031 0 0 if( rc==SQLITE_OK ) rc = rc2;
172110 0 0 if( *pRc==SQLITE_OK && nMin>pBlob->nAlloc ){
0 0 if( *pRc==SQLITE_OK && nMin>pBlob->nAlloc ){
172113 0 0 if( a ){
172139 0 0 if( p->iChild && bFirst==0 ) p->iChild++;
0 0 if( p->iChild && bFirst==0 ) p->iChild++;
172140 0 0 if( p->iOff>=p->nNode ){
172144 0 0 if( bFirst==0 ){
172145 0 0 p->iOff += fts3GetVarint32(&p->aNode[p->iOff], &nPrefix);
172147 0 0 p->iOff += fts3GetVarint32(&p->aNode[p->iOff], &nSuffix);
172149 0 0 if( nPrefix>p->iOff || nSuffix>p->nNode-p->iOff ){
0 0 if( nPrefix>p->iOff || nSuffix>p->nNode-p->iOff ){
172153 0 0 if( rc==SQLITE_OK ){
172157 0 0 if( p->iChild==0 ){
172158 0 0 p->iOff += fts3GetVarint32(&p->aNode[p->iOff], &p->nDoclist);
172159 0 0 if( (p->nNode-p->iOff)nDoclist ){
172192 0 0 if( p->aNode[0] ){
172222 0 0 for(iLayer=1; ALWAYS(iLayer
172239 0 0 if( pNode->key.n==0 || (pNode->block.n + nSpace)<=p->nNodeSize ){
0 0 if( pNode->key.n==0 || (pNode->block.n + nSpace)<=p->nNodeSize ){
172245 0 0 if( pBlk->n==0 ){
172247 0 0 if( rc==SQLITE_OK ){
172255 0 0 if( rc==SQLITE_OK ){
172256 0 0 if( pNode->key.n ){
172281 0 0 if( rc!=SQLITE_OK || iNextPtr==0 ) return rc;
0 0 if( rc!=SQLITE_OK || iNextPtr==0 ) return rc;
172332 0 0 if( rc!=SQLITE_OK ) return rc;
172339 0 0 if( bFirst==0 ){
172346 0 0 if( aDoclist ){
172389 0 0 if( pLeaf->block.n>0 && (pLeaf->block.n + nSpace)>p->nNodeSize ){
0 0 if( pLeaf->block.n>0 && (pLeaf->block.n + nSpace)>p->nNodeSize ){
172405 0 0 if( rc==SQLITE_OK ){
172422 0 0 if( rc==SQLITE_OK ){
172423 0 0 if( pLeaf->block.n==0 ){
172462 0 0 for(iRoot=FTS_MAX_APPENDABLE_HEIGHT-1; iRoot>=0; iRoot--){
172464 0 0 if( pNode->block.n>0 ) break;
172472 0 0 if( iRoot<0 ) return;
172489 0 0 if( iRoot==0 ){
172492 0 0 if( rc==SQLITE_OK ){
172503 0 0 for(i=0; i
172505 0 0 if( pNode->block.n>0 && rc==SQLITE_OK ){
0 0 if( pNode->block.n>0 && rc==SQLITE_OK ){
172513 0 0 if( rc==SQLITE_OK ){
172514 0 0 rc = fts3WriteSegdir(p,
172546 0 0 if( res==0 ) res = nLhs - nRhs;
172570 0 0 if( rc==SQLITE_OK ){
172572 0 0 if( SQLITE_ROW==sqlite3_step(pCheck) ) bRes = 1;
172607 0 0 if( rc==SQLITE_OK ){
172619 0 0 if( sqlite3_step(pSelect)==SQLITE_ROW ){
172623 0 0 if( pWriter->nLeafData<0 ){
172637 0 0 if( rc==SQLITE_OK && bAppendable ){
0 0 if( rc==SQLITE_OK && bAppendable ){
172642 0 0 if( rc==SQLITE_OK ){
172644 0 0 for(rc = nodeReaderInit(&reader, aLeaf, nLeaf);
172645 0 0 rc==SQLITE_OK && reader.aNode;
172650 0 0 if( fts3TermCmp(zKey, nKey, reader.term.a, reader.term.n)<=0 ){
172658 0 0 if( rc==SQLITE_OK && bAppendable ){
0 0 if( rc==SQLITE_OK && bAppendable ){
172671 0 0 for(i=nHeight+1; i
172678 0 0 if( rc==SQLITE_OK ){
172683 0 0 for(i=nHeight; i>=0 && rc==SQLITE_OK; i--){
0 0 for(i=nHeight; i>=0 && rc==SQLITE_OK; i--){
172688 0 0 while( reader.aNode && rc==SQLITE_OK ) rc = nodeReaderNext(&reader);
0 0 while( reader.aNode && rc==SQLITE_OK ) rc = nodeReaderNext(&reader);
172690 0 0 if( rc==SQLITE_OK ){
172693 0 0 if( i>0 ){
172700 0 0 if( rc==SQLITE_OK ){
172712 0 0 if( rc==SQLITE_OK ) rc = rc2;
172736 0 0 if( rc==SQLITE_OK ){
172787 0 0 if( rc==SQLITE_OK ){
172790 0 0 if( SQLITE_ROW==sqlite3_step(pLeafEst) ){
172795 0 0 if( rc!=SQLITE_OK ) return rc;
172799 0 0 if( rc==SQLITE_OK ){
172800 0 0 if( SQLITE_ROW==sqlite3_step(pFirstBlock) ){
172807 0 0 if( rc!=SQLITE_OK ) return rc;
172813 0 0 if( rc!=SQLITE_OK ) return rc;
172820 0 0 for(i=0; i
172846 0 0 if( rc==SQLITE_OK ){
172874 0 0 if( rc==SQLITE_OK ){
172877 0 0 while( SQLITE_ROW==sqlite3_step(pSelect) ){
172878 0 0 if( nIdx>=nAlloc ){
172882 0 0 if( !aNew ){
172891 0 0 if( rc==SQLITE_OK ) rc = rc2;
172894 0 0 if( rc==SQLITE_OK ){
172897 0 0 if( rc==SQLITE_OK ){
172903 0 0 for(i=0; rc==SQLITE_OK && i
0 0 for(i=0; rc==SQLITE_OK && i
172904 0 0 if( aIdx[i]!=i ){
172919 0 0 if( iChild ){
172951 0 0 if( rc!=SQLITE_OK ) return rc;
172955 0 0 for(rc = nodeReaderInit(&reader, aNode, nNode);
172956 0 0 rc==SQLITE_OK && reader.aNode;
172959 0 0 if( pNew->n==0 ){
172961 0 0 if( res<0 || (bLeaf==0 && res==0) ) continue;
0 0 if( res<0 || (bLeaf==0 && res==0) ) continue;
0 0 if( res<0 || (bLeaf==0 && res==0) ) continue;
172969 0 0 if( rc!=SQLITE_OK ) break;
172971 0 0 if( pNew->n==0 ){
173007 0 0 if( rc==SQLITE_OK ){
173011 0 0 if( SQLITE_ROW==sqlite3_step(pFetch) ){
173018 0 0 if( rc==SQLITE_OK ) rc = rc2;
173021 0 0 while( rc==SQLITE_OK && iBlock ){
0 0 while( rc==SQLITE_OK && iBlock ){
173027 0 0 if( rc==SQLITE_OK ){
173030 0 0 if( rc==SQLITE_OK ){
173037 0 0 if( rc==SQLITE_OK && iNewStart ){
0 0 if( rc==SQLITE_OK && iNewStart ){
173040 0 0 if( rc==SQLITE_OK ){
173048 0 0 if( rc==SQLITE_OK ){
173051 0 0 if( rc==SQLITE_OK ){
173087 0 0 for(i=pCsr->nSegment-1; i>=0 && rc==SQLITE_OK; i--){
0 0 for(i=pCsr->nSegment-1; i>=0 && rc==SQLITE_OK; i--){
173093 0 0 for(j=0; ALWAYS(jnSegment); j++){
173095 0 0 if( pSeg->iIdx==i ) break;
173099 0 0 if( pSeg->aNode==0 ){
173102 0 0 if( rc==SQLITE_OK ){
173117 0 0 if( rc==SQLITE_OK && nRem!=pCsr->nSegment ){
0 0 if( rc==SQLITE_OK && nRem!=pCsr->nSegment ){
173133 0 0 if( rc==SQLITE_OK ){
173158 0 0 if( rc==SQLITE_OK ){
173161 0 0 if( SQLITE_ROW==sqlite3_step(pSelect) ){
173164 0 0 if( aHint ){
173166 0 0 if( rc==SQLITE_OK ){
173173 0 0 if( rc==SQLITE_OK ) rc = rc2;
173195 0 0 if( *pRc==SQLITE_OK ){
173214 0 0 while( i>0 && (pHint->a[i-1] & 0x80) ) i--;
0 0 while( i>0 && (pHint->a[i-1] & 0x80) ) i--;
173215 0 0 while( i>0 && (pHint->a[i-1] & 0x80) ) i--;
0 0 while( i>0 && (pHint->a[i-1] & 0x80) ) i--;
173219 0 0 i += fts3GetVarint32(&pHint->a[i], pnInput);
173220 0 0 if( i!=nHint ) return FTS_CORRUPT_VTAB;
173249 0 0 if( !pWriter ) return SQLITE_NOMEM;
173254 0 0 while( rc==SQLITE_OK && nRem>0 ){
0 0 while( rc==SQLITE_OK && nRem>0 ){
173268 0 0 if( sqlite3_step(pFindLevel)==SQLITE_ROW ){
173282 0 0 if( rc==SQLITE_OK && hint.n ){
0 0 if( rc==SQLITE_OK && hint.n ){
173288 0 0 if( nSeg<0 || (iAbsLevel % nMod) >= (iHintAbsLevel % nMod) ){
0 0 if( nSeg<0 || (iAbsLevel % nMod) >= (iHintAbsLevel % nMod) ){
173303 0 0 if( nSeg<0 ) break;
173314 0 0 if( rc==SQLITE_OK ){
173317 0 0 if( iIdx==0 || (bUseHint && iIdx==1) ){
0 0 if( iIdx==0 || (bUseHint && iIdx==1) ){
0 0 if( iIdx==0 || (bUseHint && iIdx==1) ){
173320 0 0 if( bIgnore ){
173326 0 0 if( rc==SQLITE_OK ){
173329 0 0 if( SQLITE_OK==rc && pCsr->nSegment==nSeg
0 0 if( SQLITE_OK==rc && pCsr->nSegment==nSeg
173330 0 0 && SQLITE_OK==(rc = sqlite3Fts3SegReaderStart(p, pCsr, pFilter))
173331 0 0 && SQLITE_ROW==(rc = sqlite3Fts3SegReaderStep(p, pCsr))
173333 0 0 if( bUseHint && iIdx>0 ){
0 0 if( bUseHint && iIdx>0 ){
173341 0 0 if( rc==SQLITE_OK && pWriter->nLeafEst ){
0 0 if( rc==SQLITE_OK && pWriter->nLeafEst ){
173345 0 0 if( rc==SQLITE_OK ) rc = sqlite3Fts3SegReaderStep(p, pCsr);
173346 0 0 if( pWriter->nWork>=nRem && rc==SQLITE_ROW ) rc = SQLITE_OK;
0 0 if( pWriter->nWork>=nRem && rc==SQLITE_ROW ) rc = SQLITE_OK;
173347 0 0 }while( rc==SQLITE_ROW );
173350 0 0 if( rc==SQLITE_OK ){
173353 0 0 if( nSeg!=0 ){
173360 0 0 if( nSeg!=0 ){
173364 0 0 if( nSeg==0 && pWriter->bNoLeafData==0 ){
0 0 if( nSeg==0 && pWriter->bNoLeafData==0 ){
173373 0 0 if( bDirtyHint && rc==SQLITE_OK ){
0 0 if( bDirtyHint && rc==SQLITE_OK ){
173393 0 0 while( (*z)>='0' && (*z)<='9' && i<214748363 ) i = 10*i + *(z++) - '0';
0 0 while( (*z)>='0' && (*z)<='9' && i<214748363 ) i = 10*i + *(z++) - '0';
0 0 while( (*z)>='0' && (*z)<='9' && i<214748363 ) i = 10*i + *(z++) - '0';
173421 0 0 if( z[0]==',' && z[1]!='\0' ){
0 0 if( z[0]==',' && z[1]!='\0' ){
173426 0 0 if( z[0]!='\0' || nMin<2 ){
0 0 if( z[0]!='\0' || nMin<2 ){
173430 0 0 if( !p->bHasStat ){
173434 0 0 if( rc==SQLITE_OK ){
173457 0 0 if( p->nAutoincrmerge==1 || p->nAutoincrmerge>FTS3_MERGE_COUNT ){
0 0 if( p->nAutoincrmerge==1 || p->nAutoincrmerge>FTS3_MERGE_COUNT ){
173460 0 0 if( !p->bHasStat ){
173463 0 0 if( rc ) return rc;
173466 0 0 if( rc ) return rc;
173494 0 0 for(i=0; i
173529 0 0 if( rc==SQLITE_OK ){
173533 0 0 if( rc==SQLITE_OK ){
173534 0 0 while( SQLITE_ROW==(rc = sqlite3Fts3SegReaderStep(p, &csr)) ){
173543 0 0 while( pCsr
173546 0 0 if( pCsr
173547 0 0 if( iVal==0 || iVal==1 ){
0 0 if( iVal==0 || iVal==1 ){
173550 0 0 if( iVal ){
173590 0 0 if( rc==SQLITE_OK ){
173594 0 0 while( rc==SQLITE_OK && sqlite3_step(pAllLangid)==SQLITE_ROW ){
0 0 while( rc==SQLITE_OK && sqlite3_step(pAllLangid)==SQLITE_ROW ){
173597 0 0 for(i=0; inIndex; i++){
173602 0 0 if( rc==SQLITE_OK ) rc = rc2;
173606 0 0 if( rc==SQLITE_OK ){
173612 0 0 if( !zSql ){
173619 0 0 while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){
0 0 while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){
173624 0 0 for(iCol=0; rc==SQLITE_OK && iColnColumn; iCol++){
0 0 for(iCol=0; rc==SQLITE_OK && iColnColumn; iCol++){
173625 0 0 if( p->abNotindexed[iCol]==0 ){
173631 0 0 while( rc==SQLITE_OK ){
173638 0 0 if( rc==SQLITE_OK ){
173643 0 0 for(i=1; inIndex; i++){
173644 0 0 if( p->aIndex[i].nPrefix<=nToken ){
173652 0 0 if( pT ) pModule->xClose(pT);
173653 0 0 if( rc==SQLITE_DONE ) rc = SQLITE_OK;
173702 0 0 if( rc==SQLITE_OK && bOk==0 ) rc = FTS_CORRUPT_VTAB;
0 0 if( rc==SQLITE_OK && bOk==0 ) rc = FTS_CORRUPT_VTAB;
173719 0 0 if( !zVal ){
173721 0 0 }else if( nVal==8 && 0==sqlite3_strnicmp(zVal, "optimize", 8) ){
0 0 }else if( nVal==8 && 0==sqlite3_strnicmp(zVal, "optimize", 8) ){
173723 0 0 }else if( nVal==7 && 0==sqlite3_strnicmp(zVal, "rebuild", 7) ){
0 0 }else if( nVal==7 && 0==sqlite3_strnicmp(zVal, "rebuild", 7) ){
173725 0 0 }else if( nVal==15 && 0==sqlite3_strnicmp(zVal, "integrity-check", 15) ){
0 0 }else if( nVal==15 && 0==sqlite3_strnicmp(zVal, "integrity-check", 15) ){
173727 0 0 }else if( nVal>6 && 0==sqlite3_strnicmp(zVal, "merge=", 6) ){
0 0 }else if( nVal>6 && 0==sqlite3_strnicmp(zVal, "merge=", 6) ){
173729 0 0 }else if( nVal>10 && 0==sqlite3_strnicmp(zVal, "automerge=", 10) ){
0 0 }else if( nVal>10 && 0==sqlite3_strnicmp(zVal, "automerge=", 10) ){
173756 0 47 for(pDef=pCsr->pDeferred; pDef; pDef=pDef->pNext){
173769 0 102 for(pDef=pCsr->pDeferred; pDef; pDef=pNext){
173787 0 0 if( pCsr->pDeferred ){
173799 0 0 for(i=0; inColumn && rc==SQLITE_OK; i++){
0 0 for(i=0; inColumn && rc==SQLITE_OK; i++){
173800 0 0 if( p->abNotindexed[i]==0 ){
173805 0 0 while( rc==SQLITE_OK ){
173812 0 0 for(pDef=pCsr->pDeferred; pDef && rc==SQLITE_OK; pDef=pDef->pNext){
0 0 for(pDef=pCsr->pDeferred; pDef && rc==SQLITE_OK; pDef=pDef->pNext){
173814 0 0 if( (pDef->iCol>=p->nColumn || pDef->iCol==i)
0 0 if( (pDef->iCol>=p->nColumn || pDef->iCol==i)
173815 0 0 && (pPT->bFirst==0 || iPos==0)
0 0 && (pPT->bFirst==0 || iPos==0)
173816 0 0 && (pPT->n==nToken || (pPT->isPrefix && pPT->n
0 0 && (pPT->n==nToken || (pPT->isPrefix && pPT->n
0 0 && (pPT->n==nToken || (pPT->isPrefix && pPT->n
173817 0 0 && (0==memcmp(zToken, pPT->z, pPT->n))
173823 0 0 if( pTC ) pModule->xClose(pTC);
173824 0 0 if( rc==SQLITE_DONE ) rc = SQLITE_OK;
173828 0 0 for(pDef=pCsr->pDeferred; pDef && rc==SQLITE_OK; pDef=pDef->pNext){
0 0 for(pDef=pCsr->pDeferred; pDef && rc==SQLITE_OK; pDef=pDef->pNext){
173829 0 0 if( pDef->pList ){
173850 0 0 if( p->pList==0 ){
173855 0 0 if( !pRet ) return SQLITE_NOMEM;
173875 0 0 if( !pDeferred ){
173906 0 0 if( bFound && rc==SQLITE_OK ){
0 0 if( bFound && rc==SQLITE_OK ){
173909 0 0 if( rc==SQLITE_OK ){
173910 0 0 if( isEmpty ){
173919 0 0 if( p->zContentTbl==0 ){
173922 0 0 if( p->bHasDocsize ){
173972 28 0 if( nArg>1
173973 28 0 && sqlite3_value_type(apVal[0])==SQLITE_NULL
173974 0 28 && sqlite3_value_type(apVal[p->nColumn+2])!=SQLITE_NULL
173980 28 0 if( nArg>1 && sqlite3_value_int(apVal[2 + p->nColumn + 2])<0 ){
0 28 if( nArg>1 && sqlite3_value_int(apVal[2 + p->nColumn + 2])<0 ){
173987 0 28 if( aSzDel==0 ){
173995 0 28 if( rc!=SQLITE_OK ) goto update_out;
174006 28 0 if( nArg>1 && p->zContentTbl==0 ){
25 3 if( nArg>1 && p->zContentTbl==0 ){
174009 25 0 if( sqlite3_value_type(pNewRowid)==SQLITE_NULL ){
174015 0 0 || sqlite3_value_int64(apVal[0])!=sqlite3_value_int64(pNewRowid)
174034 0 0 if( sqlite3_vtab_on_conflict(p->db)==SQLITE_REPLACE ){
174042 0 28 if( rc!=SQLITE_OK ){
174047 0 28 if( sqlite3_value_type(apVal[0])!=SQLITE_NULL ){
174053 28 0 if( nArg>1 && rc==SQLITE_OK ){
28 0 if( nArg>1 && rc==SQLITE_OK ){
174055 28 0 if( bInsertDone==0 ){
174057 0 28 if( rc==SQLITE_CONSTRAINT && p->zContentTbl==0 ){
0 0 if( rc==SQLITE_CONSTRAINT && p->zContentTbl==0 ){
174061 28 0 if( rc==SQLITE_OK ){
174064 28 0 if( rc==SQLITE_OK ){
174068 16 12 if( p->bHasDocsize ){
174074 16 12 if( p->bFts4 ){
174092 0 0 if( rc==SQLITE_OK ){
174094 0 0 if( rc==SQLITE_OK || rc==SQLITE_DONE ){
0 0 if( rc==SQLITE_OK || rc==SQLITE_DONE ){
174096 0 0 if( rc2!=SQLITE_OK ) rc = rc2;
174246 0 0 if( pRet ){
174265 0 0 if( (u32*)p==&pBuf->aMatchinfo[1] ){
174271 0 0 if( pBuf->aRef[0]==0 && pBuf->aRef[1]==0 && pBuf->aRef[2]==0 ){
0 0 if( pBuf->aRef[0]==0 && pBuf->aRef[1]==0 && pBuf->aRef[2]==0 ){
0 0 if( pBuf->aRef[0]==0 && pBuf->aRef[1]==0 && pBuf->aRef[2]==0 ){
174280 0 0 if( p->aRef[1]==0 ){
174285 0 0 else if( p->aRef[2]==0 ){
174291 0 0 if( aOut ){
174293 0 0 if( p->bGlobal ) memcpy(aOut, &p->aMatchinfo[1], p->nElem*sizeof(u32));
174310 0 102 if( p ){
174313 0 0 if( p->aRef[0]==0 && p->aRef[1]==0 && p->aRef[2]==0 ){
0 0 if( p->aRef[0]==0 && p->aRef[1]==0 && p->aRef[2]==0 ){
0 0 if( p->aRef[0]==0 && p->aRef[1]==0 && p->aRef[2]==0 ){
174346 0 0 *pp += fts3GetVarint32(*pp, &iVal);
174362 0 0 if( eType!=FTSQUERY_PHRASE ){
174365 0 0 if( rc==SQLITE_OK && eType!=FTSQUERY_NOT ){
0 0 if( rc==SQLITE_OK && eType!=FTSQUERY_NOT ){
174432 0 0 if( pnPhrase ) *pnPhrase = sCtx.nPhrase;
174433 0 0 if( pnToken ) *pnToken = sCtx.nToken;
174455 0 0 if( pIter ){
174458 0 0 while( iIter
174459 0 0 if( 0==(*pIter & 0xFE) ){
174478 0 0 if( pIter->iCurrent<0 ){
174488 0 0 for(i=0; inPhrase; i++){
174496 0 0 for(i=0; inPhrase; i++){
174498 0 0 if( pPhrase->pHead && pPhrase->iHead
0 0 if( pPhrase->pHead && pPhrase->iHead
174502 0 0 if( iEnd==0x7FFFFFFF ){
174507 0 0 for(i=0; inPhrase; i++){
174535 0 0 for(i=0; inPhrase; i++){
174537 0 0 if( pPhrase->pTail ){
174541 0 0 while( iCsr<(iStart+pIter->nSnippet) ){
174546 0 0 if( (mCover|mCovered)&mPhrase ){
174553 0 0 for(j=0; jnToken; j++){
174557 0 0 if( 0==(*pCsr & 0x0FE) ) break;
174583 0 0 if( pCsr ){
174638 0 0 if( rc!=SQLITE_OK ){
174647 0 0 if( !sIter.aPhrase ){
174661 0 0 if( rc==SQLITE_OK ){
174664 0 0 for(i=0; i
174665 0 0 if( sIter.aPhrase[i].pHead ){
174674 0 0 while( !fts3SnippetNextCandidate(&sIter) ){
174681 0 0 if( iScore>iBestScore ){
174707 0 0 if( nAppend<0 ){
174715 0 0 if( pStr->n+nAppend+1>=pStr->nAlloc ){
174718 0 0 if( !zNew ){
174765 0 0 if( hlmask ){
174770 0 0 for(nLeft=0; !(hlmask & ((u64)1 << nLeft)); nLeft++);
174771 0 0 for(nRight=0; !(hlmask & ((u64)1 << (nSnippet-1-nRight))); nRight++);
174781 0 0 if( nDesired>0 ){
174793 0 0 if( rc!=SQLITE_OK ){
174796 0 0 while( rc==SQLITE_OK && iCurrent<(nSnippet+nDesired) ){
0 0 while( rc==SQLITE_OK && iCurrent<(nSnippet+nDesired) ){
174801 0 0 if( rc!=SQLITE_OK && rc!=SQLITE_DONE ){ return rc; }
0 0 if( rc!=SQLITE_OK && rc!=SQLITE_DONE ){ return rc; }
174805 0 0 if( nShift>0 ){
174843 0 0 if( zDoc==0 ){
174844 0 0 if( sqlite3_column_type(pCsr->pStmt, iCol)!=SQLITE_NULL ){
174854 0 0 if( rc!=SQLITE_OK ){
174858 0 0 while( rc==SQLITE_OK ){
174877 0 0 if( rc!=SQLITE_OK ){
174878 0 0 if( rc==SQLITE_DONE ){
174887 0 0 if( iCurrent
174889 0 0 if( !isShiftDone ){
174900 0 0 if( rc==SQLITE_OK ){
174901 0 0 if( iPos>0 || iFragment>0 ){
0 0 if( iPos>0 || iFragment>0 ){
174903 0 0 }else if( iBegin ){
174907 0 0 if( rc!=SQLITE_OK || iCurrent
0 0 if( rc!=SQLITE_OK || iCurrent
174910 0 0 if( iCurrent>=(iPos+nSnippet) ){
174911 0 0 if( isLast ){
174920 0 0 if( iCurrent>iPos ) rc = fts3StringAppend(pOut, &zDoc[iEnd], iBegin-iEnd);
174921 0 0 if( rc==SQLITE_OK && isHighlight ) rc = fts3StringAppend(pOut, zOpen, -1);
0 0 if( rc==SQLITE_OK && isHighlight ) rc = fts3StringAppend(pOut, zOpen, -1);
174922 0 0 if( rc==SQLITE_OK ) rc = fts3StringAppend(pOut, &zDoc[iBegin], iFin-iBegin);
174923 0 0 if( rc==SQLITE_OK && isHighlight ) rc = fts3StringAppend(pOut, zClose, -1);
0 0 if( rc==SQLITE_OK && isHighlight ) rc = fts3StringAppend(pOut, zClose, -1);
174952 0 0 while( 0xFE & (*pEnd | c) ){
174954 0 0 if( !c ) nEntry++;
174975 0 0 if( p->flag==FTS3_MATCHINFO_LHITS ){
174983 0 0 if( (pPhrase->iColumn>=pTab->nColumn || pPhrase->iColumn==iCol) ){
0 0 if( (pPhrase->iColumn>=pTab->nColumn || pPhrase->iColumn==iCol) ){
174984 0 0 if( p->flag==FTS3_MATCHINFO_LHITS ){
174986 0 0 }else if( nHit ){
174991 0 0 if( *pIter!=0x01 ) break;
174993 0 0 pIter += fts3GetVarint32(pIter, &iCol);
175005 0 0 if( pExpr->bEof==0 && pExpr->iDocid==p->pCursor->iPrevId ){
0 0 if( pExpr->bEof==0 && pExpr->iDocid==p->pCursor->iPrevId ){
175006 0 0 if( pExpr->pLeft ){
175068 0 0 for(i=0; inCol && rc==SQLITE_OK; i++){
0 0 for(i=0; inCol && rc==SQLITE_OK; i++){
175071 0 0 if( pCsr ){
175086 0 0 if( (cArg==FTS3_MATCHINFO_NPHRASE)
175087 0 0 || (cArg==FTS3_MATCHINFO_NCOL)
175088 0 0 || (cArg==FTS3_MATCHINFO_NDOC && pTab->bFts4)
0 0 || (cArg==FTS3_MATCHINFO_NDOC && pTab->bFts4)
175089 0 0 || (cArg==FTS3_MATCHINFO_AVGLENGTH && pTab->bFts4)
0 0 || (cArg==FTS3_MATCHINFO_AVGLENGTH && pTab->bFts4)
175090 0 0 || (cArg==FTS3_MATCHINFO_LENGTH && pTab->bHasDocsize)
0 0 || (cArg==FTS3_MATCHINFO_LENGTH && pTab->bHasDocsize)
175091 0 0 || (cArg==FTS3_MATCHINFO_LCS)
175092 0 0 || (cArg==FTS3_MATCHINFO_HITS)
175093 0 0 || (cArg==FTS3_MATCHINFO_LHITS)
175094 0 0 || (cArg==FTS3_MATCHINFO_LHITS_BM)
175145 0 0 if( !*ppStmt ){
175147 0 0 if( rc!=SQLITE_OK ) return rc;
175154 0 0 if( nDoc==0 ) return FTS_CORRUPT_VTAB;
175157 0 0 if( paLen ) *paLen = a;
175202 0 0 if( iRead==0 || iRead==1 ){
0 0 if( iRead==0 || iRead==1 ){
175234 0 0 if( !aIter ) return SQLITE_NOMEM;
175238 0 0 for(i=0; inPhrase; i++){
175244 0 0 for(iCol=0; iColnCol; iCol++){
175248 0 0 for(i=0; inPhrase; i++){
175252 0 0 if( rc!=SQLITE_OK ) return rc;
175253 0 0 if( pIt->pRead ){
175260 0 0 while( nLive>0 ){
175264 0 0 for(i=0; inPhrase; i++){
175266 0 0 if( pIter->pRead==0 ){
175270 0 0 if( pAdv==0 || pIter->iPosiPos ){
0 0 if( pAdv==0 || pIter->iPosiPos ){
175273 0 0 if( nThisLcs==0 || pIter->iPos==pIter[-1].iPos ){
0 0 if( nThisLcs==0 || pIter->iPos==pIter[-1].iPos ){
175278 0 0 if( nThisLcs>nLcs ) nLcs = nThisLcs;
175281 0 0 if( fts3LcsIteratorAdvance(pAdv) ) nLive--;
175319 0 0 for(i=0; rc==SQLITE_OK && zArg[i]; i++){
0 0 for(i=0; rc==SQLITE_OK && zArg[i]; i++){
175323 0 0 if( bGlobal ) pInfo->aMatchinfo[0] = pInfo->nPhrase;
175327 0 0 if( bGlobal ) pInfo->aMatchinfo[0] = pInfo->nCol;
175331 0 0 if( bGlobal ){
175339 0 0 if( bGlobal ){
175344 0 0 if( rc==SQLITE_OK ){
175346 0 0 for(iCol=0; iColnCol; iCol++){
175360 0 0 if( rc==SQLITE_OK ){
175363 0 0 for(iCol=0; iColnCol; iCol++){
175375 0 0 if( rc==SQLITE_OK ){
175393 0 0 if( rc!=SQLITE_OK ) break;
175394 0 0 if( bGlobal ){
175395 0 0 if( pCsr->pDeferred ){
175397 0 0 if( rc!=SQLITE_OK ) break;
175401 0 0 if( rc!=SQLITE_OK ) break;
175440 0 0 if( pCsr->pMIBuffer && strcmp(pCsr->pMIBuffer->zMatchinfo, zArg) ){
0 0 if( pCsr->pMIBuffer && strcmp(pCsr->pMIBuffer->zMatchinfo, zArg) ){
175450 0 0 if( pCsr->pMIBuffer==0 ){
175459 0 0 for(i=0; zArg[i]; i++){
175461 0 0 if( fts3MatchinfoCheck(pTab, zArg[i], &zErr) ){
175471 0 0 if( !pCsr->pMIBuffer ) rc = SQLITE_NOMEM;
175477 0 0 if( rc==SQLITE_OK ){
175479 0 0 if( xDestroyOut==0 ){
175484 0 0 if( rc==SQLITE_OK ){
175488 0 0 if( bGlobal ){
175493 0 0 if( rc!=SQLITE_OK ){
175495 0 0 if( xDestroyOut ) xDestroyOut(aOut);
175531 0 0 if( !pCsr->pExpr ){
175542 0 0 if( nToken>=0 ){
175548 0 0 for(iSnip=0; iSnip
175559 0 0 for(iRead=0; iReadnColumn; iRead++){
175562 0 0 if( iCol>=0 && iRead!=iCol ) continue;
0 0 if( iCol>=0 && iRead!=iCol ) continue;
175566 0 0 if( rc!=SQLITE_OK ){
175569 0 0 if( iS>iBestScore ){
175582 0 0 if( mSeen==mCovered || nSnippet==SizeofArray(aSnippet) ) break;
0 0 if( mSeen==mCovered || nSnippet==SizeofArray(aSnippet) ) break;
175587 0 0 for(i=0; i
0 0 for(i=0; i
175595 0 0 if( rc!=SQLITE_OK ){
175635 0 0 if( pList ){
175640 0 0 for(iTerm=0; iTerm
175665 0 0 if( !pCsr->pExpr ){
175675 0 0 if( rc!=SQLITE_OK ) goto offsets_out;
175679 0 0 if( 0==sCtx.aTerm ){
175689 0 0 for(iCol=0; iColnColumn; iCol++){
175715 0 0 if( zDoc==0 ){
175716 0 0 if( sqlite3_column_type(pCsr->pStmt, iCol+1)==SQLITE_NULL ){
175727 0 0 if( rc!=SQLITE_OK ) goto offsets_out;
175730 0 0 while( rc==SQLITE_OK ){
175735 0 0 for(i=0; i
175737 0 0 if( pT->pList && (pT->iPos-pT->iOff)
0 0 if( pT->pList && (pT->iPos-pT->iOff)
175743 0 0 if( !pTerm ){
175748 0 0 if( 0==(0xFE&*pTerm->pList) ){
175753 0 0 while( rc==SQLITE_OK && iCurrent
0 0 while( rc==SQLITE_OK && iCurrent
175756 0 0 if( rc==SQLITE_OK ){
175762 0 0 }else if( rc==SQLITE_DONE && pTab->zContentTbl==0 ){
0 0 }else if( rc==SQLITE_DONE && pTab->zContentTbl==0 ){
175767 0 0 if( rc==SQLITE_DONE ){
175772 0 0 if( rc!=SQLITE_OK ) goto offsets_out;
175779 0 0 if( rc!=SQLITE_OK ){
175799 0 0 if( zArg ){
175805 0 0 if( !pCsr->pExpr ){
175923 0 0 if( pTokenizer ){
175962 0 0 while( z
175963 0 0 READ_UTF8(z, zTerm, iCode);
0 0 READ_UTF8(z, zTerm, iCode);
0 0 READ_UTF8(z, zTerm, iCode);
0 0 READ_UTF8(z, zTerm, iCode);
0 0 READ_UTF8(z, zTerm, iCode);
0 0 READ_UTF8(z, zTerm, iCode);
175965 0 0 if( sqlite3FtsUnicodeIsalnum((int)iCode)!=bAlnum
175966 0 0 && sqlite3FtsUnicodeIsdiacritic((int)iCode)==0
175972 0 0 if( nEntry ){
175977 0 0 if( aNew==0 ) return SQLITE_NOMEM;
175981 0 0 while( z
175982 0 0 READ_UTF8(z, zTerm, iCode);
0 0 READ_UTF8(z, zTerm, iCode);
0 0 READ_UTF8(z, zTerm, iCode);
0 0 READ_UTF8(z, zTerm, iCode);
0 0 READ_UTF8(z, zTerm, iCode);
0 0 READ_UTF8(z, zTerm, iCode);
175983 0 0 if( sqlite3FtsUnicodeIsalnum((int)iCode)!=bAlnum
175984 0 0 && sqlite3FtsUnicodeIsdiacritic((int)iCode)==0
175987 0 0 for(i=0; i
0 0 for(i=0; i
175988 0 0 for(j=nNew; j>i; j--) aNew[j] = aNew[j-1];
176004 0 0 if( p->nException>0 ){
176009 0 0 while( iHi>=iLo ){
176011 0 0 if( iCode==a[iTest] ){
176013 0 0 }else if( iCode>a[iTest] ){
176046 0 0 if( pNew==NULL ) return SQLITE_NOMEM;
176050 0 0 for(i=0; rc==SQLITE_OK && i
0 0 for(i=0; rc==SQLITE_OK && i
176054 0 0 if( n==19 && memcmp("remove_diacritics=1", z, 19)==0 ){
0 0 if( n==19 && memcmp("remove_diacritics=1", z, 19)==0 ){
176057 0 0 else if( n==19 && memcmp("remove_diacritics=0", z, 19)==0 ){
0 0 else if( n==19 && memcmp("remove_diacritics=0", z, 19)==0 ){
176060 0 0 else if( n>=11 && memcmp("tokenchars=", z, 11)==0 ){
0 0 else if( n>=11 && memcmp("tokenchars=", z, 11)==0 ){
176063 0 0 else if( n>=11 && memcmp("separators=", z, 11)==0 ){
0 0 else if( n>=11 && memcmp("separators=", z, 11)==0 ){
176072 0 0 if( rc!=SQLITE_OK ){
176095 0 0 if( pCsr==0 ){
176101 0 0 if( aInput==0 ){
176103 0 0 }else if( nInput<0 ){
176149 0 0 while( z
176150 0 0 READ_UTF8(z, zTerm, iCode);
0 0 READ_UTF8(z, zTerm, iCode);
0 0 READ_UTF8(z, zTerm, iCode);
0 0 READ_UTF8(z, zTerm, iCode);
0 0 READ_UTF8(z, zTerm, iCode);
0 0 READ_UTF8(z, zTerm, iCode);
176151 0 0 if( unicodeIsAlnum(p, (int)iCode) ) break;
176154 0 0 if( zStart>=zTerm ) return SQLITE_DONE;
176161 0 0 if( (zOut-pCsr->zToken)>=(pCsr->nAlloc-4) ){
176163 0 0 if( !zNew ) return SQLITE_NOMEM;
176172 0 0 if( iOut ){
176173 0 0 WRITE_UTF8(zOut, iOut);
0 0 WRITE_UTF8(zOut, iOut);
0 0 WRITE_UTF8(zOut, iOut);
176177 0 0 if( z>=zTerm ) break;
176178 0 0 READ_UTF8(z, zTerm, iCode);
0 0 READ_UTF8(z, zTerm, iCode);
0 0 READ_UTF8(z, zTerm, iCode);
0 0 READ_UTF8(z, zTerm, iCode);
0 0 READ_UTF8(z, zTerm, iCode);
0 0 READ_UTF8(z, zTerm, iCode);
176180 0 0 || sqlite3FtsUnicodeIsdiacritic((int)iCode)
176181 0 0 );
176344 0 0 if( (unsigned int)c<128 ){
176346 0 0 }else if( (unsigned int)c<(1<<22) ){
176351 0 0 while( iHi>=iLo ){
176353 0 0 if( key >= aEntry[iTest] ){
176408 0 0 while( iHi>=iLo ){
176410 0 0 if( key >= aDia[iTest] ){
176418 0 0 return ((c > (aDia[iRes]>>3) + (aDia[iRes]&0x07)) ? c : (int)aChar[iRes]);
176429 0 0 if( c<768 || c>817 ) return 0;
0 0 if( c<768 || c>817 ) return 0;
176430 0 0 return (c < 768+32) ?
176541 0 0 if( c<128 ){
176542 0 0 if( c>='A' && c<='Z' ) ret = c + ('a' - 'A');
0 0 if( c>='A' && c<='Z' ) ret = c + ('a' - 'A');
176543 0 0 }else if( c<65536 ){
176550 0 0 while( iHi>=iLo ){
176553 0 0 if( cmp>=0 ){
176563 0 0 if( c<(p->iCode + p->nRange) && 0==(0x01 & p->flags & (p->iCode ^ c)) ){
0 0 if( c<(p->iCode + p->nRange) && 0==(0x01 & p->flags & (p->iCode ^ c)) ){
176568 0 0 if( bRemoveDiacritic ) ret = remove_diacritic(ret);
176571 0 0 else if( c>=66560 && c<66600 ){
0 0 else if( c>=66560 && c<66600 ){
176794 0 0 if( !p->bStatic ) sqlite3_free(p->zBuf);
176811 0 0 u64 nTotal = NnAlloc ? p->nAlloc*2 : p->nAlloc+N+10;
176813 0 0 if( p->bStatic ){
176814 0 0 if( p->bErr ) return 1;
176816 0 0 if( zNew==0 ){
176825 0 0 if( zNew==0 ){
176838 0 0 if( (N+p->nUsed >= p->nAlloc) && jsonGrow(p,N)!=0 ) return;
0 0 if( (N+p->nUsed >= p->nAlloc) && jsonGrow(p,N)!=0 ) return;
176847 0 0 if( (p->nUsed + N >= p->nAlloc) && jsonGrow(p, N) ) return;
0 0 if( (p->nUsed + N >= p->nAlloc) && jsonGrow(p, N) ) return;
176857 0 0 if( p->nUsed>=p->nAlloc && jsonGrow(p,1)!=0 ) return;
0 0 if( p->nUsed>=p->nAlloc && jsonGrow(p,1)!=0 ) return;
176866 0 0 if( p->nUsed==0 ) return;
176868 0 0 if( c!='[' && c!='{' ) jsonAppendChar(p, ',');
0 0 if( c!='[' && c!='{' ) jsonAppendChar(p, ',');
176878 0 0 if( (N+p->nUsed+2 >= p->nAlloc) && jsonGrow(p,N+2)!=0 ) return;
0 0 if( (N+p->nUsed+2 >= p->nAlloc) && jsonGrow(p,N+2)!=0 ) return;
176880 0 0 for(i=0; i
176882 0 0 if( c=='"' || c=='\\' ){
0 0 if( c=='"' || c=='\\' ){
176884 0 0 if( (p->nUsed+N+3-i > p->nAlloc) && jsonGrow(p,N+3-i)!=0 ) return;
0 0 if( (p->nUsed+N+3-i > p->nAlloc) && jsonGrow(p,N+3-i)!=0 ) return;
176886 0 0 }else if( c<=0x1f ){
176897 0 0 if( aSpecial[c] ){
176901 0 0 if( (p->nUsed+N+7+i > p->nAlloc) && jsonGrow(p,N+7-i)!=0 ) return;
0 0 if( (p->nUsed+N+7+i > p->nAlloc) && jsonGrow(p,N+7-i)!=0 ) return;
176938 0 0 if( sqlite3_value_subtype(pValue)==JSON_SUBTYPE ){
176946 0 0 if( p->bErr==0 ){
176960 0 0 if( p->bErr==0 ){
176961 0 0 sqlite3_result_text64(p->pCtx, p->zBuf, p->nUsed,
176983 0 0 return pNode->eType>=JSON_ARRAY ? pNode->n+1 : 1;
177017 0 0 if( pNode->jnFlags & (JNODE_REPLACE|JNODE_PATCH) ){
177018 0 0 if( pNode->jnFlags & JNODE_REPLACE ){
177039 0 0 if( pNode->jnFlags & JNODE_RAW ){
177054 0 0 while( j<=pNode->n ){
177055 0 0 if( (pNode[j].jnFlags & JNODE_REMOVE)==0 ){
177061 0 0 if( (pNode->jnFlags & JNODE_APPEND)==0 ) break;
177072 0 0 while( j<=pNode->n ){
177073 0 0 if( (pNode[j+1].jnFlags & JNODE_REMOVE)==0 ){
177081 0 0 if( (pNode->jnFlags & JNODE_APPEND)==0 ) break;
177131 0 0 if( z[0]=='-' ){ z++; }
177132 0 0 while( z[0]>='0' && z[0]<='9' ){
0 0 while( z[0]>='0' && z[0]<='9' ){
177134 0 0 if( i>=LARGEST_INT64/10 ){
177135 0 0 if( i>LARGEST_INT64/10 ) goto int_as_real;
177136 0 0 if( z[0]>='0' && z[0]<='9' ) goto int_as_real;
0 0 if( z[0]>='0' && z[0]<='9' ) goto int_as_real;
177137 0 0 if( v==9 ) goto int_as_real;
177138 0 0 if( v==8 ){
177139 0 0 if( pNode->u.zJContent[0]=='-' ){
177149 0 0 if( pNode->u.zJContent[0]=='-' ){ i = -i; }
177176 0 0 if( (pNode->jnFlags & JNODE_ESCAPE)==0 ){
177188 0 0 if( zOut==0 ){
177192 0 0 for(i=1, j=0; i
177194 0 0 if( c!='\\' ){
177198 0 0 if( c=='u' ){
177200 0 0 for(k=0; k<4; i++, k++){
177204 0 0 if( c<='9' ) v = v*16 + c - '0';
177205 0 0 else if( c<='F' ) v = v*16 + c - 'A' + 10;
177208 0 0 if( v==0 ) break;
177209 0 0 if( v<=0x7f ){
177211 0 0 }else if( v<=0x7ff ){
177220 0 0 if( c=='b' ){
177222 0 0 }else if( c=='f' ){
177224 0 0 }else if( c=='n' ){
177226 0 0 }else if( c=='r' ){
177228 0 0 }else if( c=='t' ){
177273 0 0 if( pParse->oom ) return -1;
177276 0 0 if( pNew==0 ){
177298 0 0 if( pParse->nNode>=pParse->nAlloc ){
177314 0 0 for(i=0; i<4; i++) if( !safe_isxdigit(z[i]) ) return 0;
0 0 for(i=0; i<4; i++) if( !safe_isxdigit(z[i]) ) return 0;
177333 0 0 while( safe_isspace(z[i]) ){ i++; }
177334 0 0 if( (c = z[i])=='{' ){
177337 0 0 if( iThis<0 ) return -1;
177339 0 0 while( safe_isspace(z[j]) ){ j++; }
177340 0 0 if( ++pParse->iDepth > JSON_MAX_DEPTH ) return -1;
177342 0 0 if( x<0 ){
177344 0 0 if( x==(-2) && pParse->nNode==(u32)iThis+1 ) return j+1;
0 0 if( x==(-2) && pParse->nNode==(u32)iThis+1 ) return j+1;
177347 0 0 if( pParse->oom ) return -1;
177349 0 0 if( pNode->eType!=JSON_STRING ) return -1;
177352 0 0 while( safe_isspace(z[j]) ){ j++; }
177353 0 0 if( z[j]!=':' ) return -1;
177357 0 0 if( x<0 ) return -1;
177359 0 0 while( safe_isspace(z[j]) ){ j++; }
177361 0 0 if( c==',' ) continue;
177362 0 0 if( c!='}' ) return -1;
177367 0 0 }else if( c=='[' ){
177370 0 0 if( iThis<0 ) return -1;
177372 0 0 while( safe_isspace(z[j]) ){ j++; }
177373 0 0 if( ++pParse->iDepth > JSON_MAX_DEPTH ) return -1;
177376 0 0 if( x<0 ){
177377 0 0 if( x==(-3) && pParse->nNode==(u32)iThis+1 ) return j+1;
0 0 if( x==(-3) && pParse->nNode==(u32)iThis+1 ) return j+1;
177381 0 0 while( safe_isspace(z[j]) ){ j++; }
177383 0 0 if( c==',' ) continue;
177384 0 0 if( c!=']' ) return -1;
177389 0 0 }else if( c=='"' ){
177395 0 0 if( (c & ~0x1f)==0 ){
177399 0 0 if( c=='\\' ){
177401 0 0 if( c=='"' || c=='\\' || c=='/' || c=='b' || c=='f'
0 0 if( c=='"' || c=='\\' || c=='/' || c=='b' || c=='f'
0 0 if( c=='"' || c=='\\' || c=='/' || c=='b' || c=='f'
0 0 if( c=='"' || c=='\\' || c=='/' || c=='b' || c=='f'
0 0 if( c=='"' || c=='\\' || c=='/' || c=='b' || c=='f'
177402 0 0 || c=='n' || c=='r' || c=='t'
0 0 || c=='n' || c=='r' || c=='t'
0 0 || c=='n' || c=='r' || c=='t'
177403 0 0 || (c=='u' && jsonIs4Hex(z+j+1)) ){
0 0 || (c=='u' && jsonIs4Hex(z+j+1)) ){
177408 0 0 }else if( c=='"' ){
177414 0 0 if( !pParse->oom ) pParse->aNode[pParse->nNode-1].jnFlags = jnFlags;
177416 0 0 }else if( c=='n'
177417 0 0 && strncmp(z+i,"null",4)==0
177418 0 0 && !safe_isalnum(z[i+4]) ){
177421 0 0 }else if( c=='t'
177422 0 0 && strncmp(z+i,"true",4)==0
177423 0 0 && !safe_isalnum(z[i+4]) ){
177426 0 0 }else if( c=='f'
177427 0 0 && strncmp(z+i,"false",5)==0
177428 0 0 && !safe_isalnum(z[i+5]) ){
177431 0 0 }else if( c=='-' || (c>='0' && c<='9') ){
0 0 }else if( c=='-' || (c>='0' && c<='9') ){
0 0 }else if( c=='-' || (c>='0' && c<='9') ){
177436 0 0 if( c<='0' ){
177437 0 0 j = c=='-' ? i+1 : i;
177438 0 0 if( z[j]=='0' && z[j+1]>='0' && z[j+1]<='9' ) return -1;
0 0 if( z[j]=='0' && z[j+1]>='0' && z[j+1]<='9' ) return -1;
0 0 if( z[j]=='0' && z[j+1]>='0' && z[j+1]<='9' ) return -1;
177443 0 0 if( c>='0' && c<='9' ) continue;
0 0 if( c>='0' && c<='9' ) continue;
177444 0 0 if( c=='.' ){
177445 0 0 if( z[j-1]=='-' ) return -1;
177446 0 0 if( seenDP ) return -1;
177450 0 0 if( c=='e' || c=='E' ){
0 0 if( c=='e' || c=='E' ){
177451 0 0 if( z[j-1]<'0' ) return -1;
177452 0 0 if( seenE ) return -1;
177455 0 0 if( c=='+' || c=='-' ){
0 0 if( c=='+' || c=='-' ){
177459 0 0 if( c<'0' || c>'9' ) return -1;
0 0 if( c<'0' || c>'9' ) return -1;
177464 0 0 if( z[j-1]<'0' ) return -1;
177465 0 0 jsonParseAddNode(pParse, seenDP ? JSON_REAL : JSON_INT,
177468 0 0 }else if( c=='}' ){
177470 0 0 }else if( c==']' ){
177472 0 0 }else if( c==0 ){
177493 0 0 if( zJson==0 ) return 1;
177496 0 0 if( pParse->oom ) i = -1;
177497 0 0 if( i>0 ){
177499 0 0 while( safe_isspace(zJson[i]) ) i++;
177500 0 0 if( zJson[i] ) i = -1;
177502 0 0 if( i<=0 ){
177503 0 0 if( pCtx!=0 ){
177504 0 0 if( pParse->oom ){
177525 0 0 for(j=1; j<=pNode->n; j += jsonNodeSize(pNode+j)){
177531 0 0 for(j=1; j<=pNode->n; j += jsonNodeSize(pNode+j+1)+1){
177550 0 0 if( aUp==0 ){
177585 0 0 if( zJson==0 ) return 0;
177586 0 0 for(iKey=0; iKey
177588 0 0 if( p==0 ){
177592 0 0 if( pMatch==0
177593 0 0 && p->nJson==nJson
177594 0 0 && memcmp(p->zJson,zJson,nJson)==0
177598 0 0 }else if( p->iHold
177602 0 0 if( p->iHold>iMaxHold ){
177606 0 0 if( pMatch ){
177612 0 0 if( p==0 ){
177619 0 0 if( jsonParse(p, pErrCtx, p->zJson) ){
177635 0 0 if( pNode->jnFlags & JNODE_RAW ){
177636 0 0 if( pNode->n!=nKey ) return 0;
177639 0 0 if( pNode->n!=nKey+2 ) return 0;
177666 0 0 if( zPath[0]==0 ) return pRoot;
177667 0 0 if( zPath[0]=='.' ){
177668 0 0 if( pRoot->eType!=JSON_OBJECT ) return 0;
177670 0 0 if( zPath[0]=='"' ){
177672 0 0 for(i=1; zPath[i] && zPath[i]!='"'; i++){}
0 0 for(i=1; zPath[i] && zPath[i]!='"'; i++){}
177674 0 0 if( zPath[i] ){
177682 0 0 for(i=0; zPath[i] && zPath[i]!='.' && zPath[i]!='['; i++){}
0 0 for(i=0; zPath[i] && zPath[i]!='.' && zPath[i]!='['; i++){}
0 0 for(i=0; zPath[i] && zPath[i]!='.' && zPath[i]!='['; i++){}
177685 0 0 if( nKey==0 ){
177691 0 0 while( j<=pRoot->n ){
177692 0 0 if( jsonLabelCompare(pRoot+j, zKey, nKey) ){
177698 0 0 if( (pRoot->jnFlags & JNODE_APPEND)==0 ) break;
177703 0 0 if( pApnd ){
177710 0 0 if( pParse->oom ) return 0;
177711 0 0 if( pNode ){
177719 0 0 }else if( zPath[0]=='[' && safe_isdigit(zPath[1]) ){
0 0 }else if( zPath[0]=='[' && safe_isdigit(zPath[1]) ){
177720 0 0 if( pRoot->eType!=JSON_ARRAY ) return 0;
177723 0 0 while( safe_isdigit(zPath[j]) ){
177727 0 0 if( zPath[j]!=']' ){
177734 0 0 while( j<=pRoot->n && (i>0 || (pRoot[j].jnFlags & JNODE_REMOVE)!=0) ){
0 0 while( j<=pRoot->n && (i>0 || (pRoot[j].jnFlags & JNODE_REMOVE)!=0) ){
0 0 while( j<=pRoot->n && (i>0 || (pRoot[j].jnFlags & JNODE_REMOVE)!=0) ){
177735 0 0 if( (pRoot[j].jnFlags & JNODE_REMOVE)==0 ) i--;
177738 0 0 if( (pRoot->jnFlags & JNODE_APPEND)==0 ) break;
177743 0 0 if( j<=pRoot->n ){
177746 0 0 if( i==0 && pApnd ){
0 0 if( i==0 && pApnd ){
177751 0 0 if( pParse->oom ) return 0;
177752 0 0 if( pNode ){
177776 0 0 if( zPath[0]==0 ){
177778 0 0 return pParse->oom ? 0 : &pParse->aNode[pParse->nNode-1];
177780 0 0 if( zPath[0]=='.' ){
177782 0 0 }else if( strncmp(zPath,"[0]",3)==0 ){
177787 0 0 if( pParse->oom ) return 0;
177819 0 0 if( zPath==0 ) return 0;
177820 0 0 if( zPath[0]!='$' ){
177826 0 0 if( zErr==0 ) return pNode;
177832 0 0 if( zMsg ){
177863 0 0 for(i=2; i<=n; i += jsonNodeSize(&pNode[i])+1){
177973 0 0 for(i=0; i
178001 0 0 if( p==0 ) return;
178003 0 0 if( argc==2 ){
178009 0 0 if( pNode==0 ){
178012 0 0 if( pNode->eType==JSON_ARRAY ){
178014 0 0 for(i=1; i<=pNode->n; n++){
178040 0 0 if( argc<2 ) return;
178042 0 0 if( p==0 ) return;
178045 0 0 for(i=1; i
178048 0 0 if( p->nErr ) break;
178049 0 0 if( argc>2 ){
178051 0 0 if( pNode ){
178056 0 0 }else if( pNode ){
178060 0 0 if( argc>2 && i==argc ){
0 0 if( argc>2 && i==argc ){
178078 0 0 if( pPatch->eType!=JSON_OBJECT ){
178084 0 0 if( pTarget->eType!=JSON_OBJECT ){
178089 0 0 for(i=1; in; i += jsonNodeSize(&pPatch[i+1])+1){
178097 0 0 for(j=1; jn; j += jsonNodeSize(&pTarget[j+1])+1 ){
178101 0 0 if( pTarget[j].n==nKey && strncmp(pTarget[j].u.zJContent,zKey,nKey)==0 ){
0 0 if( pTarget[j].n==nKey && strncmp(pTarget[j].u.zJContent,zKey,nKey)==0 ){
178102 0 0 if( pTarget[j+1].jnFlags & (JNODE_REMOVE|JNODE_PATCH) ) break;
178103 0 0 if( pPatch[i+1].eType==JSON_NULL ){
178107 0 0 if( pNew==0 ) return 0;
178109 0 0 if( pNew!=&pTarget[j+1] ){
178117 0 0 if( j>=pTarget->n && pPatch[i+1].eType!=JSON_NULL ){
0 0 if( j>=pTarget->n && pPatch[i+1].eType!=JSON_NULL ){
178122 0 0 if( pParse->oom ) return 0;
178150 0 0 if( jsonParse(&x, ctx, (const char*)sqlite3_value_text(argv[0])) ) return;
178151 0 0 if( jsonParse(&y, ctx, (const char*)sqlite3_value_text(argv[1])) ){
178157 0 0 if( pResult ){
178182 0 0 if( argc&1 ){
178189 0 0 for(i=0; i
178190 0 0 if( sqlite3_value_type(argv[i])!=SQLITE_TEXT ){
178224 0 0 if( argc<1 ) return;
178225 0 0 if( jsonParse(&x, ctx, (const char*)sqlite3_value_text(argv[0])) ) return;
178227 0 0 for(i=1; i<(u32)argc; i++){
178229 0 0 if( zPath==0 ) goto remove_done;
178231 0 0 if( x.nErr ) goto remove_done;
178232 0 0 if( pNode ) pNode->jnFlags |= JNODE_REMOVE;
178234 0 0 if( (x.aNode[0].jnFlags & JNODE_REMOVE)==0 ){
178257 0 0 if( argc<1 ) return;
178258 0 0 if( (argc&1)==0 ) {
178262 0 0 if( jsonParse(&x, ctx, (const char*)sqlite3_value_text(argv[0])) ) return;
178264 0 0 for(i=1; i<(u32)argc; i+=2){
178267 0 0 if( x.nErr ) goto replace_err;
178268 0 0 if( pNode ){
178273 0 0 if( x.aNode[0].jnFlags & JNODE_REPLACE ){
178306 0 0 if( argc<1 ) return;
178307 0 0 if( (argc&1)==0 ) {
178308 0 0 jsonWrongNumArgs(ctx, bIsSet ? "set" : "insert");
178311 0 0 if( jsonParse(&x, ctx, (const char*)sqlite3_value_text(argv[0])) ) return;
178313 0 0 for(i=1; i<(u32)argc; i+=2){
178317 0 0 if( x.oom ){
178320 0 0 }else if( x.nErr ){
178322 0 0 }else if( pNode && (bApnd || bIsSet) ){
0 0 }else if( pNode && (bApnd || bIsSet) ){
0 0 }else if( pNode && (bApnd || bIsSet) ){
178327 0 0 if( x.aNode[0].jnFlags & JNODE_REPLACE ){
178353 0 0 if( p==0 ) return;
178354 0 0 if( argc==2 ){
178360 0 0 if( pNode ){
178399 0 0 if( pStr ){
178400 0 0 if( pStr->zBuf==0 ){
178413 0 0 if( pStr ){
178416 0 0 if( pStr->bErr ){
178417 0 0 if( pStr->bErr==1 ) sqlite3_result_error_nomem(ctx);
178419 0 0 }else if( isFinal ){
178420 0 0 sqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed,
178461 0 0 if( NEVER(!pStr) ) return;
178464 0 0 for(i=1; z[i]!=',' || inStr; i++){
0 0 for(i=1; z[i]!=',' || inStr; i++){
178466 0 0 if( z[i]=='"' ){
178468 0 0 }else if( z[i]=='\\' ){
178495 0 0 if( pStr ){
178496 0 0 if( pStr->zBuf==0 ){
178513 0 0 if( pStr ){
178515 0 0 if( pStr->bErr ){
178516 0 0 if( pStr->bErr==1 ) sqlite3_result_error_nomem(ctx);
178518 0 0 }else if( isFinal ){
178519 0 0 sqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed,
178591 0 0 if( rc==SQLITE_OK ){
178593 0 0 if( pNew==0 ) return SQLITE_NOMEM;
178611 0 0 if( pCur==0 ) return SQLITE_NOMEM;
178620 0 0 if( rc==SQLITE_OK ){
178659 0 0 if( p->bRecursive ){
178660 0 0 if( p->sParse.aNode[p->i].jnFlags & JNODE_LABEL ) p->i++;
178663 0 0 if( p->iiEnd ){
178667 0 0 if( pUp->eType==JSON_ARRAY ){
178668 0 0 if( iUp==p->i-1 ){
178705 0 0 if( i==0 ){
178713 0 0 if( pUp->eType==JSON_ARRAY ){
178717 0 0 if( (pNode->jnFlags & JNODE_LABEL)==0 ) pNode--;
178734 0 0 if( p->i==0 ) break;
178735 0 0 if( p->eType==JSON_OBJECT ){
178737 0 0 }else if( p->eType==JSON_ARRAY ){
178739 0 0 if( p->bRecursive ){
178740 0 0 if( p->iRowid==0 ) break;
178750 0 0 if( pThis->jnFlags & JNODE_LABEL ) pThis++;
178755 0 0 if( pThis->jnFlags & JNODE_LABEL ) pThis++;
178760 0 0 if( pThis->jnFlags & JNODE_LABEL ) pThis++;
178761 0 0 if( pThis->eType>=JSON_ARRAY ) break;
178771 0 0 if( p->i>p->iBegin && p->bRecursive ){
0 0 if( p->i>p->iBegin && p->bRecursive ){
178779 0 0 if( p->bRecursive ){
178782 0 0 if( p->zRoot ){
178787 0 0 if( p->eType==JSON_ARRAY ){
178789 0 0 }else if( p->eType==JSON_OBJECT ){
178797 0 0 if( p->bRecursive ){
178809 0 0 if( zRoot==0 ) zRoot = "$";
178850 0 0 for(i=0; inConstraint; i++, pConstraint++){
178853 0 0 if( pConstraint->iColumn < JEACH_JSON ) continue;
178857 0 0 if( pConstraint->usable==0 ){
178859 0 0 }else if( pConstraint->op==SQLITE_INDEX_CONSTRAINT_EQ ){
178864 0 0 if( (unusableMask & ~idxMask)!=0 ){
178869 0 0 if( aIdx[0]<0 ){
178879 0 0 if( aIdx[1]<0 ){
178905 0 0 if( idxNum==0 ) return SQLITE_OK;
178907 0 0 if( z==0 ) return SQLITE_OK;
178910 0 0 if( p->zJson==0 ) return SQLITE_NOMEM;
178912 0 0 if( jsonParse(&p->sParse, 0, p->zJson) ){
178914 0 0 if( p->sParse.oom==0 ){
178917 0 0 if( cur->pVtab->zErrMsg ) rc = SQLITE_ERROR;
178921 0 0 }else if( p->bRecursive && jsonParseFindParents(&p->sParse) ){
0 0 }else if( p->bRecursive && jsonParseFindParents(&p->sParse) ){
178926 0 0 if( idxNum==3 ){
178929 0 0 if( zRoot==0 ) return SQLITE_OK;
178932 0 0 if( p->zRoot==0 ) return SQLITE_NOMEM;
178934 0 0 if( zRoot[0]!='$' ){
178939 0 0 if( zErr ){
178943 0 0 return cur->pVtab->zErrMsg ? SQLITE_ERROR : SQLITE_NOMEM;
178944 0 0 }else if( pNode==0 ){
178952 0 0 if( p->eType>=JSON_ARRAY ){
178955 0 0 if( p->bRecursive ){
178957 0 0 if( p->i>0 && (p->sParse.aNode[p->i-1].jnFlags & JNODE_LABEL)!=0 ){
0 0 if( p->i>0 && (p->sParse.aNode[p->i-1].jnFlags & JNODE_LABEL)!=0 ){
179085 3765 251 for(i=0; i
3765 0 for(i=0; i
179092 502 251 for(i=0; i
502 0 for(i=0; i
179100 502 251 for(i=0; i
502 0 for(i=0; i
179663 0 15 if( p ){
179691 18 15 for(p=pRtree->aHash[nodeHash(iNode)]; p && p->iNode!=iNode; p=p->pNext);
0 18 for(p=pRtree->aHash[nodeHash(iNode)]; p && p->iNode!=iNode; p=p->pNext);
179711 15 0 if( pNode->iNode!=0 ){
179713 0 15 for( ; (*pp)!=pNode; pp = &(*pp)->pNext){ assert(*pp); }
179728 0 0 if( pNode ){
179744 15 10 if( pRtree->pNodeBlob && pRtree->inWrTrans==0 && pRtree->nCursor==0 ){
15 0 if( pRtree->pNodeBlob && pRtree->inWrTrans==0 && pRtree->nCursor==0 ){
15 0 if( pRtree->pNodeBlob && pRtree->inWrTrans==0 && pRtree->nCursor==0 ){
179766 18 15 if( (pNode = nodeHashLookup(pRtree, iNode))!=0 ){
179768 0 18 if( pParent && !pNode->pParent ){
0 0 if( pParent && !pNode->pParent ){
179777 0 15 if( pRtree->pNodeBlob ){
179782 0 0 if( rc ){
179784 0 0 if( rc==SQLITE_NOMEM ) return SQLITE_NOMEM;
179787 15 0 if( pRtree->pNodeBlob==0 ){
179789 0 15 if( zTab==0 ) return SQLITE_NOMEM;
179794 0 15 if( rc ){
179799 0 0 if( rc==SQLITE_ERROR ) rc = SQLITE_CORRUPT_VTAB;
179800 15 0 }else if( pRtree->iNodeSize==sqlite3_blob_bytes(pRtree->pNodeBlob) ){
179802 0 15 if( !pNode ){
179824 15 0 if( pNode && iNode==1 ){
15 0 if( pNode && iNode==1 ){
179826 0 15 if( pRtree->iDepth>RTREE_MAX_DEPTH ){
179835 15 0 if( pNode && rc==SQLITE_OK ){
15 0 if( pNode && rc==SQLITE_OK ){
179836 0 15 if( NCELL(pNode)>((pRtree->iNodeSize-4)/pRtree->nBytesPerCell) ){
179841 15 0 if( rc==SQLITE_OK ){
179842 15 0 if( pNode!=0 ){
179849 0 0 if( pNode ){
179871 28 7 for(ii=0; iinDim2; ii++){
179907 7 0 if( nCell
179921 7 8 if( pNode->isDirty ){
179923 7 0 if( pNode->iNode ){
179933 0 7 if( pNode->iNode==0 && rc==SQLITE_OK ){
0 0 if( pNode->iNode==0 && rc==SQLITE_OK ){
179947 33 48 if( pNode ){
179951 15 18 if( pNode->nRef==0 ){
179953 15 0 if( pNode->iNode==1 ){
179956 0 15 if( pNode->pParent ){
179959 15 0 if( rc==SQLITE_OK ){
180017 0 0 }while( iinDim2 );
180067 1 15 if( pRtree->nBusy==0 ){
180108 0 0 if( !zCreate ){
180115 0 0 if( rc==SQLITE_OK ){
180131 8 0 if( pCsr ){
180147 6 10 if( pCsr->aConstraint ){
180149 24 6 for(i=0; inConstraint; i++){
180151 0 24 if( pInfo ){
180152 0 0 if( pInfo->xDelUser ) pInfo->xDelUser(pInfo->pUser);
180172 40 8 for(ii=0; iiaNode[ii]);
180257 0 0 if( pConstraint->op==RTREE_QUERY && pSearch->iLevel==1 ){
0 0 if( pConstraint->op==RTREE_QUERY && pSearch->iLevel==1 ){
180262 0 0 if( eInt==0 ){
180291 0 0 if( pConstraint->op==RTREE_MATCH ){
180295 0 0 if( eWithin==0 ) *peWithin = NOT_WITHIN;
180303 0 0 if( pInfo->eWithin<*peWithin ) *peWithin = pInfo->eWithin;
180304 0 0 if( pInfo->rScore<*prScore || *prScore
0 0 if( pInfo->rScore<*prScore || *prScore
180332 0 0 switch( p->op ){
180336 0 0 RTREE_DECODE_COORD(eInt, pCellData, val);
180338 0 0 if( p->u.rValue>=val ) return;
180339 0 0 if( p->op!=RTREE_EQ ) break; /* RTREE_LE and RTREE_LT end here */
180344 0 0 RTREE_DECODE_COORD(eInt, pCellData, val);
180346 0 0 if( p->u.rValue<=val ) return;
180373 119 0 RTREE_DECODE_COORD(eInt, pCellData, xN);
180375 40 15 case RTREE_LE: if( xN <= p->u.rValue ) return; break;
180376 0 0 case RTREE_LT: if( xN < p->u.rValue ) return; break;
180377 55 9 case RTREE_GE: if( xN >= p->u.rValue ) return; break;
180378 0 0 case RTREE_GT: if( xN > p->u.rValue ) return; break;
180379 0 0 default: if( xN == p->u.rValue ) return; break;
180397 3 0 for(ii=0; ii
180398 2 1 if( nodeGetRowid(pRtree, pNode, ii)==iRowid ){
180412 0 0 if( pParent ){
180433 0 0 if( pA->rScorerScore ) return -1;
180434 0 0 if( pA->rScore>pB->rScore ) return +1;
180435 0 0 if( pA->iLeveliLevel ) return -1;
180436 0 0 if( pA->iLevel>pB->iLevel ) return +1;
180449 0 0 if( i
180450 0 0 if( j>=RTREE_CACHE_SZ ){
180465 57 47 return pCur->bPoint ? &pCur->sPoint : pCur->nPoint ? pCur->aPoint : 0;
31 16 return pCur->bPoint ? &pCur->sPoint : pCur->nPoint ? pCur->aPoint : 0;
180476 18 34 if( pCur->aNode[ii]==0 ){
180478 0 18 id = ii ? pCur->aPoint[0].id : pCur->sPoint.id;
180494 5 0 if( pCur->nPoint>=pCur->nPointAlloc ){
180497 0 5 if( pNew==0 ) return 0;
180506 0 5 while( i>0 ){
180510 0 0 if( rtreeSearchPointCompare(pNew, pParent)>=0 ) break;
180530 18 8 if( pFirst==0
180531 18 0 || pFirst->rScore>rScore
180532 18 0 || (pFirst->rScore==rScore && pFirst->iLevel>iLevel)
18 0 || (pFirst->rScore==rScore && pFirst->iLevel>iLevel)
180534 5 21 if( pCur->bPoint ){
180537 0 5 if( pNew==0 ) return 0;
180539 5 0 if( ii
180593 26 0 if( p->aNode[i] ){
180597 21 5 if( p->bPoint ){
180600 5 0 }else if( p->nPoint ){
180604 5 0 if( n
180609 0 5 while( (j = i*2+1)
180611 0 0 if( kaPoint[k], &p->aPoint[j])<0 ){
0 0 if( kaPoint[k], &p->aPoint[j])<0 ){
180612 0 0 if( rtreeSearchPointCompare(&p->aPoint[k], &p->aPoint[i])<0 ){
180619 0 0 if( rtreeSearchPointCompare(&p->aPoint[j], &p->aPoint[i])<0 ){
180650 42 8 while( (p = rtreeSearchPointFirst(pCur))!=0 && p->iLevel>0 ){
24 18 while( (p = rtreeSearchPointFirst(pCur))!=0 && p->iLevel>0 ){
180652 0 24 if( rc ) return rc;
180655 42 6 while( p->iCell
180659 119 18 for(ii=0; ii
180661 0 119 if( pConstraint->op>=RTREE_MATCH ){
180664 0 0 if( rc ) return rc;
180665 119 0 }else if( p->iLevel==1 ){
180670 24 95 if( eWithin==NOT_WITHIN ) break;
180673 24 18 if( eWithin==NOT_WITHIN ) continue;
180675 0 18 if( x.iLevel ){
180682 0 18 if( p->iCell>=nCell ){
180686 18 0 if( rScore
180688 0 18 if( p==0 ) return SQLITE_NOMEM;
180695 6 18 if( p->iCell>=nCell ){
180713 0 20 if( pCsr->bAuxValid ){
180730 0 0 if( rc==SQLITE_OK && p ){
0 0 if( rc==SQLITE_OK && p ){
180747 0 28 if( rc ) return rc;
180748 0 28 if( p==0 ) return SQLITE_OK;
180749 20 8 if( i==0 ){
180751 8 0 }else if( i<=pRtree->nDim2 ){
180754 0 8 if( pRtree->eCoordType==RTREE_COORD_REAL32 ){
180763 0 0 if( !pCsr->bAuxValid ){
180764 0 0 if( pCsr->pReadAux==0 ){
180767 0 0 if( rc ) return rc;
180772 0 0 if( rc==SQLITE_ROW ){
180776 0 0 if( rc==SQLITE_DONE ) rc = SQLITE_OK;
180802 2 0 if( sqlite3_step(pRtree->pReadRowid)==SQLITE_ROW ){
180804 2 0 if( piNode ) *piNode = iNode;
180824 0 0 if( pSrc==0 ) return SQLITE_ERROR;
180827 0 0 if( !pInfo ) return SQLITE_NOMEM;
180836 0 0 if( pBlob->cb.xGeom ){
180873 2 6 if( idxNum==1 ){
180880 2 0 if( rc==SQLITE_OK && pLeaf!=0 ){
2 0 if( rc==SQLITE_OK && pLeaf!=0 ){
180897 6 0 if( rc==SQLITE_OK && argc>0 ){
6 0 if( rc==SQLITE_OK && argc>0 ){
180900 0 6 if( !pCsr->aConstraint ){
180907 24 6 for(ii=0; ii
180911 0 24 if( p->op>=RTREE_MATCH ){
180917 0 0 if( rc!=SQLITE_OK ){
180933 6 0 if( rc==SQLITE_OK ){
180936 0 6 if( pNew==0 ) return SQLITE_NOMEM;
181002 26 8 for(ii=0; iinConstraint; ii++){
181003 0 26 if( pIdxInfo->aConstraint[ii].op==SQLITE_INDEX_CONSTRAINT_MATCH ){
181009 26 6 for(ii=0; iinConstraint && iIdx<(int)(sizeof(zIdxStr)-1); ii++){
26 0 for(ii=0; iinConstraint && iIdx<(int)(sizeof(zIdxStr)-1); ii++){
181012 26 0 if( bMatch==0 && p->usable
26 0 if( bMatch==0 && p->usable
181013 2 24 && p->iColumn==0 && p->op==SQLITE_INDEX_CONSTRAINT_EQ
2 0 && p->iColumn==0 && p->op==SQLITE_INDEX_CONSTRAINT_EQ
181017 0 2 for(jj=0; jj
181037 24 0 if( p->usable
181038 24 0 && ((p->iColumn>0 && p->iColumn<=pRtree->nDim2)
0 24 && ((p->iColumn>0 && p->iColumn<=pRtree->nDim2)
181039 0 0 || p->op==SQLITE_INDEX_CONSTRAINT_MATCH)
181062 6 0 if( iIdx>0 && 0==(pIdxInfo->idxStr = sqlite3_mprintf("%s", zIdxStr)) ){
0 6 if( iIdx>0 && 0==(pIdxInfo->idxStr = sqlite3_mprintf("%s", zIdxStr)) ){
181080 0 0 if( pRtree->eCoordType==RTREE_COORD_REAL32 ){
181110 0 0 margin += (DCOORD(p->aCoord[ii+1]) - DCOORD(p->aCoord[ii]));
0 0 margin += (DCOORD(p->aCoord[ii+1]) - DCOORD(p->aCoord[ii]));
181112 0 0 }while( ii>=0 );
181121 0 0 if( pRtree->eCoordType==RTREE_COORD_REAL32 ){
181123 0 0 p1->aCoord[ii].f = MIN(p1->aCoord[ii].f, p2->aCoord[ii].f);
181124 0 0 p1->aCoord[ii+1].f = MAX(p1->aCoord[ii+1].f, p2->aCoord[ii+1].f);
181126 0 0 }while( iinDim2 );
181132 0 0 }while( iinDim2 );
181143 0 0 for(ii=0; iinDim2; ii+=2){
181146 0 0 if( (!isInt && (a2[0].fa1[1].f))
0 0 if( (!isInt && (a2[0].fa1[1].f))
0 0 if( (!isInt && (a2[0].fa1[1].f))
181147 0 0 || ( isInt && (a2[0].ia1[1].i))
0 0 || ( isInt && (a2[0].ia1[1].i))
0 0 || ( isInt && (a2[0].ia1[1].i))
181175 0 0 for(ii=0; ii
181178 0 0 for(jj=0; jjnDim2; jj+=2){
181180 0 0 x1 = MAX(DCOORD(p->aCoord[jj]), DCOORD(aCell[ii].aCoord[jj]));
0 0 x1 = MAX(DCOORD(p->aCoord[jj]), DCOORD(aCell[ii].aCoord[jj]));
0 0 x1 = MAX(DCOORD(p->aCoord[jj]), DCOORD(aCell[ii].aCoord[jj]));
0 0 x1 = MAX(DCOORD(p->aCoord[jj]), DCOORD(aCell[ii].aCoord[jj]));
0 0 x1 = MAX(DCOORD(p->aCoord[jj]), DCOORD(aCell[ii].aCoord[jj]));
181181 0 0 x2 = MIN(DCOORD(p->aCoord[jj+1]), DCOORD(aCell[ii].aCoord[jj+1]));
0 0 x2 = MIN(DCOORD(p->aCoord[jj+1]), DCOORD(aCell[ii].aCoord[jj+1]));
0 0 x2 = MIN(DCOORD(p->aCoord[jj+1]), DCOORD(aCell[ii].aCoord[jj+1]));
0 0 x2 = MIN(DCOORD(p->aCoord[jj+1]), DCOORD(aCell[ii].aCoord[jj+1]));
0 0 x2 = MIN(DCOORD(p->aCoord[jj+1]), DCOORD(aCell[ii].aCoord[jj+1]));
181182 0 0 if( x2
181210 7 0 for(ii=0; rc==SQLITE_OK && ii<(pRtree->iDepth-iHeight); ii++){
0 7 for(ii=0; rc==SQLITE_OK && ii<(pRtree->iDepth-iHeight); ii++){
181227 0 0 for(iCell=0; iCell
181234 0 0 if( iCell==0||growth
0 0 if( iCell==0||growth
0 0 if( iCell==0||growth
0 0 if( iCell==0||growth
181237 0 0 if( bBest ){
181265 0 7 while( p->pParent ){
181270 0 0 if( nodeParentIndex(pRtree, p, &iCell) ){
181275 0 0 if( !cellContains(pRtree, &cell, pCell) ){
181331 0 0 if( nIdx>1 ){
181346 0 0 while( iLeft
0 0 while( iLeft
181347 0 0 if( iLeft==nLeft ){
181350 0 0 }else if( iRight==nRight ){
181356 0 0 if( fLeft
181399 0 0 if( nIdx>1 ){
181414 0 0 while( iLeft
0 0 while( iLeft
181415 0 0 RtreeDValue xleft1 = DCOORD(aCell[aLeft[iLeft]].aCoord[iDim*2]);
181416 0 0 RtreeDValue xleft2 = DCOORD(aCell[aLeft[iLeft]].aCoord[iDim*2+1]);
181417 0 0 RtreeDValue xright1 = DCOORD(aCell[aRight[iRight]].aCoord[iDim*2]);
181418 0 0 RtreeDValue xright2 = DCOORD(aCell[aRight[iRight]].aCoord[iDim*2+1]);
181419 0 0 if( (iLeft!=nLeft) && ((iRight==nRight)
0 0 if( (iLeft!=nLeft) && ((iRight==nRight)
181420 0 0 || (xleft1
181421 0 0 || (xleft1==xright1 && xleft2
0 0 || (xleft1==xright1 && xleft2
181470 0 0 if( !aaSorted ){
181476 0 0 for(ii=0; iinDim; ii++){
181479 0 0 for(jj=0; jj
181485 0 0 for(ii=0; iinDim; ii++){
181492 0 0 for(
181505 0 0 for(kk=1; kk<(nCell-1); kk++){
181506 0 0 if( kk
181516 0 0 if( (nLeft==RTREE_MINCELLS(pRtree))
181517 0 0 || (overlap
181518 0 0 || (overlap==fBestOverlap && area
0 0 || (overlap==fBestOverlap && area
181526 0 0 if( ii==0 || margin
0 0 if( ii==0 || margin
181535 0 0 for(ii=0; ii
181536 0 0 RtreeNode *pTarget = (ii
181537 0 0 RtreeCell *pBbox = (ii
181555 0 0 xSetMapping = ((iHeight==0)?rowidWrite:parentWrite);
181556 0 0 if( iHeight>0 ){
181558 0 0 if( pChild ){
181591 0 0 if( !aCell ){
181597 0 0 for(i=0; i
181604 0 0 if( pNode->iNode==1 ){
181616 0 0 if( !pLeft || !pRight ){
0 0 if( !pLeft || !pRight ){
181626 0 0 if( rc!=SQLITE_OK ){
181635 0 0 if( SQLITE_OK!=(rc = nodeWrite(pRtree, pRight))
181636 0 0 || (0==pLeft->iNode && SQLITE_OK!=(rc = nodeWrite(pRtree, pLeft)))
0 0 || (0==pLeft->iNode && SQLITE_OK!=(rc = nodeWrite(pRtree, pLeft)))
181644 0 0 if( pNode->iNode==1 ){
181646 0 0 if( rc!=SQLITE_OK ){
181653 0 0 if( rc==SQLITE_OK ){
181657 0 0 if( rc!=SQLITE_OK ){
181661 0 0 if( (rc = rtreeInsertCell(pRtree, pRight->pParent, &rightbbox, iHeight+1)) ){
181665 0 0 for(i=0; i
181668 0 0 if( iRowid==pCell->iRowid ){
181671 0 0 if( rc!=SQLITE_OK ){
181675 0 0 if( pNode->iNode==1 ){
181676 0 0 for(i=0; i
181679 0 0 if( rc!=SQLITE_OK ){
181683 0 0 }else if( newCellIsRight==0 ){
181687 0 0 if( rc==SQLITE_OK ){
181691 0 0 if( rc==SQLITE_OK ){
181717 0 0 while( rc==SQLITE_OK && pChild->iNode!=1 && pChild->pParent==0 ){
0 0 while( rc==SQLITE_OK && pChild->iNode!=1 && pChild->pParent==0 ){
0 0 while( rc==SQLITE_OK && pChild->iNode!=1 && pChild->pParent==0 ){
181721 0 0 if( rc==SQLITE_ROW ){
181731 0 0 for(pTest=pLeaf; pTest && pTest->iNode!=iNode; pTest=pTest->pParent);
0 0 for(pTest=pLeaf; pTest && pTest->iNode!=iNode; pTest=pTest->pParent);
181732 0 0 if( !pTest ){
181737 0 0 if( rc==SQLITE_OK ) rc = rc2;
181738 0 0 if( rc==SQLITE_OK && !pChild->pParent ) rc = SQLITE_CORRUPT_VTAB;
0 0 if( rc==SQLITE_OK && !pChild->pParent ) rc = SQLITE_CORRUPT_VTAB;
181756 0 0 if( rc==SQLITE_OK ){
181762 0 0 if( rc==SQLITE_OK ){
181765 0 0 if( rc!=SQLITE_OK ){
181772 0 0 if( SQLITE_OK!=(rc = sqlite3_reset(pRtree->pDeleteNode)) ){
181779 0 0 if( SQLITE_OK!=(rc = sqlite3_reset(pRtree->pDeleteParent)) ){
181798 0 0 if( pParent ){
181803 0 0 for(ii=1; ii
181810 0 0 if( rc==SQLITE_OK ){
181826 0 0 if( SQLITE_OK!=(rc = fixLeafParent(pRtree, pNode)) ){
181842 0 0 if( pParent ){
181843 0 0 if( NCELL(pNode)
181884 0 0 if( !aCell ){
181891 0 0 for(ii=0; ii
181892 0 0 if( ii==(nCell-1) ){
181898 0 0 for(iDim=0; iDimnDim; iDim++){
181899 0 0 aCenterCoord[iDim] += DCOORD(aCell[ii].aCoord[iDim*2]);
181900 0 0 aCenterCoord[iDim] += DCOORD(aCell[ii].aCoord[iDim*2+1]);
181903 0 0 for(iDim=0; iDimnDim; iDim++){
181907 0 0 for(ii=0; ii
181909 0 0 for(iDim=0; iDimnDim; iDim++){
181910 0 0 RtreeDValue coord = (DCOORD(aCell[ii].aCoord[iDim*2+1]) -
181911 0 0 DCOORD(aCell[ii].aCoord[iDim*2]));
181919 0 0 for(ii=0; rc==SQLITE_OK && ii<(nCell-(RTREE_MINCELLS(pRtree)+1)); ii++){
0 0 for(ii=0; rc==SQLITE_OK && ii<(nCell-(RTREE_MINCELLS(pRtree)+1)); ii++){
181922 0 0 if( p->iRowid==pCell->iRowid ){
181923 0 0 if( iHeight==0 ){
181930 0 0 if( rc==SQLITE_OK ){
181933 0 0 for(; rc==SQLITE_OK && ii
0 0 for(; rc==SQLITE_OK && ii
181940 0 0 if( rc==SQLITE_OK ){
181944 0 0 if( rc==SQLITE_OK ){
181965 0 7 if( iHeight>0 ){
181967 0 0 if( pChild ){
181973 0 7 if( nodeInsertCell(pRtree, pNode, pCell) ){
181974 0 0 if( iHeight<=pRtree->iReinsertHeight || pNode->iNode==1){
0 0 if( iHeight<=pRtree->iReinsertHeight || pNode->iNode==1){
181982 7 0 if( rc==SQLITE_OK ){
181983 7 0 if( iHeight==0 ){
181998 0 0 for(ii=0; rc==SQLITE_OK && ii
0 0 for(ii=0; rc==SQLITE_OK && ii
182007 0 0 if( rc==SQLITE_OK ){
182011 0 0 if( rc==SQLITE_OK ){
182048 0 0 if( rc==SQLITE_OK ){
182053 0 0 if( rc==SQLITE_OK ){
182056 0 0 if( rc==SQLITE_OK ){
182060 0 0 if( rc==SQLITE_OK ){
182066 0 0 if( rc==SQLITE_OK ){
182080 0 0 if( rc==SQLITE_OK && pRtree->iDepth>0 && NCELL(pRoot)==1 ){
0 0 if( rc==SQLITE_OK && pRtree->iDepth>0 && NCELL(pRoot)==1 ){
0 0 if( rc==SQLITE_OK && pRtree->iDepth>0 && NCELL(pRoot)==1 ){
182085 0 0 if( rc==SQLITE_OK ){
182089 0 0 if( rc==SQLITE_OK ) rc = rc2;
182090 0 0 if( rc==SQLITE_OK ){
182098 0 0 for(pLeaf=pRtree->pDeleted; pLeaf; pLeaf=pRtree->pDeleted){
182099 0 0 if( rc==SQLITE_OK ){
182108 0 0 if( rc==SQLITE_OK ){
182131 0 0 if( f>d ){
182132 0 0 f = (float)(d*(d<0 ? RNDAWAY : RNDTOWARDS));
182139 0 0 if( f
182140 0 0 f = (float)(d*(d<0 ? RNDTOWARDS : RNDAWAY));
182166 0 0 if( zSql ){
182173 0 0 if( rc==SQLITE_OK ){
182174 0 0 if( iCol==0 ){
182189 0 0 return (rc==SQLITE_OK ? SQLITE_CONSTRAINT : rc);
182208 0 7 if( pRtree->nNodeRef ){
182230 7 0 if( nData>1 ){
182234 0 7 if( nn > pRtree->nDim2 ) nn = pRtree->nDim2;
182245 0 7 if( pRtree->eCoordType==RTREE_COORD_REAL32 ){
182246 0 0 for(ii=0; ii
182249 0 0 if( cell.aCoord[ii].f>cell.aCoord[ii+1].f ){
182257 14 7 for(ii=0; ii
182260 0 14 if( cell.aCoord[ii].i>cell.aCoord[ii+1].i ){
182269 7 0 if( sqlite3_value_type(aData[2])!=SQLITE_NULL ){
182271 0 7 if( sqlite3_value_type(aData[0])==SQLITE_NULL
182272 0 0 || sqlite3_value_int64(aData[0])!=cell.iRowid
182278 0 7 if( SQLITE_ROW==steprc ){
182279 0 0 if( sqlite3_vtab_on_conflict(pRtree->db)==SQLITE_REPLACE ){
182295 0 7 if( sqlite3_value_type(aData[0])!=SQLITE_NULL ){
182303 7 0 if( rc==SQLITE_OK && nData>1 ){
7 0 if( rc==SQLITE_OK && nData>1 ){
182308 0 7 if( bHaveRowid==0 ){
182313 7 0 if( rc==SQLITE_OK ){
182316 7 0 if( rc==SQLITE_OK ){
182321 7 0 if( rc==SQLITE_OK ){
182325 0 7 if( pRtree->nAux ){
182329 0 0 for(jj=0; jjnAux; jj++){
182377 0 0 if( zSql ){
182424 1 0 if( rc!=SQLITE_OK ){
182426 0 1 return rc==SQLITE_ERROR ? SQLITE_OK : rc;
182429 0 0 if( zSql==0 ){
182433 0 0 if( rc==SQLITE_OK ){
182434 0 0 if( sqlite3_step(p)==SQLITE_ROW ) nRow = sqlite3_column_int64(p, 0);
182436 0 0 }else if( rc!=SQLITE_NOMEM ){
182440 0 0 if( rc==SQLITE_OK ){
182441 0 0 if( nRow==0 ){
182463 12 0 for(i=0; i
182464 6 6 if( sqlite3_stricmp(zName, azName[i])==0 ) return 1;
182526 1 0 if( isCreate ){
182533 0 1 for(ii=0; iinAux; ii++){
182546 0 1 if( !zCreate ){
182551 0 1 if( rc!=SQLITE_OK ){
182566 8 1 for(i=0; i
8 0 for(i=0; i
182569 1 7 if( i!=3 || pRtree->nAux==0 ){
1 0 if( i!=3 || pRtree->nAux==0 ){
182578 8 0 if( zSql ){
182586 0 1 if( pRtree->nAux ){
182590 0 0 if( pRtree->zReadAuxSql==0 ){
182597 0 0 for(ii=0; iinAux; ii++){
182598 0 0 if( ii ) sqlite3_str_append(p, ",", 1);
182599 0 0 if( iinAuxNotNull ){
182607 0 0 if( zSql==0 ){
182629 1 0 if( zSql ){
182632 1 0 if( rc==SQLITE_OK ){
182633 1 0 if( SQLITE_ROW==sqlite3_step(pStmt) ){
182665 1 0 if( isCreate ){
182669 1 0 if( rc==SQLITE_OK ){
182671 1 0 if( (4+pRtree->nBytesPerCell*RTREE_MAXCELLS)iNodeSize ){
182683 0 0 if( rc!=SQLITE_OK ){
182685 0 0 }else if( pRtree->iNodeSize<(512-64) ){
182732 0 1 if( argc>RTREE_MAX_AUX_COLUMN+3 ){
182743 0 1 if( !pRtree ){
182762 4 1 for(ii=4; ii
182763 0 4 if( argv[ii][0]=='+' ){
182766 0 4 }else if( pRtree->nAux>0 ){
182775 0 1 if( !zSql ){
182777 0 1 }else if( ii
182780 0 1 }else if( SQLITE_OK!=(rc = sqlite3_declare_vtab(db, zSql)) ){
182784 0 1 if( rc ) goto rtreeInit_fail;
182786 0 1 if( pRtree->nDim<1 ){
182788 0 1 }else if( pRtree->nDim2>RTREE_MAX_DIMENSIONS*2 ){
182790 0 1 }else if( pRtree->nDim2 % 2 ){
182795 0 1 if( iErr ){
182803 0 1 if( rc ) goto rtreeInit_fail;
182805 0 1 if( rc ){
182814 0 0 if( rc==SQLITE_OK ) rc = SQLITE_ERROR;
182852 0 0 for(ii=0; ii
182861 0 0 for(jj=0; jj
182872 0 0 if( zText ){
182895 0 0 if( sqlite3_value_type(apArg[0])!=SQLITE_BLOB
182896 0 0 || sqlite3_value_bytes(apArg[0])<2
182933 0 0 if( pCheck->rc==SQLITE_OK ) pCheck->rc = rc;
182955 0 0 if( pCheck->rc==SQLITE_OK ){
182956 0 0 if( z==0 ){
182976 0 0 if( pCheck->rc==SQLITE_OK && pCheck->nErr
0 0 if( pCheck->rc==SQLITE_OK && pCheck->nErr
182978 0 0 if( z==0 ){
182981 0 0 pCheck->zReport = sqlite3_mprintf("%z%s%z",
182984 0 0 if( pCheck->zReport==0 ){
183011 0 0 if( pCheck->pGetNode==0 ){
183018 0 0 if( pCheck->rc==SQLITE_OK ){
183020 0 0 if( sqlite3_step(pCheck->pGetNode)==SQLITE_ROW ){
183024 0 0 if( pRet==0 ){
183032 0 0 if( pCheck->rc==SQLITE_OK && pRet==0 ){
0 0 if( pCheck->rc==SQLITE_OK && pRet==0 ){
183066 0 0 if( pCheck->aCheckMapping[bLeaf]==0 ){
183071 0 0 if( pCheck->rc!=SQLITE_OK ) return;
183076 0 0 if( rc==SQLITE_DONE ){
183077 0 0 rtreeCheckAppendMsg(pCheck, "Mapping (%lld -> %lld) missing from %s table",
183080 0 0 }else if( rc==SQLITE_ROW ){
183082 0 0 if( ii!=iVal ){
183083 0 0 rtreeCheckAppendMsg(pCheck,
183115 0 0 for(i=0; inDim; i++){
183120 0 0 if( pCheck->bInt ? c1.i>c2.i : c1.f>c2.f ){
0 0 if( pCheck->bInt ? c1.i>c2.i : c1.f>c2.f ){
183126 0 0 if( pParent ){
183130 0 0 if( (pCheck->bInt ? c1.i
0 0 if( (pCheck->bInt ? c1.i
0 0 if( (pCheck->bInt ? c1.i
183131 0 0 || (pCheck->bInt ? c2.i>p2.i : c2.f>p2.f)
0 0 || (pCheck->bInt ? c2.i>p2.i : c2.f>p2.f)
0 0 || (pCheck->bInt ? c2.i>p2.i : c2.f>p2.f)
183163 0 0 if( aNode ){
183164 0 0 if( nNode<4 ){
183171 0 0 if( aParent==0 ){
183173 0 0 if( iDepth>RTREE_MAX_DEPTH ){
183180 0 0 if( (4 + nCell*(8 + pCheck->nDim*2*4))>nNode ){
183186 0 0 for(i=0; i
183191 0 0 if( iDepth>0 ){
183214 0 0 if( pCheck->rc==SQLITE_OK ){
183219 0 0 if( pCount ){
183220 0 0 if( sqlite3_step(pCount)==SQLITE_ROW ){
183222 0 0 if( nActual!=nExpect ){
183257 0 0 if( sqlite3_get_autocommit(db) ){
183263 0 0 if( check.rc==SQLITE_OK ){
183265 0 0 if( pStmt ){
183274 0 0 if( pStmt ){
183277 0 0 if( check.nDim<1 ){
183279 0 0 }else if( SQLITE_ROW==sqlite3_step(pStmt) ){
183283 0 0 if( rc!=SQLITE_CORRUPT ) check.rc = rc;
183287 0 0 if( check.nDim>=1 ){
183288 0 0 if( check.rc==SQLITE_OK ){
183301 0 0 if( bEnd ){
183303 0 0 if( check.rc==SQLITE_OK ) check.rc = rc;
183347 0 0 if( nArg!=1 && nArg!=2 ){
0 0 if( nArg!=1 && nArg!=2 ){
183356 0 0 if( nArg==1 ){
183363 0 0 if( rc==SQLITE_OK ){
183364 0 0 sqlite3_result_text(ctx, zReport ? zReport : "ok", -1, SQLITE_TRANSIENT);
185188 251 0 if( rc==SQLITE_OK ){
185191 251 0 if( rc==SQLITE_OK ){
185194 251 0 if( rc==SQLITE_OK ){
185202 251 0 if( rc==SQLITE_OK ){
185224 0 0 if( pInfo->xDestructor ) pInfo->xDestructor(pInfo->pContext);
185234 0 0 for(i=0; inParam; i++){
185263 0 0 if( !pBlob ){
185271 0 0 for(i=0; i
185273 0 0 if( pBlob->apSqlParam[i]==0 ) memErr = 1;
185280 0 0 if( memErr ){
185302 0 0 if( !pGeomCtx ) return SQLITE_NOMEM;
185327 0 0 if( !pGeomCtx ) return SQLITE_NOMEM;
200272 0 0 if( fts5yypParser ){
200367 0 0 while( pParser->fts5yytos>pParser->fts5yystack ) fts5yy_pop_parser_stack(pParser);
200387 0 0 if( p==0 ) return;
200451 0 0 if( stateno>fts5YY_MAX_SHIFT ) return stateno;
200463 0 0 if( i>=fts5YY_NLOOKAHEAD || fts5yy_lookahead[i]!=iLookAhead ){
0 0 if( i>=fts5YY_NLOOKAHEAD || fts5yy_lookahead[i]!=iLookAhead ){
200551 0 0 while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack ) fts5yy_pop_parser_stack(fts5yypParser);
200601 0 0 if( fts5yypParser->fts5yytos>fts5yypParser->fts5yystackEnd ){
200615 0 0 if( fts5yyNewState > fts5YY_MAX_SHIFT ){
200706 0 0 if( fts5yyRuleInfo[fts5yyruleno].nrhs==0 ){
200714 0 0 if( fts5yypParser->fts5yytos>=fts5yypParser->fts5yystackEnd ){
201039 0 0 if( fts5yyact >= fts5YY_MIN_REDUCE ){
201042 0 0 }else if( fts5yyact <= fts5YY_MAX_SHIFTREDUCE ){
201048 0 0 }else if( fts5yyact==fts5YY_ACCEPT_ACTION ){
201154 0 0 }while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack );
201243 0 0 while( rc==SQLITE_OK && pIter->iInstnInst ){
0 0 while( rc==SQLITE_OK && pIter->iInstnInst ){
201246 0 0 if( rc==SQLITE_OK ){
201247 0 0 if( ic==pIter->iCol ){
201249 0 0 if( pIter->iStart<0 ){
201252 0 0 }else if( io<=pIter->iEnd ){
201253 0 0 if( iEnd>pIter->iEnd ) pIter->iEnd = iEnd;
201283 0 0 if( rc==SQLITE_OK ){
201323 0 0 if( *pRc==SQLITE_OK ){
201324 0 0 if( n<0 ) n = (int)strlen(z);
201326 0 0 if( p->zOut==0 ) *pRc = SQLITE_NOMEM;
201347 0 0 if( tflags & FTS5_TOKEN_COLOCATED ) return SQLITE_OK;
201350 0 0 if( p->iRangeEnd>0 ){
201351 0 0 if( iPosiRangeStart || iPos>p->iRangeEnd ) return SQLITE_OK;
0 0 if( iPosiRangeStart || iPos>p->iRangeEnd ) return SQLITE_OK;
201352 0 0 if( p->iRangeStart && iPos==p->iRangeStart ) p->iOff = iStartOff;
0 0 if( p->iRangeStart && iPos==p->iRangeStart ) p->iOff = iStartOff;
201355 0 0 if( iPos==p->iter.iStart ){
201361 0 0 if( iPos==p->iter.iEnd ){
201362 0 0 if( p->iRangeEnd && p->iter.iStartiRangeStart ){
0 0 if( p->iRangeEnd && p->iter.iStartiRangeStart ){
201368 0 0 if( rc==SQLITE_OK ){
201373 0 0 if( p->iRangeEnd>0 && iPos==p->iRangeEnd ){
0 0 if( p->iRangeEnd>0 && iPos==p->iRangeEnd ){
201376 0 0 if( iPos>=p->iter.iStart && iPositer.iEnd ){
0 0 if( iPos>=p->iter.iStart && iPositer.iEnd ){
201398 0 0 if( nVal!=3 ){
201410 0 0 if( ctx.zIn ){
201411 0 0 if( rc==SQLITE_OK ){
201415 0 0 if( rc==SQLITE_OK ){
201420 0 0 if( rc==SQLITE_OK ){
201425 0 0 if( rc!=SQLITE_OK ){
201451 0 0 if( p->nFirstAlloc==p->nFirst ){
201452 0 0 int nNew = p->nFirstAlloc ? p->nFirstAlloc*2 : 64;
201456 0 0 if( aNew==0 ) return SQLITE_NOMEM;
201482 0 0 if( (tflags & FTS5_TOKEN_COLOCATED)==0 ){
201484 0 0 if( p->iPos>0 ){
201487 0 0 for(i=iStartOff-1; i>=0; i--){
201489 0 0 if( c!=' ' && c!='\t' && c!='\n' && c!='\r' ) break;
0 0 if( c!=' ' && c!='\t' && c!='\n' && c!='\r' ) break;
0 0 if( c!=' ' && c!='\t' && c!='\n' && c!='\r' ) break;
0 0 if( c!=' ' && c!='\t' && c!='\n' && c!='\r' ) break;
201491 0 0 if( i!=iStartOff-1 && (c=='.' || c==':') ){
0 0 if( i!=iStartOff-1 && (c=='.' || c==':') ){
0 0 if( i!=iStartOff-1 && (c=='.' || c==':') ){
201524 0 0 for(i=0; i
0 0 for(i=0; i
201526 0 0 if( rc==SQLITE_OK && ic==iCol && iOff>=iPos && iOff<(iPos+nToken) ){
0 0 if( rc==SQLITE_OK && ic==iCol && iOff>=iPos && iOff<(iPos+nToken) ){
0 0 if( rc==SQLITE_OK && ic==iCol && iOff>=iPos && iOff<(iPos+nToken) ){
0 0 if( rc==SQLITE_OK && ic==iCol && iOff>=iPos && iOff<(iPos+nToken) ){
201527 0 0 nScore += (aSeen[ip] ? 1 : 1000);
201529 0 0 if( iFirst<0 ) iFirst = iOff;
201535 0 0 if( piPos ){
201537 0 0 if( (iAdj+nToken)>nDocsize ) iAdj = nDocsize - nToken;
201538 0 0 if( iAdj<0 ) iAdj = 0;
201552 0 0 return zRet ? zRet : "";
201581 0 0 if( nVal!=5 ){
201598 0 0 if( aSeen==0 ){
201601 0 0 if( rc==SQLITE_OK ){
201606 0 0 for(i=0; i
201607 0 0 if( iCol<0 || iCol==i ){
0 0 if( iCol<0 || iCol==i ){
201614 0 0 if( rc!=SQLITE_OK ) break;
201618 0 0 if( rc!=SQLITE_OK ) break;
201620 0 0 if( rc!=SQLITE_OK ) break;
201622 0 0 for(ii=0; rc==SQLITE_OK && ii
0 0 for(ii=0; rc==SQLITE_OK && ii
201629 0 0 if( ic!=i || rc!=SQLITE_OK ) continue;
0 0 if( ic!=i || rc!=SQLITE_OK ) continue;
201634 0 0 if( rc==SQLITE_OK && nScore>nBestScore ){
0 0 if( rc==SQLITE_OK && nScore>nBestScore ){
201641 0 0 if( rc==SQLITE_OK && sFinder.nFirst && nDocsize>nToken ){
0 0 if( rc==SQLITE_OK && sFinder.nFirst && nDocsize>nToken ){
0 0 if( rc==SQLITE_OK && sFinder.nFirst && nDocsize>nToken ){
201642 0 0 for(jj=0; jj<(sFinder.nFirst-1); jj++){
201643 0 0 if( sFinder.aFirst[jj+1]>io ) break;
201646 0 0 if( sFinder.aFirst[jj]
201652 0 0 nScore += (sFinder.aFirst[jj]==0 ? 120 : 100);
201653 0 0 if( rc==SQLITE_OK && nScore>nBestScore ){
0 0 if( rc==SQLITE_OK && nScore>nBestScore ){
201665 0 0 if( rc==SQLITE_OK ){
201668 0 0 if( rc==SQLITE_OK && nColSize==0 ){
0 0 if( rc==SQLITE_OK && nColSize==0 ){
201671 0 0 if( ctx.zIn ){
201672 0 0 if( rc==SQLITE_OK ){
201679 0 0 if( iBestStart>0 ){
201685 0 0 while( ctx.iter.iStart>=0 && ctx.iter.iStart
0 0 while( ctx.iter.iStart>=0 && ctx.iter.iStart
0 0 while( ctx.iter.iStart>=0 && ctx.iter.iStart
201689 0 0 if( rc==SQLITE_OK ){
201692 0 0 if( ctx.iRangeEnd>=(nColSize-1) ){
201698 0 0 if( rc==SQLITE_OK ){
201751 0 0 if( p==0 ){
201762 0 0 if( p==0 ){
201772 0 0 if( rc==SQLITE_OK ) rc = pApi->xRowCount(pFts, &nRow);
201773 0 0 if( rc==SQLITE_OK ) rc = pApi->xColumnTotalSize(pFts, -1, &nToken);
201774 0 0 if( rc==SQLITE_OK ) p->avgdl = (double)nToken / (double)nRow;
201777 0 0 for(i=0; rc==SQLITE_OK && i
0 0 for(i=0; rc==SQLITE_OK && i
201780 0 0 if( rc==SQLITE_OK ){
201795 0 0 if( idf<=0.0 ) idf = 1e-6;
201800 0 0 if( rc!=SQLITE_OK ){
201805 0 0 if( rc!=SQLITE_OK ) p = 0;
201834 0 0 if( rc==SQLITE_OK ){
201839 0 0 for(i=0; rc==SQLITE_OK && i
0 0 for(i=0; rc==SQLITE_OK && i
201842 0 0 if( rc==SQLITE_OK ){
201843 0 0 double w = (nVal > ic) ? sqlite3_value_double(apVal[ic]) : 1.0;
201849 0 0 if( rc==SQLITE_OK ){
201856 0 0 for(i=0; rc==SQLITE_OK && inPhrase; i++){
0 0 for(i=0; rc==SQLITE_OK && inPhrase; i++){
201865 0 0 if( rc==SQLITE_OK ){
201886 1004 0 for(i=0; rc==SQLITE_OK && i
753 251 for(i=0; rc==SQLITE_OK && i
201918 0 0 if( (u32)pBuf->nSpace
201919 0 0 u32 nNew = pBuf->nSpace ? pBuf->nSpace : 64;
201921 0 0 while( nNew
201925 0 0 if( pNew==0 ){
201942 0 0 if( fts5BufferGrow(pRc, pBuf, 9) ) return;
0 0 if( fts5BufferGrow(pRc, pBuf, 9) ) return;
201969 0 0 if( nData ){
201970 0 0 if( fts5BufferGrow(pRc, pBuf, nData) ) return;
0 0 if( fts5BufferGrow(pRc, pBuf, nData) ) return;
202004 0 0 if( *pRc==SQLITE_OK ){
202011 0 0 if( zTmp==0 ){
202022 0 0 if( *pRc==SQLITE_OK ){
202027 0 0 if( zRet==0 ){
202072 0 0 if( i>=n ){
202079 0 0 fts5FastGetVarint32(a, i, iVal);
202080 0 0 if( iVal==1 ){
202081 0 0 fts5FastGetVarint32(a, i, iVal);
202083 0 0 fts5FastGetVarint32(a, i, iVal);
202097 0 0 if( sqlite3Fts5PoslistNext64(pIter->a, pIter->n, &pIter->i, &pIter->iPos) ){
202126 0 0 if( (iPos & colmask) != (*piPrev & colmask) ){
202141 0 0 if( fts5BufferGrow(&rc, pBuf, 5+5+5) ) return rc;
0 0 if( fts5BufferGrow(&rc, pBuf, 5+5+5) ) return rc;
202148 0 0 if( *pRc==SQLITE_OK ){
202150 0 0 if( pRet==0 ){
202151 0 0 if( nByte>0 ) *pRc = SQLITE_NOMEM;
202169 0 0 if( *pRc==SQLITE_OK ){
202170 0 0 if( nIn<0 ){
202174 0 0 if( zRet ){
202207 0 0 return (t & 0x80) || aBareword[(int)t];
0 0 return (t & 0x80) || aBareword[(int)t];
202239 0 0 if( p ){
202248 0 0 for(i=nTerm-1; i>=0; i--){
202254 0 0 for(pEntry=p->apHash[hash]; pEntry; pEntry=pEntry->pNext){
202255 0 0 if( pEntry->iIdx==iIdx
202256 0 0 && pEntry->nTerm==nTerm
202257 0 0 && memcmp(pEntry->pTerm, pTerm, nTerm)==0
202264 0 0 if( pEntry==0 ){
202266 0 0 if( pEntry ){
202281 0 0 if( p ){
202283 0 0 for(i=0; iapHash); i++){
202285 0 0 while( pEntry ){
202327 0 0 return (x=='"' || x=='\'' || x=='[' || x=='`');
0 0 return (x=='"' || x=='\'' || x=='[' || x=='`');
0 0 return (x=='"' || x=='\'' || x=='[' || x=='`');
0 0 return (x=='"' || x=='\'' || x=='[' || x=='`');
202337 0 0 if( p ){
202338 0 0 while( fts5_iswhitespace(*p) ){ p++; }
202350 0 0 while ( sqlite3Fts5IsBareword(*p) ) p++;
202351 0 0 if( p==pIn ) p = 0;
202356 0 0 return (a>='0' && a<='9');
0 0 return (a>='0' && a<='9');
202365 0 0 if( sqlite3_strnicmp("null", p, 4)==0 ){
202374 0 0 if( *p=='\'' ){
202376 0 0 while( (*p>='a' && *p<='f')
0 0 while( (*p>='a' && *p<='f')
202377 0 0 || (*p>='A' && *p<='F')
0 0 || (*p>='A' && *p<='F')
202378 0 0 || (*p>='0' && *p<='9')
0 0 || (*p>='0' && *p<='9')
202382 0 0 if( *p=='\'' && 0==((p-pIn)%2) ){
0 0 if( *p=='\'' && 0==((p-pIn)%2) ){
202394 0 0 while( p ){
202395 0 0 if( *p=='\'' ){
202397 0 0 if( *p!='\'' ) break;
202400 0 0 if( *p==0 ) p = 0;
202406 0 0 if( *p=='+' || *p=='-' ) p++;
0 0 if( *p=='+' || *p=='-' ) p++;
202407 0 0 while( fts5_isdigit(*p) ) p++;
202412 0 0 if( *p=='.' && fts5_isdigit(p[1]) ){
0 0 if( *p=='.' && fts5_isdigit(p[1]) ){
202414 0 0 while( fts5_isdigit(*p) ) p++;
202416 0 0 if( p==pIn ) p = 0;
202445 0 0 if( q=='[' ) q = ']';
202447 0 0 while( ALWAYS(z[iIn]) ){
202448 0 0 if( z[iIn]==q ){
202449 0 0 if( z[iIn+1]!=q ){
202487 0 0 if( quote=='[' || quote=='\'' || quote=='"' || quote=='`' ){
0 0 if( quote=='[' || quote=='\'' || quote=='"' || quote=='`' ){
0 0 if( quote=='[' || quote=='\'' || quote=='"' || quote=='`' ){
0 0 if( quote=='[' || quote=='\'' || quote=='"' || quote=='`' ){
202508 0 0 for(i=0; aEnum[i].zName; i++){
202509 0 0 if( sqlite3_strnicmp(aEnum[i].zName, zEnum, nEnum)==0 ){
202510 0 0 if( iVal>=0 ) return SQLITE_ERROR;
202537 0 0 if( sqlite3_strnicmp("prefix", zCmd, nCmd)==0 ){
202541 0 0 if( pConfig->aPrefix==0 ){
202543 0 0 if( rc ) return rc;
202550 0 0 while( p[0]==' ' ) p++;
202551 0 0 if( bFirst==0 && p[0]==',' ){
0 0 if( bFirst==0 && p[0]==',' ){
202553 0 0 while( p[0]==' ' ) p++;
202554 0 0 }else if( p[0]=='\0' ){
202557 0 0 if( p[0]<'0' || p[0]>'9' ){
0 0 if( p[0]<'0' || p[0]>'9' ){
202563 0 0 if( pConfig->nPrefix==FTS5_MAX_PREFIX_INDEXES ){
202571 0 0 while( p[0]>='0' && p[0]<='9' && nPre<1000 ){
0 0 while( p[0]>='0' && p[0]<='9' && nPre<1000 ){
0 0 while( p[0]>='0' && p[0]<='9' && nPre<1000 ){
202576 0 0 if( nPre<=0 || nPre>=1000 ){
0 0 if( nPre<=0 || nPre>=1000 ){
202590 0 0 if( sqlite3_strnicmp("tokenize", zCmd, nCmd)==0 ){
202597 0 0 if( azArg && pSpace ){
0 0 if( azArg && pSpace ){
202598 0 0 if( pConfig->pTok ){
202602 0 0 for(nArg=0; p && *p; nArg++){
0 0 for(nArg=0; p && *p; nArg++){
202604 0 0 if( *p2=='\'' ){
202609 0 0 if( p ){
202617 0 0 if( p==0 ){
202634 0 0 if( sqlite3_strnicmp("content", zCmd, nCmd)==0 ){
202635 0 0 if( pConfig->eContent!=FTS5_CONTENT_NORMAL ){
202639 0 0 if( zArg[0] ){
202649 0 0 if( sqlite3_strnicmp("content_rowid", zCmd, nCmd)==0 ){
202650 0 0 if( pConfig->zContentRowid ){
202659 0 0 if( sqlite3_strnicmp("columnsize", zCmd, nCmd)==0 ){
202660 0 0 if( (zArg[0]!='0' && zArg[0]!='1') || zArg[1]!='\0' ){
0 0 if( (zArg[0]!='0' && zArg[0]!='1') || zArg[1]!='\0' ){
0 0 if( (zArg[0]!='0' && zArg[0]!='1') || zArg[1]!='\0' ){
202669 0 0 if( sqlite3_strnicmp("detail", zCmd, nCmd)==0 ){
202677 0 0 if( (rc = fts5ConfigSetEnum(aDetail, zArg, &pConfig->eDetail)) ){
202729 0 0 if( zOut==0 ){
202733 0 0 if( fts5_isopenquote(zOut[0]) ){
202739 0 0 if( zRet ){
202745 0 0 if( zRet==0 ){
202761 0 0 if( 0==sqlite3_stricmp(zCol, FTS5_RANK_NAME)
202762 0 0 || 0==sqlite3_stricmp(zCol, FTS5_ROWID_NAME)
202766 0 0 }else if( zArg ){
202767 0 0 if( 0==sqlite3_stricmp(zArg, "unindexed") ){
202788 0 0 if( p->eContent!=FTS5_CONTENT_NONE ){
202789 0 0 for(i=0; inCol; i++){
202790 0 0 if( p->eContent==FTS5_CONTENT_EXTERNAL ){
202829 0 0 if( pRet==0 ) return SQLITE_NOMEM;
202844 0 0 if( rc==SQLITE_OK && sqlite3_stricmp(pRet->zName, FTS5_RANK_NAME)==0 ){
0 0 if( rc==SQLITE_OK && sqlite3_stricmp(pRet->zName, FTS5_RANK_NAME)==0 ){
202849 0 0 for(i=3; rc==SQLITE_OK && i
0 0 for(i=3; rc==SQLITE_OK && i
202859 0 0 if( z && *z=='=' ){
0 0 if( z && *z=='=' ){
202862 0 0 if( bMustBeCol ) z = 0;
202865 0 0 if( z && z[0] ){
0 0 if( z && z[0] ){
202868 0 0 if( z && z[0] ) z = 0;
0 0 if( z && z[0] ) z = 0;
202871 0 0 if( rc==SQLITE_OK ){
202872 0 0 if( z==0 ){
202876 0 0 if( bOption ){
202877 0 0 rc = fts5ConfigParseSpecial(pGlobal, pRet, zOne, zTwo?zTwo:"", pzErr);
202892 0 0 if( rc==SQLITE_OK && pRet->pTok==0 ){
0 0 if( rc==SQLITE_OK && pRet->pTok==0 ){
202897 0 0 if( rc==SQLITE_OK && pRet->zContent==0 ){
0 0 if( rc==SQLITE_OK && pRet->zContent==0 ){
202902 0 0 if( pRet->eContent==FTS5_CONTENT_NORMAL ){
202904 0 0 }else if( pRet->bColumnsize ){
202908 0 0 if( zTail ){
202915 0 0 if( rc==SQLITE_OK && pRet->zContentRowid==0 ){
0 0 if( rc==SQLITE_OK && pRet->zContentRowid==0 ){
202920 0 0 if( rc==SQLITE_OK ){
202924 0 0 if( rc!=SQLITE_OK ){
202935 0 0 if( pConfig ){
202937 0 0 if( pConfig->pTok ){
202942 0 0 for(i=0; inCol; i++){
202967 0 0 for(i=0; zSql && inCol; i++){
0 0 for(i=0; zSql && inCol; i++){
202968 0 0 const char *zSep = (i==0?"":", ");
202976 0 0 if( zSql ){
203014 0 0 if( pText==0 ) return SQLITE_OK;
203033 0 0 if( p==0 || *p==')' ) break;
0 0 if( p==0 || *p==')' ) break;
203034 0 0 if( *p!=',' ){
203067 0 0 if( p==0 ){
203074 0 0 if( p ){
203076 0 0 if( zRank ) memcpy(zRank, pRank, p-pRank);
203081 0 0 if( rc==SQLITE_OK ){
203083 0 0 if( *p!='(' ) rc = SQLITE_ERROR;
203086 0 0 if( rc==SQLITE_OK ){
203090 0 0 if( *p!=')' ){
203092 0 0 if( p==0 ){
203096 0 0 if( zRankArgs ) memcpy(zRankArgs, pArgs, p-pArgs);
203102 0 0 if( rc!=SQLITE_OK ){
203120 0 0 if( 0==sqlite3_stricmp(zKey, "pgsz") ){
203122 0 0 if( SQLITE_INTEGER==sqlite3_value_numeric_type(pVal) ){
203125 0 0 if( pgsz<=0 || pgsz>FTS5_MAX_PAGE_SIZE ){
0 0 if( pgsz<=0 || pgsz>FTS5_MAX_PAGE_SIZE ){
203132 0 0 else if( 0==sqlite3_stricmp(zKey, "hashsize") ){
203134 0 0 if( SQLITE_INTEGER==sqlite3_value_numeric_type(pVal) ){
203137 0 0 if( nHashSize<=0 ){
203144 0 0 else if( 0==sqlite3_stricmp(zKey, "automerge") ){
203146 0 0 if( SQLITE_INTEGER==sqlite3_value_numeric_type(pVal) ){
203149 0 0 if( nAutomerge<0 || nAutomerge>64 ){
0 0 if( nAutomerge<0 || nAutomerge>64 ){
203152 0 0 if( nAutomerge==1 ) nAutomerge = FTS5_DEFAULT_AUTOMERGE;
203157 0 0 else if( 0==sqlite3_stricmp(zKey, "usermerge") ){
203159 0 0 if( SQLITE_INTEGER==sqlite3_value_numeric_type(pVal) ){
203162 0 0 if( nUsermerge<2 || nUsermerge>16 ){
0 0 if( nUsermerge<2 || nUsermerge>16 ){
203169 0 0 else if( 0==sqlite3_stricmp(zKey, "crisismerge") ){
203171 0 0 if( SQLITE_INTEGER==sqlite3_value_numeric_type(pVal) ){
203174 0 0 if( nCrisisMerge<0 ){
203177 0 0 if( nCrisisMerge<=1 ) nCrisisMerge = FTS5_DEFAULT_CRISISMERGE;
203182 0 0 else if( 0==sqlite3_stricmp(zKey, "rank") ){
203187 0 0 if( rc==SQLITE_OK ){
203192 0 0 }else if( rc==SQLITE_ERROR ){
203220 0 0 if( zSql ){
203226 0 0 if( rc==SQLITE_OK ){
203227 0 0 while( SQLITE_ROW==sqlite3_step(p) ){
203230 0 0 if( 0==sqlite3_stricmp(zK, "version") ){
203240 0 0 if( rc==SQLITE_OK && iVersion!=FTS5_CURRENT_VERSION ){
0 0 if( rc==SQLITE_OK && iVersion!=FTS5_CURRENT_VERSION ){
203242 0 0 if( pConfig->pzErrmsg ){
203251 0 0 if( rc==SQLITE_OK ){
203392 0 0 if( pParse->rc==SQLITE_OK ){
203400 0 0 return t==' ' || t=='\t' || t=='\n' || t=='\r';
0 0 return t==' ' || t=='\t' || t=='\n' || t=='\r';
0 0 return t==' ' || t=='\t' || t=='\n' || t=='\r';
0 0 return t==' ' || t=='\t' || t=='\n' || t=='\r';
203415 0 0 while( fts5ExprIsspace(*z) ) z++;
203437 0 0 if( z2[0]=='"' ){
203439 0 0 if( z2[0]!='"' ) break;
203441 0 0 if( z2[0]=='\0' ){
203452 0 0 if( sqlite3Fts5IsBareword(z[0])==0 ){
203457 0 0 for(z2=&z[1]; sqlite3Fts5IsBareword(*z2); z2++);
203459 0 0 if( pToken->n==2 && memcmp(pToken->p, "OR", 2)==0 ) tok = FTS5_OR;
0 0 if( pToken->n==2 && memcmp(pToken->p, "OR", 2)==0 ) tok = FTS5_OR;
203460 0 0 if( pToken->n==3 && memcmp(pToken->p, "NOT", 3)==0 ) tok = FTS5_NOT;
0 0 if( pToken->n==3 && memcmp(pToken->p, "NOT", 3)==0 ) tok = FTS5_NOT;
203461 0 0 if( pToken->n==3 && memcmp(pToken->p, "AND", 3)==0 ) tok = FTS5_AND;
0 0 if( pToken->n==3 && memcmp(pToken->p, "AND", 3)==0 ) tok = FTS5_AND;
203491 0 0 if( pEngine==0 ){ return SQLITE_NOMEM; }
203497 0 0 }while( sParse.rc==SQLITE_OK && t!=FTS5_EOF );
0 0 }while( sParse.rc==SQLITE_OK && t!=FTS5_EOF );
203502 0 0 if( iColnCol && sParse.pExpr && sParse.rc==SQLITE_OK ){
0 0 if( iColnCol && sParse.pExpr && sParse.rc==SQLITE_OK ){
0 0 if( iColnCol && sParse.pExpr && sParse.rc==SQLITE_OK ){
203505 0 0 if( pColset ){
203513 0 0 if( sParse.rc==SQLITE_OK ){
203515 0 0 if( pNew==0 ){
203519 0 0 if( !sParse.pExpr ){
203522 0 0 if( pNew->pRoot ){
203547 0 0 if( p ){
203549 0 0 for(i=0; inChild; i++){
203561 0 0 if( p ){
203579 0 0 for(p=pTerm; p; p=p->pSynonym){
203580 0 0 if( 0==sqlite3Fts5IterEof(p->pIter) ){
203582 0 0 if( bRetValid==0 || (bDesc!=(iRowid
0 0 if( bRetValid==0 || (bDesc!=(iRowid
203589 0 0 if( pbEof && bRetValid==0 ) *pbEof = 1;
0 0 if( pbEof && bRetValid==0 ) *pbEof = 1;
203610 0 0 for(p=pTerm; p; p=p->pSynonym){
203612 0 0 if( sqlite3Fts5IterEof(pIter)==0 && pIter->iRowid==iRowid ){
0 0 if( sqlite3Fts5IterEof(pIter)==0 && pIter->iRowid==iRowid ){
203613 0 0 if( pIter->nData==0 ) continue;
203614 0 0 if( nIter==nAlloc ){
203617 0 0 if( aNew==0 ){
203623 0 0 if( aIter!=aStatic ) sqlite3_free(aIter);
203632 0 0 if( nIter==1 ){
203642 0 0 for(i=0; i
203643 0 0 if( aIter[i].bEof==0 ){
203644 0 0 if( aIter[i].iPos==iPrev ){
203645 0 0 if( sqlite3Fts5PoslistReaderNext(&aIter[i]) ) continue;
203647 0 0 if( aIter[i].iPos
203652 0 0 if( iMin==FTS5_LARGEST_INT64 || rc!=SQLITE_OK ) break;
0 0 if( iMin==FTS5_LARGEST_INT64 || rc!=SQLITE_OK ) break;
203656 0 0 if( rc==SQLITE_OK ){
203663 0 0 if( aIter!=aStatic ) sqlite3_free(aIter);
203695 0 0 if( pPhrase->nTerm>ArraySize(aStatic) ){
203698 0 0 if( !aIter ) return SQLITE_NOMEM;
203703 0 0 for(i=0; inTerm; i++){
203708 0 0 if( pTerm->pSynonym ){
203711 0 0 if( rc ){
203715 0 0 if( a==buf.p ) bFlag = 1;
203722 0 0 if( aIter[i].bEof ) goto ismatch_out;
203730 0 0 for(i=0; inTerm; i++){
203733 0 0 if( pPos->iPos!=iAdj ){
203735 0 0 while( pPos->iPos
203736 0 0 if( sqlite3Fts5PoslistReaderNext(pPos) ) goto ismatch_out;
203738 0 0 if( pPos->iPos>iAdj ) iPos = pPos->iPos-i;
203741 0 0 }while( bMatch==0 );
203744 0 0 if( bFirst==0 || FTS5_POS2OFFSET(iPos)==0 ){
0 0 if( bFirst==0 || FTS5_POS2OFFSET(iPos)==0 ){
203746 0 0 if( rc!=SQLITE_OK ) goto ismatch_out;
203749 0 0 for(i=0; inTerm; i++){
203750 0 0 if( sqlite3Fts5PoslistReaderNext(&aIter[i]) ) goto ismatch_out;
203756 0 0 for(i=0; inTerm; i++){
203757 0 0 if( aIter[i].bFlag ) sqlite3_free((u8*)aIter[i].a);
203759 0 0 if( aIter!=aStatic ) sqlite3_free(aIter);
203776 0 0 if( sqlite3Fts5PoslistNext64(p->a, p->n, &p->i, &p->iLookahead) ){
203830 0 0 if( pNear->nPhrase>ArraySize(aStatic) ){
203836 0 0 if( rc!=SQLITE_OK ){
203849 0 0 for(i=0; inPhrase; i++){
203866 0 0 for(i=0; inPhrase; i++){
203869 0 0 if( pPos->iPosiPos>iMax ){
0 0 if( pPos->iPosiPos>iMax ){
203871 0 0 while( pPos->iPos
203872 0 0 if( fts5LookaheadReaderNext(pPos) ) goto ismatch_out;
203874 0 0 if( pPos->iPos>iMax ) iMax = pPos->iPos;
203877 0 0 }while( bMatch==0 );
203880 0 0 for(i=0; inPhrase; i++){
203883 0 0 if( a[i].pOut->n==0 || iPos!=pWriter->iPrev ){
0 0 if( a[i].pOut->n==0 || iPos!=pWriter->iPrev ){
203890 0 0 for(i=0; inPhrase; i++){
203891 0 0 if( a[i].reader.iLookahead < iMin ){
203896 0 0 if( fts5LookaheadReaderNext(&a[iAdv].reader) ) goto ismatch_out;
203902 0 0 if( a!=aStatic ) sqlite3_free(a);
203927 0 0 if( (bDesc==0 && iLast>iRowid) || (bDesc && iLast
0 0 if( (bDesc==0 && iLast>iRowid) || (bDesc && iLast
0 0 if( (bDesc==0 && iLast>iRowid) || (bDesc && iLast
0 0 if( (bDesc==0 && iLast>iRowid) || (bDesc && iLast
203929 0 0 if( rc || sqlite3Fts5IterEof(pIter) ){
0 0 if( rc || sqlite3Fts5IterEof(pIter) ){
203953 0 0 for(p=pTerm; rc==SQLITE_OK && p; p=p->pSynonym){
0 0 for(p=pTerm; rc==SQLITE_OK && p; p=p->pSynonym){
203954 0 0 if( sqlite3Fts5IterEof(p->pIter)==0 ){
203956 0 0 if( (bDesc==0 && iLast>iRowid) || (bDesc && iLast
0 0 if( (bDesc==0 && iLast>iRowid) || (bDesc && iLast
0 0 if( (bDesc==0 && iLast>iRowid) || (bDesc && iLast
0 0 if( (bDesc==0 && iLast>iRowid) || (bDesc && iLast
203962 0 0 if( rc!=SQLITE_OK ){
203980 0 0 if( pExpr->pConfig->eDetail!=FTS5_DETAIL_FULL ){
203984 0 0 for(pTerm=&pPhrase->aTerm[0]; pTerm; pTerm=pTerm->pSynonym){
203986 0 0 if( sqlite3Fts5IterEof(pIter)==0 ){
203987 0 0 if( pIter->iRowid==pNode->iRowid && pIter->nData>0 ){
0 0 if( pIter->iRowid==pNode->iRowid && pIter->nData>0 ){
203999 0 0 for(i=0; rc==SQLITE_OK && inPhrase; i++){
0 0 for(i=0; rc==SQLITE_OK && inPhrase; i++){
204001 0 0 if( pPhrase->nTerm>1 || pPhrase->aTerm[0].pSynonym
0 0 if( pPhrase->nTerm>1 || pPhrase->aTerm[0].pSynonym
204002 0 0 || pNear->pColset || pPhrase->aTerm[0].bFirst
0 0 || pNear->pColset || pPhrase->aTerm[0].bFirst
204006 0 0 if( bMatch==0 ) break;
204014 0 0 if( i==pNear->nPhrase && (i==1 || fts5ExprNearIsMatch(pRc, pNear)) ){
0 0 if( i==pNear->nPhrase && (i==1 || fts5ExprNearIsMatch(pRc, pNear)) ){
0 0 if( i==pNear->nPhrase && (i==1 || fts5ExprNearIsMatch(pRc, pNear)) ){
204039 0 0 for(i=0; inPhrase; i++){
204041 0 0 if( pPhrase->nTerm==0 ){
204046 0 0 for(j=0; jnTerm; j++){
204051 0 0 for(p=pTerm; p; p=p->pSynonym){
204053 0 0 if( p->pIter ){
204060 0 0 (pExpr->bDesc ? FTS5INDEX_QUERY_DESC : 0),
204065 0 0 if( rc!=SQLITE_OK ) return rc;
204066 0 0 if( 0==sqlite3Fts5IterEof(p->pIter) ){
204071 0 0 if( bHit==0 ){
204099 0 0 if( pExpr->bDesc==0 ){
204100 0 0 if( iLhs
204103 0 0 if( iLhs>iRhs ) return -1;
204112 0 0 for(i=0; inChild; i++){
204118 0 0 if( pNode->eType==FTS5_STRING || pNode->eType==FTS5_TERM ){
0 0 if( pNode->eType==FTS5_STRING || pNode->eType==FTS5_TERM ){
204121 0 0 for(i=0; inPhrase; i++){
204127 0 0 for(i=0; inChild; i++){
204152 0 0 if( p2->bEof ) return -1;
204153 0 0 if( p1->bEof ) return +1;
204191 0 0 if( pLeft->aTerm[0].pSynonym ){
204199 0 0 for(i=0; inPhrase; i++){
204201 0 0 for(j=0; jnTerm; j++){
204203 0 0 if( pTerm->pSynonym ){
204205 0 0 if( iRowid==iLast ) continue;
204207 0 0 if( fts5ExprSynonymAdvanceto(pTerm, bDesc, &iLast, &rc) ){
204214 0 0 if( pIter->iRowid==iLast || pIter->bEof ) continue;
0 0 if( pIter->iRowid==iLast || pIter->bEof ) continue;
204216 0 0 if( fts5ExprAdvanceto(pIter, bDesc, &iLast, &rc, &pNode->bEof) ){
204222 0 0 }while( bMatch==0 );
204225 0 0 pNode->bNomatch = ((0==fts5ExprNearTest(&rc, pExpr, pNode)) && rc==SQLITE_OK);
0 0 pNode->bNomatch = ((0==fts5ExprNearTest(&rc, pExpr, pNode)) && rc==SQLITE_OK);
204248 0 0 if( pTerm->pSynonym ){
204257 0 0 for(p=pTerm; p; p=p->pSynonym){
204258 0 0 if( sqlite3Fts5IterEof(p->pIter)==0 ){
204260 0 0 if( ii==iRowid
204261 0 0 || (bFromValid && ii!=iFrom && (ii>iFrom)==pExpr->bDesc)
0 0 || (bFromValid && ii!=iFrom && (ii>iFrom)==pExpr->bDesc)
0 0 || (bFromValid && ii!=iFrom && (ii>iFrom)==pExpr->bDesc)
204263 0 0 if( bFromValid ){
204268 0 0 if( rc!=SQLITE_OK ) break;
204269 0 0 if( sqlite3Fts5IterEof(p->pIter)==0 ){
204280 0 0 pNode->bEof = (rc || bEof);
0 0 pNode->bEof = (rc || bEof);
204285 0 0 if( bFromValid ){
204291 0 0 pNode->bEof = (rc || sqlite3Fts5IterEof(pIter));
0 0 pNode->bEof = (rc || sqlite3Fts5IterEof(pIter));
204294 0 0 if( pNode->bEof==0 ){
204320 0 0 if( pExpr->pConfig->eDetail==FTS5_DETAIL_FULL ){
204341 0 0 if( bFromValid ){
204346 0 0 if( rc==SQLITE_OK && sqlite3Fts5IterEof(pIter)==0 ){
0 0 if( rc==SQLITE_OK && sqlite3Fts5IterEof(pIter)==0 ){
204362 0 0 for(i=1; inChild; i++){
204365 0 0 if( cmp>0 || (cmp==0 && pChild->bNomatch==0) ){
0 0 if( cmp>0 || (cmp==0 && pChild->bNomatch==0) ){
0 0 if( cmp>0 || (cmp==0 && pChild->bNomatch==0) ){
204383 0 0 for(i=0; inChild; i++){
204386 0 0 if( p1->bEof==0 ){
204387 0 0 if( (p1->iRowid==iLast)
204388 0 0 || (bFromValid && fts5RowidCmp(pExpr, p1->iRowid, iFrom)<0)
0 0 || (bFromValid && fts5RowidCmp(pExpr, p1->iRowid, iFrom)<0)
204391 0 0 if( rc!=SQLITE_OK ){
204419 0 0 for(iChild=0; iChildnChild; iChild++){
204422 0 0 if( cmp>0 ){
204425 0 0 if( rc!=SQLITE_OK ){
204436 0 0 if( pChild->bEof ){
204440 0 0 }else if( iLast!=pChild->iRowid ){
204445 0 0 if( pChild->bNomatch ){
204449 0 0 }while( bMatch==0 );
204451 0 0 if( pAnd->bNomatch && pAnd!=pExpr->pRoot ){
0 0 if( pAnd->bNomatch && pAnd!=pExpr->pRoot ){
204465 0 0 if( rc==SQLITE_OK ){
204482 0 0 while( rc==SQLITE_OK && p1->bEof==0 ){
0 0 while( rc==SQLITE_OK && p1->bEof==0 ){
204484 0 0 if( cmp>0 ){
204489 0 0 if( cmp || p2->bNomatch ) break;
0 0 if( cmp || p2->bNomatch ) break;
204495 0 0 if( p1->bEof ){
204508 0 0 if( rc==SQLITE_OK ){
204511 0 0 if( rc!=SQLITE_OK ){
204527 0 0 if( pNode->bEof==0 ){
204572 0 0 if( Fts5NodeIsString(pNode) ){
0 0 if( Fts5NodeIsString(pNode) ){
204575 0 0 }else if( pNode->xNext==0 ){
204580 0 0 for(i=0; inChild && rc==SQLITE_OK; i++){
0 0 for(i=0; inChild && rc==SQLITE_OK; i++){
204590 0 0 if( nEof>0 ) fts5ExprSetEof(pNode);
204594 0 0 if( pNode->nChild==nEof ) fts5ExprSetEof(pNode);
204604 0 0 if( rc==SQLITE_OK ){
204636 0 0 if( rc==SQLITE_OK
204637 0 0 && 0==pRoot->bEof
204638 0 0 && fts5RowidCmp(p, pRoot->iRowid, iFirst)<0
204644 0 0 while( pRoot->bNomatch ){
204664 0 0 }while( pRoot->bNomatch );
204665 0 0 if( fts5RowidCmp(p, pRoot->iRowid, iLast)>0 ){
204689 0 0 if( pPhrase ){
204691 0 0 for(i=0; inTerm; i++){
204697 0 0 for(pSyn=pTerm->pSynonym; pSyn; pSyn=pNext){
204704 0 0 if( pPhrase->poslist.nSpace>0 ) fts5BufferFree(&pPhrase->poslist);
204714 0 0 if( pPhrase && pPhrase->nTerm ){
0 0 if( pPhrase && pPhrase->nTerm ){
204735 0 0 if( pParse->rc==SQLITE_OK ){
204736 0 0 if( pPhrase==0 ){
204739 0 0 if( pNear==0 ){
204742 0 0 if( pRet==0 ){
204747 0 0 }else if( (pNear->nPhrase % SZALLOC)==0 ){
204752 0 0 if( pRet==0 ){
204760 0 0 if( pRet==0 ){
204765 0 0 if( pRet->nPhrase>0 ){
204768 0 0 if( pPhrase->nTerm==0 ){
204773 0 0 }else if( pLast->nTerm==0 ){
204810 0 0 if( pCtx->rc!=SQLITE_OK ) return pCtx->rc;
204811 0 0 if( nToken>FTS5_MAX_TOKEN_SIZE ) nToken = FTS5_MAX_TOKEN_SIZE;
204813 0 0 if( pPhrase && pPhrase->nTerm>0 && (tflags & FTS5_TOKEN_COLOCATED) ){
0 0 if( pPhrase && pPhrase->nTerm>0 && (tflags & FTS5_TOKEN_COLOCATED) ){
0 0 if( pPhrase && pPhrase->nTerm>0 && (tflags & FTS5_TOKEN_COLOCATED) ){
204817 0 0 if( pSyn==0 ){
204828 0 0 if( pPhrase==0 || (pPhrase->nTerm % SZALLOC)==0 ){
0 0 if( pPhrase==0 || (pPhrase->nTerm % SZALLOC)==0 ){
204830 0 0 int nNew = SZALLOC + (pPhrase ? pPhrase->nTerm : 0);
204835 0 0 if( pNew==0 ){
204838 0 0 if( pPhrase==0 ) memset(pNew, 0, sizeof(Fts5ExprPhrase));
204844 0 0 if( rc==SQLITE_OK ){
204867 0 0 if( pNear ){
204869 0 0 for(i=0; inPhrase; i++){
204902 0 0 if( rc==SQLITE_OK ){
204903 0 0 int flags = FTS5_TOKENIZE_QUERY | (bPrefix ? FTS5_TOKENIZE_PREFIX : 0);
204910 0 0 if( rc || (rc = sCtx.rc) ){
0 0 if( rc || (rc = sCtx.rc) ){
204916 0 0 if( pAppend==0 ){
204917 0 0 if( (pParse->nPhrase % 8)==0 ){
204921 0 0 if( apNew==0 ){
204931 0 0 if( sCtx.pPhrase==0 ){
204935 0 0 }else if( sCtx.pPhrase->nTerm ){
204960 0 0 if( rc==SQLITE_OK ){
204964 0 0 if( rc==SQLITE_OK ){
204968 0 0 if( rc==SQLITE_OK ){
204972 0 0 if( rc==SQLITE_OK ){
204974 0 0 if( pColsetOrig ){
204977 0 0 if( pColset ){
204984 0 0 if( pOrig->nTerm ){
204986 0 0 for(i=0; rc==SQLITE_OK && inTerm; i++){
0 0 for(i=0; rc==SQLITE_OK && inTerm; i++){
204989 0 0 for(p=&pOrig->aTerm[i]; p && rc==SQLITE_OK; p=p->pSynonym){
0 0 for(p=&pOrig->aTerm[i]; p && rc==SQLITE_OK; p=p->pSynonym){
204995 0 0 if( rc==SQLITE_OK ){
205006 0 0 if( rc==SQLITE_OK ){
205016 0 0 if( pOrig->nTerm==1
205017 0 0 && pOrig->aTerm[0].pSynonym==0
205018 0 0 && pOrig->aTerm[0].bFirst==0
205043 0 0 if( pTok->n!=4 || memcmp("NEAR", pTok->p, 4) ){
0 0 if( pTok->n!=4 || memcmp("NEAR", pTok->p, 4) ){
205055 0 0 if( pNear ){
205058 0 0 if( p->n ){
205059 0 0 for(i=0; in; i++){
205061 0 0 if( c<'0' || c>'9' ){
0 0 if( c<'0' || c>'9' ){
205090 0 0 int nCol = p ? p->nCol : 0; /* Num. columns already in colset object */
205097 0 0 if( pNew==0 ){
205102 0 0 for(i=0; i
205103 0 0 if( aiCol[i]==iCol ) return pNew;
205104 0 0 if( aiCol[i]>iCol ) break;
205106 0 0 for(j=nCol; j>i; j--){
205133 0 0 if( pRet ){
205136 0 0 for(i=0; i
205137 0 0 if( iOld>=p->nCol || p->aiCol[iOld]!=i ){
0 0 if( iOld>=p->nCol || p->aiCol[iOld]!=i ){
205159 0 0 if( pParse->rc==SQLITE_OK ){
205162 0 0 for(iCol=0; iColnCol; iCol++){
205163 0 0 if( 0==sqlite3_stricmp(pConfig->azCol[iCol], z) ) break;
205165 0 0 if( iCol==pConfig->nCol ){
205173 0 0 if( pRet==0 ){
205191 0 0 if( pOrig ){
205194 0 0 if( pRet ){
205211 0 0 while( iInnCol && iMergenCol ){
0 0 while( iInnCol && iMergenCol ){
205213 0 0 if( iDiff==0 ){
205217 0 0 }else if( iDiff>0 ){
205238 0 0 if( pParse->rc==SQLITE_OK ){
205243 0 0 if( pNode->eType==FTS5_STRING || pNode->eType==FTS5_TERM ){
0 0 if( pNode->eType==FTS5_STRING || pNode->eType==FTS5_TERM ){
205245 0 0 if( pNear->pColset ){
205247 0 0 if( pNear->pColset->nCol==0 ){
205251 0 0 }else if( *ppFree ){
205260 0 0 for(i=0; inChild; i++){
205276 0 0 if( pParse->pConfig->eDetail==FTS5_DETAIL_NONE ){
205291 0 0 if( pNear->nPhrase==1 && pNear->apPhrase[0]->nTerm==1
0 0 if( pNear->nPhrase==1 && pNear->apPhrase[0]->nTerm==1
205292 0 0 && pNear->apPhrase[0]->aTerm[0].pSynonym==0
205293 0 0 && pNear->apPhrase[0]->aTerm[0].bFirst==0
205321 0 0 if( p->eType!=FTS5_NOT && pSub->eType==p->eType ){
0 0 if( p->eType!=FTS5_NOT && pSub->eType==p->eType ){
205344 0 0 if( pParse->rc==SQLITE_OK ){
205351 0 0 if( eType==FTS5_STRING && pNear==0 ) return 0;
0 0 if( eType==FTS5_STRING && pNear==0 ) return 0;
205352 0 0 if( eType!=FTS5_STRING && pLeft==0 ) return pRight;
0 0 if( eType!=FTS5_STRING && pLeft==0 ) return pRight;
205353 0 0 if( eType!=FTS5_STRING && pRight==0 ) return pLeft;
0 0 if( eType!=FTS5_STRING && pRight==0 ) return pLeft;
205355 0 0 if( eType==FTS5_NOT ){
205357 0 0 }else if( eType==FTS5_AND || eType==FTS5_OR ){
0 0 }else if( eType==FTS5_AND || eType==FTS5_OR ){
205359 0 0 if( pLeft->eType==eType ) nChild += pLeft->nChild-1;
205360 0 0 if( pRight->eType==eType ) nChild += pRight->nChild-1;
205366 0 0 if( pRet ){
205370 0 0 if( eType==FTS5_STRING ){
205372 0 0 for(iPhrase=0; iPhrasenPhrase; iPhrase++){
205374 0 0 if( pNear->apPhrase[iPhrase]->nTerm==0 ){
205380 0 0 if( pParse->pConfig->eDetail!=FTS5_DETAIL_FULL ){
205382 0 0 if( pNear->nPhrase!=1
205383 0 0 || pPhrase->nTerm>1
205384 0 0 || (pPhrase->nTerm>0 && pPhrase->aTerm[0].bFirst)
0 0 || (pPhrase->nTerm>0 && pPhrase->aTerm[0].bFirst)
205389 0 0 pParse->zErr = sqlite3_mprintf(
205404 0 0 if( pRet==0 ){
205421 0 0 if( pParse->rc ){
205436 0 0 if( pLeft->eType==FTS5_AND ){
205446 0 0 if( pRight->eType==FTS5_EOF ){
205452 0 0 else if( pPrev->eType==FTS5_EOF ){
205455 0 0 if( pPrev==pLeft ){
205483 0 0 for(p=pTerm; p; p=p->pSynonym){
205488 0 0 if( zQuoted ){
205490 0 0 for(p=pTerm; p; p=p->pSynonym){
205493 0 0 while( *zIn ){
205494 0 0 if( *zIn=='"' ) zQuoted[i++] = '"';
205498 0 0 if( p->pSynonym ) zQuoted[i++] = '|';
205500 0 0 if( pTerm->bPrefix ){
205515 0 0 if( zApp && zNew ){
0 0 if( zApp && zNew ){
205536 0 0 if( pExpr->eType==FTS5_STRING || pExpr->eType==FTS5_TERM ){
0 0 if( pExpr->eType==FTS5_STRING || pExpr->eType==FTS5_TERM ){
205542 0 0 if( zRet==0 ) return 0;
205543 0 0 if( pNear->pColset ){
205546 0 0 if( nCol==1 ){
205550 0 0 for(i=1; ipColset->nCol; i++){
205555 0 0 if( zRet==0 ) return 0;
205558 0 0 if( pNear->nPhrase>1 ){
205560 0 0 if( zRet==0 ) return 0;
205564 0 0 if( zRet==0 ) return 0;
205566 0 0 for(i=0; inPhrase; i++){
205570 0 0 for(iTerm=0; zRet && iTermnTerm; iTerm++){
0 0 for(iTerm=0; zRet && iTermnTerm; iTerm++){
205572 0 0 zRet = fts5PrintfAppend(zRet, "%s%s", iTerm==0?"":" ", zTerm);
205573 0 0 if( pPhrase->aTerm[iTerm].bPrefix ){
205578 0 0 if( zRet ) zRet = fts5PrintfAppend(zRet, "}");
205579 0 0 if( zRet==0 ) return 0;
205595 0 0 for(i=0; zRet && inChild; i++){
0 0 for(i=0; zRet && inChild; i++){
205597 0 0 if( !z ){
205611 0 0 if( pExpr->eType==0 ){
205614 0 0 if( pExpr->eType==FTS5_STRING || pExpr->eType==FTS5_TERM ){
0 0 if( pExpr->eType==FTS5_STRING || pExpr->eType==FTS5_TERM ){
205619 0 0 if( pNear->pColset ){
205622 0 0 if( zRet==0 ) return 0;
205625 0 0 if( pNear->nPhrase>1 ){
205627 0 0 if( zRet==0 ) return 0;
205630 0 0 for(i=0; inPhrase; i++){
205632 0 0 if( i!=0 ){
205634 0 0 if( zRet==0 ) return 0;
205636 0 0 for(iTerm=0; iTermnTerm; iTerm++){
205638 0 0 if( zTerm ){
205639 0 0 zRet = fts5PrintfAppend(zRet, "%s%s", iTerm==0?"":" + ", zTerm);
205642 0 0 if( zTerm==0 || zRet==0 ){
0 0 if( zTerm==0 || zRet==0 ){
205649 0 0 if( pNear->nPhrase>1 ){
205651 0 0 if( zRet==0 ) return 0;
205667 0 0 for(i=0; inChild; i++){
205669 0 0 if( z==0 ){
205674 0 0 int b = (e!=FTS5_STRING && e!=FTS5_TERM && e!=FTS5_EOF);
0 0 int b = (e!=FTS5_STRING && e!=FTS5_TERM && e!=FTS5_EOF);
0 0 int b = (e!=FTS5_STRING && e!=FTS5_TERM && e!=FTS5_EOF);
205675 0 0 zRet = fts5PrintfAppend(zRet, "%s%s%z%s",
0 0 zRet = fts5PrintfAppend(zRet, "%s%s%z%s",
0 0 zRet = fts5PrintfAppend(zRet, "%s%s%z%s",
205680 0 0 if( zRet==0 ) break;
205711 0 0 if( nArg<1 ){
205712 0 0 zErr = sqlite3_mprintf("wrong number of arguments to function %s",
205720 0 0 if( bTcl && nArg>1 ){
0 0 if( bTcl && nArg>1 ){
205727 0 0 if( azConfig==0 ){
205734 0 0 for(i=3; iArg
205741 0 0 if( rc==SQLITE_OK ){
205744 0 0 if( rc==SQLITE_OK ){
205746 0 0 if( pExpr->pRoot->xNext==0 ){
205748 0 0 }else if( bTcl ){
205753 0 0 if( zText==0 ){
205761 0 0 if( rc!=SQLITE_OK ){
205762 0 0 if( zErr ){
205801 0 0 if( nArg!=1 ){
205820 0 0 if( nArg!=1 && nArg!=2 ){
0 0 if( nArg!=1 && nArg!=2 ){
205828 0 0 if( nArg==2 ) bRemoveDiacritics = sqlite3_value_int(apVal[1]);
205851 1255 0 for(i=0; rc==SQLITE_OK && i
1004 251 for(i=0; rc==SQLITE_OK && i
205870 0 0 return (pExpr ? pExpr->nPhrase : 0);
205877 0 0 if( iPhrase<0 || iPhrase>=pExpr->nPhrase ) return 0;
0 0 if( iPhrase<0 || iPhrase>=pExpr->nPhrase ) return 0;
205889 0 0 if( pNode->bEof==0 && pNode->iRowid==pExpr->pRoot->iRowid ){
0 0 if( pNode->bEof==0 && pNode->iRowid==pExpr->pRoot->iRowid ){
205908 0 0 if( pRet ){
205911 0 0 for(i=0; inPhrase; i++){
205915 0 0 if( bLive &&
0 0 if( bLive &&
205916 0 0 (pBuf->n==0 || pNode->iRowid!=pExpr->pRoot->iRowid || pNode->bEof)
0 0 (pBuf->n==0 || pNode->iRowid!=pExpr->pRoot->iRowid || pNode->bEof)
205939 0 0 for(i=0; inCol; i++){
205940 0 0 if( pColset->aiCol[i]==iCol ) return 1;
205959 0 0 if( nToken>FTS5_MAX_TOKEN_SIZE ) nToken = FTS5_MAX_TOKEN_SIZE;
205960 0 0 if( (tflags & FTS5_TOKEN_COLOCATED)==0 ) p->iOff++;
205961 0 0 for(i=0; inPhrase; i++){
205963 0 0 if( p->aPopulator[i].bOk==0 ) continue;
205964 0 0 for(pTerm=&pExpr->apExprPhrase[i]->aTerm[0]; pTerm; pTerm=pTerm->pSynonym){
205966 0 0 if( (nTerm==nToken || (nTermbPrefix))
0 0 if( (nTerm==nToken || (nTermbPrefix))
0 0 if( (nTerm==nToken || (nTermbPrefix))
205967 0 0 && memcmp(pTerm->zTerm, pToken, nTerm)==0
205972 0 0 if( rc ) return rc;
205993 0 0 for(i=0; inPhrase; i++){
205996 0 0 if( (pColset && 0==fts5ExprColsetTest(pColset, iCol))
0 0 if( (pColset && 0==fts5ExprColsetTest(pColset, iCol))
205997 0 0 || aPopulator[i].bMiss
206011 0 0 if( pNode->eType==FTS5_TERM || pNode->eType==FTS5_STRING ){
0 0 if( pNode->eType==FTS5_TERM || pNode->eType==FTS5_STRING ){
206015 0 0 for(i=0; inChild; i++){
206031 0 0 for(i=0; inChild; i++){
206032 0 0 if( fts5ExprCheckPoslists(pNode->apChild[i], iRowid)==0 ){
206043 0 0 for(i=0; inChild; i++){
206044 0 0 if( fts5ExprCheckPoslists(pNode->apChild[i], iRowid) ){
206053 0 0 if( 0==fts5ExprCheckPoslists(pNode->apChild[0], iRowid)
206054 0 0 || 0!=fts5ExprCheckPoslists(pNode->apChild[1], iRowid)
206085 0 0 if( pNode->bEof==0
206086 0 0 && pNode->iRowid==pExpr->pRoot->iRowid
206087 0 0 && pPhrase->poslist.n>0
206090 0 0 if( pTerm->pSynonym ){
206197 0 0 if( pNew==0 ){
206208 0 0 if( pNew->aSlot==0 ){
206223 0 0 if( pHash ){
206235 0 0 for(i=0; inSlot; i++){
206238 0 0 for(pSlot=pHash->aSlot[i]; pSlot; pSlot=pNext){
206250 0 0 for(i=n-1; i>=0; i--){
206259 0 0 for(i=n-1; i>=0; i--){
206276 0 0 if( !apNew ) return SQLITE_NOMEM;
206279 0 0 for(i=0; inSlot; i++){
206280 0 0 while( apOld[i] ){
206298 0 0 if( p->iSzPoslist ){
206300 0 0 if( pHash->eDetail==FTS5_DETAIL_NONE ){
206302 0 0 if( p->bDel ){
206304 0 0 if( p->bContent ){
206313 0 0 if( nPos<=127 ){
206355 0 0 for(p=pHash->aSlot[iHash]; p; p=p->pHashNext){
206357 0 0 if( zKey[0]==bByte
206358 0 0 && p->nKey==nToken
206359 0 0 && memcmp(&zKey[1], pToken, nToken)==0
206366 0 0 if( p==0 ){
206370 0 0 if( nByte<128 ) nByte = 128;
206373 0 0 if( (pHash->nEntry*2)>=pHash->nSlot ){
206375 0 0 if( rc!=SQLITE_OK ) return rc;
206381 0 0 if( !p ) return SQLITE_NOMEM;
206400 0 0 if( pHash->eDetail!=FTS5_DETAIL_NONE ){
206402 0 0 p->iCol = (pHash->eDetail==FTS5_DETAIL_FULL ? 0 : -1);
206418 0 0 if( (p->nAlloc - p->nData) < (9 + 4 + 1 + 3 + 5) ){
206423 0 0 if( pNew==0 ) return SQLITE_NOMEM;
206425 0 0 for(pp=&pHash->aSlot[iHash]; *pp!=p; pp=&(*pp)->pHashNext);
206437 0 0 if( iRowid!=p->iRowid ){
206443 0 0 if( pHash->eDetail!=FTS5_DETAIL_NONE ){
206445 0 0 p->iCol = (pHash->eDetail==FTS5_DETAIL_FULL ? 0 : -1);
206450 0 0 if( iCol>=0 ){
206451 0 0 if( pHash->eDetail==FTS5_DETAIL_NONE ){
206456 0 0 if( iCol!=p->iCol ){
206457 0 0 if( pHash->eDetail==FTS5_DETAIL_FULL ){
206469 0 0 if( bNew ){
206499 0 0 while( p1 || p2 ){
0 0 while( p1 || p2 ){
206500 0 0 if( p1==0 ){
206503 0 0 }else if( p2==0 ){
206510 0 0 while( zKey1[i]==zKey2[i] ) i++;
206512 0 0 if( ((u8)zKey1[i])>((u8)zKey2[i]) ){
206549 0 0 if( !ap ) return SQLITE_NOMEM;
206552 0 0 for(iSlot=0; iSlotnSlot; iSlot++){
206554 0 0 for(pIter=pHash->aSlot[iSlot]; pIter; pIter=pIter->pHashNext){
206555 0 0 if( pTerm==0 || 0==memcmp(fts5EntryKey(pIter), pTerm, nTerm) ){
0 0 if( pTerm==0 || 0==memcmp(fts5EntryKey(pIter), pTerm, nTerm) ){
206558 0 0 for(i=0; ap[i]; i++){
206568 0 0 for(i=0; i
206591 0 0 for(p=pHash->aSlot[iHash]; p; p=p->pHashNext){
206593 0 0 if( memcmp(zKey, pTerm, nTerm)==0 && zKey[nTerm]==0 ) break;
0 0 if( memcmp(zKey, pTerm, nTerm)==0 && zKey[nTerm]==0 ) break;
206596 0 0 if( p ){
206631 0 0 if( (p = pHash->pScan) ){
207256 0 0 return (res==0 ? (pLeft->n - pRight->n) : res);
207269 0 0 if( p->pReader ){
207284 0 0 if( p->rc==SQLITE_OK ){
207287 0 0 if( p->pReader ){
207296 0 0 if( rc!=SQLITE_OK ){
207299 0 0 if( rc==SQLITE_ABORT ) rc = SQLITE_OK;
207304 0 0 if( p->pReader==0 && rc==SQLITE_OK ){
0 0 if( p->pReader==0 && rc==SQLITE_OK ){
207316 0 0 if( rc==SQLITE_ERROR ) rc = FTS5_CORRUPT;
207318 0 0 if( rc==SQLITE_OK ){
207323 0 0 if( pRet ){
207330 0 0 if( rc==SQLITE_OK ){
207333 0 0 if( rc!=SQLITE_OK ){
207359 0 0 if( pRet ){
207360 0 0 if( pRet->szLeaf>pRet->nn ){
207374 0 0 if( p->rc==SQLITE_OK ){
207375 0 0 if( zSql ){
207391 0 0 if( p->rc!=SQLITE_OK ) return;
207393 0 0 if( p->pWriter==0 ){
207399 0 0 if( p->rc ) return;
207415 0 0 if( p->rc!=SQLITE_OK ) return;
207417 0 0 if( p->pDeleter==0 ){
207424 0 0 if( zSql==0 ){
207431 0 0 if( rc!=SQLITE_OK ){
207450 0 0 if( p->pIdxDeleter==0 ){
207457 0 0 if( p->rc==SQLITE_OK ){
207469 0 0 if( pStruct && 0>=(--pStruct->nRef) ){
0 0 if( pStruct && 0>=(--pStruct->nRef) ){
207472 0 0 for(i=0; inLevel; i++){
207510 0 0 if( piCookie ) *piCookie = sqlite3Fts5Get32(pData);
207523 0 0 if( pRet ){
207529 0 0 for(iLvl=0; rc==SQLITE_OK && iLvl
0 0 for(iLvl=0; rc==SQLITE_OK && iLvl
207534 0 0 if( i>=nData ){
207545 0 0 if( rc==SQLITE_OK ){
207547 0 0 for(iSeg=0; iSeg
207548 0 0 if( i>=nData ){
207558 0 0 if( rc!=SQLITE_OK ){
207572 0 0 if( *pRc==SQLITE_OK ){
207581 0 0 if( pStruct ){
207602 0 0 if( *pRc==SQLITE_OK ){
207609 0 0 if( aNew ){
207610 0 0 if( bInsert==0 ){
207631 0 0 if( p->rc==SQLITE_OK ){
207635 0 0 if( p->rc==SQLITE_OK && pConfig->iCookie!=iCookie ){
0 0 if( p->rc==SQLITE_OK && pConfig->iCookie!=iCookie ){
207639 0 0 if( p->rc!=SQLITE_OK ){
207651 0 0 if( p->rc==SQLITE_OK ){
207652 0 0 if( p->pDataVersion==0 ){
207656 0 0 if( p->rc ) return 0;
207659 0 0 if( SQLITE_ROW==sqlite3_step(p->pDataVersion) ){
207681 0 0 if( p->pStruct==0 ){
207683 0 0 if( p->rc==SQLITE_OK ){
207711 0 0 if( p->rc!=SQLITE_OK ) return 0;
207719 0 0 if( p->pStruct ){
207762 0 0 if( p->rc==SQLITE_OK ){
207772 0 0 if( iCookie<0 ) iCookie = 0;
207774 0 0 if( 0==sqlite3Fts5BufferSize(&p->rc, &buf, 4+9+9+9) ){
207782 0 0 for(iLvl=0; iLvlnLevel; iLvl++){
207789 0 0 for(iSeg=0; iSegnSeg; iSeg++){
207834 0 0 if( pOut->nMerge==0 ){
207835 0 0 for(il=iPromote+1; ilnLevel; il++){
207837 0 0 if( pLvl->nMerge ) return;
207838 0 0 for(is=pLvl->nSeg-1; is>=0; is--){
207840 0 0 if( sz>szPromote ) return;
207842 0 0 if( p->rc ) return;
207873 0 0 if( p->rc==SQLITE_OK ){
207881 0 0 if( nSeg==0 ) return;
207886 0 0 for(iTst=iLvl-1; iTst>=0 && pStruct->aLevel[iTst].nSeg==0; iTst--);
0 0 for(iTst=iLvl-1; iTst>=0 && pStruct->aLevel[iTst].nSeg==0; iTst--);
207887 0 0 if( iTst>=0 ){
207892 0 0 for(i=0; inSeg; i++){
207894 0 0 if( sz>szMax ) szMax = sz;
207896 0 0 if( szMax>=szSeg ){
207906 0 0 if( iPromote<0 ){
207922 0 0 if( pLvl->iOff==0 ){
207930 0 0 for(iOff=pLvl->iOff; iOffnn; iOff++){
207931 0 0 if( pData->p[iOff] ) break;
207934 0 0 if( iOffnn ){
207955 0 0 if( fts5DlidxLvlNext(pLvl) ){
207956 0 0 if( (iLvl+1) < pIter->nLvl ){
207958 0 0 if( pLvl[1].bEof==0 ){
207964 0 0 if( pLvl->pData ) fts5DlidxLvlNext(pLvl);
207988 0 0 for(i=0; inLvl; i++){
207996 0 0 return p->rc!=SQLITE_OK || pIter->aLvl[0].bEof;
0 0 return p->rc!=SQLITE_OK || pIter->aLvl[0].bEof;
208003 0 0 for(i=pIter->nLvl-1; p->rc==SQLITE_OK && i>=0; i--){
0 0 for(i=pIter->nLvl-1; p->rc==SQLITE_OK && i>=0; i--){
208005 0 0 while( fts5DlidxLvlNext(pLvl)==0 );
208008 0 0 if( i>0 ){
208026 0 0 if( iOff<=pLvl->iFirstOff ){
208039 0 0 iLimit = (iOff>9 ? iOff-9 : 0);
208040 0 0 for(iOff--; iOff>iLimit; iOff--){
208041 0 0 if( (a[iOff-1] & 0x80)==0 ) break;
208049 0 0 for(ii=iOff-1; ii>=pLvl->iFirstOff && a[ii]==0x00; ii--){
0 0 for(ii=iOff-1; ii>=pLvl->iFirstOff && a[ii]==0x00; ii--){
208052 0 0 if( ii>=pLvl->iFirstOff && (a[ii] & 0x80) ){
0 0 if( ii>=pLvl->iFirstOff && (a[ii] & 0x80) ){
208057 0 0 if( (ii-8)>=pLvl->iFirstOff ){
208059 0 0 for(j=1; j<=8 && (a[ii-j] & 0x80); j++);
0 0 for(j=1; j<=8 && (a[ii-j] & 0x80); j++);
208062 0 0 if( bZero==0 ) nZero--;
208075 0 0 if( fts5DlidxLvlPrev(pLvl) ){
208076 0 0 if( (iLvl+1) < pIter->nLvl ){
208078 0 0 if( pLvl[1].bEof==0 ){
208084 0 0 if( pLvl->pData ){
208085 0 0 while( fts5DlidxLvlNext(pLvl)==0 );
208102 0 0 if( pIter ){
208104 0 0 for(i=0; inLvl; i++){
208121 0 0 for(i=0; p->rc==SQLITE_OK && bDone==0; i++){
0 0 for(i=0; p->rc==SQLITE_OK && bDone==0; i++){
208126 0 0 if( pNew==0 ){
208134 0 0 if( pLvl->pData && (pLvl->pData->p[0] & 0x0001)==0 ){
0 0 if( pLvl->pData && (pLvl->pData->p[0] & 0x0001)==0 ){
208141 0 0 if( p->rc==SQLITE_OK ){
208143 0 0 if( bRev==0 ){
208150 0 0 if( p->rc!=SQLITE_OK ){
208176 0 0 if( pIter->pNextLeaf ){
208179 0 0 }else if( pIter->iLeafPgno<=pSeg->pgnoLast ){
208188 0 0 if( pLeaf ){
208190 0 0 if( fts5LeafIsTermless(pLeaf) ){
208209 0 0 fts5FastGetVarint32(p, n, nSz);
208228 0 0 if( p->rc==SQLITE_OK ){
208231 0 0 if( p->pConfig->eDetail==FTS5_DETAIL_NONE ){
208235 0 0 if( iOffpLeaf->p[iOff]==0 ){
0 0 if( iOffpLeaf->p[iOff]==0 ){
208238 0 0 if( iOffpLeaf->p[iOff]==0 ){
0 0 if( iOffpLeaf->p[iOff]==0 ){
208247 0 0 fts5FastGetVarint32(pIter->pLeaf->p, iOff, nSz);
208261 0 0 if( iOff>=pIter->pLeaf->szLeaf ){
208263 0 0 if( pIter->pLeaf==0 ){
208264 0 0 if( p->rc==SQLITE_OK ) p->rc = FTS5_CORRUPT;
208295 0 0 if( iOff+nNew>pIter->pLeaf->nn ){
208306 0 0 if( pIter->iPgidxOff>=pIter->pLeaf->nn ){
208322 0 0 if( pIter->flags & FTS5_SEGITER_REVERSE ){
208324 0 0 }else if( p->pConfig->eDetail==FTS5_DETAIL_NONE ){
208344 0 0 if( pSeg->pgnoFirst==0 ){
208354 0 0 if( p->rc==SQLITE_OK ){
208362 0 0 if( p->rc==SQLITE_OK ){
208394 0 0 if( n>pIter->iEndofDoclist ){
208402 0 0 if( eDetail==FTS5_DETAIL_NONE ){
208404 0 0 if( i
0 0 if( i
208406 0 0 if( i
0 0 if( i
208414 0 0 if( i>=n ) break;
208419 0 0 if( iRowidOffset>=pIter->nRowidOffset ){
208422 0 0 if( aNew==0 ){
208446 0 0 while( p->rc==SQLITE_OK && pIter->iLeafPgno>pIter->iTermLeafPgno ){
0 0 while( p->rc==SQLITE_OK && pIter->iLeafPgno>pIter->iTermLeafPgno ){
208452 0 0 if( pNew ){
208456 0 0 if( pIter->iLeafPgno==pIter->iTermLeafPgno ){
208458 0 0 if( pIter->iTermLeafOffsetszLeaf ){
208465 0 0 if( iRowidOff ){
208471 0 0 if( pIter->pLeaf ){
208481 0 0 if( pIter->pLeaf ){
208494 0 0 return (p->rc==SQLITE_OK && pSeg->pLeaf && pSeg->nPos==0);
0 0 return (p->rc==SQLITE_OK && pSeg->pLeaf && pSeg->nPos==0);
0 0 return (p->rc==SQLITE_OK && pSeg->pLeaf && pSeg->nPos==0);
208511 0 0 if( pIter->iRowidOffset>0 ){
208520 0 0 if( p->pConfig->eDetail!=FTS5_DETAIL_NONE ){
208551 0 0 if( pIter->pSeg && iOff>=pIter->pLeaf->szLeaf ){
0 0 if( pIter->pSeg && iOff>=pIter->pLeaf->szLeaf ){
208553 0 0 if( p->rc || pIter->pLeaf==0 ) return;
0 0 if( p->rc || pIter->pLeaf==0 ) return;
208558 0 0 if( iOffiEndofDoclist ){
208564 0 0 }else if( (pIter->flags & FTS5_SEGITER_ONETERM)==0 ){
208565 0 0 if( pIter->pSeg ){
208567 0 0 if( iOff!=fts5LeafFirstTermOff(pIter->pLeaf) ){
208578 0 0 if( pList==0 ) goto next_none_eof;
208587 0 0 if( pbNewTerm ) *pbNewTerm = 1;
208630 0 0 if( iOff
208633 0 0 if( iOff>=pIter->iEndofDoclist ){
208635 0 0 if( iOff!=fts5LeafFirstTermOff(pLeaf) ){
208646 0 0 }else if( pIter->pSeg==0 ){
208651 0 0 if( 0==(pIter->flags & FTS5_SEGITER_ONETERM) ){
208655 0 0 if( pList==0 ){
208671 0 0 while( iOff==0 ){
208674 0 0 if( pLeaf==0 ) break;
208676 0 0 if( (iOff = fts5LeafFirstRowidOff(pLeaf)) && iOffszLeaf ){
0 0 if( (iOff = fts5LeafFirstRowidOff(pLeaf)) && iOffszLeaf ){
208680 0 0 if( pLeaf->nn>pLeaf->szLeaf ){
208686 0 0 else if( pLeaf->nn>pLeaf->szLeaf ){
208695 0 0 if( iOff>pLeaf->szLeaf ){
208703 0 0 if( pIter->pLeaf ){
208704 0 0 if( bNewTerm ){
208705 0 0 if( pIter->flags & FTS5_SEGITER_ONETERM ){
208711 0 0 if( pbNewTerm ) *pbNewTerm = 1;
208724 0 0 fts5FastGetVarint32(pIter->pLeaf->p, pIter->iLeafOffset, nSz);
208749 0 0 if( pDlidx ){
208760 0 0 if( pIter->iTermLeafPgno==pIter->iLeafPgno ){
208765 0 0 fts5IndexSkipVarint(pLeaf->p, iPoslist);
0 0 fts5IndexSkipVarint(pLeaf->p, iPoslist);
208771 0 0 if( pIter->iEndofDoclist>=pLeaf->szLeaf ){
208777 0 0 for(pgno=pIter->iLeafPgno+1; !p->rc && pgno<=pSeg->pgnoLast; pgno++){
0 0 for(pgno=pIter->iLeafPgno+1; !p->rc && pgno<=pSeg->pgnoLast; pgno++){
208780 0 0 if( pNew ){
208784 0 0 if( iRowid ){
208789 0 0 if( bTermless==0 ) break;
208804 0 0 if( pLast ){
208813 0 0 if( fts5LeafIsTermless(pLast) ){
208841 0 0 if( pIter->iTermLeafPgno==pIter->iLeafPgno
208842 0 0 && pIter->iEndofDoclistszLeaf
208887 0 0 if( iOff>n ){
208895 0 0 fts5FastGetVarint32(a, iOff, nNew);
208896 0 0 if( nKeep
208901 0 0 if( nKeep==nMatch ){
208905 0 0 for(i=0; i
208906 0 0 if( a[iOff+i]!=pTerm[nMatch+i] ) break;
208910 0 0 if( nTerm==nMatch ){
208911 0 0 if( i==nNew ){
208916 0 0 }else if( ipTerm[nMatch] ){
0 0 }else if( ipTerm[nMatch] ){
208921 0 0 if( iPgidx>=n ){
208930 0 0 if( iOff>=n ){
208936 0 0 fts5FastGetVarint32(a, iOff, nKeep);
208940 0 0 if( bGe==0 ){
208944 0 0 }else if( bEndOfPage ){
208947 0 0 if( pIter->pLeaf==0 ) return;
208949 0 0 if( fts5LeafIsTermless(pIter->pLeaf)==0 ){
208952 0 0 if( iOff<4 || iOff>=pIter->pLeaf->szLeaf ){
0 0 if( iOff<4 || iOff>=pIter->pLeaf->szLeaf ){
208974 0 0 if( iPgidx>=n ){
208988 0 0 if( p->pIdxSelect==0 ){
209026 0 0 if( p->rc ) return;
209029 0 0 if( SQLITE_ROW==sqlite3_step(pIdxSelect) ){
209037 0 0 if( iPgpgnoFirst ){
209045 0 0 if( pIter->pLeaf ){
209049 0 0 if( p->rc==SQLITE_OK && bGe==0 ){
0 0 if( p->rc==SQLITE_OK && bGe==0 ){
209051 0 0 if( pIter->pLeaf ){
209052 0 0 if( flags & FTS5INDEX_QUERY_DESC ){
209055 0 0 if( bDlidx ){
209058 0 0 if( flags & FTS5INDEX_QUERY_DESC ){
209103 0 0 if( pTerm==0 || (flags & FTS5INDEX_QUERY_SCAN) ){
0 0 if( pTerm==0 || (flags & FTS5INDEX_QUERY_SCAN) ){
209106 0 0 n = (z ? (int)strlen((const char*)z) : 0);
209114 0 0 if( pList ){
209118 0 0 if( pLeaf==0 ) return;
209125 0 0 if( flags & FTS5INDEX_QUERY_DESC ){
209254 0 0 if( iOut>=(pIter->nSeg/2) ){
209265 0 0 if( p1->pLeaf==0 ){ /* If p1 is at EOF */
209267 0 0 }else if( p2->pLeaf==0 ){ /* If p2 is at EOF */
209271 0 0 if( res==0 ){
209275 0 0 if( p1->iRowid==p2->iRowid ){
209279 0 0 res = ((p1->iRowid > p2->iRowid)==pIter->bRev) ? -1 : +1;
209282 0 0 if( res<0 ){
209304 0 0 if( iLeafPgno>pIter->pSeg->pgnoLast ){
209313 0 0 if( p->rc==SQLITE_OK ){
209319 0 0 if( iOff<4 || iOff>=n ){
0 0 if( iOff<4 || iOff>=n ){
209349 0 0 if( bRev==0 ){
209350 0 0 while( !fts5DlidxIterEof(p, pDlidx) && iMatch>fts5DlidxIterRowid(pDlidx) ){
0 0 while( !fts5DlidxIterEof(p, pDlidx) && iMatch>fts5DlidxIterRowid(pDlidx) ){
209355 0 0 if( iLeafPgno>pIter->iLeafPgno ){
209362 0 0 while( !fts5DlidxIterEof(p, pDlidx) && iMatch
0 0 while( !fts5DlidxIterEof(p, pDlidx) && iMatch
209369 0 0 if( iLeafPgnoiLeafPgno ){
209377 0 0 if( bMove && p->rc==SQLITE_OK ) pIter->xNext(p, pIter, 0);
0 0 if( bMove && p->rc==SQLITE_OK ) pIter->xNext(p, pIter, 0);
209378 0 0 if( pIter->pLeaf==0 ) break;
209379 0 0 if( bRev==0 && pIter->iRowid>=iMatch ) break;
0 0 if( bRev==0 && pIter->iRowid>=iMatch ) break;
209380 0 0 if( bRev!=0 && pIter->iRowid<=iMatch ) break;
0 0 if( bRev!=0 && pIter->iRowid<=iMatch ) break;
209382 0 0 }while( p->rc==SQLITE_OK );
209390 0 0 if( pIter ){
209392 0 0 for(i=0; inSeg; i++){
209408 0 0 for(i=(pIter->nSeg+iChanged)/2; i>=iMinset && p->rc==SQLITE_OK; i=i/2){
0 0 for(i=(pIter->nSeg+iChanged)/2; i>=iMinset && p->rc==SQLITE_OK; i=i/2){
209410 0 0 if( (iEq = fts5MultiIterDoCompare(pIter, i)) ){
209436 0 0 if( pNew->iRowid==pIter->iSwitchRowid
209437 0 0 || (pNew->iRowidiSwitchRowid)==pIter->bRev
209441 0 0 pIter->iSwitchRowid = pIter->bRev ? SMALLEST_INT64 : LARGEST_INT64;
209448 0 0 if( pRes->bTermEq ){
209449 0 0 if( pNew->iRowid==pOther->iRowid ){
209451 0 0 }else if( (pOther->iRowid>pNew->iRowid)==pIter->bRev ){
209454 0 0 }else if( (pOther->iRowid>pIter->iSwitchRowid)==pIter->bRev ){
209459 0 0 if( i==1 ) break;
209493 0 0 while( p->rc==SQLITE_OK ){
209498 0 0 if( bUseFrom && pSeg->pDlidx ){
0 0 if( bUseFrom && pSeg->pDlidx ){
209504 0 0 if( pSeg->pLeaf==0 || bNewTerm
0 0 if( pSeg->pLeaf==0 || bNewTerm
209505 0 0 || fts5MultiIterAdvanceRowid(pIter, iFirst, &pSeg)
209510 0 0 if( pSeg->pLeaf==0 ) return;
209515 0 0 if( pIter->bSkipEmpty==0 || pSeg->nPos ){
0 0 if( pIter->bSkipEmpty==0 || pSeg->nPos ){
209529 0 0 if( p->rc==SQLITE_OK ){
209538 0 0 if( pSeg->pLeaf==0 || bNewTerm
0 0 if( pSeg->pLeaf==0 || bNewTerm
209539 0 0 || fts5MultiIterAdvanceRowid(pIter, iFirst, &pSeg)
209547 0 0 }while( fts5MultiIterIsEmpty(p, pIter) );
209562 0 0 for(nSlot=2; nSlot
209568 0 0 if( pNew ){
209584 0 0 if( nChunk>0 ){
209609 0 0 for(i=0; inCol; i++){
209610 0 0 if( pColset->aiCol[i]==iCol ) return 1;
209623 0 0 if( nChunk>0 ){
209625 0 0 while( i
209630 0 0 if( fts5IndexColsetTest(pCtx->pColset, iVal) ){
209646 0 0 if( nChunk>0 ){
209652 0 0 if( pCtx->eState==2 ){
209654 0 0 fts5FastGetVarint32(pChunk, i, iCol);
209655 0 0 if( fts5IndexColsetTest(pCtx->pColset, iCol) ){
209664 0 0 while( i
0 0 while( i
209665 0 0 while( pChunk[i] & 0x80 ) i++;
209668 0 0 if( pCtx->eState ){
209671 0 0 if( i
209675 0 0 if( i>=nChunk ){
209678 0 0 fts5FastGetVarint32(pChunk, i, iCol);
209680 0 0 if( pCtx->eState ){
209686 0 0 }while( i
209706 0 0 if( (pSeg->flags & FTS5_SEGITER_REVERSE)==0 ){
209714 0 0 if( nRem<=0 ){
209719 0 0 if( pData==0 ) break;
209722 0 0 if( pgno==pgnoSave ){
209743 0 0 if( 0==fts5BufferGrow(&p->rc, pBuf, pSeg->nPos) ){
0 0 if( 0==fts5BufferGrow(&p->rc, pBuf, pSeg->nPos) ){
209744 0 0 if( pColset==0 ){
209747 0 0 if( p->pConfig->eDetail==FTS5_DETAIL_FULL ){
209781 0 0 while( iCol>iCurrent ){
209787 0 0 while( *p!=0x01 ){
209788 0 0 while( *p++ & 0x80 );
209789 0 0 if( p>=pEnd ) return 0;
209793 0 0 if( iCurrent & 0x80 ){
209798 0 0 if( iCol!=iCurrent ) return 0;
209802 0 0 while( p
0 0 while( p
209803 0 0 while( *p++ & 0x80 );
209815 0 0 if( *pRc==SQLITE_OK ){
209818 0 0 for(i=0; inCol; i++){
209821 0 0 if( nSub ){
209848 0 0 if( pSeg->iLeafOffset+pSeg->nPos<=pSeg->pLeaf->szLeaf ){
209899 0 0 if( pSeg->iLeafOffset+pSeg->nPos>pSeg->pLeaf->szLeaf ){
209913 0 0 while( a
209915 0 0 while( *aiCol
209917 0 0 if( aiCol==aiColEnd ) goto setoutputs_col_out;
209919 0 0 if( *aiCol==iPrev ){
209941 0 0 if( pSeg->iLeafOffset+pSeg->nPos<=pSeg->pLeaf->szLeaf ){
209945 0 0 if( pColset->nCol==1 ){
209967 0 0 if( *pRc==SQLITE_OK ){
209969 0 0 if( pConfig->eDetail==FTS5_DETAIL_NONE ){
209973 0 0 else if( pIter->pColset==0 ){
209977 0 0 else if( pIter->pColset->nCol==0 ){
209981 0 0 else if( pConfig->eDetail==FTS5_DETAIL_FULL ){
209987 0 0 if( pConfig->nCol<=100 ){
210028 0 0 if( p->rc==SQLITE_OK ){
210029 0 0 if( iLevel<0 ){
210038 0 0 if( pNew==0 ) return;
210044 0 0 if( (flags & FTS5INDEX_QUERY_NOOUTPUT)==0 ){
210049 0 0 if( p->rc==SQLITE_OK ){
210050 0 0 if( iLevel<0 ){
210052 0 0 if( p->pHash ){
210057 0 0 for(pLvl=&pStruct->aLevel[0]; pLvl
210058 0 0 for(iSeg=pLvl->nSeg-1; iSeg>=0; iSeg--){
210061 0 0 if( pTerm==0 ){
210070 0 0 for(iSeg=nSeg-1; iSeg>=0; iSeg--){
210081 0 0 if( p->rc==SQLITE_OK ){
210082 0 0 for(iIter=pNew->nSeg-1; iIter>0; iIter--){
210084 0 0 if( (iEq = fts5MultiIterDoCompare(pNew, iIter)) ){
210086 0 0 if( p->rc==SQLITE_OK ) pSeg->xNext(p, pSeg, 0);
210093 0 0 if( pNew->bSkipEmpty && fts5MultiIterIsEmpty(p, pNew) ){
0 0 if( pNew->bSkipEmpty && fts5MultiIterIsEmpty(p, pNew) ){
210095 0 0 }else if( pNew->base.bEof==0 ){
210118 0 0 if( pNew ){
210122 0 0 if( pData->szLeaf>0 ){
210127 0 0 if( bDesc ){
210154 0 0 return (p->rc || pIter->base.bEof);
0 0 return (p->rc || pIter->base.bEof);
210178 0 0 if( fts5MultiIterEof(p, pIter) ) break;
210180 0 0 if( pIter->bRev==0 && iRowid>=iMatch ) break;
0 0 if( pIter->bRev==0 && iRowid>=iMatch ) break;
210181 0 0 if( pIter->bRev!=0 && iRowid<=iMatch ) break;
0 0 if( pIter->bRev!=0 && iRowid<=iMatch ) break;
210207 0 0 if( p->rc==SQLITE_OK ){
210208 0 0 if( pStruct->nSegment>=FTS5_MAX_SEGMENT ){
210218 0 0 for(iLvl=0; iLvlnLevel; iLvl++){
210219 0 0 for(iSeg=0; iSegaLevel[iLvl].nSeg; iSeg++){
210221 0 0 if( iId<=FTS5_MAX_SEGMENT ){
210227 0 0 for(i=0; aUsed[i]==0xFFFFFFFF; i++);
210229 0 0 for(iSegid=0; mask & (1 << iSegid); iSegid++);
210263 0 0 if( p->pHash ){
210278 0 0 for(i=0; i
210279 0 0 if( pOld[i]!=pNew[i] ) break;
210291 0 0 for(i=0; inDlidx; i++){
210293 0 0 if( pDlidx->buf.n==0 ) break;
210294 0 0 if( bFlush ){
210315 0 0 if( p->rc==SQLITE_OK && nLvl>=pWriter->nDlidx ){
0 0 if( p->rc==SQLITE_OK && nLvl>=pWriter->nDlidx ){
210319 0 0 if( aDlidx==0 ){
210341 0 0 if( pWriter->aDlidx[0].buf.n>0 && pWriter->nEmpty>=FTS5_MIN_DLIDX_SIZE ){
0 0 if( pWriter->aDlidx[0].buf.n>0 && pWriter->nEmpty>=FTS5_MIN_DLIDX_SIZE ){
210364 0 0 if( pWriter->iBtPage==0 ) return;
210367 0 0 if( p->rc==SQLITE_OK ){
210368 0 0 const char *z = (pWriter->btterm.n>0?(const char*)pWriter->btterm.p:"");
210409 0 0 if( pWriter->bFirstRowidInPage && pWriter->aDlidx[0].buf.n>0 ){
0 0 if( pWriter->bFirstRowidInPage && pWriter->aDlidx[0].buf.n>0 ){
210441 0 0 for(i=0; p->rc==SQLITE_OK && bDone==0; i++){
0 0 for(i=0; p->rc==SQLITE_OK && bDone==0; i++){
210445 0 0 if( pDlidx->buf.n>=p->pConfig->pgsz ){
210458 0 0 if( p->rc==SQLITE_OK && pDlidx[1].buf.n==0 ){
0 0 if( p->rc==SQLITE_OK && pDlidx[1].buf.n==0 ){
210477 0 0 if( pDlidx->bPrevValid ){
210480 0 0 i64 iPgno = (i==0 ? pWriter->writer.pgno : pDlidx[-1].pgno);
210504 0 0 if( pWriter->bFirstTermInPage ){
210553 0 0 if( (pPage->buf.n + pPgidx->n + nTerm + 2)>=p->pConfig->pgsz ){
210554 0 0 if( pPage->buf.n>4 ){
210557 0 0 fts5BufferGrow(&p->rc, &pPage->buf, nTerm+FTS5_DATA_PADDING);
210570 0 0 if( pWriter->bFirstTermInPage ){
210572 0 0 if( pPage->pgno!=1 ){
210587 0 0 if( pPage->term.n ){
210622 0 0 if( p->rc==SQLITE_OK ){
210625 0 0 if( (pPage->buf.n + pPage->pgidx.n)>=p->pConfig->pgsz ){
210632 0 0 if( pWriter->bFirstRowidInPage ){
210638 0 0 if( pWriter->bFirstRowidInDoclist || pWriter->bFirstRowidInPage ){
0 0 if( pWriter->bFirstRowidInDoclist || pWriter->bFirstRowidInPage ){
210661 0 0 while( p->rc==SQLITE_OK
210662 0 0 && (pPage->buf.n + pPage->pgidx.n + n)>=p->pConfig->pgsz
210666 0 0 while( nCopy
210675 0 0 if( n>0 ){
210691 0 0 if( p->rc==SQLITE_OK ){
210693 0 0 if( pLeaf->buf.n>4 ){
210697 0 0 if( pLeaf->pgno>1 ){
210706 0 0 for(i=0; inDlidx; i++){
210734 0 0 if( p->pIdxWriter==0 ){
210742 0 0 if( p->rc==SQLITE_OK ){
210763 0 0 for(i=0; inSeg; i++){
210765 0 0 if( pSeg->pSeg==0 ){
210767 0 0 }else if( pSeg->pLeaf==0 ){
210782 0 0 if( pData ){
210784 0 0 fts5BufferGrow(&p->rc, &buf, pData->nn);
210789 0 0 if( p->rc==SQLITE_OK ){
210796 0 0 if( pSeg->iLeafPgno==pSeg->iTermLeafPgno
210797 0 0 && pSeg->iEndofDoclistszLeaf
210838 0 0 int nRem = pnRem ? *pnRem : 0; /* Output leaf pages left to write */
210853 0 0 if( pLvl->nMerge ){
210867 0 0 if( iLvl==pStruct->nLevel-1 ){
210872 0 0 if( p->rc ) return;
210888 0 0 bOldest = (pLvlOut->nSeg==1 && pStruct->nLevel==iLvl+2);
0 0 bOldest = (pLvlOut->nSeg==1 && pStruct->nLevel==iLvl+2);
210891 0 0 for(fts5MultiIterNew(p, pStruct, flags, 0, 0, 0, iLvl, nInput, &pIter);
210901 0 0 if( nTerm!=term.n || memcmp(pTerm, term.p, nTerm) ){
0 0 if( nTerm!=term.n || memcmp(pTerm, term.p, nTerm) ){
210902 0 0 if( pnRem && writer.nLeafWritten>nRem ){
0 0 if( pnRem && writer.nLeafWritten>nRem ){
210910 0 0 if( pSegIter->nPos==0 && (bOldest || pSegIter->bDel==0) ) continue;
0 0 if( pSegIter->nPos==0 && (bOldest || pSegIter->bDel==0) ) continue;
0 0 if( pSegIter->nPos==0 && (bOldest || pSegIter->bDel==0) ) continue;
210912 0 0 if( p->rc==SQLITE_OK && bTermWritten==0 ){
0 0 if( p->rc==SQLITE_OK && bTermWritten==0 ){
210922 0 0 if( eDetail==FTS5_DETAIL_NONE ){
210923 0 0 if( pSegIter->bDel ){
210925 0 0 if( pSegIter->nPos>0 ){
210941 0 0 if( fts5MultiIterEof(p, pIter) ){
210945 0 0 for(i=0; i
210950 0 0 if( pLvl->nSeg!=nInput ){
210957 0 0 if( pSeg->pgnoLast==0 ){
210969 0 0 if( pnRem ) *pnRem -= writer.nLeafWritten;
210986 0 0 while( nRem>0 && p->rc==SQLITE_OK ){
0 0 while( nRem>0 && p->rc==SQLITE_OK ){
210993 0 0 for(iLvl=0; iLvlnLevel; iLvl++){
210995 0 0 if( pLvl->nMerge ){
210996 0 0 if( pLvl->nMerge>nBest ){
211002 0 0 if( pLvl->nSeg>nBest ){
211015 0 0 if( nBestaLevel[iBestLvl].nMerge==0 ){
0 0 if( nBestaLevel[iBestLvl].nMerge==0 ){
211020 0 0 if( p->rc==SQLITE_OK && pStruct->aLevel[iBestLvl].nMerge==0 ){
0 0 if( p->rc==SQLITE_OK && pStruct->aLevel[iBestLvl].nMerge==0 ){
211041 0 0 if( p->rc==SQLITE_OK && p->pConfig->nAutomerge>0 ){
0 0 if( p->rc==SQLITE_OK && p->pConfig->nAutomerge>0 ){
211066 0 0 while( p->rc==SQLITE_OK && pStruct->aLevel[iLvl].nSeg>=nCrisis ){
0 0 while( p->rc==SQLITE_OK && pStruct->aLevel[iLvl].nSeg>=nCrisis ){
211096 0 0 if( ret
211099 0 0 if( (ret + i) > nMax ) break;
211125 0 0 if( iSegid ){
211145 0 0 if( p->rc==SQLITE_OK ){
211148 0 0 while( p->rc==SQLITE_OK && 0==sqlite3Fts5HashScanEof(pHash) ){
0 0 while( p->rc==SQLITE_OK && 0==sqlite3Fts5HashScanEof(pHash) ){
211158 0 0 if( pgsz>=(pBuf->n + pPgidx->n + nDoclist + 1) ){
211169 0 0 while( p->rc==SQLITE_OK && iOff
0 0 while( p->rc==SQLITE_OK && iOff
211173 0 0 if( writer.bFirstRowidInPage ){
211183 0 0 if( eDetail==FTS5_DETAIL_NONE ){
211184 0 0 if( iOff
0 0 if( iOff
211187 0 0 if( iOff
0 0 if( iOff
211192 0 0 if( (pBuf->n + pPgidx->n)>=pgsz ){
211200 0 0 if( (pBuf->n + pPgidx->n + nCopy) <= pgsz ){
211210 0 0 while( p->rc==SQLITE_OK ){
211213 0 0 if( (nCopy - iPos)<=nSpace ){
211221 0 0 if( (pBuf->n + pPgidx->n)>=pgsz ){
211224 0 0 if( iPos>=nCopy ) break;
211242 0 0 if( pStruct->nLevel==0 ){
211246 0 0 if( p->rc==SQLITE_OK ){
211267 0 0 if( p->nPendingData ){
211293 0 0 if( nSeg<2 ) return 0;
211294 0 0 for(i=0; inLevel; i++){
211296 0 0 if( nThis==nSeg || (nThis==nSeg-1 && pStruct->aLevel[i].nMerge==nThis) ){
0 0 if( nThis==nSeg || (nThis==nSeg-1 && pStruct->aLevel[i].nMerge==nThis) ){
0 0 if( nThis==nSeg || (nThis==nSeg-1 && pStruct->aLevel[i].nMerge==nThis) ){
211306 0 0 if( pNew ){
211314 0 0 if( pLvl->aSeg ){
211320 0 0 for(iLvl=pStruct->nLevel-1; iLvl>=0; iLvl--){
211321 0 0 for(iSeg=0; iSegaLevel[iLvl].nSeg; iSeg++){
211345 0 0 if( pStruct ){
211351 0 0 if( pNew ){
211353 0 0 for(iLvl=0; pNew->aLevel[iLvl].nSeg==0; iLvl++){}
211354 0 0 while( p->rc==SQLITE_OK && pNew->aLevel[iLvl].nSeg>0 ){
0 0 while( p->rc==SQLITE_OK && pNew->aLevel[iLvl].nSeg>0 ){
211372 0 0 if( pStruct ){
211375 0 0 if( nMerge<0 ){
211382 0 0 if( pStruct && pStruct->nLevel ){
0 0 if( pStruct && pStruct->nLevel ){
211383 0 0 if( fts5IndexMerge(p, &pStruct, nMerge, nMin) ){
211410 0 0 if( p->rc==SQLITE_OK && 0==fts5BufferGrow(&p->rc, pBuf, nData+9+9) ){
0 0 if( p->rc==SQLITE_OK && 0==fts5BufferGrow(&p->rc, pBuf, nData+9+9) ){
0 0 if( p->rc==SQLITE_OK && 0==fts5BufferGrow(&p->rc, pBuf, nData+9+9) ){
211422 0 0 if( p>=pIter->aEof ){
211431 0 0 if( p[0] & 0x80 ){
211489 0 0 if( i>=pBuf->n ){
211516 0 0 if( p->rc ) return;
211520 0 0 while( i1>=0 || i2>=0 ){
0 0 while( i1>=0 || i2>=0 ){
211521 0 0 if( i1>=0 && (i2<0 || iRowid1
0 0 if( i1>=0 && (i2<0 || iRowid1
0 0 if( i1>=0 && (i2<0 || iRowid1
211530 0 0 if( i1>=0 && iRowid1==iRowid2 ){
0 0 if( i1>=0 && iRowid1==iRowid2 ){
211554 0 0 if( p2->n ){
211567 0 0 if( sqlite3Fts5BufferSize(&p->rc, &out, p1->n + p2->n + 9) ) return;
211572 0 0 if( i1.iRowid
211577 0 0 if( i1.aPoslist==0 ) break;
211579 0 0 else if( i2.iRowid!=i1.iRowid ){
211584 0 0 if( i2.aPoslist==0 ) break;
211602 0 0 if( p->rc ) break;
211608 0 0 if( iPos1
211616 0 0 if( iPos1>=0 && iPos2>=0 ){
0 0 if( iPos1>=0 && iPos2>=0 ){
211618 0 0 if( iPos1
211619 0 0 if( iPos1!=iPrev ){
211623 0 0 if( iPos1<0 ) break;
211628 0 0 if( iPos2<0 ) break;
211633 0 0 if( iPos1>=0 ){
211634 0 0 if( iPos1!=iPrev ){
211649 0 0 if( i1.aPoslist==0 || i2.aPoslist==0 ) break;
0 0 if( i1.aPoslist==0 || i2.aPoslist==0 ) break;
211653 0 0 if( i1.aPoslist ){
211657 0 0 else if( i2.aPoslist ){
211683 0 0 if( p->pConfig->eDetail==FTS5_DETAIL_NONE ){
211694 0 0 if( aBuf && pStruct ){
0 0 if( aBuf && pStruct ){
211708 0 0 for( /* no-op */ ;
211718 0 0 if( bNewTerm ){
211719 0 0 if( nTerm
0 0 if( nTerm
211722 0 0 if( p1->base.nData==0 ) continue;
211724 0 0 if( p1->base.iRowid<=iLastRowid && doclist.n>0 ){
0 0 if( p1->base.iRowid<=iLastRowid && doclist.n>0 ){
211725 0 0 for(i=0; p->rc==SQLITE_OK && doclist.n; i++){
0 0 for(i=0; p->rc==SQLITE_OK && doclist.n; i++){
211727 0 0 if( aBuf[i].n==0 ){
211742 0 0 for(i=0; i
211743 0 0 if( p->rc==SQLITE_OK ){
211751 0 0 if( pData ){
211754 0 0 if( doclist.n ) memcpy(pData->p, doclist.p, doclist.n);
211773 0 0 if( p->pHash==0 ){
211778 0 0 if( iRowidiWriteRowid
211779 0 0 || (iRowid==p->iWriteRowid && p->bDelete==0)
0 0 || (iRowid==p->iWriteRowid && p->bDelete==0)
211780 0 0 || (p->nPendingData > p->pConfig->nHashSize)
211845 0 0 if( rc==SQLITE_OK ){
211849 0 0 if( p->zDataTbl && bCreate ){
0 0 if( p->zDataTbl && bCreate ){
211853 0 0 if( rc==SQLITE_OK ){
211859 0 0 if( rc==SQLITE_OK ){
211866 0 0 if( rc ){
211878 0 0 if( p ){
211906 0 0 for(i=0; i
211907 0 0 if( n>=nByte ) return 0; /* Input contains fewer than nChar chars */
211908 0 0 if( (unsigned char)p[n++]>=0xc0 ){
211909 0 0 while( (p[n] & 0xc0)==0x80 ){
211911 0 0 if( n>=nByte ) break;
211925 0 0 while( i
211926 0 0 if( (unsigned char)pIn[i++]>=0xc0 ){
211927 0 0 while( i
0 0 while( i
211962 0 0 for(i=0; inPrefix && rc==SQLITE_OK; i++){
0 0 for(i=0; inPrefix && rc==SQLITE_OK; i++){
211965 0 0 if( nByte ){
211994 0 0 if( sqlite3Fts5BufferSize(&p->rc, &buf, nToken+1)==0 ){
211996 0 0 if( nToken ) memcpy(&buf.p[1], pToken, nToken);
212014 0 0 if( flags & FTS5INDEX_QUERY_PREFIX ){
212016 0 0 for(iIdx=1; iIdx<=pConfig->nPrefix; iIdx++){
212017 0 0 if( pConfig->aPrefix[iIdx-1]==nChar ) break;
212021 0 0 if( iIdx<=pConfig->nPrefix ){
212025 0 0 if( pStruct ){
212038 0 0 if( p->rc==SQLITE_OK ){
212040 0 0 if( pSeg->pLeaf ) pRet->xSetOutputs(pRet, pSeg);
212044 0 0 if( p->rc ){
212079 0 0 if( p->rc==SQLITE_OK ){
212081 0 0 if( pSeg->pLeaf && pSeg->term.p[0]!=FTS5_MAIN_PREFIX ){
0 0 if( pSeg->pLeaf && pSeg->term.p[0]!=FTS5_MAIN_PREFIX ){
212116 0 0 if( pIndexIter ){
212137 0 0 if( p->rc==SQLITE_OK && pData->nn ){
0 0 if( p->rc==SQLITE_OK && pData->nn ){
212141 0 0 for(iCol=0; inn && iCol
0 0 for(iCol=0; inn && iCol
212187 0 0 if( rc==SQLITE_OK ){
212224 0 0 if( iIdx>=0 ) ret += (ret<<3) + (FTS5_MAIN_PREFIX + iIdx);
212225 0 0 for(i=0; i
212404 0 0 for(i=iFirst; p->rc==SQLITE_OK && i<=iLast; i++){
0 0 for(i=iFirst; p->rc==SQLITE_OK && i<=iLast; i++){
212406 0 0 if( pLeaf ){
212407 0 0 if( !fts5LeafIsTermless(pLeaf) ) p->rc = FTS5_CORRUPT;
212408 0 0 if( i>=iNoRowid && 0!=fts5LeafFirstRowidOff(pLeaf) ) p->rc = FTS5_CORRUPT;
0 0 if( i>=iNoRowid && 0!=fts5LeafFirstRowidOff(pLeaf) ) p->rc = FTS5_CORRUPT;
212422 0 0 while( iinn && p->rc==SQLITE_OK ){
0 0 while( iinn && p->rc==SQLITE_OK ){
212431 0 0 if( iOff>=pLeaf->szLeaf ){
212433 0 0 }else if( iTermOff==nIncr ){
212436 0 0 if( (iOff+nByte)>pLeaf->szLeaf ){
212445 0 0 if( nKeep>buf1.n || (iOff+nByte)>pLeaf->szLeaf ){
0 0 if( nKeep>buf1.n || (iOff+nByte)>pLeaf->szLeaf ){
212452 0 0 if( p->rc==SQLITE_OK ){
212454 0 0 if( res<=0 ) p->rc = FTS5_CORRUPT;
212474 0 0 if( pSeg->pgnoFirst==0 ) return;
212482 0 0 while( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){
0 0 while( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){
212493 0 0 if( iIdxLeafpgnoFirst ) continue;
212496 0 0 if( pLeaf==0 ) break;
212502 0 0 if( pLeaf->nn<=pLeaf->szLeaf ){
212512 0 0 if( iRowidOff>=iOff ){
212517 0 0 if( res==0 ) res = nTerm - nIdxTerm;
212518 0 0 if( res<0 ) p->rc = FTS5_CORRUPT;
212524 0 0 if( p->rc ) break;
212531 0 0 if( p->rc ) break;
212534 0 0 if( bIdxDlidx ){
212541 0 0 for(pDlidx=fts5DlidxIterInit(p, 0, iSegid, iIdxLeaf);
212547 0 0 for(iPg=iPrevLeaf+1; iPg
212550 0 0 if( pLeaf ){
212551 0 0 if( fts5LeafFirstRowidOff(pLeaf)!=0 ) p->rc = FTS5_CORRUPT;
212561 0 0 if( pLeaf ){
212565 0 0 if( iRowidOff>=pLeaf->szLeaf ){
212569 0 0 if( iRowid!=fts5DlidxIterRowid(pDlidx) ) p->rc = FTS5_CORRUPT;
212587 0 0 if( p->rc==SQLITE_OK ) p->rc = rc2;
212626 0 0 if( pStruct ){
212628 0 0 for(iLvl=0; iLvlnLevel; iLvl++){
212629 0 0 for(iSeg=0; iSegaLevel[iLvl].nSeg; iSeg++){
212649 0 0 for(fts5MultiIterNew(p, pStruct, flags, 0, 0, 0, -1, 0, &pIter);
212662 0 0 if( eDetail==FTS5_DETAIL_NONE ){
212663 0 0 if( 0==fts5MultiIterIsEmpty(p, pIter) ){
212669 0 0 while( 0==sqlite3Fts5PoslistNext64(poslist.p, poslist.n, &iOff, &iPos) ){
212679 0 0 if( p->rc==SQLITE_OK && cksum!=cksum2 ) p->rc = FTS5_CORRUPT;
0 0 if( p->rc==SQLITE_OK && cksum!=cksum2 ) p->rc = FTS5_CORRUPT;
212722 0 0 if( iSegid==0 ){
212723 0 0 if( iKey==FTS5_AVERAGES_ROWID ){
212730 0 0 sqlite3Fts5BufferAppendPrintf(pRc, pBuf, "{%ssegid=%d h=%d pgno=%d}",
212743 0 0 for(iLvl=0; iLvlnLevel; iLvl++){
212748 0 0 for(iSeg=0; iSegnSeg; iSeg++){
212774 0 0 if( rc!=SQLITE_OK ){
212798 0 0 while( i
212815 0 0 while( iOff
212835 0 0 if( n>0 ){
212839 0 0 while( iOff
212843 0 0 sqlite3Fts5BufferAppendPrintf(pRc, pBuf, " nPos=%d%s", nPos, bDel?"*":"");
212845 0 0 if( iOff
212877 0 0 while( i
212883 0 0 if( i
0 0 if( i
212885 0 0 if( i
0 0 if( i
212926 0 0 if( a==0 ) goto decode_out;
212933 0 0 if( bDlidx ){
212944 0 0 for(fts5DlidxLvlNext(&lvl); lvl.bEof==0; fts5DlidxLvlNext(&lvl)){
212949 0 0 }else if( iSegid==0 ){
212950 0 0 if( iRowid==FTS5_AVERAGES_ROWID ){
212955 0 0 }else if( eDetailNone ){
212966 0 0 if( szLeaf
212974 0 0 while( iOff
212987 0 0 if( iPgidxOff
212997 0 0 if( iOff
213015 0 0 if( n<4 ){
213021 0 0 if( iPgidxOff
213027 0 0 if( iRowidOff!=0 ){
213029 0 0 }else if( iTermOff!=0 ){
213038 0 0 nDoclist = (iTermOff ? iTermOff : szLeaf) - iOff;
213041 0 0 while( iPgidxOff
213050 0 0 if( iPgidxOff
213057 0 0 if( bFirst==0 ){
213076 0 0 if( rc==SQLITE_OK ){
213093 0 0 if( nArg==0 ){
213097 0 0 if( 0==sqlite3_stricmp(zArg, "segment") ){
213100 0 0 if( nArg!=3 ){
213131 251 0 if( rc==SQLITE_OK ){
213138 251 0 if( rc==SQLITE_OK ){
213149 0 0 if( fts5IndexDataVersion(p)!=p->iStructVersion ){
213471 0 0 if( pTab ){
213493 0 0 if( rc==SQLITE_OK ){
213527 0 0 if( rc==SQLITE_OK ){
213531 0 0 if( rc==SQLITE_OK ){
213537 0 0 if( rc==SQLITE_OK ){
213542 0 0 if( rc==SQLITE_OK ){
213549 0 0 if( rc==SQLITE_OK ){
213554 0 0 if( rc==SQLITE_OK ){
213562 0 0 if( rc!=SQLITE_OK ){
213699 0 0 for(i=0; inConstraint; i++){
213703 0 0 if( (p->op==SQLITE_INDEX_CONSTRAINT_MATCH && iCol>=0 && iCol<=nCol)
0 0 if( (p->op==SQLITE_INDEX_CONSTRAINT_MATCH && iCol>=0 && iCol<=nCol)
0 0 if( (p->op==SQLITE_INDEX_CONSTRAINT_MATCH && iCol>=0 && iCol<=nCol)
213704 0 0 || (p->op==SQLITE_INDEX_CONSTRAINT_EQ && iCol==nCol)
0 0 || (p->op==SQLITE_INDEX_CONSTRAINT_EQ && iCol==nCol)
213707 0 0 if( p->usable ){
213716 0 0 }else if( p->op<=SQLITE_INDEX_CONSTRAINT_MATCH ){
213718 0 0 for(j=1; j
213720 0 0 if( iCol==aColMap[pC->iCol] && (p->op & pC->op) && p->usable ){
0 0 if( iCol==aColMap[pC->iCol] && (p->op & pC->op) && p->usable ){
0 0 if( iCol==aColMap[pC->iCol] && (p->op & pC->op) && p->usable ){
213729 0 0 if( pInfo->nOrderBy==1 ){
213731 0 0 if( iSort==(pConfig->nCol+1) && BitFlagTest(idxFlags, FTS5_BI_MATCH) ){
0 0 if( iSort==(pConfig->nCol+1) && BitFlagTest(idxFlags, FTS5_BI_MATCH) ){
213733 0 0 }else if( iSort==-1 ){
213736 0 0 if( BitFlagTest(idxFlags, FTS5_BI_ORDER_RANK|FTS5_BI_ORDER_ROWID) ){
213738 0 0 if( pInfo->aOrderBy[0].desc ){
213746 0 0 if( BitFlagTest(idxFlags, FTS5_BI_ROWID_EQ) ){
213747 0 0 pInfo->estimatedCost = bHasMatch ? 100.0 : 10.0;
213748 0 0 if( bHasMatch==0 ) fts5SetUniqueFlag(pInfo);
213749 0 0 }else if( BitFlagAllTest(idxFlags, FTS5_BI_ROWID_LE|FTS5_BI_ROWID_GE) ){
213750 0 0 pInfo->estimatedCost = bHasMatch ? 500.0 : 250000.0;
213751 0 0 }else if( BitFlagTest(idxFlags, FTS5_BI_ROWID_LE|FTS5_BI_ROWID_GE) ){
213752 0 0 pInfo->estimatedCost = bHasMatch ? 750.0 : 750000.0;
213754 0 0 pInfo->estimatedCost = bHasMatch ? 1000.0 : 1000000.0;
213759 0 0 for(i=0; i
213761 0 0 if( pC->iConsIndex>=0 ){
213773 0 0 for(pCsr=pTab->pGlobal->pCsr; pCsr; pCsr=pCsr->pNext){
213774 0 0 if( pCsr->base.pVtab==(sqlite3_vtab*)pTab ) return SQLITE_OK;
213790 0 0 if( rc==SQLITE_OK ){
213793 0 0 if( pCsr ){
213809 0 0 if( pCsr->ePlan==FTS5_PLAN_SCAN ){
213836 0 0 if( pCsr->pStmt ){
213840 0 0 if( pCsr->pSorter ){
213846 0 0 if( pCsr->ePlan!=FTS5_PLAN_SOURCE ){
213850 0 0 for(pData=pCsr->pAuxdata; pData; pData=pNext){
213852 0 0 if( pData->xDelete ) pData->xDelete(pData->pPtr);
213859 0 0 if( CsrFlagTest(pCsr, FTS5CSR_FREE_ZRANK) ){
213873 0 0 if( pCursor ){
213880 0 0 for(pp=&pTab->pGlobal->pCsr; (*pp)!=pCsr; pp=&(*pp)->pNext);
213893 0 0 if( rc==SQLITE_DONE ){
213896 0 0 }else if( rc==SQLITE_ROW ){
213909 0 0 if( nBlob>0 ){
213910 0 0 for(i=0; i<(pSorter->nIdx-1); i++){
213933 0 0 for(pCsr=pTab->pGlobal->pCsr; pCsr; pCsr=pCsr->pNext){
213934 0 0 if( pCsr->ePlan==FTS5_PLAN_MATCH
213935 0 0 && pCsr->base.pVtab==(sqlite3_vtab*)pTab
213957 0 0 if( CsrFlagTest(pCsr, FTS5CSR_REQUIRE_RESEEK) ){
213963 0 0 if( rc==SQLITE_OK && iRowid!=sqlite3Fts5ExprRowid(pCsr->pExpr) ){
0 0 if( rc==SQLITE_OK && iRowid!=sqlite3Fts5ExprRowid(pCsr->pExpr) ){
213969 0 0 if( sqlite3Fts5ExprEof(pCsr->pExpr) ){
213995 0 0 if( pCsr->ePlan<3 ){
213997 0 0 if( (rc = fts5CursorReseek(pCsr, &bSkip)) || bSkip ) return rc;
0 0 if( (rc = fts5CursorReseek(pCsr, &bSkip)) || bSkip ) return rc;
214016 0 0 if( rc!=SQLITE_ROW ){
214043 0 0 if( zSql==0 ){
214048 0 0 if( rc!=SQLITE_OK ){
214071 0 0 if( pSorter==0 ) return SQLITE_NOMEM;
214082 0 0 rc = fts5PrepareStatement(&pSorter->pStmt, pConfig,
0 0 rc = fts5PrepareStatement(&pSorter->pStmt, pConfig,
0 0 rc = fts5PrepareStatement(&pSorter->pStmt, pConfig,
214091 0 0 if( rc==SQLITE_OK ){
214098 0 0 if( rc!=SQLITE_OK ){
214111 0 0 if( sqlite3Fts5ExprEof(pExpr) ){
214133 0 0 while( z[0]==' ' ) z++;
214134 0 0 for(n=0; z[n] && z[n]!=' '; n++);
0 0 for(n=0; z[n] && z[n]!=' '; n++);
214139 0 0 if( 0==sqlite3_strnicmp("reads", z, n) ){
214142 0 0 else if( 0==sqlite3_strnicmp("id", z, n) ){
214162 0 0 for(pAux=pTab->pGlobal->pAux; pAux; pAux=pAux->pNext){
214163 0 0 if( sqlite3_stricmp(zName, pAux->zFunc)==0 ) return pAux;
214179 0 0 if( zRankArgs ){
214181 0 0 if( zSql ){
214187 0 0 if( rc==SQLITE_OK ){
214188 0 0 if( SQLITE_ROW==sqlite3_step(pStmt) ){
214193 0 0 if( rc==SQLITE_OK ){
214195 0 0 for(i=0; inRankArg; i++){
214208 0 0 if( rc==SQLITE_OK ){
214210 0 0 if( pAux==0 ){
214228 0 0 if( pRank ){
214233 0 0 if( z==0 ){
214234 0 0 if( sqlite3_value_type(pRank)==SQLITE_NULL ) rc = SQLITE_ERROR;
214238 0 0 if( rc==SQLITE_OK ){
214242 0 0 }else if( rc==SQLITE_ERROR ){
214248 0 0 if( pConfig->zRank ){
214260 0 0 if( pVal ){
214262 0 0 if( eType==SQLITE_INTEGER ){
214305 0 0 if( pCsr->ePlan ){
214325 0 0 if( BitFlagTest(idxNum, FTS5_BI_MATCH) ) pMatch = apVal[iVal++];
214326 0 0 if( BitFlagTest(idxNum, FTS5_BI_RANK) ) pRank = apVal[iVal++];
214327 0 0 if( BitFlagTest(idxNum, FTS5_BI_ROWID_EQ) ) pRowidEq = apVal[iVal++];
214328 0 0 if( BitFlagTest(idxNum, FTS5_BI_ROWID_LE) ) pRowidLe = apVal[iVal++];
214329 0 0 if( BitFlagTest(idxNum, FTS5_BI_ROWID_GE) ) pRowidGe = apVal[iVal++];
214340 0 0 if( pRowidEq ){
214343 0 0 if( bDesc ){
214351 0 0 if( pTab->pSortCsr ){
214362 0 0 if( pTab->pSortCsr->bDesc ){
214372 0 0 }else if( pMatch ){
214374 0 0 if( zExpr==0 ) zExpr = "";
214377 0 0 if( rc==SQLITE_OK ){
214378 0 0 if( zExpr[0]=='*' ){
214386 0 0 if( rc==SQLITE_OK ){
214387 0 0 if( bOrderByRank ){
214397 0 0 }else if( pConfig->zContent==0 ){
214405 0 0 pCsr->ePlan = (pRowidEq ? FTS5_PLAN_ROWID : FTS5_PLAN_SCAN);
214409 0 0 if( rc==SQLITE_OK ){
214410 0 0 if( pCsr->ePlan==FTS5_PLAN_ROWID ){
214441 0 0 if( pCsr->pSorter ){
214489 0 0 if( pCsr->pStmt==0 ){
214492 0 0 rc = sqlite3Fts5StorageStmt(
214499 0 0 if( rc==SQLITE_OK && CsrFlagTest(pCsr, FTS5CSR_REQUIRE_CONTENT) ){
0 0 if( rc==SQLITE_OK && CsrFlagTest(pCsr, FTS5CSR_REQUIRE_CONTENT) ){
214504 0 0 if( rc==SQLITE_ROW ){
214509 0 0 if( rc==SQLITE_OK ){
214549 0 0 if( 0==sqlite3_stricmp("delete-all", zCmd) ){
214550 0 0 if( pConfig->eContent==FTS5_CONTENT_NORMAL ){
214559 0 0 }else if( 0==sqlite3_stricmp("rebuild", zCmd) ){
214560 0 0 if( pConfig->eContent==FTS5_CONTENT_NONE ){
214568 0 0 }else if( 0==sqlite3_stricmp("optimize", zCmd) ){
214570 0 0 }else if( 0==sqlite3_stricmp("merge", zCmd) ){
214573 0 0 }else if( 0==sqlite3_stricmp("integrity-check", zCmd) ){
214581 0 0 if( rc==SQLITE_OK ){
214584 0 0 if( rc==SQLITE_OK ){
214585 0 0 if( bError ){
214601 0 0 if( eType1==SQLITE_INTEGER ){
214615 0 0 if( rc==SQLITE_OK ){
214618 0 0 if( rc==SQLITE_OK ){
214665 0 0 if( eType0==SQLITE_NULL
214666 0 0 && sqlite3_value_type(apVal[2+pConfig->nCol])!=SQLITE_NULL
214670 0 0 if( pConfig->eContent!=FTS5_CONTENT_NORMAL
214671 0 0 && 0==sqlite3_stricmp("delete", z)
214690 0 0 if( pConfig->eContent==FTS5_CONTENT_NORMAL ){
214699 0 0 if( eType0==SQLITE_INTEGER && fts5IsContentless(pTab) ){
0 0 if( eType0==SQLITE_INTEGER && fts5IsContentless(pTab) ){
214700 0 0 pTab->base.zErrMsg = sqlite3_mprintf(
214708 0 0 else if( nArg==1 ){
214714 0 0 else if( eType0!=SQLITE_INTEGER ){
214716 0 0 if( eConflict==SQLITE_REPLACE
214717 0 0 && sqlite3_value_type(apVal[1])==SQLITE_INTEGER
214729 0 0 if( iOld!=iNew ){
214730 0 0 if( eConflict==SQLITE_REPLACE ){
214732 0 0 if( rc==SQLITE_OK ){
214738 0 0 if( rc==SQLITE_OK ){
214741 0 0 if( rc==SQLITE_OK ){
214861 0 0 if( fts5IsContentless((Fts5Table*)(pCsr->base.pVtab)) ){
214866 0 0 if( rc==SQLITE_OK ){
214884 0 0 if( CsrFlagTest(pCsr, FTS5CSR_REQUIRE_POSLIST) ){
214886 0 0 if( pConfig->eDetail!=FTS5_DETAIL_FULL ){
214890 0 0 if( aPopulator==0 ) rc = SQLITE_NOMEM;
214891 0 0 for(i=0; inCol && rc==SQLITE_OK; i++){
0 0 for(i=0; inCol && rc==SQLITE_OK; i++){
214894 0 0 if( rc==SQLITE_OK ){
214902 0 0 if( pCsr->pSorter ){
214909 0 0 if( pCsr->pSorter && pConfig->eDetail==FTS5_DETAIL_FULL ){
0 0 if( pCsr->pSorter && pConfig->eDetail==FTS5_DETAIL_FULL ){
214911 0 0 int i1 = (iPhrase==0 ? 0 : pSorter->aIdx[iPhrase-1]);
214932 0 0 if( pCsr->aInstIter==0 ){
214938 0 0 if( aIter ){
214943 0 0 for(i=0; i
0 0 for(i=0; i
214947 0 0 if( rc==SQLITE_OK ){
214952 0 0 if( rc==SQLITE_OK ){
214956 0 0 for(i=0; i
214957 0 0 if( (aIter[i].bEof==0)
214958 0 0 && (iBest<0 || aIter[i].iPos
0 0 && (iBest<0 || aIter[i].iPos
214963 0 0 if( iBest<0 ) break;
214966 0 0 if( nInst>=pCsr->nInstAlloc ){
214967 0 0 pCsr->nInstAlloc = pCsr->nInstAlloc ? pCsr->nInstAlloc*2 : 32;
214971 0 0 if( aInst ){
214996 0 0 if( CsrFlagTest(pCsr, FTS5CSR_REQUIRE_INST)==0
214997 0 0 || SQLITE_OK==(rc = fts5CacheInstArray(pCsr)) ){
215012 0 0 if( CsrFlagTest(pCsr, FTS5CSR_REQUIRE_INST)==0
215013 0 0 || SQLITE_OK==(rc = fts5CacheInstArray(pCsr))
215015 0 0 if( iIdx<0 || iIdx>=pCsr->nInstCount ){
0 0 if( iIdx<0 || iIdx>=pCsr->nInstCount ){
215047 0 0 if( (tflags & FTS5_TOKEN_COLOCATED)==0 ){
215059 0 0 if( CsrFlagTest(pCsr, FTS5CSR_REQUIRE_DOCSIZE) ){
215060 0 0 if( pConfig->bColumnsize ){
215063 0 0 }else if( pConfig->zContent==0 ){
215065 0 0 for(i=0; inCol; i++){
215066 0 0 if( pConfig->abUnindexed[i]==0 ){
215072 0 0 for(i=0; rc==SQLITE_OK && inCol; i++){
0 0 for(i=0; rc==SQLITE_OK && inCol; i++){
215073 0 0 if( pConfig->abUnindexed[i]==0 ){
215078 0 0 if( rc==SQLITE_OK ){
215088 0 0 if( iCol<0 ){
215091 0 0 for(i=0; inCol; i++){
215094 0 0 }else if( iColnCol ){
215116 0 0 for(pData=pCsr->pAuxdata; pData; pData=pData->pNext){
215117 0 0 if( pData->pAux==pCsr->pAux ) break;
215120 0 0 if( pData ){
215121 0 0 if( pData->xDelete ){
215127 0 0 if( pData==0 ){
215128 0 0 if( xDelete ) xDelete(pPtr);
215146 0 0 for(pData=pCsr->pAuxdata; pData; pData=pData->pNext){
215147 0 0 if( pData->pAux==pCsr->pAux ) break;
215150 0 0 if( pData ){
215152 0 0 if( bClear ){
215167 0 0 if( pIter->a>=pIter->b ){
215173 0 0 if( iVal==1 ){
215192 0 0 if( rc==SQLITE_OK ){
215209 0 0 if( pConfig->eDetail==FTS5_DETAIL_COLUMNS ){
215210 0 0 if( pIter->a>=pIter->b ){
215220 0 0 if( pIter->a>=pIter->b ){
215224 0 0 if( pIter->a[0]==0x01 ) break;
215241 0 0 if( pConfig->eDetail==FTS5_DETAIL_COLUMNS ){
215244 0 0 if( pSorter ){
215245 0 0 int i1 = (iPhrase==0 ? 0 : pSorter->aIdx[iPhrase-1]);
215251 0 0 if( rc==SQLITE_OK ){
215259 0 0 if( rc==SQLITE_OK ){
215261 0 0 if( n<=0 ){
215263 0 0 }else if( pIter->a[0]==0x01 ){
215317 0 0 if( rc==SQLITE_OK ){
215325 0 0 if( rc==SQLITE_OK ){
215326 0 0 for(rc = fts5CursorFirst(pTab, pNew, 0);
215327 0 0 rc==SQLITE_OK && CsrFlagTest(pNew, FTS5CSR_EOF)==0;
215331 0 0 if( rc!=SQLITE_OK ){
215332 0 0 if( rc==SQLITE_DONE ) rc = SQLITE_OK;
215357 0 0 for(pCsr=pGlobal->pCsr; pCsr; pCsr=pCsr->pNext){
215358 0 0 if( pCsr->iCsrId==iCsrId ) break;
215378 0 0 if( pCsr==0 ){
215436 0 0 for(i=0; i<(nPhrase-1); i++){
215443 0 0 for(i=0; i
215454 0 0 for(i=0; rc==SQLITE_OK && i<(nPhrase-1); i++){
0 0 for(i=0; rc==SQLITE_OK && i<(nPhrase-1); i++){
215462 0 0 for(i=0; rc==SQLITE_OK && i
0 0 for(i=0; rc==SQLITE_OK && i
215494 0 0 if( pCsr->ePlan==FTS5_PLAN_SPECIAL ){
215495 0 0 if( iCol==pConfig->nCol ){
215500 0 0 if( iCol==pConfig->nCol ){
215506 0 0 }else if( iCol==pConfig->nCol+1 ){
215509 0 0 if( pCsr->ePlan==FTS5_PLAN_SOURCE ){
215511 0 0 }else if(
215513 0 0 || pCsr->ePlan==FTS5_PLAN_SORTED_MATCH
215515 0 0 if( pCsr->pRank || SQLITE_OK==(rc = fts5FindRankFunction(pCsr)) ){
0 0 if( pCsr->pRank || SQLITE_OK==(rc = fts5FindRankFunction(pCsr)) ){
215519 0 0 }else if( !fts5IsContentless(pTab) ){
215521 0 0 if( rc==SQLITE_OK ){
215545 0 0 if( pAux ){
215617 753 0 if( rc==SQLITE_OK ){
215625 753 0 if( pAux ){
215663 753 0 if( pNew ){
215672 251 502 if( pNew->pNext==0 ){
215688 0 0 if( zName==0 ){
215691 0 0 for(pMod=pGlobal->pTok; pMod; pMod=pMod->pNext){
215692 0 0 if( sqlite3_stricmp(zName, pMod->zName)==0 ) break;
215713 0 0 if( pMod ){
215735 0 0 pMod = fts5LocateTokenizer(pGlobal, nArg==0 ? 0 : azArg[0]);
215736 0 0 if( pMod==0 ){
215741 0 0 rc = pMod->x.xCreate(pMod->pUserData, &azArg[1], (nArg?nArg-1:0), ppTok);
215743 0 0 if( rc!=SQLITE_OK && pzErr ){
0 0 if( rc!=SQLITE_OK && pzErr ){
215748 0 0 if( rc!=SQLITE_OK ){
215761 747 249 for(pAux=pGlobal->pAux; pAux; pAux=pNextAux){
215763 0 747 if( pAux->xDestroy ) pAux->xDestroy(pAux->pUserData);
215767 747 249 for(pTok=pGlobal->pTok; pTok; pTok=pNextTok){
215769 0 747 if( pTok->xDestroy ) pTok->xDestroy(pTok->pUserData);
215786 0 0 if( ppApi ) *ppApi = &pGlobal->api;
215811 0 0 for(i=0; i
215812 0 0 if( sqlite3_stricmp(zName, azName[i])==0 ) return 1;
215849 0 251 if( pGlobal==0 ){
215860 251 0 if( rc==SQLITE_OK ) rc = sqlite3Fts5IndexInit(db);
215861 251 0 if( rc==SQLITE_OK ) rc = sqlite3Fts5ExprInit(pGlobal, db);
215862 251 0 if( rc==SQLITE_OK ) rc = sqlite3Fts5AuxInit(&pGlobal->api);
215863 251 0 if( rc==SQLITE_OK ) rc = sqlite3Fts5TokenizerInit(&pGlobal->api);
215864 251 0 if( rc==SQLITE_OK ) rc = sqlite3Fts5VocabInit(pGlobal, db);
215865 251 0 if( rc==SQLITE_OK ){
215870 251 0 if( rc==SQLITE_OK ){
216001 0 0 if( p->aStmt[eStmt]==0 ){
216049 0 0 if( zBind ){
216050 0 0 for(i=0; i
216066 0 0 if( zSql==0 ){
216072 0 0 if( rc!=SQLITE_OK && pzErrMsg ){
0 0 if( rc!=SQLITE_OK && pzErrMsg ){
216097 0 0 if( zSql==0 ){
216121 0 0 if( rc==SQLITE_OK && pConfig->bColumnsize ){
0 0 if( rc==SQLITE_OK && pConfig->bColumnsize ){
216127 0 0 if( rc==SQLITE_OK && pConfig->eContent==FTS5_CONTENT_NORMAL ){
0 0 if( rc==SQLITE_OK && pConfig->eContent==FTS5_CONTENT_NORMAL ){
216142 0 0 if( *pRc==SQLITE_OK ){
216157 0 0 if( pConfig->bColumnsize ){
216160 0 0 if( pConfig->eContent==FTS5_CONTENT_NORMAL ){
216180 0 0 rc = fts5ExecPrintf(pConfig->db, &zErr, "CREATE TABLE %Q.'%q_%q'(%s)%s",
216187 0 0 if( zErr ){
216219 0 0 if( !p ) return SQLITE_NOMEM;
216226 0 0 if( bCreate ){
216227 0 0 if( pConfig->eContent==FTS5_CONTENT_NORMAL ){
216230 0 0 if( zDefn==0 ){
216237 0 0 for(i=0; inCol; i++){
216246 0 0 if( rc==SQLITE_OK && pConfig->bColumnsize ){
0 0 if( rc==SQLITE_OK && pConfig->bColumnsize ){
216251 0 0 if( rc==SQLITE_OK ){
216256 0 0 if( rc==SQLITE_OK ){
216261 0 0 if( rc ){
216273 0 0 if( p ){
216277 0 0 for(i=0; iaStmt); i++){
216307 0 0 if( nToken>FTS5_MAX_TOKEN_SIZE ) nToken = FTS5_MAX_TOKEN_SIZE;
216308 0 0 if( (tflags & FTS5_TOKEN_COLOCATED)==0 || pCtx->szCol==0 ){
0 0 if( (tflags & FTS5_TOKEN_COLOCATED)==0 || pCtx->szCol==0 ){
216331 0 0 if( apVal==0 ){
216333 0 0 if( rc!=SQLITE_OK ) return rc;
216335 0 0 if( sqlite3_step(pSeek)!=SQLITE_ROW ){
216343 0 0 for(iCol=1; rc==SQLITE_OK && iCol<=pConfig->nCol; iCol++){
0 0 for(iCol=1; rc==SQLITE_OK && iCol<=pConfig->nCol; iCol++){
216344 0 0 if( pConfig->abUnindexed[iCol-1]==0 ){
216347 0 0 if( pSeek ){
216364 0 0 if( rc==SQLITE_OK ) rc = rc2;
216383 0 0 if( p->pConfig->bColumnsize ){
216386 0 0 if( rc==SQLITE_OK ){
216409 0 0 if( p->bTotalsValid==0 ){
216431 0 0 for(i=0; i
216434 0 0 if( rc==SQLITE_OK ){
216454 0 0 if( rc==SQLITE_OK ){
216459 0 0 if( rc==SQLITE_OK && pConfig->bColumnsize ){
0 0 if( rc==SQLITE_OK && pConfig->bColumnsize ){
216461 0 0 if( rc==SQLITE_OK ){
216469 0 0 if( pConfig->eContent==FTS5_CONTENT_NORMAL ){
216470 0 0 if( rc==SQLITE_OK ){
216473 0 0 if( rc==SQLITE_OK ){
216497 0 0 if( rc==SQLITE_OK && pConfig->bColumnsize ){
0 0 if( rc==SQLITE_OK && pConfig->bColumnsize ){
216506 0 0 if( rc==SQLITE_OK ){
216509 0 0 if( rc==SQLITE_OK ){
216525 0 0 if( rc==SQLITE_OK ){
216529 0 0 if( rc==SQLITE_OK ){
216533 0 0 while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pScan) ){
0 0 while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pScan) ){
216538 0 0 for(ctx.iCol=0; rc==SQLITE_OK && ctx.iColnCol; ctx.iCol++){
0 0 for(ctx.iCol=0; rc==SQLITE_OK && ctx.iColnCol; ctx.iCol++){
216540 0 0 if( pConfig->abUnindexed[ctx.iCol]==0 ){
216554 0 0 if( rc==SQLITE_OK ){
216561 0 0 if( rc==SQLITE_OK ){
216590 0 0 if( p->pConfig->bColumnsize ){
216593 0 0 if( rc==SQLITE_OK ){
216599 0 0 if( rc==SQLITE_OK ){
216618 0 0 if( pConfig->eContent!=FTS5_CONTENT_NORMAL ){
216619 0 0 if( sqlite3_value_type(apVal[1])==SQLITE_INTEGER ){
216628 0 0 for(i=1; rc==SQLITE_OK && i<=pConfig->nCol+1; i++){
0 0 for(i=1; rc==SQLITE_OK && i<=pConfig->nCol+1; i++){
216631 0 0 if( rc==SQLITE_OK ){
216658 0 0 if( rc==SQLITE_OK ){
216661 0 0 for(ctx.iCol=0; rc==SQLITE_OK && ctx.iColnCol; ctx.iCol++){
0 0 for(ctx.iCol=0; rc==SQLITE_OK && ctx.iColnCol; ctx.iCol++){
216663 0 0 if( pConfig->abUnindexed[ctx.iCol]==0 ){
216678 0 0 if( rc==SQLITE_OK ){
216694 0 0 if( zSql==0 ){
216699 0 0 if( rc==SQLITE_OK ){
216700 0 0 if( SQLITE_ROW==sqlite3_step(pCnt) ){
216745 0 0 if( nToken>FTS5_MAX_TOKEN_SIZE ) nToken = FTS5_MAX_TOKEN_SIZE;
216747 0 0 if( (tflags & FTS5_TOKEN_COLOCATED)==0 || pCtx->szCol==0 ){
0 0 if( (tflags & FTS5_TOKEN_COLOCATED)==0 || pCtx->szCol==0 ){
216770 0 0 if( rc==SQLITE_OK && bPresent==0 ){
0 0 if( rc==SQLITE_OK && bPresent==0 ){
216776 0 0 for(ii=0; rc==SQLITE_OK && iipConfig->nPrefix; ii++){
0 0 for(ii=0; rc==SQLITE_OK && iipConfig->nPrefix; ii++){
216779 0 0 if( nByte ){
216781 0 0 if( bPresent==0 ){
216809 0 0 if( !aTotalSize ) return SQLITE_NOMEM;
216816 0 0 if( rc==SQLITE_OK ){
216818 0 0 while( SQLITE_ROW==sqlite3_step(pScan) ){
216822 0 0 if( pConfig->bColumnsize ){
216825 0 0 if( rc==SQLITE_OK && pConfig->eDetail==FTS5_DETAIL_NONE ){
0 0 if( rc==SQLITE_OK && pConfig->eDetail==FTS5_DETAIL_NONE ){
216828 0 0 for(i=0; rc==SQLITE_OK && inCol; i++){
0 0 for(i=0; rc==SQLITE_OK && inCol; i++){
216829 0 0 if( pConfig->abUnindexed[i] ) continue;
216832 0 0 if( pConfig->eDetail==FTS5_DETAIL_COLUMNS ){
216835 0 0 if( rc==SQLITE_OK ){
216844 0 0 if( rc==SQLITE_OK && pConfig->bColumnsize && ctx.szCol!=aColSize[i] ){
0 0 if( rc==SQLITE_OK && pConfig->bColumnsize && ctx.szCol!=aColSize[i] ){
0 0 if( rc==SQLITE_OK && pConfig->bColumnsize && ctx.szCol!=aColSize[i] ){
216848 0 0 if( pConfig->eDetail==FTS5_DETAIL_COLUMNS ){
216856 0 0 if( rc!=SQLITE_OK ) break;
216859 0 0 if( rc==SQLITE_OK ) rc = rc2;
216863 0 0 if( rc==SQLITE_OK ){
216866 0 0 for(i=0; rc==SQLITE_OK && inCol; i++){
0 0 for(i=0; rc==SQLITE_OK && inCol; i++){
216867 0 0 if( p->aTotalSize[i]!=aTotalSize[i] ) rc = FTS5_CORRUPT;
216873 0 0 if( rc==SQLITE_OK && pConfig->eContent==FTS5_CONTENT_NORMAL ){
0 0 if( rc==SQLITE_OK && pConfig->eContent==FTS5_CONTENT_NORMAL ){
216876 0 0 if( rc==SQLITE_OK && nRow!=p->nTotalRow ) rc = FTS5_CORRUPT;
0 0 if( rc==SQLITE_OK && nRow!=p->nTotalRow ) rc = FTS5_CORRUPT;
216878 0 0 if( rc==SQLITE_OK && pConfig->bColumnsize ){
0 0 if( rc==SQLITE_OK && pConfig->bColumnsize ){
216881 0 0 if( rc==SQLITE_OK && nRow!=p->nTotalRow ) rc = FTS5_CORRUPT;
0 0 if( rc==SQLITE_OK && nRow!=p->nTotalRow ) rc = FTS5_CORRUPT;
216887 0 0 if( rc==SQLITE_OK ){
216911 0 0 if( rc==SQLITE_OK ){
216932 0 0 if( p->aStmt[eStmt]==0 ){
216946 0 0 for(i=0; i
216947 0 0 if( iOff>=nBlob ) return 1;
216968 0 0 if( rc==SQLITE_OK ){
216971 0 0 if( SQLITE_ROW==sqlite3_step(pLookup) ){
216974 0 0 if( 0==fts5StorageDecodeSizeArray(aCol, nCol, aBlob, nBlob) ){
216979 0 0 if( bCorrupt && rc==SQLITE_OK ){
0 0 if( bCorrupt && rc==SQLITE_OK ){
216989 0 0 if( rc==SQLITE_OK ){
216991 0 0 if( iCol<0 ){
216993 0 0 for(i=0; ipConfig->nCol; i++){
216996 0 0 }else if( iColpConfig->nCol ){
217007 0 0 if( rc==SQLITE_OK ){
217019 0 0 if( p->bTotalsValid ){
217023 0 0 if( rc==SQLITE_OK ){
217043 0 0 if( rc==SQLITE_OK ){
217045 0 0 if( pVal ){
217054 0 0 if( rc==SQLITE_OK && pVal ){
0 0 if( rc==SQLITE_OK && pVal ){
217057 0 0 if( rc==SQLITE_OK ){
217110 0 0 for(i=0; zArg[i]; i++){
217111 0 0 if( (zArg[i] & 0x80)==0 ){
217135 0 0 if( nArg%2 ){
217139 0 0 if( p==0 ){
217145 0 0 for(i=0; rc==SQLITE_OK && i
0 0 for(i=0; rc==SQLITE_OK && i
217147 0 0 if( 0==sqlite3_stricmp(azArg[i], "tokenchars") ){
217150 0 0 if( 0==sqlite3_stricmp(azArg[i], "separators") ){
217156 0 0 if( rc!=SQLITE_OK ){
217170 0 0 for(i=0; i
217172 0 0 if( c>='A' && c<='Z' ) c += 32;
0 0 if( c>='A' && c<='Z' ) c += 32;
217199 0 0 while( is
0 0 while( is
217203 0 0 while( is
0 0 while( is
0 0 while( is
217206 0 0 if( is==nText ) break;
217210 0 0 while( ie
0 0 while( ie
0 0 while( ie
217216 0 0 if( nByte>nFold ){
217217 0 0 if( pFold!=aFold ) sqlite3_free(pFold);
217219 0 0 if( pFold==0 ){
217232 0 0 if( pFold!=aFold ) sqlite3_free(pFold);
217233 0 0 if( rc==SQLITE_DONE ) rc = SQLITE_OK;
217316 0 0 if( n>0 ){
217318 0 0 if( aNew ){
217322 0 0 while( zCsr
217325 0 0 READ_UTF8(zCsr, zTerm, iCode);
0 0 READ_UTF8(zCsr, zTerm, iCode);
0 0 READ_UTF8(zCsr, zTerm, iCode);
0 0 READ_UTF8(zCsr, zTerm, iCode);
0 0 READ_UTF8(zCsr, zTerm, iCode);
0 0 READ_UTF8(zCsr, zTerm, iCode);
217326 0 0 if( iCode<128 ){
217332 0 0 if( bToken!=bTokenChars && sqlite3Fts5UnicodeIsdiacritic(iCode)==0 ){
0 0 if( bToken!=bTokenChars && sqlite3Fts5UnicodeIsdiacritic(iCode)==0 ){
217334 0 0 for(i=0; i
217335 0 0 if( aNew[i]>iCode ) break;
217357 0 0 if( p->nException>0 ){
217362 0 0 while( iHi>=iLo ){
217364 0 0 if( iCode==a[iTest] ){
217366 0 0 }else if( iCode>a[iTest] ){
217381 0 0 if( pTok ){
217393 0 0 while( *z ){
217394 0 0 while( *z==' ' || *z=='\t' ) z++;
0 0 while( *z==' ' || *z=='\t' ) z++;
217395 0 0 if( *z && sqlite3Fts5UnicodeCatParse(z, p->aCategory) ){
0 0 if( *z && sqlite3Fts5UnicodeCatParse(z, p->aCategory) ){
217398 0 0 while( *z!=' ' && *z!='\t' && *z!='\0' ) z++;
0 0 while( *z!=' ' && *z!='\t' && *z!='\0' ) z++;
0 0 while( *z!=' ' && *z!='\t' && *z!='\0' ) z++;
217418 0 0 if( nArg%2 ){
217422 0 0 if( p ){
217430 0 0 if( p->aFold==0 ){
217435 0 0 for(i=0; rc==SQLITE_OK && i
0 0 for(i=0; rc==SQLITE_OK && i
217436 0 0 if( 0==sqlite3_stricmp(azArg[i], "categories") ){
217441 0 0 if( rc==SQLITE_OK ){
217445 0 0 for(i=0; rc==SQLITE_OK && i
0 0 for(i=0; rc==SQLITE_OK && i
217447 0 0 if( 0==sqlite3_stricmp(azArg[i], "remove_diacritics") ){
217448 0 0 if( (zArg[0]!='0' && zArg[0]!='1') || zArg[1] ){
0 0 if( (zArg[0]!='0' && zArg[0]!='1') || zArg[1] ){
0 0 if( (zArg[0]!='0' && zArg[0]!='1') || zArg[1] ){
217453 0 0 if( 0==sqlite3_stricmp(azArg[i], "tokenchars") ){
217456 0 0 if( 0==sqlite3_stricmp(azArg[i], "separators") ){
217459 0 0 if( 0==sqlite3_stricmp(azArg[i], "categories") ){
217469 0 0 if( rc!=SQLITE_OK ){
217513 0 0 while( rc==SQLITE_OK ){
217521 0 0 if( zCsr>=zTerm ) goto tokenize_done;
217522 0 0 if( *zCsr & 0x80 ) {
217526 0 0 READ_UTF8(zCsr, zTerm, iCode);
0 0 READ_UTF8(zCsr, zTerm, iCode);
0 0 READ_UTF8(zCsr, zTerm, iCode);
0 0 READ_UTF8(zCsr, zTerm, iCode);
0 0 READ_UTF8(zCsr, zTerm, iCode);
0 0 READ_UTF8(zCsr, zTerm, iCode);
217527 0 0 if( fts5UnicodeIsAlnum(p, iCode) ){
217531 0 0 if( a[*zCsr] ){
217541 0 0 while( zCsr
217545 0 0 if( zOut>pEnd ){
217547 0 0 if( aFold==0 ){
217559 0 0 if( *zCsr & 0x80 ){
217562 0 0 READ_UTF8(zCsr, zTerm, iCode);
0 0 READ_UTF8(zCsr, zTerm, iCode);
0 0 READ_UTF8(zCsr, zTerm, iCode);
0 0 READ_UTF8(zCsr, zTerm, iCode);
0 0 READ_UTF8(zCsr, zTerm, iCode);
0 0 READ_UTF8(zCsr, zTerm, iCode);
217563 0 0 if( fts5UnicodeIsAlnum(p,iCode)||sqlite3Fts5UnicodeIsdiacritic(iCode) ){
0 0 if( fts5UnicodeIsAlnum(p,iCode)||sqlite3Fts5UnicodeIsdiacritic(iCode) ){
217566 0 0 if( iCode ) WRITE_UTF8(zOut, iCode);
0 0 if( iCode ) WRITE_UTF8(zOut, iCode);
0 0 if( iCode ) WRITE_UTF8(zOut, iCode);
0 0 if( iCode ) WRITE_UTF8(zOut, iCode);
217570 0 0 }else if( a[*zCsr]==0 ){
217575 0 0 if( *zCsr>='A' && *zCsr<='Z' ){
0 0 if( *zCsr>='A' && *zCsr<='Z' ){
217590 0 0 if( rc==SQLITE_DONE ) rc = SQLITE_OK;
217613 0 0 if( pTok ){
217615 0 0 if( p->pTokenizer ){
217636 0 0 if( nArg>0 ){
217641 0 0 if( pRet ){
217647 0 0 if( rc==SQLITE_OK ){
217648 0 0 int nArg2 = (nArg>0 ? nArg-1 : 0);
217649 0 0 const char **azArg2 = (nArg2 ? &azArg[1] : 0);
217653 0 0 if( rc!=SQLITE_OK ){
217705 0 0 c=='a' || c=='e' || c=='i' || c=='o' || c=='u' || (bYIsVowel && c=='y')
0 0 c=='a' || c=='e' || c=='i' || c=='o' || c=='u' || (bYIsVowel && c=='y')
0 0 c=='a' || c=='e' || c=='i' || c=='o' || c=='u' || (bYIsVowel && c=='y')
0 0 c=='a' || c=='e' || c=='i' || c=='o' || c=='u' || (bYIsVowel && c=='y')
0 0 c=='a' || c=='e' || c=='i' || c=='o' || c=='u' || (bYIsVowel && c=='y')
0 0 c=='a' || c=='e' || c=='i' || c=='o' || c=='u' || (bYIsVowel && c=='y')
0 0 c=='a' || c=='e' || c=='i' || c=='o' || c=='u' || (bYIsVowel && c=='y')
217714 0 0 for(i=0; i
217715 0 0 if( 0==(bCons = !fts5PorterIsVowel(zStem[i], bCons)) ) break;
217719 0 0 for(i++; i
217720 0 0 if( (bCons = !fts5PorterIsVowel(zStem[i], bCons)) ) return i+1;
217734 0 0 if( n && fts5PorterGobbleVC(&zStem[n], nStem-n, 1) ){
0 0 if( n && fts5PorterGobbleVC(&zStem[n], nStem-n, 1) ){
217744 0 0 if( n && 0==fts5PorterGobbleVC(&zStem[n], nStem-n, 1) ){
0 0 if( n && 0==fts5PorterGobbleVC(&zStem[n], nStem-n, 1) ){
217752 0 0 if( zStem[nStem-1]=='w' || zStem[nStem-1]=='x' || zStem[nStem-1]=='y' ){
0 0 if( zStem[nStem-1]=='w' || zStem[nStem-1]=='x' || zStem[nStem-1]=='y' ){
0 0 if( zStem[nStem-1]=='w' || zStem[nStem-1]=='x' || zStem[nStem-1]=='y' ){
217758 0 0 for(i=0; i
217770 0 0 return (zStem[nStem-1]=='s' || zStem[nStem-1]=='t')
217771 0 0 && fts5Porter_MGt1(zStem, nStem);
0 0 && fts5Porter_MGt1(zStem, nStem);
217777 0 0 for(i=0; i
217778 0 0 if( fts5PorterIsVowel(zStem[i], i>0) ){
217797 0 0 if( nBuf>2 && 0==memcmp("al", &aBuf[nBuf-2], 2) ){
0 0 if( nBuf>2 && 0==memcmp("al", &aBuf[nBuf-2], 2) ){
217798 0 0 if( fts5Porter_MGt1(aBuf, nBuf-2) ){
217805 0 0 if( nBuf>4 && 0==memcmp("ance", &aBuf[nBuf-4], 4) ){
0 0 if( nBuf>4 && 0==memcmp("ance", &aBuf[nBuf-4], 4) ){
217806 0 0 if( fts5Porter_MGt1(aBuf, nBuf-4) ){
217809 0 0 }else if( nBuf>4 && 0==memcmp("ence", &aBuf[nBuf-4], 4) ){
0 0 }else if( nBuf>4 && 0==memcmp("ence", &aBuf[nBuf-4], 4) ){
217810 0 0 if( fts5Porter_MGt1(aBuf, nBuf-4) ){
217817 0 0 if( nBuf>2 && 0==memcmp("er", &aBuf[nBuf-2], 2) ){
0 0 if( nBuf>2 && 0==memcmp("er", &aBuf[nBuf-2], 2) ){
217818 0 0 if( fts5Porter_MGt1(aBuf, nBuf-2) ){
217825 0 0 if( nBuf>2 && 0==memcmp("ic", &aBuf[nBuf-2], 2) ){
0 0 if( nBuf>2 && 0==memcmp("ic", &aBuf[nBuf-2], 2) ){
217826 0 0 if( fts5Porter_MGt1(aBuf, nBuf-2) ){
217833 0 0 if( nBuf>4 && 0==memcmp("able", &aBuf[nBuf-4], 4) ){
0 0 if( nBuf>4 && 0==memcmp("able", &aBuf[nBuf-4], 4) ){
217834 0 0 if( fts5Porter_MGt1(aBuf, nBuf-4) ){
217837 0 0 }else if( nBuf>4 && 0==memcmp("ible", &aBuf[nBuf-4], 4) ){
0 0 }else if( nBuf>4 && 0==memcmp("ible", &aBuf[nBuf-4], 4) ){
217838 0 0 if( fts5Porter_MGt1(aBuf, nBuf-4) ){
217845 0 0 if( nBuf>3 && 0==memcmp("ant", &aBuf[nBuf-3], 3) ){
0 0 if( nBuf>3 && 0==memcmp("ant", &aBuf[nBuf-3], 3) ){
217846 0 0 if( fts5Porter_MGt1(aBuf, nBuf-3) ){
217849 0 0 }else if( nBuf>5 && 0==memcmp("ement", &aBuf[nBuf-5], 5) ){
0 0 }else if( nBuf>5 && 0==memcmp("ement", &aBuf[nBuf-5], 5) ){
217850 0 0 if( fts5Porter_MGt1(aBuf, nBuf-5) ){
217853 0 0 }else if( nBuf>4 && 0==memcmp("ment", &aBuf[nBuf-4], 4) ){
0 0 }else if( nBuf>4 && 0==memcmp("ment", &aBuf[nBuf-4], 4) ){
217854 0 0 if( fts5Porter_MGt1(aBuf, nBuf-4) ){
217857 0 0 }else if( nBuf>3 && 0==memcmp("ent", &aBuf[nBuf-3], 3) ){
0 0 }else if( nBuf>3 && 0==memcmp("ent", &aBuf[nBuf-3], 3) ){
217858 0 0 if( fts5Porter_MGt1(aBuf, nBuf-3) ){
217865 0 0 if( nBuf>3 && 0==memcmp("ion", &aBuf[nBuf-3], 3) ){
0 0 if( nBuf>3 && 0==memcmp("ion", &aBuf[nBuf-3], 3) ){
217866 0 0 if( fts5Porter_MGt1_and_S_or_T(aBuf, nBuf-3) ){
217869 0 0 }else if( nBuf>2 && 0==memcmp("ou", &aBuf[nBuf-2], 2) ){
0 0 }else if( nBuf>2 && 0==memcmp("ou", &aBuf[nBuf-2], 2) ){
217870 0 0 if( fts5Porter_MGt1(aBuf, nBuf-2) ){
217877 0 0 if( nBuf>3 && 0==memcmp("ism", &aBuf[nBuf-3], 3) ){
0 0 if( nBuf>3 && 0==memcmp("ism", &aBuf[nBuf-3], 3) ){
217878 0 0 if( fts5Porter_MGt1(aBuf, nBuf-3) ){
217885 0 0 if( nBuf>3 && 0==memcmp("ate", &aBuf[nBuf-3], 3) ){
0 0 if( nBuf>3 && 0==memcmp("ate", &aBuf[nBuf-3], 3) ){
217886 0 0 if( fts5Porter_MGt1(aBuf, nBuf-3) ){
217889 0 0 }else if( nBuf>3 && 0==memcmp("iti", &aBuf[nBuf-3], 3) ){
0 0 }else if( nBuf>3 && 0==memcmp("iti", &aBuf[nBuf-3], 3) ){
217890 0 0 if( fts5Porter_MGt1(aBuf, nBuf-3) ){
217897 0 0 if( nBuf>3 && 0==memcmp("ous", &aBuf[nBuf-3], 3) ){
0 0 if( nBuf>3 && 0==memcmp("ous", &aBuf[nBuf-3], 3) ){
217898 0 0 if( fts5Porter_MGt1(aBuf, nBuf-3) ){
217905 0 0 if( nBuf>3 && 0==memcmp("ive", &aBuf[nBuf-3], 3) ){
0 0 if( nBuf>3 && 0==memcmp("ive", &aBuf[nBuf-3], 3) ){
217906 0 0 if( fts5Porter_MGt1(aBuf, nBuf-3) ){
217913 0 0 if( nBuf>3 && 0==memcmp("ize", &aBuf[nBuf-3], 3) ){
0 0 if( nBuf>3 && 0==memcmp("ize", &aBuf[nBuf-3], 3) ){
217914 0 0 if( fts5Porter_MGt1(aBuf, nBuf-3) ){
217931 0 0 if( nBuf>2 && 0==memcmp("at", &aBuf[nBuf-2], 2) ){
0 0 if( nBuf>2 && 0==memcmp("at", &aBuf[nBuf-2], 2) ){
217939 0 0 if( nBuf>2 && 0==memcmp("bl", &aBuf[nBuf-2], 2) ){
0 0 if( nBuf>2 && 0==memcmp("bl", &aBuf[nBuf-2], 2) ){
217947 0 0 if( nBuf>2 && 0==memcmp("iz", &aBuf[nBuf-2], 2) ){
0 0 if( nBuf>2 && 0==memcmp("iz", &aBuf[nBuf-2], 2) ){
217965 0 0 if( nBuf>7 && 0==memcmp("ational", &aBuf[nBuf-7], 7) ){
0 0 if( nBuf>7 && 0==memcmp("ational", &aBuf[nBuf-7], 7) ){
217966 0 0 if( fts5Porter_MGt0(aBuf, nBuf-7) ){
217970 0 0 }else if( nBuf>6 && 0==memcmp("tional", &aBuf[nBuf-6], 6) ){
0 0 }else if( nBuf>6 && 0==memcmp("tional", &aBuf[nBuf-6], 6) ){
217971 0 0 if( fts5Porter_MGt0(aBuf, nBuf-6) ){
217979 0 0 if( nBuf>4 && 0==memcmp("enci", &aBuf[nBuf-4], 4) ){
0 0 if( nBuf>4 && 0==memcmp("enci", &aBuf[nBuf-4], 4) ){
217980 0 0 if( fts5Porter_MGt0(aBuf, nBuf-4) ){
217984 0 0 }else if( nBuf>4 && 0==memcmp("anci", &aBuf[nBuf-4], 4) ){
0 0 }else if( nBuf>4 && 0==memcmp("anci", &aBuf[nBuf-4], 4) ){
217985 0 0 if( fts5Porter_MGt0(aBuf, nBuf-4) ){
217993 0 0 if( nBuf>4 && 0==memcmp("izer", &aBuf[nBuf-4], 4) ){
0 0 if( nBuf>4 && 0==memcmp("izer", &aBuf[nBuf-4], 4) ){
217994 0 0 if( fts5Porter_MGt0(aBuf, nBuf-4) ){
218002 0 0 if( nBuf>4 && 0==memcmp("logi", &aBuf[nBuf-4], 4) ){
0 0 if( nBuf>4 && 0==memcmp("logi", &aBuf[nBuf-4], 4) ){
218003 0 0 if( fts5Porter_MGt0(aBuf, nBuf-4) ){
218011 0 0 if( nBuf>3 && 0==memcmp("bli", &aBuf[nBuf-3], 3) ){
0 0 if( nBuf>3 && 0==memcmp("bli", &aBuf[nBuf-3], 3) ){
218012 0 0 if( fts5Porter_MGt0(aBuf, nBuf-3) ){
218016 0 0 }else if( nBuf>4 && 0==memcmp("alli", &aBuf[nBuf-4], 4) ){
0 0 }else if( nBuf>4 && 0==memcmp("alli", &aBuf[nBuf-4], 4) ){
218017 0 0 if( fts5Porter_MGt0(aBuf, nBuf-4) ){
218021 0 0 }else if( nBuf>5 && 0==memcmp("entli", &aBuf[nBuf-5], 5) ){
0 0 }else if( nBuf>5 && 0==memcmp("entli", &aBuf[nBuf-5], 5) ){
218022 0 0 if( fts5Porter_MGt0(aBuf, nBuf-5) ){
218026 0 0 }else if( nBuf>3 && 0==memcmp("eli", &aBuf[nBuf-3], 3) ){
0 0 }else if( nBuf>3 && 0==memcmp("eli", &aBuf[nBuf-3], 3) ){
218027 0 0 if( fts5Porter_MGt0(aBuf, nBuf-3) ){
218031 0 0 }else if( nBuf>5 && 0==memcmp("ousli", &aBuf[nBuf-5], 5) ){
0 0 }else if( nBuf>5 && 0==memcmp("ousli", &aBuf[nBuf-5], 5) ){
218032 0 0 if( fts5Porter_MGt0(aBuf, nBuf-5) ){
218040 0 0 if( nBuf>7 && 0==memcmp("ization", &aBuf[nBuf-7], 7) ){
0 0 if( nBuf>7 && 0==memcmp("ization", &aBuf[nBuf-7], 7) ){
218041 0 0 if( fts5Porter_MGt0(aBuf, nBuf-7) ){
218045 0 0 }else if( nBuf>5 && 0==memcmp("ation", &aBuf[nBuf-5], 5) ){
0 0 }else if( nBuf>5 && 0==memcmp("ation", &aBuf[nBuf-5], 5) ){
218046 0 0 if( fts5Porter_MGt0(aBuf, nBuf-5) ){
218050 0 0 }else if( nBuf>4 && 0==memcmp("ator", &aBuf[nBuf-4], 4) ){
0 0 }else if( nBuf>4 && 0==memcmp("ator", &aBuf[nBuf-4], 4) ){
218051 0 0 if( fts5Porter_MGt0(aBuf, nBuf-4) ){
218059 0 0 if( nBuf>5 && 0==memcmp("alism", &aBuf[nBuf-5], 5) ){
0 0 if( nBuf>5 && 0==memcmp("alism", &aBuf[nBuf-5], 5) ){
218060 0 0 if( fts5Porter_MGt0(aBuf, nBuf-5) ){
218064 0 0 }else if( nBuf>7 && 0==memcmp("iveness", &aBuf[nBuf-7], 7) ){
0 0 }else if( nBuf>7 && 0==memcmp("iveness", &aBuf[nBuf-7], 7) ){
218065 0 0 if( fts5Porter_MGt0(aBuf, nBuf-7) ){
218069 0 0 }else if( nBuf>7 && 0==memcmp("fulness", &aBuf[nBuf-7], 7) ){
0 0 }else if( nBuf>7 && 0==memcmp("fulness", &aBuf[nBuf-7], 7) ){
218070 0 0 if( fts5Porter_MGt0(aBuf, nBuf-7) ){
218074 0 0 }else if( nBuf>7 && 0==memcmp("ousness", &aBuf[nBuf-7], 7) ){
0 0 }else if( nBuf>7 && 0==memcmp("ousness", &aBuf[nBuf-7], 7) ){
218075 0 0 if( fts5Porter_MGt0(aBuf, nBuf-7) ){
218083 0 0 if( nBuf>5 && 0==memcmp("aliti", &aBuf[nBuf-5], 5) ){
0 0 if( nBuf>5 && 0==memcmp("aliti", &aBuf[nBuf-5], 5) ){
218084 0 0 if( fts5Porter_MGt0(aBuf, nBuf-5) ){
218088 0 0 }else if( nBuf>5 && 0==memcmp("iviti", &aBuf[nBuf-5], 5) ){
0 0 }else if( nBuf>5 && 0==memcmp("iviti", &aBuf[nBuf-5], 5) ){
218089 0 0 if( fts5Porter_MGt0(aBuf, nBuf-5) ){
218093 0 0 }else if( nBuf>6 && 0==memcmp("biliti", &aBuf[nBuf-6], 6) ){
0 0 }else if( nBuf>6 && 0==memcmp("biliti", &aBuf[nBuf-6], 6) ){
218094 0 0 if( fts5Porter_MGt0(aBuf, nBuf-6) ){
218112 0 0 if( nBuf>4 && 0==memcmp("ical", &aBuf[nBuf-4], 4) ){
0 0 if( nBuf>4 && 0==memcmp("ical", &aBuf[nBuf-4], 4) ){
218113 0 0 if( fts5Porter_MGt0(aBuf, nBuf-4) ){
218121 0 0 if( nBuf>4 && 0==memcmp("ness", &aBuf[nBuf-4], 4) ){
0 0 if( nBuf>4 && 0==memcmp("ness", &aBuf[nBuf-4], 4) ){
218122 0 0 if( fts5Porter_MGt0(aBuf, nBuf-4) ){
218129 0 0 if( nBuf>5 && 0==memcmp("icate", &aBuf[nBuf-5], 5) ){
0 0 if( nBuf>5 && 0==memcmp("icate", &aBuf[nBuf-5], 5) ){
218130 0 0 if( fts5Porter_MGt0(aBuf, nBuf-5) ){
218134 0 0 }else if( nBuf>5 && 0==memcmp("iciti", &aBuf[nBuf-5], 5) ){
0 0 }else if( nBuf>5 && 0==memcmp("iciti", &aBuf[nBuf-5], 5) ){
218135 0 0 if( fts5Porter_MGt0(aBuf, nBuf-5) ){
218143 0 0 if( nBuf>3 && 0==memcmp("ful", &aBuf[nBuf-3], 3) ){
0 0 if( nBuf>3 && 0==memcmp("ful", &aBuf[nBuf-3], 3) ){
218144 0 0 if( fts5Porter_MGt0(aBuf, nBuf-3) ){
218151 0 0 if( nBuf>5 && 0==memcmp("ative", &aBuf[nBuf-5], 5) ){
0 0 if( nBuf>5 && 0==memcmp("ative", &aBuf[nBuf-5], 5) ){
218152 0 0 if( fts5Porter_MGt0(aBuf, nBuf-5) ){
218159 0 0 if( nBuf>5 && 0==memcmp("alize", &aBuf[nBuf-5], 5) ){
0 0 if( nBuf>5 && 0==memcmp("alize", &aBuf[nBuf-5], 5) ){
218160 0 0 if( fts5Porter_MGt0(aBuf, nBuf-5) ){
218178 0 0 if( nBuf>3 && 0==memcmp("eed", &aBuf[nBuf-3], 3) ){
0 0 if( nBuf>3 && 0==memcmp("eed", &aBuf[nBuf-3], 3) ){
218179 0 0 if( fts5Porter_MGt0(aBuf, nBuf-3) ){
218183 0 0 }else if( nBuf>2 && 0==memcmp("ed", &aBuf[nBuf-2], 2) ){
0 0 }else if( nBuf>2 && 0==memcmp("ed", &aBuf[nBuf-2], 2) ){
218184 0 0 if( fts5Porter_Vowel(aBuf, nBuf-2) ){
218192 0 0 if( nBuf>3 && 0==memcmp("ing", &aBuf[nBuf-3], 3) ){
0 0 if( nBuf>3 && 0==memcmp("ing", &aBuf[nBuf-3], 3) ){
218193 0 0 if( fts5Porter_Vowel(aBuf, nBuf-3) ){
218211 0 0 if( aBuf[nBuf-1]=='s' ){
218212 0 0 if( aBuf[nBuf-2]=='e' ){
218213 0 0 if( (nBuf>4 && aBuf[nBuf-4]=='s' && aBuf[nBuf-3]=='s')
0 0 if( (nBuf>4 && aBuf[nBuf-4]=='s' && aBuf[nBuf-3]=='s')
0 0 if( (nBuf>4 && aBuf[nBuf-4]=='s' && aBuf[nBuf-3]=='s')
218214 0 0 || (nBuf>3 && aBuf[nBuf-3]=='i' )
0 0 || (nBuf>3 && aBuf[nBuf-3]=='i' )
218221 0 0 else if( aBuf[nBuf-2]!='s' ){
218240 0 0 if( nToken>FTS5_PORTER_MAX_TOKEN || nToken<3 ) goto pass_through;
0 0 if( nToken>FTS5_PORTER_MAX_TOKEN || nToken<3 ) goto pass_through;
218247 0 0 if( fts5PorterStep1B(aBuf, &nBuf) ){
218248 0 0 if( fts5PorterStep1B2(aBuf, &nBuf)==0 ){
218250 0 0 if( fts5PorterIsVowel(c, 0)==0
218251 0 0 && c!='l' && c!='s' && c!='z' && c==aBuf[nBuf-2]
0 0 && c!='l' && c!='s' && c!='z' && c==aBuf[nBuf-2]
0 0 && c!='l' && c!='s' && c!='z' && c==aBuf[nBuf-2]
0 0 && c!='l' && c!='s' && c!='z' && c==aBuf[nBuf-2]
218254 0 0 }else if( fts5Porter_MEq1(aBuf, nBuf) && fts5Porter_Ostar(aBuf, nBuf) ){
0 0 }else if( fts5Porter_MEq1(aBuf, nBuf) && fts5Porter_Ostar(aBuf, nBuf) ){
218261 0 0 if( aBuf[nBuf-1]=='y' && fts5Porter_Vowel(aBuf, nBuf-1) ){
0 0 if( aBuf[nBuf-1]=='y' && fts5Porter_Vowel(aBuf, nBuf-1) ){
218272 0 0 if( aBuf[nBuf-1]=='e' ){
218273 0 0 if( fts5Porter_MGt1(aBuf, nBuf-1)
218274 0 0 || (fts5Porter_MEq1(aBuf, nBuf-1) && !fts5Porter_Ostar(aBuf, nBuf-1))
0 0 || (fts5Porter_MEq1(aBuf, nBuf-1) && !fts5Porter_Ostar(aBuf, nBuf-1))
218281 0 0 if( nBuf>1 && aBuf[nBuf-1]=='l'
0 0 if( nBuf>1 && aBuf[nBuf-1]=='l'
218282 0 0 && aBuf[nBuf-2]=='l' && fts5Porter_MGt1(aBuf, nBuf-1)
0 0 && aBuf[nBuf-2]=='l' && fts5Porter_MGt1(aBuf, nBuf-1)
218329 1004 0 for(i=0; rc==SQLITE_OK && i
753 251 for(i=0; rc==SQLITE_OK && i
218405 0 0 while( iHi>=iLo ){
218407 0 0 if( key >= aDia[iTest] ){
218415 0 0 return ((c > (aDia[iRes]>>3) + (aDia[iRes]&0x07)) ? c : (int)aChar[iRes]);
218426 0 0 if( c<768 || c>817 ) return 0;
0 0 if( c<768 || c>817 ) return 0;
218427 0 0 return (c < 768+32) ?
218538 0 0 if( c<128 ){
218539 0 0 if( c>='A' && c<='Z' ) ret = c + ('a' - 'A');
0 0 if( c>='A' && c<='Z' ) ret = c + ('a' - 'A');
218540 0 0 }else if( c<65536 ){
218547 0 0 while( iHi>=iLo ){
218550 0 0 if( cmp>=0 ){
218560 0 0 if( c<(p->iCode + p->nRange) && 0==(0x01 & p->flags & (p->iCode ^ c)) ){
0 0 if( c<(p->iCode + p->nRange) && 0==(0x01 & p->flags & (p->iCode ^ c)) ){
218565 0 0 if( bRemoveDiacritic ) ret = fts5_remove_diacritic(ret);
218568 0 0 else if( c>=66560 && c<66600 ){
0 0 else if( c>=66560 && c<66600 ){
219070 0 0 if( iCode>=(1<<20) ){
219076 0 0 while( iHi>iLo ){
219079 0 0 if( iKey>=aFts5UnicodeMap[iTest] ){
219087 0 0 if( iRes<0 ) return 0;
219088 0 0 if( iKey>=(aFts5UnicodeMap[iRes]+(aFts5UnicodeData[iRes]>>5)) ) return 0;
219090 0 0 if( ret!=30 ) return ret;
219091 0 0 return ((iKey - aFts5UnicodeMap[iRes]) & 0x01) ? 5 : 9;
219097 0 0 while( i<128 ){
219100 0 0 for(; i<128 && i
0 0 for(; i<128 && i
219137 0 0 if (!(a&0x80))
219148 0 0 if (!(b&0x80))
219162 0 0 if (!(a&0x80))
219214 0 0 if (!(a&0x80))
219223 0 0 if (!(b&0x80))
219240 0 0 if (!(a&0x80))
219256 0 0 if (!(b&0x80))
219280 0 0 if (!(a&0x80))
219301 0 0 if (!(b&0x80))
219317 0 0 if (!(a&0x80))
219334 0 0 if (!(b&0x80))
219406 0 0 if( v & (((u64)0xff000000)<<32) ){
219409 0 0 for(i=7; i>=0; i--){
219419 0 0 }while( v!=0 );
219422 0 0 for(i=0, j=n-1; j>=0; j--, i++){
219429 0 0 if( v<=0x7f ){
219433 0 0 if( v<=0x3fff ){
219447 0 0 if( iVal<(1 << 14) ) return 2;
219448 0 0 if( iVal<(1 << 21) ) return 3;
219449 0 0 if( iVal<(1 << 28) ) return 4;
219559 0 0 if( rc==SQLITE_OK ){
219561 0 0 if( sqlite3_stricmp(zCopy, "col")==0 ){
219565 0 0 if( sqlite3_stricmp(zCopy, "row")==0 ){
219568 0 0 if( sqlite3_stricmp(zCopy, "instance")==0 ){
219639 0 0 bDb = (argc==6 && strlen(argv[1])==4 && memcmp("temp", argv[1], 4)==0);
0 0 bDb = (argc==6 && strlen(argv[1])==4 && memcmp("temp", argv[1], 4)==0);
0 0 bDb = (argc==6 && strlen(argv[1])==4 && memcmp("temp", argv[1], 4)==0);
219641 0 0 if( argc!=5 && bDb==0 ){
0 0 if( argc!=5 && bDb==0 ){
219646 0 0 const char *zDb = bDb ? argv[3] : argv[1];
219647 0 0 const char *zTab = bDb ? argv[4] : argv[3];
219648 0 0 const char *zType = bDb ? argv[5] : argv[4];
219654 0 0 if( rc==SQLITE_OK ){
219661 0 0 if( pRet ){
219729 0 0 for(i=0; inConstraint; i++){
219731 0 0 if( p->usable==0 ) continue;
219732 0 0 if( p->iColumn==0 ){ /* term column */
219733 0 0 if( p->op==SQLITE_INDEX_CONSTRAINT_EQ ) iTermEq = i;
219734 0 0 if( p->op==SQLITE_INDEX_CONSTRAINT_LE ) iTermLe = i;
219735 0 0 if( p->op==SQLITE_INDEX_CONSTRAINT_LT ) iTermLe = i;
219736 0 0 if( p->op==SQLITE_INDEX_CONSTRAINT_GE ) iTermGe = i;
219737 0 0 if( p->op==SQLITE_INDEX_CONSTRAINT_GT ) iTermGe = i;
219741 0 0 if( iTermEq>=0 ){
219747 0 0 if( iTermGe>=0 ){
219752 0 0 if( iTermLe>=0 ){
219764 0 0 if( pInfo->nOrderBy==1
219765 0 0 && pInfo->aOrderBy[0].iColumn==0
219766 0 0 && pInfo->aOrderBy[0].desc==0
219794 0 0 if( zSql ){
219799 0 0 if( rc==SQLITE_ERROR ) rc = SQLITE_OK;
219801 0 0 if( pStmt && sqlite3_step(pStmt)==SQLITE_ROW ){
0 0 if( pStmt && sqlite3_step(pStmt)==SQLITE_ROW ){
219806 0 0 if( rc==SQLITE_OK && pIndex==0 ){
0 0 if( rc==SQLITE_OK && pIndex==0 ){
219809 0 0 if( rc==SQLITE_OK ){
219817 0 0 if( rc==SQLITE_OK ){
219822 0 0 if( pCsr ){
219861 0 0 if( sqlite3Fts5IterEof(pCsr->pIter) ){
219867 0 0 if( pCsr->nLeTerm>=0 ){
219870 0 0 if( bCmp<0 || (bCmp==0 && pCsr->nLeTerm
0 0 if( bCmp<0 || (bCmp==0 && pCsr->nLeTerm
0 0 if( bCmp<0 || (bCmp==0 && pCsr->nLeTerm
219889 0 0 while( eDetail==FTS5_DETAIL_NONE
219890 0 0 || sqlite3Fts5PoslistNext64(pIter->pData, pIter->nData, po, pp)
219896 0 0 if( rc==SQLITE_OK ){
219898 0 0 if( pCsr->bEof || eDetail==FTS5_DETAIL_NONE ) break;
0 0 if( pCsr->bEof || eDetail==FTS5_DETAIL_NONE ) break;
219900 0 0 if( rc ){
219920 0 0 if( pTab->eType==FTS5_VOCAB_INSTANCE ){
219924 0 0 if( pTab->eType==FTS5_VOCAB_COL ){
219925 0 0 for(pCsr->iCol++; pCsr->iColiCol++){
219926 0 0 if( pCsr->aDoc[pCsr->iCol] ) break;
219930 0 0 if( pTab->eType!=FTS5_VOCAB_COL || pCsr->iCol>=nCol ){
0 0 if( pTab->eType!=FTS5_VOCAB_COL || pCsr->iCol>=nCol ){
219931 0 0 if( sqlite3Fts5IterEof(pCsr->pIter) ){
219938 0 0 if( pCsr->nLeTerm>=0 ){
219941 0 0 if( bCmp<0 || (bCmp==0 && pCsr->nLeTerm
0 0 if( bCmp<0 || (bCmp==0 && pCsr->nLeTerm
0 0 if( bCmp<0 || (bCmp==0 && pCsr->nLeTerm
219953 0 0 while( rc==SQLITE_OK ){
219964 0 0 if( eDetail==FTS5_DETAIL_FULL ){
219965 0 0 while( 0==sqlite3Fts5PoslistNext64(pPos, nPos, &iOff, &iPos) ){
219973 0 0 if( eDetail==FTS5_DETAIL_FULL ){
219975 0 0 while( 0==sqlite3Fts5PoslistNext64(pPos, nPos, &iOff, &iPos) ){
219978 0 0 if( iCol!=ii ){
219979 0 0 if( ii>=nCol ){
219987 0 0 }else if( eDetail==FTS5_DETAIL_COLUMNS ){
219988 0 0 while( 0==sqlite3Fts5PoslistNext64(pPos, nPos, &iOff,&iPos) ){
219990 0 0 if( iPos>=nCol ){
220007 0 0 if( rc==SQLITE_OK ){
220010 0 0 if( pTab->eType==FTS5_VOCAB_INSTANCE ) break;
220012 0 0 if( rc==SQLITE_OK ){
220014 0 0 if( nTerm!=pCsr->term.n || memcmp(zTerm, pCsr->term.p, nTerm) ){
0 0 if( nTerm!=pCsr->term.n || memcmp(zTerm, pCsr->term.p, nTerm) ){
220017 0 0 if( sqlite3Fts5IterEof(pCsr->pIter) ) break;
220023 0 0 if( rc==SQLITE_OK && pCsr->bEof==0 && pTab->eType==FTS5_VOCAB_COL ){
0 0 if( rc==SQLITE_OK && pCsr->bEof==0 && pTab->eType==FTS5_VOCAB_COL ){
0 0 if( rc==SQLITE_OK && pCsr->bEof==0 && pTab->eType==FTS5_VOCAB_COL ){
220024 0 0 while( pCsr->aDoc[pCsr->iCol]==0 ) pCsr->iCol++;
220057 0 0 if( idxNum & FTS5_VOCAB_TERM_EQ ) pEq = apVal[iVal++];
220058 0 0 if( idxNum & FTS5_VOCAB_TERM_GE ) pGe = apVal[iVal++];
220059 0 0 if( idxNum & FTS5_VOCAB_TERM_LE ) pLe = apVal[iVal++];
220061 0 0 if( pEq ){
220066 0 0 if( pGe ){
220070 0 0 if( pLe ){
220074 0 0 if( pCsr->zLeTerm==0 ){
220082 0 0 if( rc==SQLITE_OK ){
220085 0 0 if( rc==SQLITE_OK && eType==FTS5_VOCAB_INSTANCE ){
0 0 if( rc==SQLITE_OK && eType==FTS5_VOCAB_INSTANCE ){
220088 0 0 if( rc==SQLITE_OK
220089 0 0 && !pCsr->bEof
220090 0 0 && (eType!=FTS5_VOCAB_INSTANCE || pCsr->pConfig->eDetail!=FTS5_DETAIL_NONE)
0 0 && (eType!=FTS5_VOCAB_INSTANCE || pCsr->pConfig->eDetail!=FTS5_DETAIL_NONE)
220117 0 0 if( iCol==0 ){
220121 0 0 }else if( eType==FTS5_VOCAB_COL ){
220123 0 0 if( iCol==1 ){
220124 0 0 if( eDetail!=FTS5_DETAIL_NONE ){
220128 0 0 }else if( iCol==2 ){
220133 0 0 }else if( eType==FTS5_VOCAB_ROW ){
220135 0 0 if( iCol==1 ){
220148 0 0 if( eDetail==FTS5_DETAIL_FULL ){
220150 0 0 }else if( eDetail==FTS5_DETAIL_COLUMNS ){
220153 0 0 if( ii>=0 && iipConfig->nCol ){
0 0 if( ii>=0 && iipConfig->nCol ){
220161 0 0 if( eDetail==FTS5_DETAIL_FULL ){
220170 0 0 if( iVal>0 ) sqlite3_result_int64(pCtx, iVal);