Lines Matching refs:pTab
12521 Table *pTab; /* Source table */ member
12661 Table *pTab; /* Table for TK_COLUMN expressions. */ member
12847 Table *pTab; /* An SQL table corresponding to zName */ member
13132 Table *pTab; /* Table this info block refers to */ member
23310 if( pItem->pTab ){
23311 sqlite3XPrintf(&x, 0, " tabname=%Q", pItem->pTab->zName);
79751 Table *pTab;
79782 pTab = sqlite3LocateTable(pParse, 0, zTable, zDb);
79783 if( pTab && IsVirtual(pTab) ){
79784 pTab = 0;
79787 if( pTab && !HasRowid(pTab) ){
79788 pTab = 0;
79792 if( pTab && pTab->pSelect ){
79793 pTab = 0;
79797 if( !pTab ){
79809 for(iCol=0; iCol<pTab->nCol; iCol++) {
79810 if( sqlite3StrICmp(pTab->aCol[iCol].zName, zColumn)==0 ){
79814 if( iCol==pTab->nCol ){
79836 for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){
79846 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
79868 int iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
79872 pTab->pSchema->schema_cookie,
79873 pTab->pSchema->iGeneration);
79885 sqlite3VdbeChangeP2(v, 1, pTab->tnum);
79887 sqlite3VdbeChangeP4(v, 1, pTab->zName, P4_TRANSIENT);
79893 sqlite3VdbeChangeP2(v, 2 + flags, pTab->tnum);
79903 sqlite3VdbeChangeP4(v, 2+flags, SQLITE_INT_TO_PTR(pTab->nCol+1),P4_INT32);
79904 sqlite3VdbeChangeP2(v, 6, pTab->nCol);
83682 Table *pTab = 0; /* Table hold the row */
83691 pExpr->pTab = 0;
83725 pTab = pItem->pTab;
83726 assert( pTab!=0 && pTab->zName!=0 );
83727 assert( pTab->nCol>0 );
83742 if( zDb && pTab->pSchema!=pSchema ){
83746 const char *zTabName = pItem->zAlias ? pItem->zAlias : pTab->zName;
83755 for(j=0, pCol=pTab->aCol; j<pTab->nCol; j++, pCol++){
83768 pExpr->iColumn = j==pTab->iPKey ? -1 : (i16)j;
83775 pExpr->pTab = pMatch->pTab;
83781 pSchema = pExpr->pTab->pSchema;
83794 pTab = pParse->pTriggerTab;
83797 pTab = pParse->pTriggerTab;
83799 pTab = 0;
83802 if( pTab ){
83804 pSchema = pTab->pSchema;
83806 for(iCol=0, pCol=pTab->aCol; iCol<pTab->nCol; iCol++, pCol++){
83808 if( iCol==pTab->iPKey ){
83814 if( iCol>=pTab->nCol && sqlite3IsRowid(zCol) && VisibleRowid(pTab) ){
83819 if( iCol<pTab->nCol ){
83833 pExpr->pTab = pTab;
83848 && VisibleRowid(pMatch->pTab)
83919 pExpr->pTab = 0;
83992 p->pTab = pItem->pTab;
83994 if( p->pTab->iPKey==iCol ){
84086 pExpr->pTab = pItem->pTab;
84959 Table *pTab, /* The table being referenced */
84971 sSrc.a[0].zName = pTab->zName;
84972 sSrc.a[0].pTab = pTab;
85031 && pExpr->pTab!=0
85037 assert( pExpr->pTab && j<pExpr->pTab->nCol );
85038 return pExpr->pTab->aCol[j].affinity;
85120 && p->pTab!=0
85126 const char *zColl = p->pTab->aCol[j].zColl;
86014 Table *pTab;
86031 pTab = pNewItem->pTab = pOldItem->pTab;
86032 if( pTab ){
86033 pTab->nRef++;
86463 assert( p->pTab!=0 );
86465 (p->iColumn>=0 && p->pTab->aCol[p->iColumn].notNull==0);
86537 Table *pTab;
86553 pTab = pSrc->a[0].pTab;
86554 if( NEVER(pTab==0) ) return 0;
86555 assert( pTab->pSelect==0 ); /* FROM clause is not a view */
86556 if( IsVirtual(pTab) ) return 0; /* FROM clause not a virtual table */
86695 Table *pTab; /* Table <table>. */
86704 pTab = p->pSrc->a[0].pTab;
86709 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
86711 sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
86722 sqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead);
86738 int affinity_ok = sqlite3IndexAffinityOk(pX, pTab->aCol[iCol].affinity);
86740 for(pIdx=pTab->pIndex; pIdx && eType==0 && affinity_ok; pIdx=pIdx->pNext){
86752 if( prRhsHasNull && !pTab->aCol[iCol].notNull ){
87444 Table *pTab, /* The table containing the value */
87449 if( iCol<0 || iCol==pTab->iPKey ){
87452 int op = IsVirtual(pTab) ? OP_VColumn : OP_Column;
87454 if( !HasRowid(pTab) ){
87455 x = sqlite3ColumnOfIndex(sqlite3PrimaryKeyIndex(pTab), iCol);
87460 sqlite3ColumnDefault(v, pTab, iCol, regOut);
87475 Table *pTab, /* Description of the table we are reading from */
87493 sqlite3ExprCodeGetColumnOfTable(v, pTab, iTable, iColumn, iReg);
87629 inReg = sqlite3ExprCodeGetColumn(pParse, pExpr->pTab,
88043 Table *pTab = pExpr->pTab;
88044 int p1 = pExpr->iTable * (pTab->nCol+1) + 1 + pExpr->iColumn;
88047 assert( pExpr->iColumn>=-1 && pExpr->iColumn<pTab->nCol );
88048 assert( pTab->iPKey<0 || pExpr->iColumn!=pTab->iPKey );
88049 assert( p1>=0 && p1<(pTab->nCol*2+2) );
88054 (pExpr->iColumn<0 ? "rowid" : pExpr->pTab->aCol[pExpr->iColumn].zName),
88065 && pTab->aCol[pExpr->iColumn].affinity==SQLITE_AFF_REAL
88991 pCol->pTab = pExpr->pTab;
89469 static char *whereForeignKeys(Parse *pParse, Table *pTab){
89472 for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){
89485 static char *whereTempTriggers(Parse *pParse, Table *pTab){
89495 if( pTab->pSchema!=pTempSchema ){
89497 for(pTrig=sqlite3TriggerList(pParse, pTab); pTrig; pTrig=pTrig->pNext){
89519 static void reloadTableSchema(Parse *pParse, Table *pTab, const char *zName){
89530 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
89535 for(pTrig=sqlite3TriggerList(pParse, pTab); pTrig; pTrig=pTrig->pNext){
89543 sqlite3VdbeAddOp4(v, OP_DropTable, iDb, 0, 0, pTab->zName, 0);
89554 if( (zWhere=whereTempTriggers(pParse, pTab))!=0 ){
89587 Table *pTab; /* Table being renamed */
89604 pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]);
89605 if( !pTab ) goto exit_rename_table;
89606 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
89626 if( SQLITE_OK!=isSystemTable(pParse, pTab->zName) ){
89634 if( pTab->pSelect ){
89635 sqlite3ErrorMsg(pParse, "view %s may not be altered", pTab->zName);
89642 if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){
89648 if( sqlite3ViewGetColumnNames(pParse, pTab) ){
89651 if( IsVirtual(pTab) ){
89652 pVTab = sqlite3GetVTable(db, pTab);
89686 zTabName = pTab->zName;
89694 if( (zWhere=whereForeignKeys(pParse, pTab))!=0 ){
89736 zDb, zName, pTab->zName);
89745 if( (zWhere=whereTempTriggers(pParse, pTab))!=0 ){
89758 for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){
89760 if( pFrom!=pTab ){
89768 reloadTableSchema(pParse, pTab, zName);
89813 Table *pTab; /* Table being altered */
89833 pTab = sqlite3FindTable(db, zTab, zDb);
89834 assert( pTab );
89838 if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){
89920 reloadTableSchema(pParse, pTab, pTab->zName);
89940 Table *pTab;
89951 pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]);
89952 if( !pTab ) goto exit_begin_add_column;
89955 if( IsVirtual(pTab) ){
89962 if( pTab->pSelect ){
89966 if( SQLITE_OK!=isSystemTable(pParse, pTab->zName) ){
89970 assert( pTab->addColOffset>0 );
89971 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
89984 pNew->nCol = pTab->nCol;
89989 pNew->zName = sqlite3MPrintf(db, "sqlite_altertab_%s", pTab->zName);
89994 memcpy(pNew->aCol, pTab->aCol, sizeof(Column)*pNew->nCol);
90004 pNew->addColOffset = pTab->addColOffset;
90977 Table *pTab, /* Table whose indices are to be analyzed */
91006 if( v==0 || NEVER(pTab==0) ){
91009 if( pTab->tnum==0 ){
91013 if( sqlite3_strnicmp(pTab->zName, "sqlite_", 7)==0 ){
91018 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
91022 if( sqlite3AuthCheck(pParse, SQLITE_ANALYZE, pTab->zName, 0,
91032 sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
91036 sqlite3OpenTable(pParse, iTabCur, iDb, pTab, OP_OpenRead);
91037 sqlite3VdbeLoadString(v, regTabname, pTab->zName);
91039 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
91048 if( !HasRowid(pTab) && IsPrimaryKeyIndex(pIdx) ){
91050 zIdxName = pTab->zName;
91060 VdbeComment((v, "Analysis for %s.%s", pTab->zName, zIdxName));
91201 if( HasRowid(pTab) ){
91209 assert( k>=0 && k<pTab->nCol );
91211 VdbeComment((v, "%s", pTab->aCol[pPk->aiColumn[j]].zName));
91242 u8 seekOp = HasRowid(pTab) ? OP_NotExists : OP_NotFound;
91283 VdbeComment((v, "%s", pTab->zName));
91327 Table *pTab = (Table*)sqliteHashData(k);
91328 analyzeOneTable(pParse, pTab, 0, iStatCur, iMem, iTab);
91338 static void analyzeTable(Parse *pParse, Table *pTab, Index *pOnlyIdx){
91342 assert( pTab!=0 );
91344 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
91351 openStatTable(pParse, iDb, iStatCur, pTab->zName, "tbl");
91353 analyzeOneTable(pParse, pTab, pOnlyIdx, iStatCur,pParse->nMem+1,pParse->nTab);
91374 Table *pTab;
91403 }else if( (pTab = sqlite3LocateTable(pParse, 0, z, 0))!=0 ){
91404 analyzeTable(pParse, pTab, 0);
91418 }else if( (pTab = sqlite3LocateTable(pParse, 0, z, zDb))!=0 ){
91419 analyzeTable(pParse, pTab, 0);
91664 Table *pTab = sqlite3FindTable(db, zName, zDb);
91665 if( pTab && !HasRowid(pTab) ) pIdx = sqlite3PrimaryKeyIndex(pTab);
92649 Table *pTab = 0; /* The table being read */
92665 pTab = pParse->pTriggerTab;
92670 pTab = pTabList->a[iSrc].pTab;
92676 if( NEVER(pTab==0) ) return;
92679 assert( iCol<pTab->nCol );
92680 zCol = pTab->aCol[iCol].zName;
92681 }else if( pTab->iPKey>=0 ){
92682 assert( pTab->iPKey<pTab->nCol );
92683 zCol = pTab->aCol[pTab->iPKey].zName;
92688 if( SQLITE_IGNORE==sqlite3AuthReadCol(pParse, pTab->zName, zCol, iDb) ){
93578 SQLITE_PRIVATE Index *sqlite3PrimaryKeyIndex(Table *pTab){
93580 for(p=pTab->pIndex; p && !IsPrimaryKeyIndex(p); p=p->pNext){}
94087 Table *pTab = pParse->pNewTable;
94091 if( pTab==0 || IN_DECLARE_VTAB ) goto primary_key_exit;
94092 if( pTab->tabFlags & TF_HasPrimaryKey ){
94094 "table \"%s\" has more than one primary key", pTab->zName);
94097 pTab->tabFlags |= TF_HasPrimaryKey;
94099 iCol = pTab->nCol - 1;
94100 pTab->aCol[iCol].colFlags |= COLFLAG_PRIMKEY;
94101 zType = pTab->aCol[iCol].zType;
94111 for(iCol=0; iCol<pTab->nCol; iCol++){
94112 if( sqlite3StrICmp(zCName, pTab->aCol[iCol].zName)==0 ){
94113 pTab->aCol[iCol].colFlags |= COLFLAG_PRIMKEY;
94114 zType = pTab->aCol[iCol].zType;
94125 pTab->iPKey = iCol;
94126 pTab->keyConf = (u8)onError;
94128 pTab->tabFlags |= autoInc*TF_Autoincrement;
94158 Table *pTab = pParse->pNewTable;
94160 if( pTab && !IN_DECLARE_VTAB
94163 pTab->pCheck = sqlite3ExprListAppend(pParse, pTab->pCheck, pCheckExpr);
94165 sqlite3ExprListSetName(pParse, pTab->pCheck, &pParse->constraintName, 1);
94420 static void estimateTableWidth(Table *pTab){
94424 for(i=pTab->nCol, pTabCol=pTab->aCol; i>0; i--, pTabCol++){
94427 if( pTab->iPKey<0 ) wTable++;
94428 pTab->szTabRow = sqlite3LogEst(wTable*4);
94476 static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){
94496 if( pTab->iPKey>=0 ){
94499 ipkToken.z = pTab->aCol[pTab->iPKey].zName;
94505 assert( pParse->pNewTable==pTab );
94506 pPk = sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0);
94509 pTab->iPKey = -1;
94511 pPk = sqlite3PrimaryKeyIndex(pTab);
94544 pTab->aCol[pPk->aiColumn[i]].notNull = 1;
94550 pPk->tnum = pTab->tnum;
94555 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
94580 if( nPk<pTab->nCol ){
94581 if( resizeIndexObject(db, pPk, pTab->nCol) ) return;
94582 for(i=0, j=nPk; i<pTab->nCol; i++){
94591 assert( pTab->nCol==j );
94593 pPk->nColumn = pTab->nCol;
95034 Table *pTab = sqliteHashData(i);
95035 if( pTab->pSelect ){
95036 sqlite3DeleteColumnNames(db, pTab);
95037 pTab->aCol = 0;
95038 pTab->nCol = 0;
95074 Table *pTab = sqliteHashData(pElem);
95075 if( pTab->tnum==iFrom ){
95076 pTab->tnum = iTo;
95123 static void destroyTable(Parse *pParse, Table *pTab){
95126 int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
95127 destroyRootPage(pParse, pTab->tnum, iDb);
95128 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
95148 int iTab = pTab->tnum;
95158 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
95160 assert( pIdx->pSchema==pTab->pSchema );
95168 int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
95204 SQLITE_PRIVATE void sqlite3CodeDropTable(Parse *pParse, Table *pTab, int iDb, int isView){
95215 if( IsVirtual(pTab) ){
95224 pTrigger = sqlite3TriggerList(pParse, pTab);
95226 assert( pTrigger->pSchema==pTab->pSchema ||
95238 if( pTab->tabFlags & TF_Autoincrement ){
95241 pDb->zName, pTab->zName
95255 pDb->zName, SCHEMA_TABLE(iDb), pTab->zName);
95256 if( !isView && !IsVirtual(pTab) ){
95257 destroyTable(pParse, pTab);
95263 if( IsVirtual(pTab) ){
95264 sqlite3VdbeAddOp4(v, OP_VDestroy, iDb, 0, 0, pTab->zName, 0);
95266 sqlite3VdbeAddOp4(v, OP_DropTable, iDb, 0, 0, pTab->zName, 0);
95276 Table *pTab;
95288 pTab = sqlite3LocateTableItem(pParse, isView, &pName->a[0]);
95291 if( pTab==0 ){
95295 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
95301 if( IsVirtual(pTab) && sqlite3ViewGetColumnNames(pParse, pTab) ){
95320 }else if( IsVirtual(pTab) ){
95322 zArg2 = sqlite3GetVTable(db, pTab)->pMod->zName;
95331 if( sqlite3AuthCheck(pParse, code, pTab->zName, zArg2, zDb) ){
95334 if( sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0, zDb) ){
95339 if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0
95340 && sqlite3StrNICmp(pTab->zName, "sqlite_stat", 11)!=0 ){
95341 sqlite3ErrorMsg(pParse, "table %s may not be dropped", pTab->zName);
95349 if( isView && pTab->pSelect==0 ){
95350 sqlite3ErrorMsg(pParse, "use DROP TABLE to delete table %s", pTab->zName);
95353 if( !isView && pTab->pSelect ){
95354 sqlite3ErrorMsg(pParse, "use DROP VIEW to delete view %s", pTab->zName);
95365 sqlite3ClearStatTables(pParse, iDb, "tbl", pTab->zName);
95366 sqlite3FkDropTable(pParse, pName, pTab);
95367 sqlite3CodeDropTable(pParse, pTab, iDb, isView);
95513 Table *pTab;
95515 if( (pTab = pParse->pNewTable)==0 || (pFKey = pTab->pFKey)==0 ) return;
95533 Table *pTab = pIndex->pTable; /* The table that is indexed */
95555 sqlite3TableLock(pParse, iDb, pTab->tnum, 1, pTab->zName);
95573 sqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead);
95676 Table *pTab = 0; /* Table to be indexed */
95720 pTab = sqlite3SrcListLookup(pParse, pTblName);
95721 if( pName2->n==0 && pTab && pTab->pSchema==db->aDb[1].pSchema ){
95733 pTab = sqlite3LocateTableItem(pParse, 0, &pTblName->a[0]);
95734 assert( db->mallocFailed==0 || pTab==0 );
95735 if( pTab==0 ) goto exit_create_index;
95736 if( iDb==1 && db->aDb[iDb].pSchema!=pTab->pSchema ){
95739 pTab->zName);
95742 if( !HasRowid(pTab) ) pPk = sqlite3PrimaryKeyIndex(pTab);
95746 pTab = pParse->pNewTable;
95747 if( !pTab ) goto exit_create_index;
95748 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
95752 assert( pTab!=0 );
95754 if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0
95757 && sqlite3UserAuthTable(pTab->zName)==0
95759 && sqlite3StrNICmp(&pTab->zName[7],"altertab_",9)!=0 ){
95760 sqlite3ErrorMsg(pParse, "table %s may not be indexed", pTab->zName);
95764 if( pTab->pSelect ){
95770 if( IsVirtual(pTab) ){
95814 for(pLoop=pTab->pIndex, n=1; pLoop; pLoop=pLoop->pNext, n++){}
95815 zName = sqlite3MPrintf(db, "sqlite_autoindex_%s_%d", pTab->zName, n);
95831 if( sqlite3AuthCheck(pParse, i, zName, pTab->zName, zDb) ){
95843 prevCol.z = pTab->aCol[pTab->nCol-1].zName;
95880 pIndex->pTable = pTab;
95887 sqlite3ResolveSelfReference(pParse, pTab, NC_PartIdx, pPIWhere, 0);
95916 sqlite3ResolveSelfReference(pParse, pTab, NC_IdxExpr, pListItem->pExpr, 0);
95920 if( pTab==pParse->pNewTable ){
95940 j = pTab->iPKey;
95941 }else if( pTab->aCol[j].notNull==0 ){
95957 zColl = pTab->aCol[j].zColl;
95993 if( pTab==pParse->pNewTable ){
96016 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
96088 else if( HasRowid(pTab) || pTblName!=0 ){
96128 pTab->zName,
96155 if( onError!=OE_Replace || pTab->pIndex==0
96156 || pTab->pIndex->onError==OE_Replace){
96157 pIndex->pNext = pTab->pIndex;
96158 pTab->pIndex = pIndex;
96160 Index *pOther = pTab->pIndex;
96260 Table *pTab = pIndex->pTable;
96267 if( sqlite3AuthCheck(pParse, code, pIndex->zName, pTab->zName, zDb) ){
96550 sqlite3DeleteTable(db, pItem->pTab);
96915 Table *pTab = pIdx->pTable;
96924 zCol = pTab->aCol[pIdx->aiColumn[j]].zName;
96926 sqlite3XPrintf(&errMsg, 0, "%s.%s", pTab->zName, zCol);
96943 Table *pTab /* The table with the non-unique rowid */
96947 if( pTab->iPKey>=0 ){
96948 zMsg = sqlite3MPrintf(pParse->db, "%s.%s", pTab->zName,
96949 pTab->aCol[pTab->iPKey].zName);
96952 zMsg = sqlite3MPrintf(pParse->db, "%s.rowid", pTab->zName);
96983 static void reindexTable(Parse *pParse, Table *pTab, char const *zColl){
96986 for(pIndex=pTab->pIndex; pIndex; pIndex=pIndex->pNext){
96988 int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
97007 Table *pTab; /* A table in the database */
97013 pTab = (Table*)sqliteHashData(k);
97014 reindexTable(pParse, pTab, zColl);
97038 Table *pTab; /* A table in the database */
97071 pTab = sqlite3FindTable(db, z, zDb);
97072 if( pTab ){
97073 reindexTable(pParse, pTab, 0);
97641 Table *pTab = sqliteHashData(pElem);
97642 sqlite3DeleteTable(0, pTab);
97710 Table *pTab;
97712 pTab = sqlite3LocateTableItem(pParse, 0, pItem);
97713 sqlite3DeleteTable(pParse->db, pItem->pTab);
97714 pItem->pTab = pTab;
97715 if( pTab ){
97716 pTab->nRef++;
97719 pTab = 0;
97721 return pTab;
97729 SQLITE_PRIVATE int sqlite3IsReadOnly(Parse *pParse, Table *pTab, int viewOk){
97740 if( ( IsVirtual(pTab)
97741 && sqlite3GetVTable(pParse->db, pTab)->pMod->pModule->xUpdate==0 )
97742 || ( (pTab->tabFlags & TF_Readonly)!=0
97746 sqlite3ErrorMsg(pParse, "table %s may not be modified", pTab->zName);
97751 if( !viewOk && pTab->pSelect ){
97752 sqlite3ErrorMsg(pParse,"cannot modify %s because it is a view",pTab->zName);
97900 Table *pTab; /* The table from which records will be deleted */
97947 pTab = sqlite3SrcListLookup(pParse, pTabList);
97948 if( pTab==0 ) goto delete_from_cleanup;
97954 pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0);
97955 isView = pTab->pSelect!=0;
97956 bComplex = pTrigger || sqlite3FkRequired(pParse, pTab, 0, 0);
97969 if( sqlite3ViewGetColumnNames(pParse, pTab) ){
97973 if( sqlite3IsReadOnly(pParse, pTab, (pTrigger?1:0)) ){
97976 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
97979 rcauth = sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0, zDb);
97990 for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){
97997 sqlite3AuthContextPush(pParse, &sContext, pTab->zName);
98014 sqlite3MaterializeView(pParse, pTab, pWhere, iTabCur);
98044 && !IsVirtual(pTab)
98047 sqlite3TableLock(pParse, iDb, pTab->tnum, 1, pTab->zName);
98048 if( HasRowid(pTab) ){
98049 sqlite3VdbeAddOp4(v, OP_Clear, pTab->tnum, iDb, memCnt,
98050 pTab->zName, P4_STATIC);
98052 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
98053 assert( pIdx->pSchema==pTab->pSchema );
98061 if( HasRowid(pTab) ){
98070 pPk = sqlite3PrimaryKeyIndex(pTab);
98091 assert( IsVirtual(pTab)==0 || eOnePass!=ONEPASS_MULTI );
98092 assert( IsVirtual(pTab) || bComplex || eOnePass!=ONEPASS_OFF );
98103 sqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur,
98109 iKey = sqlite3ExprCodeGetColumn(pParse, pTab, -1, iTabCur, iKey, 0);
98161 testcase( IsVirtual(pTab) );
98162 sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, iTabCur, aToOpen,
98164 assert( pPk || IsVirtual(pTab) || iDataCur==iTabCur );
98165 assert( pPk || IsVirtual(pTab) || iIdxCur==iDataCur+1 );
98174 if( !IsVirtual(pTab) && aToOpen[iDataCur-iTabCur] ){
98175 assert( pPk!=0 || pTab->pSelect!=0 );
98191 if( IsVirtual(pTab) ){
98192 const char *pVTab = (const char *)sqlite3GetVTable(db, pTab);
98193 sqlite3VtabMakeWritable(pParse, pTab);
98209 sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur,
98226 if( !isView && !IsVirtual(pTab) ){
98228 for(i=0, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){
98310 Table *pTab, /* Table containing the row to be deleted */
98335 opSeek = HasRowid(pTab) ? OP_NotExists : OP_NotFound;
98344 if( sqlite3FkRequired(pParse, pTab, 0, 0) || pTrigger ){
98352 pParse, pTrigger, 0, 0, TRIGGER_BEFORE|TRIGGER_AFTER, pTab, onconf
98354 mask |= sqlite3FkOldmask(pParse, pTab);
98356 pParse->nMem += (1 + pTab->nCol);
98361 for(iCol=0; iCol<pTab->nCol; iCol++){
98365 sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, iCol, iOld+iCol+1);
98372 TK_DELETE, 0, TRIGGER_BEFORE, pTab, iOld, onconf, iLabel
98389 sqlite3FkCheck(pParse, pTab, iOld, 0, 0, 0);
98395 if( pTab->pSelect==0 ){
98396 sqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur,0,iIdxNoSeek);
98399 sqlite3VdbeChangeP4(v, -1, pTab->zName, P4_TRANSIENT);
98410 sqlite3FkActions(pParse, pTab, 0, iOld, 0, 0);
98414 TK_DELETE, 0, TRIGGER_AFTER, pTab, iOld, onconf, iLabel
98444 Table *pTab, /* Table containing the row to be deleted */
98459 pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);
98460 for(i=0, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){
100694 Table *pTab, /* Parent table of FK pFKey */
100743 if( pTab==pFKey->pFrom && nIncr==1 ){
100748 sqlite3OpenTable(pParse, iCur, iDb, pTab, OP_OpenRead);
100775 if( pTab==pFKey->pFrom && nIncr==1 ){
100781 assert( aiCol[i]!=pTab->iPKey );
100782 if( pIdx->aiColumn[i]==pTab->iPKey ){
100834 Table *pTab, /* The table whose content is at r[regBase]... */
100845 if( iCol>=0 && iCol!=pTab->iPKey ){
100846 pCol = &pTab->aCol[iCol];
100866 Table *pTab, /* The table whose column is desired */
100872 pExpr->pTab = pTab;
100914 Table *pTab, /* The parent table */
100929 assert( pIdx==0 || pIdx->pTable==pTab );
100932 assert( pIdx!=0 || HasRowid(pTab) );
100955 pLeft = exprTableRegister(pParse, pTab, regData, iCol);
100975 if( pTab==pFKey->pFrom && nIncr>0 ){
100979 if( HasRowid(pTab) ){
100980 pLeft = exprTableRegister(pParse, pTab, regData, -1);
100981 pRight = exprTableColumn(db, pTab, pSrc->a[0].iCursor, -1);
100985 Index *pPk = sqlite3PrimaryKeyIndex(pTab);
100990 pLeft = exprTableRegister(pParse, pTab, regData, iCol);
100991 pRight = exprTableColumn(db, pTab, pSrc->a[0].iCursor, iCol);
101036 SQLITE_PRIVATE FKey *sqlite3FkReferences(Table *pTab){
101037 return (FKey *)sqlite3HashFind(&pTab->pSchema->fkeyHash, pTab->zName);
101076 SQLITE_PRIVATE void sqlite3FkDropTable(Parse *pParse, SrcList *pName, Table *pTab){
101078 if( (db->flags&SQLITE_ForeignKeys) && !IsVirtual(pTab) && !pTab->pSelect ){
101083 if( sqlite3FkReferences(pTab)==0 ){
101090 for(p=pTab->pFKey; p; p=p->pNextFrom){
101138 Table *pTab, /* Table being updated */
101147 if( iChildKey==pTab->iPKey && bChngRowid ) return 1;
101165 Table *pTab,
101174 for(iKey=0; iKey<pTab->nCol; iKey++){
101175 if( aChange[iKey]>=0 || (iKey==pTab->iPKey && bChngRowid) ){
101176 Column *pCol = &pTab->aCol[iKey];
101228 Table *pTab, /* Row is being deleted from this table */
101246 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
101251 for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){
101261 && sqlite3_stricmp(pTab->zName, pFKey->zTo)!=0
101262 && fkChildIsModified(pTab, pFKey, aChange, bChngRowid)==0
101306 if( aiCol[i]==pTab->iPKey ){
101352 for(pFKey = sqlite3FkReferences(pTab); pFKey; pFKey=pFKey->pNextTo){
101357 if( aChange && fkParentIsModified(pTab, pFKey, aChange, bChngRowid)==0 ){
101370 if( sqlite3FkLocateIndex(pParse, pTab, pFKey, &pIdx, &aiCol) ){
101381 pItem->pTab = pFKey->pFrom;
101383 pItem->pTab->nRef++;
101387 fkScanChildren(pParse, pSrc, pTab, pIdx, pFKey, aiCol, regNew, -1);
101391 fkScanChildren(pParse, pSrc, pTab, pIdx, pFKey, aiCol, regOld, 1);
101428 Table *pTab /* Table being modified */
101434 for(p=pTab->pFKey; p; p=p->pNextFrom){
101437 for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){
101439 sqlite3FkLocateIndex(pParse, pTab, p, &pIdx, 0);
101468 Table *pTab, /* Table being modified */
101477 return (sqlite3FkReferences(pTab) || pTab->pFKey);
101484 for(p=pTab->pFKey; p; p=p->pNextFrom){
101485 if( fkChildIsModified(pTab, p, aChange, chngRowid) ) return 1;
101489 for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){
101490 if( fkParentIsModified(pTab, p, aChange, chngRowid) ) return 1;
101528 Table *pTab, /* Table being updated or deleted from */
101553 if( sqlite3FkLocateIndex(pParse, pTab, pFKey, &pIdx, &aiCol) ) return 0;
101566 assert( pIdx!=0 || (pTab->iPKey>=0 && pTab->iPKey<pTab->nCol) );
101568 tToCol.z = pTab->aCol[pIdx ? pIdx->aiColumn[i] : pTab->iPKey].zName;
101700 pTrigger->pSchema = pTab->pSchema;
101701 pTrigger->pTabSchema = pTab->pSchema;
101715 Table *pTab, /* Table being updated or deleted from */
101727 for(pFKey = sqlite3FkReferences(pTab); pFKey; pFKey=pFKey->pNextTo){
101728 if( aChange==0 || fkParentIsModified(pTab, pFKey, aChange, bChngRowid) ){
101729 Trigger *pAct = fkActionTrigger(pParse, pTab, pFKey, pChanges);
101731 sqlite3CodeRowTriggerDirect(pParse, pAct, pTab, regOld, OE_Abort, 0);
101745 SQLITE_PRIVATE void sqlite3FkDelete(sqlite3 *db, Table *pTab){
101749 assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pTab->pSchema) );
101750 for(pFKey=pTab->pFKey; pFKey; pFKey=pNext){
101759 sqlite3HashInsert(&pTab->pSchema->fkeyHash, z, p);
101814 Table *pTab, /* The table to be opened */
101818 assert( !IsVirtual(pTab) );
101821 sqlite3TableLock(pParse, iDb, pTab->tnum,
101822 (opcode==OP_OpenWrite)?1:0, pTab->zName);
101823 if( HasRowid(pTab) ){
101824 sqlite3VdbeAddOp4Int(v, opcode, iCur, pTab->tnum, iDb, pTab->nCol);
101825 VdbeComment((v, "%s", pTab->zName));
101827 Index *pPk = sqlite3PrimaryKeyIndex(pTab);
101829 assert( pPk->tnum==pTab->tnum );
101832 VdbeComment((v, "%s", pTab->zName));
101867 Table *pTab = pIdx->pTable;
101876 pIdx->zColAff[n] = pTab->aCol[x].affinity;
101914 SQLITE_PRIVATE void sqlite3TableAffinity(Vdbe *v, Table *pTab, int iReg){
101916 char *zColAff = pTab->zColAff;
101919 zColAff = (char *)sqlite3DbMallocRaw(0, pTab->nCol+1);
101925 for(i=0; i<pTab->nCol; i++){
101926 zColAff[i] = pTab->aCol[i].affinity;
101931 pTab->zColAff = zColAff;
101949 static int readsTable(Parse *p, int iDb, Table *pTab){
101954 VTable *pVTab = IsVirtual(pTab) ? sqlite3GetVTable(p->db, pTab) : 0;
101963 if( tnum==pTab->tnum ){
101966 for(pIndex=pTab->pIndex; pIndex; pIndex=pIndex->pNext){
102007 Table *pTab /* The table we are writing to */
102010 if( pTab->tabFlags & TF_Autoincrement ){
102015 while( pInfo && pInfo->pTab!=pTab ){ pInfo = pInfo->pNext; }
102021 pInfo->pTab = pTab;
102057 sqlite3VdbeLoadString(v, memId-1, p->pTab->zName);
102241 Table *pTab; /* The table to insert into. aka TABLE */
102302 pTab = sqlite3SrcListLookup(pParse, pTabList);
102303 if( pTab==0 ){
102306 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
102310 if( sqlite3AuthCheck(pParse, SQLITE_INSERT, pTab->zName, 0, zDb) ){
102313 withoutRowid = !HasRowid(pTab);
102319 pTrigger = sqlite3TriggersExist(pParse, pTab, TK_INSERT, 0, &tmask);
102320 isView = pTab->pSelect!=0;
102335 if( sqlite3ViewGetColumnNames(pParse, pTab) ){
102341 if( sqlite3IsReadOnly(pParse, pTab, tmask) ){
102362 if( pColumn==0 && xferOptimization(pParse, pTab, pSelect, onError, iDb) ){
102372 regAutoinc = autoIncBegin(pParse, iDb, pTab);
102378 pParse->nMem += pTab->nCol + 1;
102379 if( IsVirtual(pTab) ){
102396 bIdListInOrder = (pTab->tabFlags & TF_OOOHidden)==0;
102402 for(j=0; j<pTab->nCol; j++){
102403 if( sqlite3StrICmp(pColumn->a[i].zName, pTab->aCol[j].zName)==0 ){
102406 if( j==pTab->iPKey ){
102412 if( j>=pTab->nCol ){
102443 dest.nSdst = pTab->nCol;
102461 if( pTrigger || readsTable(pParse, iDb, pTab) ){
102517 ipkColumn = pTab->iPKey;
102523 if( IsVirtual(pTab) ){
102524 for(i=0; i<pTab->nCol; i++){
102525 nHidden += (IsHiddenColumn(&pTab->aCol[i]) ? 1 : 0);
102528 if( pColumn==0 && nColumn && nColumn!=(pTab->nCol-nHidden) ){
102531 pTabList, 0, pTab->nCol-nHidden, nColumn);
102549 nIdx = sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, -1, 0,
102590 int regCols = sqlite3GetTempRange(pParse, pTab->nCol+1);
102618 assert( !IsVirtual(pTab) );
102622 for(i=0; i<pTab->nCol; i++){
102631 sqlite3ExprCode(pParse, pTab->aCol[i].pDflt, regCols+i+1);
102646 sqlite3TableAffinity(v, pTab, regCols+1);
102651 pTab, regCols-pTab->nCol-1, onError, endOfLoop);
102653 sqlite3ReleaseTempRange(pParse, regCols, pTab->nCol+1);
102660 if( IsVirtual(pTab) ){
102673 if( ALWAYS(pOp) && pOp->opcode==OP_Null && !IsVirtual(pTab) ){
102686 if( !IsVirtual(pTab) ){
102696 }else if( IsVirtual(pTab) || withoutRowid ){
102708 for(i=0; i<pTab->nCol; i++){
102710 if( i==pTab->iPKey ){
102720 if( IsHiddenColumn(&pTab->aCol[i]) ){
102721 assert( IsVirtual(pTab) );
102733 sqlite3ExprCodeFactorable(pParse, pTab->aCol[i].pDflt, iRegStore);
102749 if( IsVirtual(pTab) ){
102750 const char *pVTab = (const char *)sqlite3GetVTable(db, pTab);
102751 sqlite3VtabMakeWritable(pParse, pTab);
102752 sqlite3VdbeAddOp4(v, OP_VUpdate, 1, pTab->nCol+2, regIns, pVTab, P4_VTAB);
102759 sqlite3GenerateConstraintChecks(pParse, pTab, aRegIdx, iDataCur, iIdxCur,
102762 sqlite3FkCheck(pParse, pTab, 0, regIns, 0, 0);
102763 sqlite3CompleteInsertion(pParse, pTab, iDataCur, iIdxCur,
102777 pTab, regData-2-pTab->nCol, onError, endOfLoop);
102793 if( !IsVirtual(pTab) && !isView ){
102796 for(idx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, idx++){
102927 Table *pTab, /* The table being inserted or updated */
102959 assert( pTab->pSelect==0 ); /* This table is not a VIEW */
102960 nCol = pTab->nCol;
102966 if( HasRowid(pTab) ){
102970 pPk = sqlite3PrimaryKeyIndex(pTab);
102981 if( i==pTab->iPKey ){
102984 onError = pTab->aCol[i].notNull;
102991 if( onError==OE_Replace && pTab->aCol[i].pDflt==0 ){
103002 char *zMsg = sqlite3MPrintf(db, "%s.%s", pTab->zName,
103003 pTab->aCol[i].zName);
103019 sqlite3ExprCode(pParse, pTab->aCol[i].pDflt, regNewData+1+i);
103029 if( pTab->pCheck && (db->flags & SQLITE_IgnoreChecks)==0 ){
103030 ExprList *pCheck = pTab->pCheck;
103040 if( zName==0 ) zName = pTab->zName;
103058 onError = pTab->keyConf;
103080 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
103102 sqlite3RowidConstraint(pParse, onError, pTab);
103130 pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0);
103132 if( pTrigger || sqlite3FkRequired(pParse, pTab, 0, 0) ){
103134 sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur,
103138 if( pTab->pIndex ){
103140 sqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur,0,-1);
103166 for(ix=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, ix++){
103174 sqlite3TableAffinity(v, pTab, regNewData+1);
103202 if( iField==XN_ROWID || iField==pTab->iPKey ){
103210 VdbeComment((v, "%s", iField<0 ? "rowid" : pTab->aCol[iField].zName));
103246 if( HasRowid(pTab) ){
103264 VdbeComment((v, "%s.%s", pTab->zName,
103265 pTab->aCol[pPk->aiColumn[i]].zName));
103318 pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0);
103320 sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur,
103351 Table *pTab, /* the table into which we are inserting */
103370 assert( pTab->pSelect==0 ); /* This table is not a VIEW */
103371 for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
103381 if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){
103387 if( !HasRowid(pTab) ) return;
103390 sqlite3VdbeAddOp3(v, OP_MakeRecord, regData, pTab->nCol, regRec);
103391 if( !bAffinityDone ) sqlite3TableAffinity(v, pTab, 0);
103392 sqlite3ExprCacheAffinityChange(pParse, regData, pTab->nCol);
103407 sqlite3VdbeChangeP4(v, -1, pTab->zName, P4_TRANSIENT);
103435 Table *pTab, /* Table to be opened */
103449 if( IsVirtual(pTab) ){
103455 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
103461 if( HasRowid(pTab) && (aToOpen==0 || aToOpen[0]) ){
103462 sqlite3OpenTable(pParse, iDataCur, iDb, pTab, op);
103464 sqlite3TableLock(pParse, iDb, pTab->tnum, op==OP_OpenWrite, pTab->zName);
103467 for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
103469 assert( pIdx->pSchema==pTab->pSchema );
103470 if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) && piDataCur ){
106819 Table *pTab;
106820 pTab = sqlite3FindTable(db, zRight, zDb);
106821 if( pTab ){
106828 Index *pPk = sqlite3PrimaryKeyIndex(pTab);
106832 sqlite3ViewGetColumnNames(pParse, pTab);
106833 for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
106843 for(k=1; k<=pTab->nCol && pPk->aiColumn[k-1]!=i; k++){}
106867 Table *pTab = sqliteHashData(i);
106869 pTab->zName,
106871 (int)sqlite3LogEstToInt(pTab->szTabRow),
106872 (int)sqlite3LogEstToInt(pTab->nRowLogEst));
106874 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
106887 Table *pTab;
106904 pTab = pIdx->pTable;
106911 cnum<0 ? 0 : pTab->aCol[cnum].zName);
106926 Table *pTab;
106928 pTab = sqlite3FindTable(db, zRight, zDb);
106929 if( pTab ){
106937 for(pIdx=pTab->pIndex, i=0; pIdx; pIdx=pIdx->pNext, i++){
106986 Table *pTab;
106987 pTab = sqlite3FindTable(db, zRight, zDb);
106988 if( pTab ){
106990 pFK = pTab->pFKey;
107007 pTab->aCol[pFK->aCol[j].iFrom].zName,
107027 Table *pTab; /* Child table contain "REFERENCES" keyword */
107052 pTab = sqlite3LocateTable(pParse, 0, zRight, zDb);
107055 pTab = (Table*)sqliteHashData(k);
107058 if( pTab==0 || pTab->pFKey==0 ) continue;
107059 sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
107060 if( pTab->nCol+regRow>pParse->nMem ) pParse->nMem = pTab->nCol + regRow;
107061 sqlite3OpenTable(pParse, 0, iDb, pTab, OP_OpenRead);
107062 sqlite3VdbeLoadString(v, regResult, pTab->zName);
107063 for(i=1, pFK=pTab->pFKey; pFK; i++, pFK=pFK->pNextFrom){
107085 for(i=1, pFK=pTab->pFKey; pFK; i++, pFK=pFK->pNextFrom){
107096 assert( iKey>=0 && iKey<pTab->nCol );
107097 if( iKey!=pTab->iPKey ){
107099 sqlite3ColumnDefault(v, pTab, iKey, regRow);
107111 sqlite3ExprCodeGetColumnOfTable(v, pTab, 0,
107235 Table *pTab = sqliteHashData(x);
107237 if( HasRowid(pTab) ){
107238 sqlite3VdbeAddOp2(v, OP_Integer, pTab->tnum, 2+cnt);
107239 VdbeComment((v, "%s", pTab->zName));
107242 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
107267 Table *pTab = sqliteHashData(x);
107274 if( pTab->pIndex==0 ) continue;
107275 pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);
107281 sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenRead,
107284 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
107291 for(j=0; j<pTab->nCol; j++){
107294 if( j==pTab->iPKey ) continue;
107295 if( pTab->aCol[j].notNull==0 ) continue;
107296 sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, j, 3);
107300 zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName,
107301 pTab->aCol[j].zName);
107310 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
107341 assert( iCol!=XN_ROWID && iCol<pTab->nCol );
107342 if( iCol>=0 && pTab->aCol[iCol].notNull ) continue;
107363 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
107881 Table *pTab;
107946 pTab = sqlite3FindTable(db, zMasterName, db->aDb[iDb].zName);
107947 if( ALWAYS(pTab) ){
107948 pTab->tabFlags |= TF_Readonly;
108889 static int columnIndex(Table *pTab, const char *zCol){
108891 for(i=0; i<pTab->nCol; i++){
108892 if( sqlite3StrICmp(pTab->aCol[i].zName, zCol)==0 ) return i;
108918 iCol = columnIndex(pSrc->a[i].pTab, zCol);
108958 assert( pSrc->a[iLeft].pTab );
108959 assert( pSrc->a[iRight].pTab );
109041 Table *pLeftTab = pLeft->pTab;
109042 Table *pRightTab = pRight->pTab;
109988 Table *pTab = 0; /* Table structure column is extracted from */
109993 while( pNC && !pTab ){
109997 pTab = pTabList->a[j].pTab;
110004 if( pTab==0 ){
110025 assert( pTab && pExpr->pTab==pTab );
110046 }else if( pTab->pSchema ){
110049 if( iCol<0 ) iCol = pTab->iPKey;
110050 assert( iCol==-1 || (iCol>=0 && iCol<pTab->nCol) );
110056 zType = pTab->aCol[iCol].zType;
110057 zOrigCol = pTab->aCol[iCol].zName;
110058 estWidth = pTab->aCol[iCol].szEst;
110060 zOrigTab = pTab->zName;
110062 int iDb = sqlite3SchemaToIndex(pNC->pParse->db, pTab->pSchema);
110069 zType = pTab->aCol[iCol].zType;
110070 estWidth = pTab->aCol[iCol].szEst;
110181 Table *pTab;
110188 pTab = pTabList->a[j].pTab;
110189 if( iCol<0 ) iCol = pTab->iPKey;
110190 assert( iCol==-1 || (iCol>=0 && iCol<pTab->nCol) );
110194 zCol = pTab->aCol[iCol].zName;
110201 zName = sqlite3MPrintf(db, "%s.%s", pTab->zName, zCol);
110263 Table *pTab; /* Table associated with this expression */
110268 if( pColExpr->op==TK_COLUMN && ALWAYS(pColExpr->pTab!=0) ){
110271 pTab = pColExpr->pTab;
110272 if( iCol<0 ) iCol = pTab->iPKey;
110274 iCol>=0 ? pTab->aCol[iCol].zName : "rowid");
110333 Table *pTab, /* Add column type information to this table */
110347 assert( pTab->nCol==pSelect->pEList->nExpr || db->mallocFailed );
110352 for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
110366 pTab->szTabRow = sqlite3LogEst(szAll*4);
110374 Table *pTab;
110385 pTab = sqlite3DbMallocZero(db, sizeof(Table) );
110386 if( pTab==0 ){
110392 pTab->nRef = 1;
110393 pTab->zName = 0;
110394 pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
110395 sqlite3ColumnsFromExprList(pParse, pSelect->pEList, &pTab->nCol, &pTab->aCol);
110396 selectAddColumnTypeAndCollation(pParse, pTab, pSelect);
110397 pTab->iPKey = -1;
110399 sqlite3DeleteTable(db, pTab);
110402 return pTab;
112195 if( ALWAYS(pSubitem->pTab!=0) ){
112196 Table *pTabToDel = pSubitem->pTab;
112204 pSubitem->pTab = 0;
112481 Table *pTab;
112491 pTab = p->pSrc->a[0].pTab;
112493 assert( pTab && !pTab->pSelect && pExpr );
112495 if( IsVirtual(pTab) ) return 0;
112501 return pTab;
112512 if( pFrom->pTab && pFrom->fg.isIndexedBy ){
112513 Table *pTab = pFrom->pTab;
112516 for(pIdx=pTab->pIndex;
112675 assert( pFrom->pTab==0 );
112679 Table *pTab;
112695 assert( pFrom->pTab==0 );
112696 pFrom->pTab = pTab = sqlite3DbMallocZero(db, sizeof(Table));
112697 if( pTab==0 ) return WRC_Abort;
112698 pTab->nRef = 1;
112699 pTab->zName = sqlite3DbStrDup(db, pCte->zName);
112700 pTab->iPKey = -1;
112701 pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
112702 pTab->tabFlags |= TF_Ephemeral | TF_NoVisibleRowid;
112719 pItem->pTab = pTab;
112721 pTab->nRef++;
112728 if( pTab->nRef>2 ){
112734 assert( pTab->nRef==1 || ((pSel->selFlags&SF_Recursive) && pTab->nRef==2 ));
112754 sqlite3ColumnsFromExprList(pParse, pEList, &pTab->nCol, &pTab->aCol);
112849 Table *pTab;
112850 assert( pFrom->fg.isRecursive==0 || pFrom->pTab!=0 );
112852 assert( pFrom->pTab==0 );
112855 if( pFrom->pTab ) {} else
112862 assert( pFrom->pTab==0 );
112864 pFrom->pTab = pTab = sqlite3DbMallocZero(db, sizeof(Table));
112865 if( pTab==0 ) return WRC_Abort;
112866 pTab->nRef = 1;
112867 pTab->zName = sqlite3MPrintf(db, "sqlite_sq_%p", (void*)pTab);
112869 sqlite3ColumnsFromExprList(pParse, pSel->pEList,&pTab->nCol,&pTab->aCol);
112870 pTab->iPKey = -1;
112871 pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
112872 pTab->tabFlags |= TF_Ephemeral;
112876 assert( pFrom->pTab==0 );
112877 pFrom->pTab = pTab = sqlite3LocateTableItem(pParse, 0, pFrom);
112878 if( pTab==0 ) return WRC_Abort;
112879 if( pTab->nRef==0xffff ){
112881 pTab->zName);
112882 pFrom->pTab = 0;
112885 pTab->nRef++;
112887 if( pTab->pSelect || IsVirtual(pTab) ){
112889 if( sqlite3ViewGetColumnNames(pParse, pTab) ) return WRC_Abort;
112891 if( pFrom->fg.isTabFunc && !IsVirtual(pTab) ){
112892 sqlite3ErrorMsg(pParse, "'%s' is not a function", pTab->zName);
112895 pFrom->pSelect = sqlite3SelectDup(db, pTab->pSelect, 0);
112896 sqlite3SelectSetName(pFrom->pSelect, pTab->zName);
112897 nCol = pTab->nCol;
112898 pTab->nCol = -1;
112900 pTab->nCol = nCol;
112972 Table *pTab = pFrom->pTab;
112978 zTabName = pTab->zName;
112986 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
112989 for(j=0; j<pTab->nCol; j++){
112990 char *zName = pTab->aCol[j].zName;
113006 if( IsHiddenColumn(&pTab->aCol[j]) ){
113007 assert(IsVirtual(pTab));
113153 Table *pTab = pFrom->pTab;
113154 assert( pTab!=0 );
113155 if( (pTab->tabFlags & TF_Ephemeral)!=0 ){
113160 selectAddColumnTypeAndCollation(pParse, pTab, pSel);
113366 Table *pTab, /* Table being queried */
113370 int bCover = (pIdx!=0 && (HasRowid(pTab) || !IsPrimaryKeyIndex(pIdx)));
113372 pTab->zName,
113486 Table *pTab = pItem->pTab;
113491 if( pTab->nCol!=pSub->pEList->nExpr ){
113493 pTab->nCol, pTab->zName, pSub->pEList->nExpr);
113591 VdbeComment((v, "%s", pItem->pTab->zName));
113596 pItem->pTab->nRowLogEst = sqlite3LogEst(pSub->nSelectRow);
113620 VdbeComment((v, "materialize \"%s\"", pItem->pTab->zName));
113622 VdbeNoopComment((v, "materialize \"%s\"", pItem->pTab->zName));
113627 pItem->pTab->nRowLogEst = sqlite3LogEst(pSub->nSelectRow);
113630 VdbeComment((v, "end %s", pItem->pTab->zName));
113938 pCol->pTab, pCol->iColumn, pCol->iTable, r1, 0);
114078 Table *pTab;
114079 if( (pTab = isSimpleCount(p, &sAggInfo))!=0 ){
114093 const int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
114098 int iRoot = pTab->tnum; /* Root page of scanned b-tree */
114101 sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
114112 if( !HasRowid(pTab) ) pBest = sqlite3PrimaryKeyIndex(pTab);
114113 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
114115 && pIdx->szIdxRow<pTab->szTabRow
114134 explainSimpleCount(pParse, pTab, pBest);
114506 SQLITE_PRIVATE Trigger *sqlite3TriggerList(Parse *pParse, Table *pTab){
114514 if( pTmpSchema!=pTab->pSchema ){
114519 if( pTrig->pTabSchema==pTab->pSchema
114520 && 0==sqlite3StrICmp(pTrig->table, pTab->zName)
114522 pTrig->pNext = (pList ? pList : pTab->pTrigger);
114528 return (pList ? pList : pTab->pTrigger);
114552 Table *pTab; /* Table that the trigger fires off of */
114601 pTab = sqlite3SrcListLookup(pParse, pTableName);
114602 if( db->init.busy==0 && pName2->n==0 && pTab
114603 && pTab->pSchema==db->aDb[1].pSchema ){
114614 pTab = sqlite3SrcListLookup(pParse, pTableName);
114615 if( !pTab ){
114630 if( IsVirtual(pTab) ){
114653 if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 ){
114661 if( pTab->pSelect && tr_tm!=TK_INSTEAD ){
114666 if( !pTab->pSelect && tr_tm==TK_INSTEAD ){
114671 iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema);
114679 if( sqlite3AuthCheck(pParse, code, zName, pTab->zName, zDbTrig) ){
114704 pTrigger->pTabSchema = pTab->pSchema;
114788 Table *pTab;
114789 pTab = sqlite3HashFind(&pLink->pTabSchema->tblHash, pLink->table);
114790 assert( pTab!=0 );
114791 pLink->pNext = pTab->pTrigger;
114792 pTab->pTrigger = pLink;
115061 Table *pTab = tableOfTrigger(pTrigger);
115063 for(pp=&pTab->pTrigger; *pp!=pTrigger; pp=&((*pp)->pNext));
115097 Table *pTab, /* The table the contains the triggers */
115107 pList = sqlite3TriggerList(pParse, pTab);
115109 assert( pList==0 || IsVirtual(pTab)==0 );
115270 Table *pTab, /* The table pTrigger is attached to */
115283 assert( pTrigger->zName==0 || pTab==tableOfTrigger(pTrigger) );
115308 pSubParse->pTriggerTab = pTab;
115322 pTab->zName
115384 Table *pTab, /* The table trigger pTrigger is attached to */
115390 assert( pTrigger->zName==0 || pTab==tableOfTrigger(pTrigger) );
115403 pPrg = codeRowTrigger(pParse, pTrigger, pTab, orconf);
115418 Table *pTab, /* The table to code triggers from */
115425 pPrg = getRowTrigger(pParse, p, pTab, orconf);
115493 Table *pTab, /* The table to code triggers from */
115519 sqlite3CodeRowTriggerDirect(pParse, p, pTab, reg, orconf, ignoreJump);
115555 Table *pTab, /* The table to code triggers from */
115568 pPrg = getRowTrigger(pParse, p, pTab, orconf);
115603 Table *pTab, /* The virtual table */
115642 SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *v, Table *pTab, int i, int iReg){
115643 assert( pTab!=0 );
115644 if( !pTab->pSelect ){
115647 Column *pCol = &pTab->aCol[i];
115648 VdbeComment((v, "%s.%s", pTab->zName, pCol->zName));
115649 assert( i<pTab->nCol );
115656 if( pTab->aCol[i].affinity==SQLITE_AFF_REAL ){
115678 Table *pTab; /* The table to be updated */
115734 pTab = sqlite3SrcListLookup(pParse, pTabList);
115735 if( pTab==0 ) goto update_cleanup;
115736 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
115742 pTrigger = sqlite3TriggersExist(pParse, pTab, TK_UPDATE, pChanges, &tmask);
115743 isView = pTab->pSelect!=0;
115755 if( sqlite3ViewGetColumnNames(pParse, pTab) ){
115758 if( sqlite3IsReadOnly(pParse, pTab, tmask) ){
115769 pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);
115770 for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){
115781 aXRef = sqlite3DbMallocRaw(db, sizeof(int) * (pTab->nCol+nIdx) + nIdx+2 );
115783 aRegIdx = aXRef+pTab->nCol;
115787 for(i=0; i<pTab->nCol; i++) aXRef[i] = -1;
115805 for(j=0; j<pTab->nCol; j++){
115806 if( sqlite3StrICmp(pTab->aCol[j].zName, pChanges->a[i].zName)==0 ){
115807 if( j==pTab->iPKey ){
115810 }else if( pPk && (pTab->aCol[j].colFlags & COLFLAG_PRIMKEY)!=0 ){
115817 if( j>=pTab->nCol ){
115831 rc = sqlite3AuthCheck(pParse, SQLITE_UPDATE, pTab->zName,
115832 j<0 ? "ROWID" : pTab->aCol[j].zName,
115852 hasFK = sqlite3FkRequired(pParse, pTab, aXRef, chngKey);
115860 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
115885 if( !IsVirtual(pTab) ){
115890 pParse->nMem += pTab->nCol;
115896 pParse->nMem += pTab->nCol;
115901 sqlite3AuthContextPush(pParse, &sContext, pTab->zName);
115909 sqlite3MaterializeView(pParse, pTab, pWhere, iDataCur);
115922 if( IsVirtual(pTab) ){
115923 updateVirtualTable(pParse, pTabList, pTab, pChanges, pRowidExpr, aXRef,
115931 if( HasRowid(pTab) ){
115969 sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, pPk->aiColumn[i],
116002 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
116013 sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, iBaseCur, aToOpen,
116055 u32 oldmask = (hasFK ? sqlite3FkOldmask(pParse, pTab) : 0);
116057 pTrigger, pChanges, 0, TRIGGER_BEFORE|TRIGGER_AFTER, pTab, onError
116059 for(i=0; i<pTab->nCol; i++){
116062 || (pTab->aCol[i].colFlags & COLFLAG_PRIMKEY)!=0
116065 sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, regOld+i);
116089 pParse, pTrigger, pChanges, 1, TRIGGER_BEFORE, pTab, onError
116091 for(i=0; i<pTab->nCol; i++){
116092 if( i==pTab->iPKey ){
116106 sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, regNew+i);
116117 sqlite3TableAffinity(v, pTab, regNew);
116119 TRIGGER_BEFORE, pTab, regOldRowid, onError, labelContinue);
116140 for(i=0; i<pTab->nCol; i++){
116141 if( aXRef[i]<0 && i!=pTab->iPKey ){
116142 sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, regNew+i);
116153 sqlite3GenerateConstraintChecks(pParse, pTab, aRegIdx, iDataCur, iIdxCur,
116158 sqlite3FkCheck(pParse, pTab, regOldRowid, 0, aXRef, chngKey);
116170 sqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur, aRegIdx, -1);
116181 sqlite3FkCheck(pParse, pTab, 0, regNewRowid, aXRef, chngKey);
116185 sqlite3CompleteInsertion(pParse, pTab, iDataCur, iIdxCur,
116192 sqlite3FkActions(pParse, pTab, pChanges, regOldRowid, aXRef, chngKey);
116203 TRIGGER_AFTER, pTab, regOldRowid, onError, labelContinue);
116219 for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
116289 Table *pTab, /* The virtual table */
116300 const char *pVTab = (const char*)sqlite3GetVTable(db, pTab);
116302 int nArg = 2 + pTab->nCol; /* Number of arguments to VUpdate */
116333 for(i=0; i<pTab->nCol; i++){
116373 sqlite3VtabMakeWritable(pParse, pTab);
116793 Table *pTab; /* The Table object to which the virtual table belongs */
116894 SQLITE_PRIVATE VTable *sqlite3GetVTable(sqlite3 *db, Table *pTab){
116896 assert( IsVirtual(pTab) );
116897 for(pVtab=pTab->pVTable; pVtab && pVtab->db!=db; pVtab=pVtab->pNext);
117138 Table *pTab = pParse->pNewTable; /* The table being constructed */
117141 if( pTab==0 ) return;
117144 if( pTab->nModuleArg<1 ) return;
117173 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
117179 pTab->zName,
117180 pTab->zName,
117189 zWhere = sqlite3MPrintf(db, "name='%q' AND type='table'", pTab->zName);
117193 sqlite3VdbeLoadString(v, iReg, pTab->zName);
117204 Schema *pSchema = pTab->pSchema;
117205 const char *zName = pTab->zName;
117207 pOld = sqlite3HashInsert(&pSchema->tblHash, zName, pTab);
117210 assert( pTab==pOld ); /* Malloc must have failed inside HashInsert() */
117249 Table *pTab,
117257 const char *const*azArg = (const char *const*)pTab->azModuleArg;
117258 int nArg = pTab->nModuleArg;
117266 if( pCtx->pTab==pTab ){
117268 "vtable constructor called recursively: %s", pTab->zName
117274 zModuleName = sqlite3MPrintf(db, "%s", pTab->zName);
117287 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
117288 pTab->azModuleArg[1] = db->aDb[iDb].zName;
117293 sCtx.pTab = pTab;
117301 assert( sCtx.pTab==pTab );
117319 *pzErr = sqlite3MPrintf(db, zFormat, pTab->zName);
117330 pVTable->pNext = pTab->pVTable;
117331 pTab->pVTable = pVTable;
117333 for(iCol=0; iCol<pTab->nCol; iCol++){
117334 char *zType = pTab->aCol[iCol].zType;
117338 pTab->tabFlags |= oooHidden;
117362 pTab->aCol[iCol].colFlags |= COLFLAG_HIDDEN;
117365 pTab->tabFlags |= oooHidden;
117382 SQLITE_PRIVATE int sqlite3VtabCallConnect(Parse *pParse, Table *pTab){
117388 assert( pTab );
117389 if( (pTab->tabFlags & TF_Virtual)==0 || sqlite3GetVTable(db, pTab) ){
117394 zMod = pTab->azModuleArg[0];
117398 const char *zModule = pTab->azModuleArg[0];
117403 rc = vtabCallConstructor(db, pTab, pMod, pMod->pModule->xConnect, &zErr);
117454 Table *pTab;
117458 pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zName);
117459 assert( pTab && (pTab->tabFlags & TF_Virtual)!=0 && !pTab->pVTable );
117462 zMod = pTab->azModuleArg[0];
117473 rc = vtabCallConstructor(db, pTab, pMod, pMod->pModule->xCreate, pzErr);
117478 if( rc==SQLITE_OK && ALWAYS(sqlite3GetVTable(db, pTab)) ){
117481 addToVTrans(db, sqlite3GetVTable(db, pTab));
117497 Table *pTab;
117512 pTab = pCtx->pTab;
117513 assert( (pTab->tabFlags & TF_Virtual)!=0 );
117529 if( !pTab->aCol ){
117530 pTab->aCol = pParse->pNewTable->aCol;
117531 pTab->nCol = pParse->pNewTable->nCol;
117566 Table *pTab;
117568 pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zName);
117569 if( ALWAYS(pTab!=0 && pTab->pVTable!=0) ){
117572 for(p=pTab->pVTable; p; p=p->pNext){
117578 p = vtabDisconnectAll(db, pTab);
117584 assert( pTab->pVTable==p && p->pNext==0 );
117586 pTab->pVTable = 0;
117783 Table *pTab;
117797 pTab = pExpr->pTab;
117798 if( NEVER(pTab==0) ) return pDef;
117799 if( (pTab->tabFlags & TF_Virtual)==0 ) return pDef;
117800 pVtab = sqlite3GetVTable(db, pTab)->pVtab;
117843 SQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse *pParse, Table *pTab){
117848 assert( IsVirtual(pTab) );
117850 if( pTab==pToplevel->apVtabLock[i] ) return;
117856 pToplevel->apVtabLock[pToplevel->nVtabLock++] = pTab;
117878 Table *pTab;
117886 pTab = sqlite3DbMallocZero(db, sizeof(Table) + nName);
117887 if( pTab==0 ) return 0;
117888 pMod->pEpoTab = pTab;
117889 pTab->zName = (char*)&pTab[1];
117890 memcpy(pTab->zName, pMod->zName, nName);
117891 pTab->nRef = 1;
117892 pTab->pSchema = db->aDb[0].pSchema;
117893 pTab->tabFlags |= TF_Virtual;
117894 pTab->nModuleArg = 0;
117895 pTab->iPKey = -1;
117896 addModuleArgument(db, pTab, sqlite3DbStrDup(db, pTab->zName));
117897 addModuleArgument(db, pTab, 0);
117898 addModuleArgument(db, pTab, sqlite3DbStrDup(db, pTab->zName));
117899 rc = vtabCallConstructor(db, pTab, pMod, pModule->xConnect, &zErr);
117914 Table *pTab = pMod->pEpoTab;
117915 if( pTab!=0 ){
117916 sqlite3DeleteColumnNames(db, pTab);
117917 sqlite3VtabClear(db, pTab);
117918 sqlite3DbFree(db, pTab);
117963 assert( p->pTab==0 || (p->pTab->tabFlags & TF_Virtual)!=0 );
118671 if( !HasRowid(pItem->pTab) && IsPrimaryKeyIndex(pIdx) ){
119151 VdbeModuleComment((v, "Begin WHERE-loop%d: %s",iLevel,pTabItem->pTab->zName));
119182 VdbeComment((v, "next row of \"%s\"", pTabItem->pTab->zName));
119685 Table *pTab = pTabItem->pTab;
119730 if( HasRowid(pTab) ){
119734 Index *pPk = sqlite3PrimaryKeyIndex(pTab);
119812 if( HasRowid(pTab) ){
119813 r = sqlite3ExprCodeGetColumn(pParse, pTab, -1, iCur, regRowid, 0);
119818 Index *pPk = sqlite3PrimaryKeyIndex(pTab);
119827 rx = sqlite3ExprCodeGetColumn(pParse, pTab, iCol, iCur,r+iPk,0);
119889 && (HasRowid(pTab) || !IsPrimaryKeyIndex(pSubLoop->u.btree.pIndex))
120251 || IsVirtual(pLeft->pTab) /* Value might be numeric */
120864 for(pIdx=pFrom->a[i].pTab->pIndex; pIdx; pIdx=pIdx->pNext){
121345 Table *pTab;
121351 pTab = pItem->pTab;
121352 assert( pTab!=0 );
121356 while( k<pTab->nCol && (pTab->aCol[k].colFlags & COLFLAG_HIDDEN)==0 ){ k++; }
121357 if( k>=pTab->nCol ){
121359 pTab->zName, j);
121366 pColRef->pTab = pTab;
121799 Table *pTab;
121809 pTab = pTabList->a[0].pTab;
121833 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
121962 aff = pSrc->pTab->aCol[pTerm->u.leftColumn].affinity;
122016 pTable = pSrc->pTab;
122138 VdbeComment((v, "next row of \"%s\"", pTabItem->pTab->zName));
122306 static int vtabBestIndex(Parse *pParse, Table *pTab, sqlite3_index_info *p){
122307 sqlite3_vtab *pVtab = sqlite3GetVTable(pParse->db, pTab)->pVtab;
122330 "table %s: xBestIndex returned an invalid plan", pTab->zName);
123022 Table *pTab = pItem->pTab;
123026 pItem->zAlias ? pItem->zAlias : pTab->zName);
123739 rCostIdx = pNew->nOut + 1 + (15*pProbe->szIdxRow)/pSrc->pTab->szTabRow;
123943 Table *pTab; /* Table being queried */
123949 pTab = pSrc->pTab;
123951 assert( !IsVirtual(pSrc->pTab) );
123956 }else if( !HasRowid(pTab) ){
123957 pProbe = pTab->pIndex;
123970 sPk.pTable = pTab;
123971 sPk.szIdxRow = pTab->szTabRow;
123972 aiRowEstPk[0] = pTab->nRowLogEst;
123974 pFirst = pSrc->pTab->pIndex;
123982 rSize = pTab->nRowLogEst;
123992 && HasRowid(pTab) /* Not WITHOUT ROWID table. (FIXME: Why not?) */
124016 if( pTab->pSelect==0 && (pTab->tabFlags & TF_Ephemeral)==0 ){
124019 ApplyCostMultiplier(pNew->rSetup, pTab->costMult);
124062 ApplyCostMultiplier(pNew->rRun, pTab->costMult);
124079 || !HasRowid(pTab)
124082 && (pProbe->szIdxRow<pTab->szTabRow)
124094 pNew->rRun = rSize + 1 + (15*pProbe->szIdxRow)/pTab->szTabRow;
124098 ApplyCostMultiplier(pNew->rRun, pTab->costMult);
124155 Table *pTab;
124177 pTab = pSrc->pTab;
124178 assert( IsVirtual(pTab) );
124238 rc = vtabBestIndex(pParse, pTab, pIdxInfo);
124255 sqlite3ErrorMsg(pParse, "%s.xBestIndex() malfunction", pTab->zName);
124388 if( IsVirtual(pItem->pTab) ){
124477 if( IsVirtual(pItem->pTab) ){
125208 Table *pTab;
125215 pTab = pItem->pTab;
125216 if( IsVirtual(pTab) ) return 0;
125233 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
125642 if( HasRowid(pTabList->a[0].pTab) ){
125652 Table *pTab; /* Table to open */
125657 pTab = pTabItem->pTab;
125658 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
125660 if( (pTab->tabFlags & TF_Ephemeral)!=0 || pTab->pSelect ){
125665 const char *pVTab = (const char *)sqlite3GetVTable(db, pTab);
125668 }else if( IsVirtual(pTab) ){
125679 sqlite3OpenTable(pParse, pTabItem->iCursor, iDb, pTab, op);
125681 testcase( pWInfo->eOnePass==ONEPASS_OFF && pTab->nCol==BMS-1 );
125682 testcase( pWInfo->eOnePass==ONEPASS_OFF && pTab->nCol==BMS );
125683 if( pWInfo->eOnePass==ONEPASS_OFF && pTab->nCol<BMS && HasRowid(pTab) ){
125689 assert( n<=pTab->nCol );
125696 sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
125704 if( !HasRowid(pTab) && IsPrimaryKeyIndex(pIx)
125712 Index *pJ = pTabItem->pTab->pIndex;
125728 assert( pIx->pSchema==pTab->pSchema );
125881 pWInfo->pTabList->a[pLevel->iFrom].pTab->zName));
125895 Table *pTab = pTabItem->pTab;
125896 assert( pTab!=0 );
125914 if( (pTab->tabFlags & TF_Ephemeral)==0
125915 && pTab->pSelect==0
125957 assert( pIdx->pTable==pTab );
125958 if( !HasRowid(pTab) ){
125959 Index *pPk = sqlite3PrimaryKeyIndex(pTab);
131753 Table *pTab = (Table *)sqliteHashData(p);
131754 if( IsVirtual(pTab) ) sqlite3VtabDisconnect(db, pTab);
134024 Table *pTab = 0;
134049 pTab = sqlite3FindTable(db, zTableName, zDbName);
134050 if( !pTab || pTab->pSelect ){
134051 pTab = 0;
134059 for(iCol=0; iCol<pTab->nCol; iCol++){
134060 pCol = &pTab->aCol[iCol];
134065 if( iCol==pTab->nCol ){
134066 if( HasRowid(pTab) && sqlite3IsRowid(zColumnName) ){
134067 iCol = pTab->iPKey;
134068 pCol = iCol>=0 ? &pTab->aCol[iCol] : 0;
134070 pTab = 0;
134091 autoinc = pTab->iPKey==iCol && (pTab->tabFlags & TF_Autoincrement)!=0;
134113 if( SQLITE_OK==rc && !pTab ){
139878 Fts3Table *pTab, /* FTS Table pointer */
139924 pTab->bDescIdx, nDiff, pLeft, nLeft, &pRight, &nRight
139945 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
139956 rc = fts3TermSelect(pTab, pToken, p->iColumn, &nThis, &pThis);
139958 rc = fts3EvalPhraseMergeToken(pTab, p, iToken, pThis, nThis);
140090 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
140101 && pCsr->bDesc==pTab->bDescIdx
140104 && pTab->bNoIncrDoclist==0
140117 int iCol = (p->iColumn >= pTab->nColumn ? -1 : p->iColumn);
140122 rc = sqlite3Fts3MsrIncrStart(pTab, pSegcsr, iCol, pToken->z, pToken->n);
140240 Fts3Table *pTab,
140259 if( pTab->bDescIdx==0 || pDL->pNextDocid==0 ){
140303 Fts3Table *pTab, /* Virtual table handle */
140314 fts3EvalDlPhraseNext(pTab, &pPhrase->doclist, pbEof);
140325 pTab, pToken->pSegcsr, &p->iDocid, &p->pList, &p->nList
140361 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
140369 rc = sqlite3Fts3MsrIncrNext(pTab, p->aToken[0].pSegcsr,
140388 rc = incrPhraseTokenNext(pTab, p, i, &a[i], &bEof);
140402 rc = incrPhraseTokenNext(pTab, p, i, &a[i], &bEof);
140461 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
140465 }else if( pCsr->bDesc!=pTab->bDescIdx && pDL->nAll ){
140466 sqlite3Fts3DoclistPrev(pTab->bDescIdx, pDL->aAll, pDL->nAll,
140471 fts3EvalDlPhraseNext(pTab, pDL, pbEof);
140667 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
140682 if( pTab->zContentTbl ){
140760 rc = fts3TermSelect(pTab, pToken, pTC->iCol, &nList, &pList);
140764 pTab, pTC->pPhrase, pTC->iToken,pList,nList
140795 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
140805 if( rc==SQLITE_OK && nToken>1 && pTab->bFts4 ){
141452 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
141473 pE->aMI = (u32 *)sqlite3_malloc(pTab->nColumn * 3 * sizeof(u32));
141475 memset(pE->aMI, 0, pTab->nColumn * 3 * sizeof(u32));
141560 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
141566 for(iCol=0; iCol<pTab->nColumn; iCol++){
141574 for(iCol=0; iCol<pTab->nColumn; iCol++){
141610 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
141618 assert( iCol>=0 && iCol<pTab->nColumn );
141619 if( (pPhrase->iColumn<pTab->nColumn && pPhrase->iColumn!=iCol) ){
141627 int bDescDoclist = pTab->bDescIdx; /* For DOCID_CMP macro */
145596 Fts3tokTable *pTab = 0;
145626 pTab = (Fts3tokTable *)sqlite3_malloc(sizeof(Fts3tokTable));
145627 if( pTab==0 ){
145633 memset(pTab, 0, sizeof(Fts3tokTable));
145634 pTab->pMod = pMod;
145635 pTab->pTok = pTok;
145636 *ppVtab = &pTab->base;
145653 Fts3tokTable *pTab = (Fts3tokTable *)pVtab;
145655 pTab->pMod->xDestroy(pTab->pTok);
145656 sqlite3_free(pTab);
145712 Fts3tokTable *pTab = (Fts3tokTable *)(pCsr->base.pVtab);
145713 pTab->pMod->xClose(pCsr->pCsr);
145742 Fts3tokTable *pTab = (Fts3tokTable *)(pCursor->pVtab);
145746 rc = pTab->pMod->xNext(pCsr->pCsr,
145771 Fts3tokTable *pTab = (Fts3tokTable *)(pCursor->pVtab);
145785 rc = pTab->pMod->xOpen(pTab->pTok, pCsr->zInput, nByte, &pCsr->pCsr);
145787 pCsr->pCsr->pTokenizer = pTab->pTok;
146315 Fts3Table *pTab, /* FTS3 table handle */
146322 rc = fts3SqlStmt(pTab, SQL_SELECT_DOCSIZE, &pStmt, 0);
146340 Fts3Table *pTab, /* Fts3 table handle */
146345 rc = fts3SqlStmt(pTab, SQL_SELECT_STAT, &pStmt, 0);
146361 Fts3Table *pTab, /* Fts3 table handle */
146365 return fts3SelectDocsize(pTab, iDocid, ppStmt);
147304 static int fts3SegReaderFirstDocid(Fts3Table *pTab, Fts3SegReader *pReader){
147308 if( pTab->bDescIdx && fts3SegReaderIsPending(pReader) ){
147337 Fts3Table *pTab,
147348 if( pTab->bDescIdx && fts3SegReaderIsPending(pReader) ){
147412 if( pTab->bDescIdx ){
152212 Fts3Table *pTab, /* FTS3 table snippet comes from */
152244 pMod = (sqlite3_tokenizer_module *)pTab->pTokenizer->pModule;
152249 rc = sqlite3Fts3OpenTokenizer(pTab->pTokenizer, iLangid, zDoc, nDoc, &pC);
152286 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
152309 pMod = (sqlite3_tokenizer_module *)pTab->pTokenizer->pModule;
152310 rc = sqlite3Fts3OpenTokenizer(pTab->pTokenizer, pCsr->iLangid, zDoc,nDoc,&pC);
152349 pTab, pCsr->iLangid, nSnippet, &zDoc[iBegin], n, &iPos, &hlmask
152425 Fts3Table *pTab = (Fts3Table *)p->pCursor->base.pVtab;
152440 if( (pPhrase->iColumn>=pTab->nColumn || pPhrase->iColumn==iCol) ){
152539 Fts3Table *pTab,
152545 || (cArg==FTS3_MATCHINFO_NDOC && pTab->bFts4)
152546 || (cArg==FTS3_MATCHINFO_AVGLENGTH && pTab->bFts4)
152547 || (cArg==FTS3_MATCHINFO_LENGTH && pTab->bHasDocsize)
152593 Fts3Table *pTab,
152603 int rc = sqlite3Fts3SelectDoctotal(pTab, ppStmt);
152773 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
152790 rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &nDoc, 0);
152800 rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &nDoc, &a);
152816 rc = sqlite3Fts3SelectDocsize(pTab, pCsr->iPrevId, &pSelectDocsize);
152853 rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &pInfo->nDoc, 0);
152883 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
152892 sInfo.nCol = pTab->nColumn;
152918 if( fts3MatchinfoCheck(pTab, zArg[i], &zErr) ){
152971 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
153016 for(iRead=0; iRead<pTab->nColumn; iRead++){
153051 sqlite3Fts3SegmentsClose(pTab);
153114 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
153115 sqlite3_tokenizer_module const *pMod = pTab->pTokenizer->pModule;
153146 for(iCol=0; iCol<pTab->nColumn; iCol++){
153181 rc = sqlite3Fts3OpenTokenizer(pTab->pTokenizer, pCsr->iLangid,
153219 }else if( rc==SQLITE_DONE && pTab->zContentTbl==0 ){
153235 sqlite3Fts3SegmentsClose(pTab);
153253 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
153268 sqlite3Fts3SegmentsClose(pTab);
162997 StatTable *pTab = 0;
163012 pTab = (StatTable *)sqlite3_malloc64(sizeof(StatTable));
163013 if( pTab==0 ) rc = SQLITE_NOMEM;
163016 assert( rc==SQLITE_OK || pTab==0 );
163018 memset(pTab, 0, sizeof(StatTable));
163019 pTab->db = db;
163020 pTab->iDb = iDb;
163023 *ppVtab = (sqlite3_vtab*)pTab;
163089 StatTable *pTab = (StatTable *)pVTab;
163098 pCsr->iDb = pTab->iDb;
163260 StatTable *pTab = (StatTable *)((sqlite3_vtab_cursor *)pCsr)->pVtab;
163261 Btree *pBt = pTab->db->aDb[pTab->iDb].pBt;
163289 StatTable *pTab = (StatTable *)pCursor->pVtab;
163290 Btree *pBt = pTab->db->aDb[pCsr->iDb].pBt;
163428 StatTable *pTab = (StatTable*)(pCursor->pVtab);
163435 pCsr->iDb = sqlite3FindDbName(pTab->db, zDbase);
163442 pCsr->iDb = pTab->iDb;
163453 " ORDER BY name", pTab->db->aDb[pCsr->iDb].zName, zMaster);
163457 rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pCsr->pStmt, 0);
178516 static int fts5IsContentless(Fts5Table *pTab){
178517 return pTab->pConfig->eContent==FTS5_CONTENT_NONE;
178523 static void fts5FreeVtab(Fts5Table *pTab){
178524 if( pTab ){
178525 sqlite3Fts5IndexClose(pTab->pIndex);
178526 sqlite3Fts5StorageClose(pTab->pStorage);
178527 sqlite3Fts5ConfigFree(pTab->pConfig);
178528 sqlite3_free(pTab);
178544 Fts5Table *pTab = (Fts5Table*)pVtab;
178545 int rc = sqlite3Fts5DropAll(pTab->pConfig);
178576 Fts5Table *pTab = 0; /* New virtual table object */
178579 pTab = (Fts5Table*)sqlite3Fts5MallocZero(&rc, sizeof(Fts5Table));
178585 pTab->pConfig = pConfig;
178586 pTab->pGlobal = pGlobal;
178591 rc = sqlite3Fts5IndexOpen(pConfig, bCreate, &pTab->pIndex, pzErr);
178597 pConfig, pTab->pIndex, bCreate, &pTab->pStorage, pzErr
178607 fts5FreeVtab(pTab);
178608 pTab = 0;
178610 fts5CheckTransactionState(pTab, FTS5_BEGIN, 0);
178612 *ppVTab = (sqlite3_vtab*)pTab;
178702 Fts5Table *pTab = (Fts5Table*)pVTab;
178703 Fts5Config *pConfig = pTab->pConfig;
178799 Fts5Table *pTab = (Fts5Table*)pVTab;
178800 Fts5Config *pConfig = pTab->pConfig;
178808 Fts5Global *pGlobal = pTab->pGlobal;
178842 Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);
178850 sqlite3Fts5StorageStmtRelease(pTab->pStorage, eStmt, pCsr->pStmt);
178886 Fts5Table *pTab = (Fts5Table*)(pCursor->pVtab);
178892 for(pp=&pTab->pGlobal->pCsr; (*pp)!=pCsr; pp=&(*pp)->pNext);
178940 static void fts5TripCursors(Fts5Table *pTab){
178942 for(pCsr=pTab->pGlobal->pCsr; pCsr; pCsr=pCsr->pNext){
178944 && pCsr->base.pVtab==(sqlite3_vtab*)pTab
178967 Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);
178971 rc = sqlite3Fts5ExprFirst(pCsr->pExpr, pTab->pIndex, iRowid, bDesc);
179037 static int fts5CursorFirstSorted(Fts5Table *pTab, Fts5Cursor *pCsr, int bDesc){
179038 Fts5Config *pConfig = pTab->pConfig;
179075 assert( pTab->pSortCsr==0 );
179076 pTab->pSortCsr = pCsr;
179078 pTab->pSortCsr = 0;
179090 static int fts5CursorFirst(Fts5Table *pTab, Fts5Cursor *pCsr, int bDesc){
179093 rc = sqlite3Fts5ExprFirst(pExpr, pTab->pIndex, pCsr->iFirstRowid, bDesc);
179108 Fts5Table *pTab,
179119 assert( pTab->base.zErrMsg==0 );
179123 pCsr->iSpecial = sqlite3Fts5IndexReads(pTab->pIndex);
179130 pTab->base.zErrMsg = sqlite3_mprintf("unknown special query: %.*s", n, z);
179142 static Fts5Auxiliary *fts5FindAuxiliary(Fts5Table *pTab, const char *zName){
179145 for(pAux=pTab->pGlobal->pAux; pAux; pAux=pAux->pNext){
179155 Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);
179156 Fts5Config *pConfig = pTab->pConfig;
179191 pAux = fts5FindAuxiliary(pTab, zRank);
179193 assert( pTab->base.zErrMsg==0 );
179194 pTab->base.zErrMsg = sqlite3_mprintf("no such function: %s", zRank);
179269 Fts5Table *pTab = (Fts5Table*)(pCursor->pVtab);
179270 Fts5Config *pConfig = pTab->pConfig;
179295 assert( pzErrmsg==0 || pzErrmsg==&pTab->base.zErrMsg );
179296 pConfig->pzErrmsg = &pTab->base.zErrMsg;
179327 if( pTab->pSortCsr ){
179339 pCsr->pExpr = pTab->pSortCsr->pExpr;
179340 rc = fts5CursorFirst(pTab, pCsr, bDesc);
179351 rc = fts5SpecialMatch(pTab, pCsr, &zExpr[1]);
179353 char **pzErr = &pTab->base.zErrMsg;
179358 rc = fts5CursorFirstSorted(pTab, pCsr, bDesc);
179361 rc = fts5CursorFirst(pTab, pCsr, bDesc);
179376 pTab->pStorage, fts5StmtType(pCsr), &pCsr->pStmt, &pTab->base.zErrMsg
179459 Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);
179462 pTab->pStorage, eStmt, &pCsr->pStmt, (bErrormsg?&pTab->base.zErrMsg:0)
179464 assert( rc!=SQLITE_OK || pTab->base.zErrMsg==0 );
179510 Fts5Table *pTab, /* Fts5 table object */
179514 Fts5Config *pConfig = pTab->pConfig;
179520 fts5SetVtabError(pTab,
179526 rc = sqlite3Fts5StorageDeleteAll(pTab->pStorage);
179530 fts5SetVtabError(pTab,
179535 rc = sqlite3Fts5StorageRebuild(pTab->pStorage);
179538 rc = sqlite3Fts5StorageOptimize(pTab->pStorage);
179541 rc = sqlite3Fts5StorageMerge(pTab->pStorage, nMerge);
179543 rc = sqlite3Fts5StorageIntegrity(pTab->pStorage);
179549 rc = sqlite3Fts5IndexLoadConfig(pTab->pIndex);
179551 rc = sqlite3Fts5ConfigSetValue(pTab->pConfig, zCmd, pVal, &bError);
179557 rc = sqlite3Fts5StorageConfigValue(pTab->pStorage, zCmd, pVal, 0);
179565 Fts5Table *pTab,
179573 rc = sqlite3Fts5StorageSpecialDelete(pTab->pStorage, iDel, &apVal[2]);
179580 Fts5Table *pTab,
179586 rc = sqlite3Fts5StorageContentInsert(pTab->pStorage, apVal, piRowid);
179589 rc = sqlite3Fts5StorageIndexInsert(pTab->pStorage, apVal, *piRowid);
179614 Fts5Table *pTab = (Fts5Table*)pVtab;
179615 Fts5Config *pConfig = pTab->pConfig;
179620 assert( pTab->ts.eState==1 );
179628 assert( pTab->pConfig->pzErrmsg==0 );
179629 pTab->pConfig->pzErrmsg = &pTab->base.zErrMsg;
179632 fts5TripCursors(pTab);
179643 rc = fts5SpecialDelete(pTab, apVal, pRowid);
179645 rc = fts5SpecialInsert(pTab, z, apVal[2 + pConfig->nCol + 1]);
179666 if( eType0==SQLITE_INTEGER && fts5IsContentless(pTab) ){
179667 pTab->base.zErrMsg = sqlite3_mprintf(
179677 rc = sqlite3Fts5StorageDelete(pTab->pStorage, iDel);
179687 rc = sqlite3Fts5StorageDelete(pTab->pStorage, iNew);
179689 fts5StorageInsert(&rc, pTab, apVal, pRowid);
179698 rc = sqlite3Fts5StorageDelete(pTab->pStorage, iOld);
179700 rc = sqlite3Fts5StorageDelete(pTab->pStorage, iNew);
179702 fts5StorageInsert(&rc, pTab, apVal, pRowid);
179704 rc = sqlite3Fts5StorageContentInsert(pTab->pStorage, apVal, pRowid);
179706 rc = sqlite3Fts5StorageDelete(pTab->pStorage, iOld);
179709 rc = sqlite3Fts5StorageIndexInsert(pTab->pStorage, apVal, *pRowid);
179713 rc = sqlite3Fts5StorageDelete(pTab->pStorage, iOld);
179714 fts5StorageInsert(&rc, pTab, apVal, pRowid);
179719 pTab->pConfig->pzErrmsg = 0;
179728 Fts5Table *pTab = (Fts5Table*)pVtab;
179729 fts5CheckTransactionState(pTab, FTS5_SYNC, 0);
179730 pTab->pConfig->pzErrmsg = &pTab->base.zErrMsg;
179731 fts5TripCursors(pTab);
179732 rc = sqlite3Fts5StorageSync(pTab->pStorage, 1);
179733 pTab->pConfig->pzErrmsg = 0;
179761 Fts5Table *pTab = (Fts5Table*)pVtab;
179762 fts5CheckTransactionState(pTab, FTS5_ROLLBACK, 0);
179763 rc = sqlite3Fts5StorageRollback(pTab->pStorage);
179783 Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);
179784 return sqlite3Fts5StorageSize(pTab->pStorage, iCol, pnToken);
179789 Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);
179790 return sqlite3Fts5StorageRowCount(pTab->pStorage, pnRow);
179800 Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);
179802 pTab->pConfig, FTS5_TOKENIZE_AUX, pText, nText, pUserData, xToken
179971 Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);
179972 Fts5Config *pConfig = pTab->pConfig;
179978 rc = sqlite3Fts5StorageDocsize(pTab->pStorage, iRowid, pCsr->aColumnSize);
180148 Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);
180154 Fts5Config *pConf = pTab->pConfig;
180158 pNew->base.pVtab = (sqlite3_vtab*)pTab;
180163 for(rc = fts5CursorFirst(pTab, pNew, 0);
180238 Fts5Table *pTab;
180241 pTab = (Fts5Table*)pCsr->base.pVtab;
180242 *pnCol = pTab->pConfig->nCol;
180244 return pTab->pIndex;
180298 Fts5Table *pTab = (Fts5Table*)(pCursor->pVtab);
180299 Fts5Config *pConfig = pTab->pConfig;
180330 }else if( !fts5IsContentless(pTab) ){
180351 Fts5Table *pTab = (Fts5Table*)pVtab;
180354 pAux = fts5FindAuxiliary(pTab, zName);
180372 Fts5Table *pTab = (Fts5Table*)pVtab;
180373 return sqlite3Fts5StorageRename(pTab->pStorage, zName);
180382 Fts5Table *pTab = (Fts5Table*)pVtab;
180383 fts5CheckTransactionState(pTab, FTS5_SAVEPOINT, iSavepoint);
180384 fts5TripCursors(pTab);
180385 return sqlite3Fts5StorageSync(pTab->pStorage, 0);
180394 Fts5Table *pTab = (Fts5Table*)pVtab;
180395 fts5CheckTransactionState(pTab, FTS5_RELEASE, iSavepoint);
180396 fts5TripCursors(pTab);
180397 return sqlite3Fts5StorageSync(pTab->pStorage, 0);
180406 Fts5Table *pTab = (Fts5Table*)pVtab;
180407 fts5CheckTransactionState(pTab, FTS5_ROLLBACKTO, iSavepoint);
180408 fts5TripCursors(pTab);
180409 return sqlite3Fts5StorageRollback(pTab->pStorage);
183866 Fts5VocabTable *pTab = (Fts5VocabTable*)pVtab;
183867 sqlite3_free(pTab);
183875 Fts5VocabTable *pTab = (Fts5VocabTable*)pVtab;
183876 sqlite3_free(pTab);
184000 Fts5VocabTable *pTab = (Fts5VocabTable*)pVTab;
184011 pTab->zFts5Tbl, pTab->zFts5Db, pTab->zFts5Tbl, pTab->zFts5Tbl
184014 rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pStmt, 0);
184022 pIndex = sqlite3Fts5IndexFromCsrid(pTab->pGlobal, iId, &nCol);
184030 "no such fts5 table: %s.%s", pTab->zFts5Db, pTab->zFts5Tbl
184077 Fts5VocabTable *pTab = (Fts5VocabTable*)pCursor->pVtab;
184082 if( pTab->eType==FTS5_VOCAB_COL ){
184088 if( pTab->eType==FTS5_VOCAB_ROW || pCsr->iCol>=pCsr->nCol ){
184102 assert( pTab->eType==FTS5_VOCAB_COL || pTab->eType==FTS5_VOCAB_ROW );
184111 if( pTab->eType==FTS5_VOCAB_ROW ){
184138 if( pCsr->bEof==0 && pTab->eType==FTS5_VOCAB_COL ){