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);
79769 Table *pTab;
79800 pTab = sqlite3LocateTable(pParse, 0, zTable, zDb);
79801 if( pTab && IsVirtual(pTab) ){
79802 pTab = 0;
79805 if( pTab && !HasRowid(pTab) ){
79806 pTab = 0;
79810 if( pTab && pTab->pSelect ){
79811 pTab = 0;
79815 if( !pTab ){
79827 for(iCol=0; iCol<pTab->nCol; iCol++) {
79828 if( sqlite3StrICmp(pTab->aCol[iCol].zName, zColumn)==0 ){
79832 if( iCol==pTab->nCol ){
79854 for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){
79864 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
79886 int iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
79890 pTab->pSchema->schema_cookie,
79891 pTab->pSchema->iGeneration);
79903 sqlite3VdbeChangeP2(v, 1, pTab->tnum);
79905 sqlite3VdbeChangeP4(v, 1, pTab->zName, P4_TRANSIENT);
79911 sqlite3VdbeChangeP2(v, 2 + flags, pTab->tnum);
79921 sqlite3VdbeChangeP4(v, 2+flags, SQLITE_INT_TO_PTR(pTab->nCol+1),P4_INT32);
79922 sqlite3VdbeChangeP2(v, 6, pTab->nCol);
83700 Table *pTab = 0; /* Table hold the row */
83709 pExpr->pTab = 0;
83743 pTab = pItem->pTab;
83744 assert( pTab!=0 && pTab->zName!=0 );
83745 assert( pTab->nCol>0 );
83760 if( zDb && pTab->pSchema!=pSchema ){
83764 const char *zTabName = pItem->zAlias ? pItem->zAlias : pTab->zName;
83773 for(j=0, pCol=pTab->aCol; j<pTab->nCol; j++, pCol++){
83786 pExpr->iColumn = j==pTab->iPKey ? -1 : (i16)j;
83793 pExpr->pTab = pMatch->pTab;
83799 pSchema = pExpr->pTab->pSchema;
83812 pTab = pParse->pTriggerTab;
83815 pTab = pParse->pTriggerTab;
83817 pTab = 0;
83820 if( pTab ){
83822 pSchema = pTab->pSchema;
83824 for(iCol=0, pCol=pTab->aCol; iCol<pTab->nCol; iCol++, pCol++){
83826 if( iCol==pTab->iPKey ){
83832 if( iCol>=pTab->nCol && sqlite3IsRowid(zCol) && VisibleRowid(pTab) ){
83837 if( iCol<pTab->nCol ){
83851 pExpr->pTab = pTab;
83866 && VisibleRowid(pMatch->pTab)
83937 pExpr->pTab = 0;
84010 p->pTab = pItem->pTab;
84012 if( p->pTab->iPKey==iCol ){
84104 pExpr->pTab = pItem->pTab;
84977 Table *pTab, /* The table being referenced */
84989 sSrc.a[0].zName = pTab->zName;
84990 sSrc.a[0].pTab = pTab;
85049 && pExpr->pTab!=0
85055 assert( pExpr->pTab && j<pExpr->pTab->nCol );
85056 return pExpr->pTab->aCol[j].affinity;
85138 && p->pTab!=0
85144 const char *zColl = p->pTab->aCol[j].zColl;
86032 Table *pTab;
86049 pTab = pNewItem->pTab = pOldItem->pTab;
86050 if( pTab ){
86051 pTab->nRef++;
86481 assert( p->pTab!=0 );
86483 (p->iColumn>=0 && p->pTab->aCol[p->iColumn].notNull==0);
86555 Table *pTab;
86571 pTab = pSrc->a[0].pTab;
86572 if( NEVER(pTab==0) ) return 0;
86573 assert( pTab->pSelect==0 ); /* FROM clause is not a view */
86574 if( IsVirtual(pTab) ) return 0; /* FROM clause not a virtual table */
86713 Table *pTab; /* Table <table>. */
86722 pTab = p->pSrc->a[0].pTab;
86727 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
86729 sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
86740 sqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead);
86756 int affinity_ok = sqlite3IndexAffinityOk(pX, pTab->aCol[iCol].affinity);
86758 for(pIdx=pTab->pIndex; pIdx && eType==0 && affinity_ok; pIdx=pIdx->pNext){
86770 if( prRhsHasNull && !pTab->aCol[iCol].notNull ){
87462 Table *pTab, /* The table containing the value */
87467 if( iCol<0 || iCol==pTab->iPKey ){
87470 int op = IsVirtual(pTab) ? OP_VColumn : OP_Column;
87472 if( !HasRowid(pTab) ){
87473 x = sqlite3ColumnOfIndex(sqlite3PrimaryKeyIndex(pTab), iCol);
87478 sqlite3ColumnDefault(v, pTab, iCol, regOut);
87493 Table *pTab, /* Description of the table we are reading from */
87511 sqlite3ExprCodeGetColumnOfTable(v, pTab, iTable, iColumn, iReg);
87647 inReg = sqlite3ExprCodeGetColumn(pParse, pExpr->pTab,
88061 Table *pTab = pExpr->pTab;
88062 int p1 = pExpr->iTable * (pTab->nCol+1) + 1 + pExpr->iColumn;
88065 assert( pExpr->iColumn>=-1 && pExpr->iColumn<pTab->nCol );
88066 assert( pTab->iPKey<0 || pExpr->iColumn!=pTab->iPKey );
88067 assert( p1>=0 && p1<(pTab->nCol*2+2) );
88072 (pExpr->iColumn<0 ? "rowid" : pExpr->pTab->aCol[pExpr->iColumn].zName),
88083 && pTab->aCol[pExpr->iColumn].affinity==SQLITE_AFF_REAL
89009 pCol->pTab = pExpr->pTab;
89487 static char *whereForeignKeys(Parse *pParse, Table *pTab){
89490 for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){
89503 static char *whereTempTriggers(Parse *pParse, Table *pTab){
89513 if( pTab->pSchema!=pTempSchema ){
89515 for(pTrig=sqlite3TriggerList(pParse, pTab); pTrig; pTrig=pTrig->pNext){
89537 static void reloadTableSchema(Parse *pParse, Table *pTab, const char *zName){
89548 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
89553 for(pTrig=sqlite3TriggerList(pParse, pTab); pTrig; pTrig=pTrig->pNext){
89561 sqlite3VdbeAddOp4(v, OP_DropTable, iDb, 0, 0, pTab->zName, 0);
89572 if( (zWhere=whereTempTriggers(pParse, pTab))!=0 ){
89605 Table *pTab; /* Table being renamed */
89622 pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]);
89623 if( !pTab ) goto exit_rename_table;
89624 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
89644 if( SQLITE_OK!=isSystemTable(pParse, pTab->zName) ){
89652 if( pTab->pSelect ){
89653 sqlite3ErrorMsg(pParse, "view %s may not be altered", pTab->zName);
89660 if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){
89666 if( sqlite3ViewGetColumnNames(pParse, pTab) ){
89669 if( IsVirtual(pTab) ){
89670 pVTab = sqlite3GetVTable(db, pTab);
89704 zTabName = pTab->zName;
89712 if( (zWhere=whereForeignKeys(pParse, pTab))!=0 ){
89754 zDb, zName, pTab->zName);
89763 if( (zWhere=whereTempTriggers(pParse, pTab))!=0 ){
89776 for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){
89778 if( pFrom!=pTab ){
89786 reloadTableSchema(pParse, pTab, zName);
89831 Table *pTab; /* Table being altered */
89851 pTab = sqlite3FindTable(db, zTab, zDb);
89852 assert( pTab );
89856 if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){
89938 reloadTableSchema(pParse, pTab, pTab->zName);
89958 Table *pTab;
89969 pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]);
89970 if( !pTab ) goto exit_begin_add_column;
89973 if( IsVirtual(pTab) ){
89980 if( pTab->pSelect ){
89984 if( SQLITE_OK!=isSystemTable(pParse, pTab->zName) ){
89988 assert( pTab->addColOffset>0 );
89989 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
90002 pNew->nCol = pTab->nCol;
90007 pNew->zName = sqlite3MPrintf(db, "sqlite_altertab_%s", pTab->zName);
90012 memcpy(pNew->aCol, pTab->aCol, sizeof(Column)*pNew->nCol);
90022 pNew->addColOffset = pTab->addColOffset;
90995 Table *pTab, /* Table whose indices are to be analyzed */
91024 if( v==0 || NEVER(pTab==0) ){
91027 if( pTab->tnum==0 ){
91031 if( sqlite3_strnicmp(pTab->zName, "sqlite_", 7)==0 ){
91036 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
91040 if( sqlite3AuthCheck(pParse, SQLITE_ANALYZE, pTab->zName, 0,
91050 sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
91054 sqlite3OpenTable(pParse, iTabCur, iDb, pTab, OP_OpenRead);
91055 sqlite3VdbeLoadString(v, regTabname, pTab->zName);
91057 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
91066 if( !HasRowid(pTab) && IsPrimaryKeyIndex(pIdx) ){
91068 zIdxName = pTab->zName;
91078 VdbeComment((v, "Analysis for %s.%s", pTab->zName, zIdxName));
91219 if( HasRowid(pTab) ){
91227 assert( k>=0 && k<pTab->nCol );
91229 VdbeComment((v, "%s", pTab->aCol[pPk->aiColumn[j]].zName));
91260 u8 seekOp = HasRowid(pTab) ? OP_NotExists : OP_NotFound;
91301 VdbeComment((v, "%s", pTab->zName));
91345 Table *pTab = (Table*)sqliteHashData(k);
91346 analyzeOneTable(pParse, pTab, 0, iStatCur, iMem, iTab);
91356 static void analyzeTable(Parse *pParse, Table *pTab, Index *pOnlyIdx){
91360 assert( pTab!=0 );
91362 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
91369 openStatTable(pParse, iDb, iStatCur, pTab->zName, "tbl");
91371 analyzeOneTable(pParse, pTab, pOnlyIdx, iStatCur,pParse->nMem+1,pParse->nTab);
91392 Table *pTab;
91421 }else if( (pTab = sqlite3LocateTable(pParse, 0, z, 0))!=0 ){
91422 analyzeTable(pParse, pTab, 0);
91436 }else if( (pTab = sqlite3LocateTable(pParse, 0, z, zDb))!=0 ){
91437 analyzeTable(pParse, pTab, 0);
91682 Table *pTab = sqlite3FindTable(db, zName, zDb);
91683 if( pTab && !HasRowid(pTab) ) pIdx = sqlite3PrimaryKeyIndex(pTab);
92667 Table *pTab = 0; /* The table being read */
92683 pTab = pParse->pTriggerTab;
92688 pTab = pTabList->a[iSrc].pTab;
92694 if( NEVER(pTab==0) ) return;
92697 assert( iCol<pTab->nCol );
92698 zCol = pTab->aCol[iCol].zName;
92699 }else if( pTab->iPKey>=0 ){
92700 assert( pTab->iPKey<pTab->nCol );
92701 zCol = pTab->aCol[pTab->iPKey].zName;
92706 if( SQLITE_IGNORE==sqlite3AuthReadCol(pParse, pTab->zName, zCol, iDb) ){
93596 SQLITE_PRIVATE Index *sqlite3PrimaryKeyIndex(Table *pTab){
93598 for(p=pTab->pIndex; p && !IsPrimaryKeyIndex(p); p=p->pNext){}
94105 Table *pTab = pParse->pNewTable;
94109 if( pTab==0 || IN_DECLARE_VTAB ) goto primary_key_exit;
94110 if( pTab->tabFlags & TF_HasPrimaryKey ){
94112 "table \"%s\" has more than one primary key", pTab->zName);
94115 pTab->tabFlags |= TF_HasPrimaryKey;
94117 iCol = pTab->nCol - 1;
94118 pTab->aCol[iCol].colFlags |= COLFLAG_PRIMKEY;
94119 zType = pTab->aCol[iCol].zType;
94129 for(iCol=0; iCol<pTab->nCol; iCol++){
94130 if( sqlite3StrICmp(zCName, pTab->aCol[iCol].zName)==0 ){
94131 pTab->aCol[iCol].colFlags |= COLFLAG_PRIMKEY;
94132 zType = pTab->aCol[iCol].zType;
94143 pTab->iPKey = iCol;
94144 pTab->keyConf = (u8)onError;
94146 pTab->tabFlags |= autoInc*TF_Autoincrement;
94176 Table *pTab = pParse->pNewTable;
94178 if( pTab && !IN_DECLARE_VTAB
94181 pTab->pCheck = sqlite3ExprListAppend(pParse, pTab->pCheck, pCheckExpr);
94183 sqlite3ExprListSetName(pParse, pTab->pCheck, &pParse->constraintName, 1);
94438 static void estimateTableWidth(Table *pTab){
94442 for(i=pTab->nCol, pTabCol=pTab->aCol; i>0; i--, pTabCol++){
94445 if( pTab->iPKey<0 ) wTable++;
94446 pTab->szTabRow = sqlite3LogEst(wTable*4);
94494 static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){
94514 if( pTab->iPKey>=0 ){
94517 ipkToken.z = pTab->aCol[pTab->iPKey].zName;
94523 assert( pParse->pNewTable==pTab );
94524 pPk = sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0);
94527 pTab->iPKey = -1;
94529 pPk = sqlite3PrimaryKeyIndex(pTab);
94562 pTab->aCol[pPk->aiColumn[i]].notNull = 1;
94568 pPk->tnum = pTab->tnum;
94573 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
94598 if( nPk<pTab->nCol ){
94599 if( resizeIndexObject(db, pPk, pTab->nCol) ) return;
94600 for(i=0, j=nPk; i<pTab->nCol; i++){
94609 assert( pTab->nCol==j );
94611 pPk->nColumn = pTab->nCol;
95052 Table *pTab = sqliteHashData(i);
95053 if( pTab->pSelect ){
95054 sqlite3DeleteColumnNames(db, pTab);
95055 pTab->aCol = 0;
95056 pTab->nCol = 0;
95092 Table *pTab = sqliteHashData(pElem);
95093 if( pTab->tnum==iFrom ){
95094 pTab->tnum = iTo;
95141 static void destroyTable(Parse *pParse, Table *pTab){
95144 int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
95145 destroyRootPage(pParse, pTab->tnum, iDb);
95146 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
95166 int iTab = pTab->tnum;
95176 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
95178 assert( pIdx->pSchema==pTab->pSchema );
95186 int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
95222 SQLITE_PRIVATE void sqlite3CodeDropTable(Parse *pParse, Table *pTab, int iDb, int isView){
95233 if( IsVirtual(pTab) ){
95242 pTrigger = sqlite3TriggerList(pParse, pTab);
95244 assert( pTrigger->pSchema==pTab->pSchema ||
95256 if( pTab->tabFlags & TF_Autoincrement ){
95259 pDb->zName, pTab->zName
95273 pDb->zName, SCHEMA_TABLE(iDb), pTab->zName);
95274 if( !isView && !IsVirtual(pTab) ){
95275 destroyTable(pParse, pTab);
95281 if( IsVirtual(pTab) ){
95282 sqlite3VdbeAddOp4(v, OP_VDestroy, iDb, 0, 0, pTab->zName, 0);
95284 sqlite3VdbeAddOp4(v, OP_DropTable, iDb, 0, 0, pTab->zName, 0);
95294 Table *pTab;
95306 pTab = sqlite3LocateTableItem(pParse, isView, &pName->a[0]);
95309 if( pTab==0 ){
95313 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
95319 if( IsVirtual(pTab) && sqlite3ViewGetColumnNames(pParse, pTab) ){
95338 }else if( IsVirtual(pTab) ){
95340 zArg2 = sqlite3GetVTable(db, pTab)->pMod->zName;
95349 if( sqlite3AuthCheck(pParse, code, pTab->zName, zArg2, zDb) ){
95352 if( sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0, zDb) ){
95357 if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0
95358 && sqlite3StrNICmp(pTab->zName, "sqlite_stat", 11)!=0 ){
95359 sqlite3ErrorMsg(pParse, "table %s may not be dropped", pTab->zName);
95367 if( isView && pTab->pSelect==0 ){
95368 sqlite3ErrorMsg(pParse, "use DROP TABLE to delete table %s", pTab->zName);
95371 if( !isView && pTab->pSelect ){
95372 sqlite3ErrorMsg(pParse, "use DROP VIEW to delete view %s", pTab->zName);
95383 sqlite3ClearStatTables(pParse, iDb, "tbl", pTab->zName);
95384 sqlite3FkDropTable(pParse, pName, pTab);
95385 sqlite3CodeDropTable(pParse, pTab, iDb, isView);
95531 Table *pTab;
95533 if( (pTab = pParse->pNewTable)==0 || (pFKey = pTab->pFKey)==0 ) return;
95551 Table *pTab = pIndex->pTable; /* The table that is indexed */
95573 sqlite3TableLock(pParse, iDb, pTab->tnum, 1, pTab->zName);
95591 sqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead);
95694 Table *pTab = 0; /* Table to be indexed */
95738 pTab = sqlite3SrcListLookup(pParse, pTblName);
95739 if( pName2->n==0 && pTab && pTab->pSchema==db->aDb[1].pSchema ){
95751 pTab = sqlite3LocateTableItem(pParse, 0, &pTblName->a[0]);
95752 assert( db->mallocFailed==0 || pTab==0 );
95753 if( pTab==0 ) goto exit_create_index;
95754 if( iDb==1 && db->aDb[iDb].pSchema!=pTab->pSchema ){
95757 pTab->zName);
95760 if( !HasRowid(pTab) ) pPk = sqlite3PrimaryKeyIndex(pTab);
95764 pTab = pParse->pNewTable;
95765 if( !pTab ) goto exit_create_index;
95766 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
95770 assert( pTab!=0 );
95772 if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0
95775 && sqlite3UserAuthTable(pTab->zName)==0
95777 && sqlite3StrNICmp(&pTab->zName[7],"altertab_",9)!=0 ){
95778 sqlite3ErrorMsg(pParse, "table %s may not be indexed", pTab->zName);
95782 if( pTab->pSelect ){
95788 if( IsVirtual(pTab) ){
95832 for(pLoop=pTab->pIndex, n=1; pLoop; pLoop=pLoop->pNext, n++){}
95833 zName = sqlite3MPrintf(db, "sqlite_autoindex_%s_%d", pTab->zName, n);
95849 if( sqlite3AuthCheck(pParse, i, zName, pTab->zName, zDb) ){
95861 prevCol.z = pTab->aCol[pTab->nCol-1].zName;
95898 pIndex->pTable = pTab;
95905 sqlite3ResolveSelfReference(pParse, pTab, NC_PartIdx, pPIWhere, 0);
95934 sqlite3ResolveSelfReference(pParse, pTab, NC_IdxExpr, pListItem->pExpr, 0);
95938 if( pTab==pParse->pNewTable ){
95958 j = pTab->iPKey;
95959 }else if( pTab->aCol[j].notNull==0 ){
95975 zColl = pTab->aCol[j].zColl;
96011 if( pTab==pParse->pNewTable ){
96034 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
96106 else if( HasRowid(pTab) || pTblName!=0 ){
96146 pTab->zName,
96173 if( onError!=OE_Replace || pTab->pIndex==0
96174 || pTab->pIndex->onError==OE_Replace){
96175 pIndex->pNext = pTab->pIndex;
96176 pTab->pIndex = pIndex;
96178 Index *pOther = pTab->pIndex;
96278 Table *pTab = pIndex->pTable;
96285 if( sqlite3AuthCheck(pParse, code, pIndex->zName, pTab->zName, zDb) ){
96568 sqlite3DeleteTable(db, pItem->pTab);
96933 Table *pTab = pIdx->pTable;
96942 zCol = pTab->aCol[pIdx->aiColumn[j]].zName;
96944 sqlite3XPrintf(&errMsg, 0, "%s.%s", pTab->zName, zCol);
96961 Table *pTab /* The table with the non-unique rowid */
96965 if( pTab->iPKey>=0 ){
96966 zMsg = sqlite3MPrintf(pParse->db, "%s.%s", pTab->zName,
96967 pTab->aCol[pTab->iPKey].zName);
96970 zMsg = sqlite3MPrintf(pParse->db, "%s.rowid", pTab->zName);
97001 static void reindexTable(Parse *pParse, Table *pTab, char const *zColl){
97004 for(pIndex=pTab->pIndex; pIndex; pIndex=pIndex->pNext){
97006 int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
97025 Table *pTab; /* A table in the database */
97031 pTab = (Table*)sqliteHashData(k);
97032 reindexTable(pParse, pTab, zColl);
97056 Table *pTab; /* A table in the database */
97089 pTab = sqlite3FindTable(db, z, zDb);
97090 if( pTab ){
97091 reindexTable(pParse, pTab, 0);
97659 Table *pTab = sqliteHashData(pElem);
97660 sqlite3DeleteTable(0, pTab);
97728 Table *pTab;
97730 pTab = sqlite3LocateTableItem(pParse, 0, pItem);
97731 sqlite3DeleteTable(pParse->db, pItem->pTab);
97732 pItem->pTab = pTab;
97733 if( pTab ){
97734 pTab->nRef++;
97737 pTab = 0;
97739 return pTab;
97747 SQLITE_PRIVATE int sqlite3IsReadOnly(Parse *pParse, Table *pTab, int viewOk){
97758 if( ( IsVirtual(pTab)
97759 && sqlite3GetVTable(pParse->db, pTab)->pMod->pModule->xUpdate==0 )
97760 || ( (pTab->tabFlags & TF_Readonly)!=0
97764 sqlite3ErrorMsg(pParse, "table %s may not be modified", pTab->zName);
97769 if( !viewOk && pTab->pSelect ){
97770 sqlite3ErrorMsg(pParse,"cannot modify %s because it is a view",pTab->zName);
97918 Table *pTab; /* The table from which records will be deleted */
97965 pTab = sqlite3SrcListLookup(pParse, pTabList);
97966 if( pTab==0 ) goto delete_from_cleanup;
97972 pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0);
97973 isView = pTab->pSelect!=0;
97974 bComplex = pTrigger || sqlite3FkRequired(pParse, pTab, 0, 0);
97987 if( sqlite3ViewGetColumnNames(pParse, pTab) ){
97991 if( sqlite3IsReadOnly(pParse, pTab, (pTrigger?1:0)) ){
97994 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
97997 rcauth = sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0, zDb);
98008 for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){
98015 sqlite3AuthContextPush(pParse, &sContext, pTab->zName);
98032 sqlite3MaterializeView(pParse, pTab, pWhere, iTabCur);
98062 && !IsVirtual(pTab)
98065 sqlite3TableLock(pParse, iDb, pTab->tnum, 1, pTab->zName);
98066 if( HasRowid(pTab) ){
98067 sqlite3VdbeAddOp4(v, OP_Clear, pTab->tnum, iDb, memCnt,
98068 pTab->zName, P4_STATIC);
98070 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
98071 assert( pIdx->pSchema==pTab->pSchema );
98079 if( HasRowid(pTab) ){
98088 pPk = sqlite3PrimaryKeyIndex(pTab);
98109 assert( IsVirtual(pTab)==0 || eOnePass!=ONEPASS_MULTI );
98110 assert( IsVirtual(pTab) || bComplex || eOnePass!=ONEPASS_OFF );
98121 sqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur,
98127 iKey = sqlite3ExprCodeGetColumn(pParse, pTab, -1, iTabCur, iKey, 0);
98179 testcase( IsVirtual(pTab) );
98180 sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, iTabCur, aToOpen,
98182 assert( pPk || IsVirtual(pTab) || iDataCur==iTabCur );
98183 assert( pPk || IsVirtual(pTab) || iIdxCur==iDataCur+1 );
98192 if( !IsVirtual(pTab) && aToOpen[iDataCur-iTabCur] ){
98193 assert( pPk!=0 || pTab->pSelect!=0 );
98209 if( IsVirtual(pTab) ){
98210 const char *pVTab = (const char *)sqlite3GetVTable(db, pTab);
98211 sqlite3VtabMakeWritable(pParse, pTab);
98227 sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur,
98244 if( !isView && !IsVirtual(pTab) ){
98246 for(i=0, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){
98328 Table *pTab, /* Table containing the row to be deleted */
98353 opSeek = HasRowid(pTab) ? OP_NotExists : OP_NotFound;
98362 if( sqlite3FkRequired(pParse, pTab, 0, 0) || pTrigger ){
98370 pParse, pTrigger, 0, 0, TRIGGER_BEFORE|TRIGGER_AFTER, pTab, onconf
98372 mask |= sqlite3FkOldmask(pParse, pTab);
98374 pParse->nMem += (1 + pTab->nCol);
98379 for(iCol=0; iCol<pTab->nCol; iCol++){
98383 sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, iCol, iOld+iCol+1);
98390 TK_DELETE, 0, TRIGGER_BEFORE, pTab, iOld, onconf, iLabel
98407 sqlite3FkCheck(pParse, pTab, iOld, 0, 0, 0);
98413 if( pTab->pSelect==0 ){
98414 sqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur,0,iIdxNoSeek);
98417 sqlite3VdbeChangeP4(v, -1, pTab->zName, P4_TRANSIENT);
98428 sqlite3FkActions(pParse, pTab, 0, iOld, 0, 0);
98432 TK_DELETE, 0, TRIGGER_AFTER, pTab, iOld, onconf, iLabel
98462 Table *pTab, /* Table containing the row to be deleted */
98477 pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);
98478 for(i=0, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){
100712 Table *pTab, /* Parent table of FK pFKey */
100761 if( pTab==pFKey->pFrom && nIncr==1 ){
100766 sqlite3OpenTable(pParse, iCur, iDb, pTab, OP_OpenRead);
100793 if( pTab==pFKey->pFrom && nIncr==1 ){
100799 assert( aiCol[i]!=pTab->iPKey );
100800 if( pIdx->aiColumn[i]==pTab->iPKey ){
100852 Table *pTab, /* The table whose content is at r[regBase]... */
100863 if( iCol>=0 && iCol!=pTab->iPKey ){
100864 pCol = &pTab->aCol[iCol];
100884 Table *pTab, /* The table whose column is desired */
100890 pExpr->pTab = pTab;
100932 Table *pTab, /* The parent table */
100947 assert( pIdx==0 || pIdx->pTable==pTab );
100950 assert( pIdx!=0 || HasRowid(pTab) );
100973 pLeft = exprTableRegister(pParse, pTab, regData, iCol);
100993 if( pTab==pFKey->pFrom && nIncr>0 ){
100997 if( HasRowid(pTab) ){
100998 pLeft = exprTableRegister(pParse, pTab, regData, -1);
100999 pRight = exprTableColumn(db, pTab, pSrc->a[0].iCursor, -1);
101003 Index *pPk = sqlite3PrimaryKeyIndex(pTab);
101008 pLeft = exprTableRegister(pParse, pTab, regData, iCol);
101009 pRight = exprTableColumn(db, pTab, pSrc->a[0].iCursor, iCol);
101054 SQLITE_PRIVATE FKey *sqlite3FkReferences(Table *pTab){
101055 return (FKey *)sqlite3HashFind(&pTab->pSchema->fkeyHash, pTab->zName);
101094 SQLITE_PRIVATE void sqlite3FkDropTable(Parse *pParse, SrcList *pName, Table *pTab){
101096 if( (db->flags&SQLITE_ForeignKeys) && !IsVirtual(pTab) && !pTab->pSelect ){
101101 if( sqlite3FkReferences(pTab)==0 ){
101108 for(p=pTab->pFKey; p; p=p->pNextFrom){
101156 Table *pTab, /* Table being updated */
101165 if( iChildKey==pTab->iPKey && bChngRowid ) return 1;
101183 Table *pTab,
101192 for(iKey=0; iKey<pTab->nCol; iKey++){
101193 if( aChange[iKey]>=0 || (iKey==pTab->iPKey && bChngRowid) ){
101194 Column *pCol = &pTab->aCol[iKey];
101246 Table *pTab, /* Row is being deleted from this table */
101264 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
101269 for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){
101279 && sqlite3_stricmp(pTab->zName, pFKey->zTo)!=0
101280 && fkChildIsModified(pTab, pFKey, aChange, bChngRowid)==0
101324 if( aiCol[i]==pTab->iPKey ){
101370 for(pFKey = sqlite3FkReferences(pTab); pFKey; pFKey=pFKey->pNextTo){
101375 if( aChange && fkParentIsModified(pTab, pFKey, aChange, bChngRowid)==0 ){
101388 if( sqlite3FkLocateIndex(pParse, pTab, pFKey, &pIdx, &aiCol) ){
101399 pItem->pTab = pFKey->pFrom;
101401 pItem->pTab->nRef++;
101405 fkScanChildren(pParse, pSrc, pTab, pIdx, pFKey, aiCol, regNew, -1);
101409 fkScanChildren(pParse, pSrc, pTab, pIdx, pFKey, aiCol, regOld, 1);
101446 Table *pTab /* Table being modified */
101452 for(p=pTab->pFKey; p; p=p->pNextFrom){
101455 for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){
101457 sqlite3FkLocateIndex(pParse, pTab, p, &pIdx, 0);
101486 Table *pTab, /* Table being modified */
101495 return (sqlite3FkReferences(pTab) || pTab->pFKey);
101502 for(p=pTab->pFKey; p; p=p->pNextFrom){
101503 if( fkChildIsModified(pTab, p, aChange, chngRowid) ) return 1;
101507 for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){
101508 if( fkParentIsModified(pTab, p, aChange, chngRowid) ) return 1;
101546 Table *pTab, /* Table being updated or deleted from */
101571 if( sqlite3FkLocateIndex(pParse, pTab, pFKey, &pIdx, &aiCol) ) return 0;
101584 assert( pIdx!=0 || (pTab->iPKey>=0 && pTab->iPKey<pTab->nCol) );
101586 tToCol.z = pTab->aCol[pIdx ? pIdx->aiColumn[i] : pTab->iPKey].zName;
101718 pTrigger->pSchema = pTab->pSchema;
101719 pTrigger->pTabSchema = pTab->pSchema;
101733 Table *pTab, /* Table being updated or deleted from */
101745 for(pFKey = sqlite3FkReferences(pTab); pFKey; pFKey=pFKey->pNextTo){
101746 if( aChange==0 || fkParentIsModified(pTab, pFKey, aChange, bChngRowid) ){
101747 Trigger *pAct = fkActionTrigger(pParse, pTab, pFKey, pChanges);
101749 sqlite3CodeRowTriggerDirect(pParse, pAct, pTab, regOld, OE_Abort, 0);
101763 SQLITE_PRIVATE void sqlite3FkDelete(sqlite3 *db, Table *pTab){
101767 assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pTab->pSchema) );
101768 for(pFKey=pTab->pFKey; pFKey; pFKey=pNext){
101777 sqlite3HashInsert(&pTab->pSchema->fkeyHash, z, p);
101832 Table *pTab, /* The table to be opened */
101836 assert( !IsVirtual(pTab) );
101839 sqlite3TableLock(pParse, iDb, pTab->tnum,
101840 (opcode==OP_OpenWrite)?1:0, pTab->zName);
101841 if( HasRowid(pTab) ){
101842 sqlite3VdbeAddOp4Int(v, opcode, iCur, pTab->tnum, iDb, pTab->nCol);
101843 VdbeComment((v, "%s", pTab->zName));
101845 Index *pPk = sqlite3PrimaryKeyIndex(pTab);
101847 assert( pPk->tnum==pTab->tnum );
101850 VdbeComment((v, "%s", pTab->zName));
101885 Table *pTab = pIdx->pTable;
101894 pIdx->zColAff[n] = pTab->aCol[x].affinity;
101932 SQLITE_PRIVATE void sqlite3TableAffinity(Vdbe *v, Table *pTab, int iReg){
101934 char *zColAff = pTab->zColAff;
101937 zColAff = (char *)sqlite3DbMallocRaw(0, pTab->nCol+1);
101943 for(i=0; i<pTab->nCol; i++){
101944 zColAff[i] = pTab->aCol[i].affinity;
101949 pTab->zColAff = zColAff;
101967 static int readsTable(Parse *p, int iDb, Table *pTab){
101972 VTable *pVTab = IsVirtual(pTab) ? sqlite3GetVTable(p->db, pTab) : 0;
101981 if( tnum==pTab->tnum ){
101984 for(pIndex=pTab->pIndex; pIndex; pIndex=pIndex->pNext){
102025 Table *pTab /* The table we are writing to */
102028 if( pTab->tabFlags & TF_Autoincrement ){
102033 while( pInfo && pInfo->pTab!=pTab ){ pInfo = pInfo->pNext; }
102039 pInfo->pTab = pTab;
102075 sqlite3VdbeLoadString(v, memId-1, p->pTab->zName);
102259 Table *pTab; /* The table to insert into. aka TABLE */
102320 pTab = sqlite3SrcListLookup(pParse, pTabList);
102321 if( pTab==0 ){
102324 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
102328 if( sqlite3AuthCheck(pParse, SQLITE_INSERT, pTab->zName, 0, zDb) ){
102331 withoutRowid = !HasRowid(pTab);
102337 pTrigger = sqlite3TriggersExist(pParse, pTab, TK_INSERT, 0, &tmask);
102338 isView = pTab->pSelect!=0;
102353 if( sqlite3ViewGetColumnNames(pParse, pTab) ){
102359 if( sqlite3IsReadOnly(pParse, pTab, tmask) ){
102380 if( pColumn==0 && xferOptimization(pParse, pTab, pSelect, onError, iDb) ){
102390 regAutoinc = autoIncBegin(pParse, iDb, pTab);
102396 pParse->nMem += pTab->nCol + 1;
102397 if( IsVirtual(pTab) ){
102414 bIdListInOrder = (pTab->tabFlags & TF_OOOHidden)==0;
102420 for(j=0; j<pTab->nCol; j++){
102421 if( sqlite3StrICmp(pColumn->a[i].zName, pTab->aCol[j].zName)==0 ){
102424 if( j==pTab->iPKey ){
102430 if( j>=pTab->nCol ){
102461 dest.nSdst = pTab->nCol;
102479 if( pTrigger || readsTable(pParse, iDb, pTab) ){
102535 ipkColumn = pTab->iPKey;
102541 if( IsVirtual(pTab) ){
102542 for(i=0; i<pTab->nCol; i++){
102543 nHidden += (IsHiddenColumn(&pTab->aCol[i]) ? 1 : 0);
102546 if( pColumn==0 && nColumn && nColumn!=(pTab->nCol-nHidden) ){
102549 pTabList, 0, pTab->nCol-nHidden, nColumn);
102567 nIdx = sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, -1, 0,
102608 int regCols = sqlite3GetTempRange(pParse, pTab->nCol+1);
102636 assert( !IsVirtual(pTab) );
102640 for(i=0; i<pTab->nCol; i++){
102649 sqlite3ExprCode(pParse, pTab->aCol[i].pDflt, regCols+i+1);
102664 sqlite3TableAffinity(v, pTab, regCols+1);
102669 pTab, regCols-pTab->nCol-1, onError, endOfLoop);
102671 sqlite3ReleaseTempRange(pParse, regCols, pTab->nCol+1);
102678 if( IsVirtual(pTab) ){
102691 if( ALWAYS(pOp) && pOp->opcode==OP_Null && !IsVirtual(pTab) ){
102704 if( !IsVirtual(pTab) ){
102714 }else if( IsVirtual(pTab) || withoutRowid ){
102726 for(i=0; i<pTab->nCol; i++){
102728 if( i==pTab->iPKey ){
102738 if( IsHiddenColumn(&pTab->aCol[i]) ){
102739 assert( IsVirtual(pTab) );
102751 sqlite3ExprCodeFactorable(pParse, pTab->aCol[i].pDflt, iRegStore);
102767 if( IsVirtual(pTab) ){
102768 const char *pVTab = (const char *)sqlite3GetVTable(db, pTab);
102769 sqlite3VtabMakeWritable(pParse, pTab);
102770 sqlite3VdbeAddOp4(v, OP_VUpdate, 1, pTab->nCol+2, regIns, pVTab, P4_VTAB);
102777 sqlite3GenerateConstraintChecks(pParse, pTab, aRegIdx, iDataCur, iIdxCur,
102780 sqlite3FkCheck(pParse, pTab, 0, regIns, 0, 0);
102781 sqlite3CompleteInsertion(pParse, pTab, iDataCur, iIdxCur,
102795 pTab, regData-2-pTab->nCol, onError, endOfLoop);
102811 if( !IsVirtual(pTab) && !isView ){
102814 for(idx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, idx++){
102945 Table *pTab, /* The table being inserted or updated */
102977 assert( pTab->pSelect==0 ); /* This table is not a VIEW */
102978 nCol = pTab->nCol;
102984 if( HasRowid(pTab) ){
102988 pPk = sqlite3PrimaryKeyIndex(pTab);
102999 if( i==pTab->iPKey ){
103002 onError = pTab->aCol[i].notNull;
103009 if( onError==OE_Replace && pTab->aCol[i].pDflt==0 ){
103020 char *zMsg = sqlite3MPrintf(db, "%s.%s", pTab->zName,
103021 pTab->aCol[i].zName);
103037 sqlite3ExprCode(pParse, pTab->aCol[i].pDflt, regNewData+1+i);
103047 if( pTab->pCheck && (db->flags & SQLITE_IgnoreChecks)==0 ){
103048 ExprList *pCheck = pTab->pCheck;
103058 if( zName==0 ) zName = pTab->zName;
103076 onError = pTab->keyConf;
103098 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
103120 sqlite3RowidConstraint(pParse, onError, pTab);
103148 pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0);
103150 if( pTrigger || sqlite3FkRequired(pParse, pTab, 0, 0) ){
103152 sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur,
103156 if( pTab->pIndex ){
103158 sqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur,0,-1);
103184 for(ix=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, ix++){
103192 sqlite3TableAffinity(v, pTab, regNewData+1);
103220 if( iField==XN_ROWID || iField==pTab->iPKey ){
103228 VdbeComment((v, "%s", iField<0 ? "rowid" : pTab->aCol[iField].zName));
103264 if( HasRowid(pTab) ){
103282 VdbeComment((v, "%s.%s", pTab->zName,
103283 pTab->aCol[pPk->aiColumn[i]].zName));
103336 pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0);
103338 sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur,
103369 Table *pTab, /* the table into which we are inserting */
103388 assert( pTab->pSelect==0 ); /* This table is not a VIEW */
103389 for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
103399 if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){
103405 if( !HasRowid(pTab) ) return;
103408 sqlite3VdbeAddOp3(v, OP_MakeRecord, regData, pTab->nCol, regRec);
103409 if( !bAffinityDone ) sqlite3TableAffinity(v, pTab, 0);
103410 sqlite3ExprCacheAffinityChange(pParse, regData, pTab->nCol);
103425 sqlite3VdbeChangeP4(v, -1, pTab->zName, P4_TRANSIENT);
103453 Table *pTab, /* Table to be opened */
103467 if( IsVirtual(pTab) ){
103473 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
103479 if( HasRowid(pTab) && (aToOpen==0 || aToOpen[0]) ){
103480 sqlite3OpenTable(pParse, iDataCur, iDb, pTab, op);
103482 sqlite3TableLock(pParse, iDb, pTab->tnum, op==OP_OpenWrite, pTab->zName);
103485 for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
103487 assert( pIdx->pSchema==pTab->pSchema );
103488 if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) && piDataCur ){
106837 Table *pTab;
106838 pTab = sqlite3FindTable(db, zRight, zDb);
106839 if( pTab ){
106846 Index *pPk = sqlite3PrimaryKeyIndex(pTab);
106850 sqlite3ViewGetColumnNames(pParse, pTab);
106851 for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
106861 for(k=1; k<=pTab->nCol && pPk->aiColumn[k-1]!=i; k++){}
106885 Table *pTab = sqliteHashData(i);
106887 pTab->zName,
106889 (int)sqlite3LogEstToInt(pTab->szTabRow),
106890 (int)sqlite3LogEstToInt(pTab->nRowLogEst));
106892 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
106905 Table *pTab;
106922 pTab = pIdx->pTable;
106929 cnum<0 ? 0 : pTab->aCol[cnum].zName);
106944 Table *pTab;
106946 pTab = sqlite3FindTable(db, zRight, zDb);
106947 if( pTab ){
106955 for(pIdx=pTab->pIndex, i=0; pIdx; pIdx=pIdx->pNext, i++){
107004 Table *pTab;
107005 pTab = sqlite3FindTable(db, zRight, zDb);
107006 if( pTab ){
107008 pFK = pTab->pFKey;
107025 pTab->aCol[pFK->aCol[j].iFrom].zName,
107045 Table *pTab; /* Child table contain "REFERENCES" keyword */
107070 pTab = sqlite3LocateTable(pParse, 0, zRight, zDb);
107073 pTab = (Table*)sqliteHashData(k);
107076 if( pTab==0 || pTab->pFKey==0 ) continue;
107077 sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
107078 if( pTab->nCol+regRow>pParse->nMem ) pParse->nMem = pTab->nCol + regRow;
107079 sqlite3OpenTable(pParse, 0, iDb, pTab, OP_OpenRead);
107080 sqlite3VdbeLoadString(v, regResult, pTab->zName);
107081 for(i=1, pFK=pTab->pFKey; pFK; i++, pFK=pFK->pNextFrom){
107103 for(i=1, pFK=pTab->pFKey; pFK; i++, pFK=pFK->pNextFrom){
107114 assert( iKey>=0 && iKey<pTab->nCol );
107115 if( iKey!=pTab->iPKey ){
107117 sqlite3ColumnDefault(v, pTab, iKey, regRow);
107129 sqlite3ExprCodeGetColumnOfTable(v, pTab, 0,
107253 Table *pTab = sqliteHashData(x);
107255 if( HasRowid(pTab) ){
107256 sqlite3VdbeAddOp2(v, OP_Integer, pTab->tnum, 2+cnt);
107257 VdbeComment((v, "%s", pTab->zName));
107260 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
107285 Table *pTab = sqliteHashData(x);
107292 if( pTab->pIndex==0 ) continue;
107293 pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);
107299 sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenRead,
107302 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
107309 for(j=0; j<pTab->nCol; j++){
107312 if( j==pTab->iPKey ) continue;
107313 if( pTab->aCol[j].notNull==0 ) continue;
107314 sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, j, 3);
107318 zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName,
107319 pTab->aCol[j].zName);
107328 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
107359 assert( iCol!=XN_ROWID && iCol<pTab->nCol );
107360 if( iCol>=0 && pTab->aCol[iCol].notNull ) continue;
107381 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
107899 Table *pTab;
107964 pTab = sqlite3FindTable(db, zMasterName, db->aDb[iDb].zName);
107965 if( ALWAYS(pTab) ){
107966 pTab->tabFlags |= TF_Readonly;
108907 static int columnIndex(Table *pTab, const char *zCol){
108909 for(i=0; i<pTab->nCol; i++){
108910 if( sqlite3StrICmp(pTab->aCol[i].zName, zCol)==0 ) return i;
108936 iCol = columnIndex(pSrc->a[i].pTab, zCol);
108976 assert( pSrc->a[iLeft].pTab );
108977 assert( pSrc->a[iRight].pTab );
109059 Table *pLeftTab = pLeft->pTab;
109060 Table *pRightTab = pRight->pTab;
110006 Table *pTab = 0; /* Table structure column is extracted from */
110011 while( pNC && !pTab ){
110015 pTab = pTabList->a[j].pTab;
110022 if( pTab==0 ){
110043 assert( pTab && pExpr->pTab==pTab );
110064 }else if( pTab->pSchema ){
110067 if( iCol<0 ) iCol = pTab->iPKey;
110068 assert( iCol==-1 || (iCol>=0 && iCol<pTab->nCol) );
110074 zType = pTab->aCol[iCol].zType;
110075 zOrigCol = pTab->aCol[iCol].zName;
110076 estWidth = pTab->aCol[iCol].szEst;
110078 zOrigTab = pTab->zName;
110080 int iDb = sqlite3SchemaToIndex(pNC->pParse->db, pTab->pSchema);
110087 zType = pTab->aCol[iCol].zType;
110088 estWidth = pTab->aCol[iCol].szEst;
110199 Table *pTab;
110206 pTab = pTabList->a[j].pTab;
110207 if( iCol<0 ) iCol = pTab->iPKey;
110208 assert( iCol==-1 || (iCol>=0 && iCol<pTab->nCol) );
110212 zCol = pTab->aCol[iCol].zName;
110219 zName = sqlite3MPrintf(db, "%s.%s", pTab->zName, zCol);
110281 Table *pTab; /* Table associated with this expression */
110286 if( pColExpr->op==TK_COLUMN && ALWAYS(pColExpr->pTab!=0) ){
110289 pTab = pColExpr->pTab;
110290 if( iCol<0 ) iCol = pTab->iPKey;
110292 iCol>=0 ? pTab->aCol[iCol].zName : "rowid");
110351 Table *pTab, /* Add column type information to this table */
110365 assert( pTab->nCol==pSelect->pEList->nExpr || db->mallocFailed );
110370 for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
110384 pTab->szTabRow = sqlite3LogEst(szAll*4);
110392 Table *pTab;
110403 pTab = sqlite3DbMallocZero(db, sizeof(Table) );
110404 if( pTab==0 ){
110410 pTab->nRef = 1;
110411 pTab->zName = 0;
110412 pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
110413 sqlite3ColumnsFromExprList(pParse, pSelect->pEList, &pTab->nCol, &pTab->aCol);
110414 selectAddColumnTypeAndCollation(pParse, pTab, pSelect);
110415 pTab->iPKey = -1;
110417 sqlite3DeleteTable(db, pTab);
110420 return pTab;
112213 if( ALWAYS(pSubitem->pTab!=0) ){
112214 Table *pTabToDel = pSubitem->pTab;
112222 pSubitem->pTab = 0;
112499 Table *pTab;
112509 pTab = p->pSrc->a[0].pTab;
112511 assert( pTab && !pTab->pSelect && pExpr );
112513 if( IsVirtual(pTab) ) return 0;
112519 return pTab;
112530 if( pFrom->pTab && pFrom->fg.isIndexedBy ){
112531 Table *pTab = pFrom->pTab;
112534 for(pIdx=pTab->pIndex;
112693 assert( pFrom->pTab==0 );
112697 Table *pTab;
112713 assert( pFrom->pTab==0 );
112714 pFrom->pTab = pTab = sqlite3DbMallocZero(db, sizeof(Table));
112715 if( pTab==0 ) return WRC_Abort;
112716 pTab->nRef = 1;
112717 pTab->zName = sqlite3DbStrDup(db, pCte->zName);
112718 pTab->iPKey = -1;
112719 pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
112720 pTab->tabFlags |= TF_Ephemeral | TF_NoVisibleRowid;
112737 pItem->pTab = pTab;
112739 pTab->nRef++;
112746 if( pTab->nRef>2 ){
112752 assert( pTab->nRef==1 || ((pSel->selFlags&SF_Recursive) && pTab->nRef==2 ));
112772 sqlite3ColumnsFromExprList(pParse, pEList, &pTab->nCol, &pTab->aCol);
112867 Table *pTab;
112868 assert( pFrom->fg.isRecursive==0 || pFrom->pTab!=0 );
112870 assert( pFrom->pTab==0 );
112873 if( pFrom->pTab ) {} else
112880 assert( pFrom->pTab==0 );
112882 pFrom->pTab = pTab = sqlite3DbMallocZero(db, sizeof(Table));
112883 if( pTab==0 ) return WRC_Abort;
112884 pTab->nRef = 1;
112885 pTab->zName = sqlite3MPrintf(db, "sqlite_sq_%p", (void*)pTab);
112887 sqlite3ColumnsFromExprList(pParse, pSel->pEList,&pTab->nCol,&pTab->aCol);
112888 pTab->iPKey = -1;
112889 pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
112890 pTab->tabFlags |= TF_Ephemeral;
112894 assert( pFrom->pTab==0 );
112895 pFrom->pTab = pTab = sqlite3LocateTableItem(pParse, 0, pFrom);
112896 if( pTab==0 ) return WRC_Abort;
112897 if( pTab->nRef==0xffff ){
112899 pTab->zName);
112900 pFrom->pTab = 0;
112903 pTab->nRef++;
112905 if( pTab->pSelect || IsVirtual(pTab) ){
112907 if( sqlite3ViewGetColumnNames(pParse, pTab) ) return WRC_Abort;
112909 if( pFrom->fg.isTabFunc && !IsVirtual(pTab) ){
112910 sqlite3ErrorMsg(pParse, "'%s' is not a function", pTab->zName);
112913 pFrom->pSelect = sqlite3SelectDup(db, pTab->pSelect, 0);
112914 sqlite3SelectSetName(pFrom->pSelect, pTab->zName);
112915 nCol = pTab->nCol;
112916 pTab->nCol = -1;
112918 pTab->nCol = nCol;
112990 Table *pTab = pFrom->pTab;
112996 zTabName = pTab->zName;
113004 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
113007 for(j=0; j<pTab->nCol; j++){
113008 char *zName = pTab->aCol[j].zName;
113024 if( IsHiddenColumn(&pTab->aCol[j]) ){
113025 assert(IsVirtual(pTab));
113171 Table *pTab = pFrom->pTab;
113172 assert( pTab!=0 );
113173 if( (pTab->tabFlags & TF_Ephemeral)!=0 ){
113178 selectAddColumnTypeAndCollation(pParse, pTab, pSel);
113384 Table *pTab, /* Table being queried */
113388 int bCover = (pIdx!=0 && (HasRowid(pTab) || !IsPrimaryKeyIndex(pIdx)));
113390 pTab->zName,
113504 Table *pTab = pItem->pTab;
113509 if( pTab->nCol!=pSub->pEList->nExpr ){
113511 pTab->nCol, pTab->zName, pSub->pEList->nExpr);
113609 VdbeComment((v, "%s", pItem->pTab->zName));
113614 pItem->pTab->nRowLogEst = sqlite3LogEst(pSub->nSelectRow);
113638 VdbeComment((v, "materialize \"%s\"", pItem->pTab->zName));
113640 VdbeNoopComment((v, "materialize \"%s\"", pItem->pTab->zName));
113645 pItem->pTab->nRowLogEst = sqlite3LogEst(pSub->nSelectRow);
113648 VdbeComment((v, "end %s", pItem->pTab->zName));
113956 pCol->pTab, pCol->iColumn, pCol->iTable, r1, 0);
114096 Table *pTab;
114097 if( (pTab = isSimpleCount(p, &sAggInfo))!=0 ){
114111 const int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
114116 int iRoot = pTab->tnum; /* Root page of scanned b-tree */
114119 sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
114130 if( !HasRowid(pTab) ) pBest = sqlite3PrimaryKeyIndex(pTab);
114131 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
114133 && pIdx->szIdxRow<pTab->szTabRow
114152 explainSimpleCount(pParse, pTab, pBest);
114524 SQLITE_PRIVATE Trigger *sqlite3TriggerList(Parse *pParse, Table *pTab){
114532 if( pTmpSchema!=pTab->pSchema ){
114537 if( pTrig->pTabSchema==pTab->pSchema
114538 && 0==sqlite3StrICmp(pTrig->table, pTab->zName)
114540 pTrig->pNext = (pList ? pList : pTab->pTrigger);
114546 return (pList ? pList : pTab->pTrigger);
114570 Table *pTab; /* Table that the trigger fires off of */
114619 pTab = sqlite3SrcListLookup(pParse, pTableName);
114620 if( db->init.busy==0 && pName2->n==0 && pTab
114621 && pTab->pSchema==db->aDb[1].pSchema ){
114632 pTab = sqlite3SrcListLookup(pParse, pTableName);
114633 if( !pTab ){
114648 if( IsVirtual(pTab) ){
114671 if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 ){
114679 if( pTab->pSelect && tr_tm!=TK_INSTEAD ){
114684 if( !pTab->pSelect && tr_tm==TK_INSTEAD ){
114689 iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema);
114697 if( sqlite3AuthCheck(pParse, code, zName, pTab->zName, zDbTrig) ){
114722 pTrigger->pTabSchema = pTab->pSchema;
114806 Table *pTab;
114807 pTab = sqlite3HashFind(&pLink->pTabSchema->tblHash, pLink->table);
114808 assert( pTab!=0 );
114809 pLink->pNext = pTab->pTrigger;
114810 pTab->pTrigger = pLink;
115079 Table *pTab = tableOfTrigger(pTrigger);
115081 for(pp=&pTab->pTrigger; *pp!=pTrigger; pp=&((*pp)->pNext));
115115 Table *pTab, /* The table the contains the triggers */
115125 pList = sqlite3TriggerList(pParse, pTab);
115127 assert( pList==0 || IsVirtual(pTab)==0 );
115288 Table *pTab, /* The table pTrigger is attached to */
115301 assert( pTrigger->zName==0 || pTab==tableOfTrigger(pTrigger) );
115326 pSubParse->pTriggerTab = pTab;
115340 pTab->zName
115402 Table *pTab, /* The table trigger pTrigger is attached to */
115408 assert( pTrigger->zName==0 || pTab==tableOfTrigger(pTrigger) );
115421 pPrg = codeRowTrigger(pParse, pTrigger, pTab, orconf);
115436 Table *pTab, /* The table to code triggers from */
115443 pPrg = getRowTrigger(pParse, p, pTab, orconf);
115511 Table *pTab, /* The table to code triggers from */
115537 sqlite3CodeRowTriggerDirect(pParse, p, pTab, reg, orconf, ignoreJump);
115573 Table *pTab, /* The table to code triggers from */
115586 pPrg = getRowTrigger(pParse, p, pTab, orconf);
115621 Table *pTab, /* The virtual table */
115660 SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *v, Table *pTab, int i, int iReg){
115661 assert( pTab!=0 );
115662 if( !pTab->pSelect ){
115665 Column *pCol = &pTab->aCol[i];
115666 VdbeComment((v, "%s.%s", pTab->zName, pCol->zName));
115667 assert( i<pTab->nCol );
115674 if( pTab->aCol[i].affinity==SQLITE_AFF_REAL ){
115696 Table *pTab; /* The table to be updated */
115752 pTab = sqlite3SrcListLookup(pParse, pTabList);
115753 if( pTab==0 ) goto update_cleanup;
115754 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
115760 pTrigger = sqlite3TriggersExist(pParse, pTab, TK_UPDATE, pChanges, &tmask);
115761 isView = pTab->pSelect!=0;
115773 if( sqlite3ViewGetColumnNames(pParse, pTab) ){
115776 if( sqlite3IsReadOnly(pParse, pTab, tmask) ){
115787 pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);
115788 for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){
115799 aXRef = sqlite3DbMallocRaw(db, sizeof(int) * (pTab->nCol+nIdx) + nIdx+2 );
115801 aRegIdx = aXRef+pTab->nCol;
115805 for(i=0; i<pTab->nCol; i++) aXRef[i] = -1;
115823 for(j=0; j<pTab->nCol; j++){
115824 if( sqlite3StrICmp(pTab->aCol[j].zName, pChanges->a[i].zName)==0 ){
115825 if( j==pTab->iPKey ){
115828 }else if( pPk && (pTab->aCol[j].colFlags & COLFLAG_PRIMKEY)!=0 ){
115835 if( j>=pTab->nCol ){
115849 rc = sqlite3AuthCheck(pParse, SQLITE_UPDATE, pTab->zName,
115850 j<0 ? "ROWID" : pTab->aCol[j].zName,
115870 hasFK = sqlite3FkRequired(pParse, pTab, aXRef, chngKey);
115878 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
115903 if( !IsVirtual(pTab) ){
115908 pParse->nMem += pTab->nCol;
115914 pParse->nMem += pTab->nCol;
115919 sqlite3AuthContextPush(pParse, &sContext, pTab->zName);
115927 sqlite3MaterializeView(pParse, pTab, pWhere, iDataCur);
115940 if( IsVirtual(pTab) ){
115941 updateVirtualTable(pParse, pTabList, pTab, pChanges, pRowidExpr, aXRef,
115949 if( HasRowid(pTab) ){
115987 sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, pPk->aiColumn[i],
116020 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
116031 sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, iBaseCur, aToOpen,
116073 u32 oldmask = (hasFK ? sqlite3FkOldmask(pParse, pTab) : 0);
116075 pTrigger, pChanges, 0, TRIGGER_BEFORE|TRIGGER_AFTER, pTab, onError
116077 for(i=0; i<pTab->nCol; i++){
116080 || (pTab->aCol[i].colFlags & COLFLAG_PRIMKEY)!=0
116083 sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, regOld+i);
116107 pParse, pTrigger, pChanges, 1, TRIGGER_BEFORE, pTab, onError
116109 for(i=0; i<pTab->nCol; i++){
116110 if( i==pTab->iPKey ){
116124 sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, regNew+i);
116135 sqlite3TableAffinity(v, pTab, regNew);
116137 TRIGGER_BEFORE, pTab, regOldRowid, onError, labelContinue);
116158 for(i=0; i<pTab->nCol; i++){
116159 if( aXRef[i]<0 && i!=pTab->iPKey ){
116160 sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, regNew+i);
116171 sqlite3GenerateConstraintChecks(pParse, pTab, aRegIdx, iDataCur, iIdxCur,
116176 sqlite3FkCheck(pParse, pTab, regOldRowid, 0, aXRef, chngKey);
116188 sqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur, aRegIdx, -1);
116199 sqlite3FkCheck(pParse, pTab, 0, regNewRowid, aXRef, chngKey);
116203 sqlite3CompleteInsertion(pParse, pTab, iDataCur, iIdxCur,
116210 sqlite3FkActions(pParse, pTab, pChanges, regOldRowid, aXRef, chngKey);
116221 TRIGGER_AFTER, pTab, regOldRowid, onError, labelContinue);
116237 for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
116307 Table *pTab, /* The virtual table */
116318 const char *pVTab = (const char*)sqlite3GetVTable(db, pTab);
116320 int nArg = 2 + pTab->nCol; /* Number of arguments to VUpdate */
116351 for(i=0; i<pTab->nCol; i++){
116391 sqlite3VtabMakeWritable(pParse, pTab);
116811 Table *pTab; /* The Table object to which the virtual table belongs */
116912 SQLITE_PRIVATE VTable *sqlite3GetVTable(sqlite3 *db, Table *pTab){
116914 assert( IsVirtual(pTab) );
116915 for(pVtab=pTab->pVTable; pVtab && pVtab->db!=db; pVtab=pVtab->pNext);
117156 Table *pTab = pParse->pNewTable; /* The table being constructed */
117159 if( pTab==0 ) return;
117162 if( pTab->nModuleArg<1 ) return;
117191 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
117197 pTab->zName,
117198 pTab->zName,
117207 zWhere = sqlite3MPrintf(db, "name='%q' AND type='table'", pTab->zName);
117211 sqlite3VdbeLoadString(v, iReg, pTab->zName);
117222 Schema *pSchema = pTab->pSchema;
117223 const char *zName = pTab->zName;
117225 pOld = sqlite3HashInsert(&pSchema->tblHash, zName, pTab);
117228 assert( pTab==pOld ); /* Malloc must have failed inside HashInsert() */
117267 Table *pTab,
117275 const char *const*azArg = (const char *const*)pTab->azModuleArg;
117276 int nArg = pTab->nModuleArg;
117284 if( pCtx->pTab==pTab ){
117286 "vtable constructor called recursively: %s", pTab->zName
117292 zModuleName = sqlite3MPrintf(db, "%s", pTab->zName);
117305 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
117306 pTab->azModuleArg[1] = db->aDb[iDb].zName;
117311 sCtx.pTab = pTab;
117319 assert( sCtx.pTab==pTab );
117337 *pzErr = sqlite3MPrintf(db, zFormat, pTab->zName);
117348 pVTable->pNext = pTab->pVTable;
117349 pTab->pVTable = pVTable;
117351 for(iCol=0; iCol<pTab->nCol; iCol++){
117352 char *zType = pTab->aCol[iCol].zType;
117356 pTab->tabFlags |= oooHidden;
117380 pTab->aCol[iCol].colFlags |= COLFLAG_HIDDEN;
117383 pTab->tabFlags |= oooHidden;
117400 SQLITE_PRIVATE int sqlite3VtabCallConnect(Parse *pParse, Table *pTab){
117406 assert( pTab );
117407 if( (pTab->tabFlags & TF_Virtual)==0 || sqlite3GetVTable(db, pTab) ){
117412 zMod = pTab->azModuleArg[0];
117416 const char *zModule = pTab->azModuleArg[0];
117421 rc = vtabCallConstructor(db, pTab, pMod, pMod->pModule->xConnect, &zErr);
117472 Table *pTab;
117476 pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zName);
117477 assert( pTab && (pTab->tabFlags & TF_Virtual)!=0 && !pTab->pVTable );
117480 zMod = pTab->azModuleArg[0];
117491 rc = vtabCallConstructor(db, pTab, pMod, pMod->pModule->xCreate, pzErr);
117496 if( rc==SQLITE_OK && ALWAYS(sqlite3GetVTable(db, pTab)) ){
117499 addToVTrans(db, sqlite3GetVTable(db, pTab));
117515 Table *pTab;
117530 pTab = pCtx->pTab;
117531 assert( (pTab->tabFlags & TF_Virtual)!=0 );
117547 if( !pTab->aCol ){
117548 pTab->aCol = pParse->pNewTable->aCol;
117549 pTab->nCol = pParse->pNewTable->nCol;
117584 Table *pTab;
117586 pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zName);
117587 if( ALWAYS(pTab!=0 && pTab->pVTable!=0) ){
117590 for(p=pTab->pVTable; p; p=p->pNext){
117596 p = vtabDisconnectAll(db, pTab);
117602 assert( pTab->pVTable==p && p->pNext==0 );
117604 pTab->pVTable = 0;
117801 Table *pTab;
117815 pTab = pExpr->pTab;
117816 if( NEVER(pTab==0) ) return pDef;
117817 if( (pTab->tabFlags & TF_Virtual)==0 ) return pDef;
117818 pVtab = sqlite3GetVTable(db, pTab)->pVtab;
117861 SQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse *pParse, Table *pTab){
117866 assert( IsVirtual(pTab) );
117868 if( pTab==pToplevel->apVtabLock[i] ) return;
117874 pToplevel->apVtabLock[pToplevel->nVtabLock++] = pTab;
117896 Table *pTab;
117904 pTab = sqlite3DbMallocZero(db, sizeof(Table) + nName);
117905 if( pTab==0 ) return 0;
117906 pMod->pEpoTab = pTab;
117907 pTab->zName = (char*)&pTab[1];
117908 memcpy(pTab->zName, pMod->zName, nName);
117909 pTab->nRef = 1;
117910 pTab->pSchema = db->aDb[0].pSchema;
117911 pTab->tabFlags |= TF_Virtual;
117912 pTab->nModuleArg = 0;
117913 pTab->iPKey = -1;
117914 addModuleArgument(db, pTab, sqlite3DbStrDup(db, pTab->zName));
117915 addModuleArgument(db, pTab, 0);
117916 addModuleArgument(db, pTab, sqlite3DbStrDup(db, pTab->zName));
117917 rc = vtabCallConstructor(db, pTab, pMod, pModule->xConnect, &zErr);
117932 Table *pTab = pMod->pEpoTab;
117933 if( pTab!=0 ){
117934 sqlite3DeleteColumnNames(db, pTab);
117935 sqlite3VtabClear(db, pTab);
117936 sqlite3DbFree(db, pTab);
117981 assert( p->pTab==0 || (p->pTab->tabFlags & TF_Virtual)!=0 );
118689 if( !HasRowid(pItem->pTab) && IsPrimaryKeyIndex(pIdx) ){
119169 VdbeModuleComment((v, "Begin WHERE-loop%d: %s",iLevel,pTabItem->pTab->zName));
119200 VdbeComment((v, "next row of \"%s\"", pTabItem->pTab->zName));
119703 Table *pTab = pTabItem->pTab;
119748 if( HasRowid(pTab) ){
119752 Index *pPk = sqlite3PrimaryKeyIndex(pTab);
119830 if( HasRowid(pTab) ){
119831 r = sqlite3ExprCodeGetColumn(pParse, pTab, -1, iCur, regRowid, 0);
119836 Index *pPk = sqlite3PrimaryKeyIndex(pTab);
119845 rx = sqlite3ExprCodeGetColumn(pParse, pTab, iCol, iCur,r+iPk,0);
119907 && (HasRowid(pTab) || !IsPrimaryKeyIndex(pSubLoop->u.btree.pIndex))
120269 || IsVirtual(pLeft->pTab) /* Value might be numeric */
120882 for(pIdx=pFrom->a[i].pTab->pIndex; pIdx; pIdx=pIdx->pNext){
121363 Table *pTab;
121369 pTab = pItem->pTab;
121370 assert( pTab!=0 );
121374 while( k<pTab->nCol && (pTab->aCol[k].colFlags & COLFLAG_HIDDEN)==0 ){ k++; }
121375 if( k>=pTab->nCol ){
121377 pTab->zName, j);
121384 pColRef->pTab = pTab;
121817 Table *pTab;
121827 pTab = pTabList->a[0].pTab;
121851 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
121980 aff = pSrc->pTab->aCol[pTerm->u.leftColumn].affinity;
122034 pTable = pSrc->pTab;
122156 VdbeComment((v, "next row of \"%s\"", pTabItem->pTab->zName));
122324 static int vtabBestIndex(Parse *pParse, Table *pTab, sqlite3_index_info *p){
122325 sqlite3_vtab *pVtab = sqlite3GetVTable(pParse->db, pTab)->pVtab;
122348 "table %s: xBestIndex returned an invalid plan", pTab->zName);
123040 Table *pTab = pItem->pTab;
123044 pItem->zAlias ? pItem->zAlias : pTab->zName);
123757 rCostIdx = pNew->nOut + 1 + (15*pProbe->szIdxRow)/pSrc->pTab->szTabRow;
123961 Table *pTab; /* Table being queried */
123967 pTab = pSrc->pTab;
123969 assert( !IsVirtual(pSrc->pTab) );
123974 }else if( !HasRowid(pTab) ){
123975 pProbe = pTab->pIndex;
123988 sPk.pTable = pTab;
123989 sPk.szIdxRow = pTab->szTabRow;
123990 aiRowEstPk[0] = pTab->nRowLogEst;
123992 pFirst = pSrc->pTab->pIndex;
124000 rSize = pTab->nRowLogEst;
124010 && HasRowid(pTab) /* Not WITHOUT ROWID table. (FIXME: Why not?) */
124034 if( pTab->pSelect==0 && (pTab->tabFlags & TF_Ephemeral)==0 ){
124037 ApplyCostMultiplier(pNew->rSetup, pTab->costMult);
124080 ApplyCostMultiplier(pNew->rRun, pTab->costMult);
124097 || !HasRowid(pTab)
124100 && (pProbe->szIdxRow<pTab->szTabRow)
124112 pNew->rRun = rSize + 1 + (15*pProbe->szIdxRow)/pTab->szTabRow;
124116 ApplyCostMultiplier(pNew->rRun, pTab->costMult);
124173 Table *pTab;
124195 pTab = pSrc->pTab;
124196 assert( IsVirtual(pTab) );
124256 rc = vtabBestIndex(pParse, pTab, pIdxInfo);
124273 sqlite3ErrorMsg(pParse, "%s.xBestIndex() malfunction", pTab->zName);
124406 if( IsVirtual(pItem->pTab) ){
124495 if( IsVirtual(pItem->pTab) ){
125226 Table *pTab;
125233 pTab = pItem->pTab;
125234 if( IsVirtual(pTab) ) return 0;
125251 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
125660 if( HasRowid(pTabList->a[0].pTab) ){
125670 Table *pTab; /* Table to open */
125675 pTab = pTabItem->pTab;
125676 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
125678 if( (pTab->tabFlags & TF_Ephemeral)!=0 || pTab->pSelect ){
125683 const char *pVTab = (const char *)sqlite3GetVTable(db, pTab);
125686 }else if( IsVirtual(pTab) ){
125697 sqlite3OpenTable(pParse, pTabItem->iCursor, iDb, pTab, op);
125699 testcase( pWInfo->eOnePass==ONEPASS_OFF && pTab->nCol==BMS-1 );
125700 testcase( pWInfo->eOnePass==ONEPASS_OFF && pTab->nCol==BMS );
125701 if( pWInfo->eOnePass==ONEPASS_OFF && pTab->nCol<BMS && HasRowid(pTab) ){
125707 assert( n<=pTab->nCol );
125714 sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
125722 if( !HasRowid(pTab) && IsPrimaryKeyIndex(pIx)
125730 Index *pJ = pTabItem->pTab->pIndex;
125746 assert( pIx->pSchema==pTab->pSchema );
125899 pWInfo->pTabList->a[pLevel->iFrom].pTab->zName));
125913 Table *pTab = pTabItem->pTab;
125914 assert( pTab!=0 );
125932 if( (pTab->tabFlags & TF_Ephemeral)==0
125933 && pTab->pSelect==0
125975 assert( pIdx->pTable==pTab );
125976 if( !HasRowid(pTab) ){
125977 Index *pPk = sqlite3PrimaryKeyIndex(pTab);
131771 Table *pTab = (Table *)sqliteHashData(p);
131772 if( IsVirtual(pTab) ) sqlite3VtabDisconnect(db, pTab);
134042 Table *pTab = 0;
134067 pTab = sqlite3FindTable(db, zTableName, zDbName);
134068 if( !pTab || pTab->pSelect ){
134069 pTab = 0;
134077 for(iCol=0; iCol<pTab->nCol; iCol++){
134078 pCol = &pTab->aCol[iCol];
134083 if( iCol==pTab->nCol ){
134084 if( HasRowid(pTab) && sqlite3IsRowid(zColumnName) ){
134085 iCol = pTab->iPKey;
134086 pCol = iCol>=0 ? &pTab->aCol[iCol] : 0;
134088 pTab = 0;
134109 autoinc = pTab->iPKey==iCol && (pTab->tabFlags & TF_Autoincrement)!=0;
134131 if( SQLITE_OK==rc && !pTab ){
139908 Fts3Table *pTab, /* FTS Table pointer */
139954 pTab->bDescIdx, nDiff, pLeft, nLeft, &pRight, &nRight
139975 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
139986 rc = fts3TermSelect(pTab, pToken, p->iColumn, &nThis, &pThis);
139988 rc = fts3EvalPhraseMergeToken(pTab, p, iToken, pThis, nThis);
140120 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
140131 && pCsr->bDesc==pTab->bDescIdx
140134 && pTab->bNoIncrDoclist==0
140147 int iCol = (p->iColumn >= pTab->nColumn ? -1 : p->iColumn);
140152 rc = sqlite3Fts3MsrIncrStart(pTab, pSegcsr, iCol, pToken->z, pToken->n);
140270 Fts3Table *pTab,
140289 if( pTab->bDescIdx==0 || pDL->pNextDocid==0 ){
140333 Fts3Table *pTab, /* Virtual table handle */
140344 fts3EvalDlPhraseNext(pTab, &pPhrase->doclist, pbEof);
140355 pTab, pToken->pSegcsr, &p->iDocid, &p->pList, &p->nList
140391 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
140399 rc = sqlite3Fts3MsrIncrNext(pTab, p->aToken[0].pSegcsr,
140418 rc = incrPhraseTokenNext(pTab, p, i, &a[i], &bEof);
140432 rc = incrPhraseTokenNext(pTab, p, i, &a[i], &bEof);
140491 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
140495 }else if( pCsr->bDesc!=pTab->bDescIdx && pDL->nAll ){
140496 sqlite3Fts3DoclistPrev(pTab->bDescIdx, pDL->aAll, pDL->nAll,
140501 fts3EvalDlPhraseNext(pTab, pDL, pbEof);
140697 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
140712 if( pTab->zContentTbl ){
140790 rc = fts3TermSelect(pTab, pToken, pTC->iCol, &nList, &pList);
140794 pTab, pTC->pPhrase, pTC->iToken,pList,nList
140825 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
140835 if( rc==SQLITE_OK && nToken>1 && pTab->bFts4 ){
141482 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
141503 pE->aMI = (u32 *)sqlite3_malloc(pTab->nColumn * 3 * sizeof(u32));
141505 memset(pE->aMI, 0, pTab->nColumn * 3 * sizeof(u32));
141590 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
141596 for(iCol=0; iCol<pTab->nColumn; iCol++){
141604 for(iCol=0; iCol<pTab->nColumn; iCol++){
141640 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
141648 assert( iCol>=0 && iCol<pTab->nColumn );
141649 if( (pPhrase->iColumn<pTab->nColumn && pPhrase->iColumn!=iCol) ){
141657 int bDescDoclist = pTab->bDescIdx; /* For DOCID_CMP macro */
145626 Fts3tokTable *pTab = 0;
145656 pTab = (Fts3tokTable *)sqlite3_malloc(sizeof(Fts3tokTable));
145657 if( pTab==0 ){
145663 memset(pTab, 0, sizeof(Fts3tokTable));
145664 pTab->pMod = pMod;
145665 pTab->pTok = pTok;
145666 *ppVtab = &pTab->base;
145683 Fts3tokTable *pTab = (Fts3tokTable *)pVtab;
145685 pTab->pMod->xDestroy(pTab->pTok);
145686 sqlite3_free(pTab);
145742 Fts3tokTable *pTab = (Fts3tokTable *)(pCsr->base.pVtab);
145743 pTab->pMod->xClose(pCsr->pCsr);
145772 Fts3tokTable *pTab = (Fts3tokTable *)(pCursor->pVtab);
145776 rc = pTab->pMod->xNext(pCsr->pCsr,
145801 Fts3tokTable *pTab = (Fts3tokTable *)(pCursor->pVtab);
145815 rc = pTab->pMod->xOpen(pTab->pTok, pCsr->zInput, nByte, &pCsr->pCsr);
145817 pCsr->pCsr->pTokenizer = pTab->pTok;
146345 Fts3Table *pTab, /* FTS3 table handle */
146352 rc = fts3SqlStmt(pTab, SQL_SELECT_DOCSIZE, &pStmt, 0);
146370 Fts3Table *pTab, /* Fts3 table handle */
146375 rc = fts3SqlStmt(pTab, SQL_SELECT_STAT, &pStmt, 0);
146391 Fts3Table *pTab, /* Fts3 table handle */
146395 return fts3SelectDocsize(pTab, iDocid, ppStmt);
147334 static int fts3SegReaderFirstDocid(Fts3Table *pTab, Fts3SegReader *pReader){
147338 if( pTab->bDescIdx && fts3SegReaderIsPending(pReader) ){
147367 Fts3Table *pTab,
147378 if( pTab->bDescIdx && fts3SegReaderIsPending(pReader) ){
147442 if( pTab->bDescIdx ){
152242 Fts3Table *pTab, /* FTS3 table snippet comes from */
152274 pMod = (sqlite3_tokenizer_module *)pTab->pTokenizer->pModule;
152279 rc = sqlite3Fts3OpenTokenizer(pTab->pTokenizer, iLangid, zDoc, nDoc, &pC);
152316 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
152339 pMod = (sqlite3_tokenizer_module *)pTab->pTokenizer->pModule;
152340 rc = sqlite3Fts3OpenTokenizer(pTab->pTokenizer, pCsr->iLangid, zDoc,nDoc,&pC);
152379 pTab, pCsr->iLangid, nSnippet, &zDoc[iBegin], n, &iPos, &hlmask
152455 Fts3Table *pTab = (Fts3Table *)p->pCursor->base.pVtab;
152470 if( (pPhrase->iColumn>=pTab->nColumn || pPhrase->iColumn==iCol) ){
152569 Fts3Table *pTab,
152575 || (cArg==FTS3_MATCHINFO_NDOC && pTab->bFts4)
152576 || (cArg==FTS3_MATCHINFO_AVGLENGTH && pTab->bFts4)
152577 || (cArg==FTS3_MATCHINFO_LENGTH && pTab->bHasDocsize)
152623 Fts3Table *pTab,
152633 int rc = sqlite3Fts3SelectDoctotal(pTab, ppStmt);
152803 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
152820 rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &nDoc, 0);
152830 rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &nDoc, &a);
152846 rc = sqlite3Fts3SelectDocsize(pTab, pCsr->iPrevId, &pSelectDocsize);
152883 rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &pInfo->nDoc, 0);
152913 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
152922 sInfo.nCol = pTab->nColumn;
152948 if( fts3MatchinfoCheck(pTab, zArg[i], &zErr) ){
153001 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
153046 for(iRead=0; iRead<pTab->nColumn; iRead++){
153081 sqlite3Fts3SegmentsClose(pTab);
153144 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
153145 sqlite3_tokenizer_module const *pMod = pTab->pTokenizer->pModule;
153176 for(iCol=0; iCol<pTab->nColumn; iCol++){
153211 rc = sqlite3Fts3OpenTokenizer(pTab->pTokenizer, pCsr->iLangid,
153249 }else if( rc==SQLITE_DONE && pTab->zContentTbl==0 ){
153265 sqlite3Fts3SegmentsClose(pTab);
153283 Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab;
153298 sqlite3Fts3SegmentsClose(pTab);
163027 StatTable *pTab = 0;
163042 pTab = (StatTable *)sqlite3_malloc64(sizeof(StatTable));
163043 if( pTab==0 ) rc = SQLITE_NOMEM;
163046 assert( rc==SQLITE_OK || pTab==0 );
163048 memset(pTab, 0, sizeof(StatTable));
163049 pTab->db = db;
163050 pTab->iDb = iDb;
163053 *ppVtab = (sqlite3_vtab*)pTab;
163119 StatTable *pTab = (StatTable *)pVTab;
163128 pCsr->iDb = pTab->iDb;
163290 StatTable *pTab = (StatTable *)((sqlite3_vtab_cursor *)pCsr)->pVtab;
163291 Btree *pBt = pTab->db->aDb[pTab->iDb].pBt;
163319 StatTable *pTab = (StatTable *)pCursor->pVtab;
163320 Btree *pBt = pTab->db->aDb[pCsr->iDb].pBt;
163458 StatTable *pTab = (StatTable*)(pCursor->pVtab);
163465 pCsr->iDb = sqlite3FindDbName(pTab->db, zDbase);
163472 pCsr->iDb = pTab->iDb;
163483 " ORDER BY name", pTab->db->aDb[pCsr->iDb].zName, zMaster);
163487 rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pCsr->pStmt, 0);
178546 static int fts5IsContentless(Fts5Table *pTab){
178547 return pTab->pConfig->eContent==FTS5_CONTENT_NONE;
178553 static void fts5FreeVtab(Fts5Table *pTab){
178554 if( pTab ){
178555 sqlite3Fts5IndexClose(pTab->pIndex);
178556 sqlite3Fts5StorageClose(pTab->pStorage);
178557 sqlite3Fts5ConfigFree(pTab->pConfig);
178558 sqlite3_free(pTab);
178574 Fts5Table *pTab = (Fts5Table*)pVtab;
178575 int rc = sqlite3Fts5DropAll(pTab->pConfig);
178606 Fts5Table *pTab = 0; /* New virtual table object */
178609 pTab = (Fts5Table*)sqlite3Fts5MallocZero(&rc, sizeof(Fts5Table));
178615 pTab->pConfig = pConfig;
178616 pTab->pGlobal = pGlobal;
178621 rc = sqlite3Fts5IndexOpen(pConfig, bCreate, &pTab->pIndex, pzErr);
178627 pConfig, pTab->pIndex, bCreate, &pTab->pStorage, pzErr
178637 fts5FreeVtab(pTab);
178638 pTab = 0;
178640 fts5CheckTransactionState(pTab, FTS5_BEGIN, 0);
178642 *ppVTab = (sqlite3_vtab*)pTab;
178732 Fts5Table *pTab = (Fts5Table*)pVTab;
178733 Fts5Config *pConfig = pTab->pConfig;
178829 Fts5Table *pTab = (Fts5Table*)pVTab;
178830 Fts5Config *pConfig = pTab->pConfig;
178838 Fts5Global *pGlobal = pTab->pGlobal;
178872 Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);
178880 sqlite3Fts5StorageStmtRelease(pTab->pStorage, eStmt, pCsr->pStmt);
178916 Fts5Table *pTab = (Fts5Table*)(pCursor->pVtab);
178922 for(pp=&pTab->pGlobal->pCsr; (*pp)!=pCsr; pp=&(*pp)->pNext);
178970 static void fts5TripCursors(Fts5Table *pTab){
178972 for(pCsr=pTab->pGlobal->pCsr; pCsr; pCsr=pCsr->pNext){
178974 && pCsr->base.pVtab==(sqlite3_vtab*)pTab
178997 Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);
179001 rc = sqlite3Fts5ExprFirst(pCsr->pExpr, pTab->pIndex, iRowid, bDesc);
179067 static int fts5CursorFirstSorted(Fts5Table *pTab, Fts5Cursor *pCsr, int bDesc){
179068 Fts5Config *pConfig = pTab->pConfig;
179105 assert( pTab->pSortCsr==0 );
179106 pTab->pSortCsr = pCsr;
179108 pTab->pSortCsr = 0;
179120 static int fts5CursorFirst(Fts5Table *pTab, Fts5Cursor *pCsr, int bDesc){
179123 rc = sqlite3Fts5ExprFirst(pExpr, pTab->pIndex, pCsr->iFirstRowid, bDesc);
179138 Fts5Table *pTab,
179149 assert( pTab->base.zErrMsg==0 );
179153 pCsr->iSpecial = sqlite3Fts5IndexReads(pTab->pIndex);
179160 pTab->base.zErrMsg = sqlite3_mprintf("unknown special query: %.*s", n, z);
179172 static Fts5Auxiliary *fts5FindAuxiliary(Fts5Table *pTab, const char *zName){
179175 for(pAux=pTab->pGlobal->pAux; pAux; pAux=pAux->pNext){
179185 Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);
179186 Fts5Config *pConfig = pTab->pConfig;
179221 pAux = fts5FindAuxiliary(pTab, zRank);
179223 assert( pTab->base.zErrMsg==0 );
179224 pTab->base.zErrMsg = sqlite3_mprintf("no such function: %s", zRank);
179299 Fts5Table *pTab = (Fts5Table*)(pCursor->pVtab);
179300 Fts5Config *pConfig = pTab->pConfig;
179325 assert( pzErrmsg==0 || pzErrmsg==&pTab->base.zErrMsg );
179326 pConfig->pzErrmsg = &pTab->base.zErrMsg;
179357 if( pTab->pSortCsr ){
179369 pCsr->pExpr = pTab->pSortCsr->pExpr;
179370 rc = fts5CursorFirst(pTab, pCsr, bDesc);
179381 rc = fts5SpecialMatch(pTab, pCsr, &zExpr[1]);
179383 char **pzErr = &pTab->base.zErrMsg;
179388 rc = fts5CursorFirstSorted(pTab, pCsr, bDesc);
179391 rc = fts5CursorFirst(pTab, pCsr, bDesc);
179406 pTab->pStorage, fts5StmtType(pCsr), &pCsr->pStmt, &pTab->base.zErrMsg
179489 Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);
179492 pTab->pStorage, eStmt, &pCsr->pStmt, (bErrormsg?&pTab->base.zErrMsg:0)
179494 assert( rc!=SQLITE_OK || pTab->base.zErrMsg==0 );
179540 Fts5Table *pTab, /* Fts5 table object */
179544 Fts5Config *pConfig = pTab->pConfig;
179550 fts5SetVtabError(pTab,
179556 rc = sqlite3Fts5StorageDeleteAll(pTab->pStorage);
179560 fts5SetVtabError(pTab,
179565 rc = sqlite3Fts5StorageRebuild(pTab->pStorage);
179568 rc = sqlite3Fts5StorageOptimize(pTab->pStorage);
179571 rc = sqlite3Fts5StorageMerge(pTab->pStorage, nMerge);
179573 rc = sqlite3Fts5StorageIntegrity(pTab->pStorage);
179579 rc = sqlite3Fts5IndexLoadConfig(pTab->pIndex);
179581 rc = sqlite3Fts5ConfigSetValue(pTab->pConfig, zCmd, pVal, &bError);
179587 rc = sqlite3Fts5StorageConfigValue(pTab->pStorage, zCmd, pVal, 0);
179595 Fts5Table *pTab,
179603 rc = sqlite3Fts5StorageSpecialDelete(pTab->pStorage, iDel, &apVal[2]);
179610 Fts5Table *pTab,
179616 rc = sqlite3Fts5StorageContentInsert(pTab->pStorage, apVal, piRowid);
179619 rc = sqlite3Fts5StorageIndexInsert(pTab->pStorage, apVal, *piRowid);
179644 Fts5Table *pTab = (Fts5Table*)pVtab;
179645 Fts5Config *pConfig = pTab->pConfig;
179650 assert( pTab->ts.eState==1 );
179658 assert( pTab->pConfig->pzErrmsg==0 );
179659 pTab->pConfig->pzErrmsg = &pTab->base.zErrMsg;
179662 fts5TripCursors(pTab);
179673 rc = fts5SpecialDelete(pTab, apVal, pRowid);
179675 rc = fts5SpecialInsert(pTab, z, apVal[2 + pConfig->nCol + 1]);
179696 if( eType0==SQLITE_INTEGER && fts5IsContentless(pTab) ){
179697 pTab->base.zErrMsg = sqlite3_mprintf(
179707 rc = sqlite3Fts5StorageDelete(pTab->pStorage, iDel);
179717 rc = sqlite3Fts5StorageDelete(pTab->pStorage, iNew);
179719 fts5StorageInsert(&rc, pTab, apVal, pRowid);
179728 rc = sqlite3Fts5StorageDelete(pTab->pStorage, iOld);
179730 rc = sqlite3Fts5StorageDelete(pTab->pStorage, iNew);
179732 fts5StorageInsert(&rc, pTab, apVal, pRowid);
179734 rc = sqlite3Fts5StorageContentInsert(pTab->pStorage, apVal, pRowid);
179736 rc = sqlite3Fts5StorageDelete(pTab->pStorage, iOld);
179739 rc = sqlite3Fts5StorageIndexInsert(pTab->pStorage, apVal, *pRowid);
179743 rc = sqlite3Fts5StorageDelete(pTab->pStorage, iOld);
179744 fts5StorageInsert(&rc, pTab, apVal, pRowid);
179749 pTab->pConfig->pzErrmsg = 0;
179758 Fts5Table *pTab = (Fts5Table*)pVtab;
179759 fts5CheckTransactionState(pTab, FTS5_SYNC, 0);
179760 pTab->pConfig->pzErrmsg = &pTab->base.zErrMsg;
179761 fts5TripCursors(pTab);
179762 rc = sqlite3Fts5StorageSync(pTab->pStorage, 1);
179763 pTab->pConfig->pzErrmsg = 0;
179791 Fts5Table *pTab = (Fts5Table*)pVtab;
179792 fts5CheckTransactionState(pTab, FTS5_ROLLBACK, 0);
179793 rc = sqlite3Fts5StorageRollback(pTab->pStorage);
179813 Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);
179814 return sqlite3Fts5StorageSize(pTab->pStorage, iCol, pnToken);
179819 Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);
179820 return sqlite3Fts5StorageRowCount(pTab->pStorage, pnRow);
179830 Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);
179832 pTab->pConfig, FTS5_TOKENIZE_AUX, pText, nText, pUserData, xToken
180001 Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);
180002 Fts5Config *pConfig = pTab->pConfig;
180008 rc = sqlite3Fts5StorageDocsize(pTab->pStorage, iRowid, pCsr->aColumnSize);
180178 Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab);
180184 Fts5Config *pConf = pTab->pConfig;
180188 pNew->base.pVtab = (sqlite3_vtab*)pTab;
180193 for(rc = fts5CursorFirst(pTab, pNew, 0);
180268 Fts5Table *pTab;
180271 pTab = (Fts5Table*)pCsr->base.pVtab;
180272 *pnCol = pTab->pConfig->nCol;
180274 return pTab->pIndex;
180328 Fts5Table *pTab = (Fts5Table*)(pCursor->pVtab);
180329 Fts5Config *pConfig = pTab->pConfig;
180360 }else if( !fts5IsContentless(pTab) ){
180381 Fts5Table *pTab = (Fts5Table*)pVtab;
180384 pAux = fts5FindAuxiliary(pTab, zName);
180402 Fts5Table *pTab = (Fts5Table*)pVtab;
180403 return sqlite3Fts5StorageRename(pTab->pStorage, zName);
180412 Fts5Table *pTab = (Fts5Table*)pVtab;
180413 fts5CheckTransactionState(pTab, FTS5_SAVEPOINT, iSavepoint);
180414 fts5TripCursors(pTab);
180415 return sqlite3Fts5StorageSync(pTab->pStorage, 0);
180424 Fts5Table *pTab = (Fts5Table*)pVtab;
180425 fts5CheckTransactionState(pTab, FTS5_RELEASE, iSavepoint);
180426 fts5TripCursors(pTab);
180427 return sqlite3Fts5StorageSync(pTab->pStorage, 0);
180436 Fts5Table *pTab = (Fts5Table*)pVtab;
180437 fts5CheckTransactionState(pTab, FTS5_ROLLBACKTO, iSavepoint);
180438 fts5TripCursors(pTab);
180439 return sqlite3Fts5StorageRollback(pTab->pStorage);
183896 Fts5VocabTable *pTab = (Fts5VocabTable*)pVtab;
183897 sqlite3_free(pTab);
183905 Fts5VocabTable *pTab = (Fts5VocabTable*)pVtab;
183906 sqlite3_free(pTab);
184030 Fts5VocabTable *pTab = (Fts5VocabTable*)pVTab;
184041 pTab->zFts5Tbl, pTab->zFts5Db, pTab->zFts5Tbl, pTab->zFts5Tbl
184044 rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pStmt, 0);
184052 pIndex = sqlite3Fts5IndexFromCsrid(pTab->pGlobal, iId, &nCol);
184060 "no such fts5 table: %s.%s", pTab->zFts5Db, pTab->zFts5Tbl
184107 Fts5VocabTable *pTab = (Fts5VocabTable*)pCursor->pVtab;
184112 if( pTab->eType==FTS5_VOCAB_COL ){
184118 if( pTab->eType==FTS5_VOCAB_ROW || pCsr->iCol>=pCsr->nCol ){
184132 assert( pTab->eType==FTS5_VOCAB_COL || pTab->eType==FTS5_VOCAB_ROW );
184141 if( pTab->eType==FTS5_VOCAB_ROW ){
184168 if( pCsr->bEof==0 && pTab->eType==FTS5_VOCAB_COL ){