Lines Matching defs:pSchema
17419 Schema *pSchema; /* Pointer to database schema (possibly shared) */
17455 ** Db.pSchema->flags field.
17457 #define DbHasProperty(D,I,P) (((D)->aDb[I].pSchema->schemaFlags&(P))==(P))
17458 #define DbHasAnyProperty(D,I,P) (((D)->aDb[I].pSchema->schemaFlags&(P))!=0)
17459 #define DbSetProperty(D,I,P) (D)->aDb[I].pSchema->schemaFlags|=(P)
17460 #define DbClearProperty(D,I,P) (D)->aDb[I].pSchema->schemaFlags&=~(P)
17463 ** Allowed values for the DB.pSchema->flags field.
17784 #define SCHEMA_ENC(db) ((db)->aDb[0].pSchema->enc)
18428 Schema *pSchema; /* Schema that contains this table */
18740 Schema *pSchema; /* Schema containing this index */
19263 Schema *pSchema; /* Schema to which this item is fixed */
20007 Schema *pSchema; /* Schema containing the trigger */
20316 Schema *pSchema; /* Fix items to this schema */
24115 Schema *pSchema = db->aDb[i].pSchema;
24116 if( ALWAYS(pSchema!=0) ){
24120 pSchema->tblHash.count
24121 + pSchema->trigHash.count
24122 + pSchema->idxHash.count
24123 + pSchema->fkeyHash.count
24125 nByte += sqlite3_msize(pSchema->tblHash.ht);
24126 nByte += sqlite3_msize(pSchema->trigHash.ht);
24127 nByte += sqlite3_msize(pSchema->idxHash.ht);
24128 nByte += sqlite3_msize(pSchema->fkeyHash.ht);
24130 for(p=sqliteHashFirst(&pSchema->trigHash); p; p=sqliteHashNext(p)){
24133 for(p=sqliteHashFirst(&pSchema->tblHash); p; p=sqliteHashNext(p)){
69916 ** The pSchema field may be set once under BtShared.mutex and
69960 void *pSchema; /* Pointer to space allocated by sqlite3BtreeSchema() */
69961 void (*xFreeSchema)(void*); /* Destructor for BtShared.pSchema */
70474 ** db->aDb[iDb].pSchema structure. The mutexes required for schema
70480 ** If pSchema is not NULL, then iDb is computed from pSchema and
70483 SQLITE_PRIVATE int sqlite3SchemaMutexHeld(sqlite3 *db, int iDb, Schema *pSchema){
70487 if( pSchema ) iDb = sqlite3SchemaToIndex(db, pSchema);
70767 Schema *pSchema = (Schema *)pBtree->pBt->pSchema;
70786 if( isIndex && (!pSchema || (pSchema->schemaFlags&DB_SchemaLoaded)==0) ){
70797 for(p=sqliteHashFirst(&pSchema->idxHash); p; p=sqliteHashNext(p)){
73493 if( pBt->xFreeSchema && pBt->pSchema ){
73494 pBt->xFreeSchema(pBt->pSchema);
73496 sqlite3DbFree(0, pBt->pSchema);
81811 if( !pBt->pSchema && nBytes ){
81812 pBt->pSchema = sqlite3DbMallocZero(0, nBytes);
81816 return pBt->pSchema;
97191 && (iMeta!=pOp->p3 || pDb->pSchema->iGeneration!=pOp->p4.i)
97213 if( db->aDb[pOp->p1].pSchema->schema_cookie!=iMeta ){
97289 *(u32*)&pDb->pSchema->schema_cookie = *(u32*)&pOp->p3 - pOp->p5;
97294 pDb->pSchema->file_format = pOp->p3;
97437 if( pDb->pSchema->file_format < p->minWriteFileFormat ){
97438 p->minWriteFileFormat = pDb->pSchema->file_format;
100125 sqlite3SchemaClear(db->aDb[iDb].pSchema);
102470 pBlob->zDb = db->aDb[sqlite3SchemaToIndex(db, pTab->pSchema)].zDbSName;
102558 int iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
102562 pTab->pSchema->schema_cookie,
102563 pTab->pSchema->iGeneration);
103799 mxCache = db->aDb[0].pSchema->cache_size;
105781 Schema *pSchema;
105786 pSchema = db->aDb[iDb].pSchema;
105788 for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){
105797 for(k=sqliteHashFirst(&pSchema->idxHash); k; k=sqliteHashNext(k)){
107018 Schema *pSchema = 0; /* Schema of the expression */
107035 ** schema. If not found, pSchema will remain NULL and nothing will match
107051 pSchema = db->aDb[i].pSchema;
107058 pSchema = db->aDb[0].pSchema;
107140 if( pTab->pSchema!=pSchema ) continue;
107141 if( pSchema==0 && strcmp(zDb,"*")!=0 ) continue;
107236 pSchema = pExpr->y.pTab->pSchema;
107283 pSchema = pTab->pSchema;
107571 sqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList);
108996 if( pTab->pSchema!=pParse->db->aDb[1].pSchema ){
110889 pNewItem->pSchema = pOldItem->pSchema;
112171 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
116287 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
116476 iDb = sqlite3SchemaToIndex(db, pNew->pSchema);
116659 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
116690 pNew->pSchema = db->aDb[iDb].pSchema;
116762 iSchema = sqlite3SchemaToIndex(db, pTab->pSchema);
117956 && sCtx.pTab->pSchema==pTrigger->pTabSchema
118345 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
119481 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
119581 assert( iDb==sqlite3SchemaToIndex(db, pIdx->pSchema) );
119851 Schema *pSchema = db->aDb[iDb].pSchema; /* Schema of database iDb */
119864 for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){
119887 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
120408 Schema *pSchema = db->aDb[iDb].pSchema;
120416 for(i=sqliteHashFirst(&pSchema->tblHash); i; i=sqliteHashNext(i)){
120420 for(i=sqliteHashFirst(&pSchema->idxHash); i; i=sqliteHashNext(i)){
120447 for(i=sqliteHashFirst(&pSchema->idxHash); i; i=sqliteHashNext(i)){
120459 for(i=sqliteHashFirst(&pSchema->idxHash); i; i=sqliteHashNext(i)){
120597 pNew->pSchema = pNewSchema;
120666 pNew->pSchema = sqlite3SchemaGet(db, pNew->pBt);
120667 if( !pNew->pSchema ){
120669 }else if( pNew->pSchema->file_format && pNew->pSchema->enc!=ENC(db) ){
120722 db->aDb[iDb].pSchema = 0;
120794 assert( db->aDb[1].pSchema );
120795 pEntry = sqliteHashFirst(&db->aDb[1].pSchema->trigHash);
120798 if( pTrig->pTabSchema==pDb->pSchema ){
120799 pTrig->pTabSchema = pTrig->pSchema;
120806 pDb->pSchema = 0;
120970 pItem->pSchema = pFix->pSchema;
121006 pFix->pSchema = db->aDb[iDb].pSchema;
121239 Schema *pSchema, /* The schema of the expression */
121251 iDb = sqlite3SchemaToIndex(pParse->db, pSchema);
121581 Schema *pSchema;
121584 pSchema = db->aDb[iDb].pSchema;
121589 pSchema->schema_cookie, /* P3 */
121590 pSchema->iGeneration /* P4 */
121746 p = sqlite3HashFind(&db->aDb[i].pSchema->tblHash, zName);
121753 p = sqlite3HashFind(&db->aDb[1].pSchema->tblHash,
121758 p = sqlite3HashFind(&db->aDb[i].pSchema->tblHash,
121765 p = sqlite3HashFind(&db->aDb[1].pSchema->tblHash, zName);
121768 p = sqlite3HashFind(&db->aDb[0].pSchema->tblHash, zName);
121773 p = sqlite3HashFind(&db->aDb[i].pSchema->tblHash, zName);
121778 p = sqlite3HashFind(&db->aDb[0].pSchema->tblHash, LEGACY_SCHEMA_TABLE);
121780 p = sqlite3HashFind(&db->aDb[1].pSchema->tblHash,
121857 ** the search to schema (p->pSchema) if it is not NULL. p->pSchema may be
121867 assert( p->pSchema==0 || p->zDatabase==0 );
121868 if( p->pSchema ){
121869 int iDb = sqlite3SchemaToIndex(pParse->db, p->pSchema);
121912 Schema *pSchema = db->aDb[j].pSchema;
121913 assert( pSchema );
121916 p = sqlite3HashFind(&pSchema->idxHash, zName);
121950 pHash = &db->aDb[iDb].pSchema->idxHash;
122019 sqlite3SchemaClear(db->aDb[i].pSchema);
122034 if( pDb->pSchema ){
122036 sqlite3SchemaClear(pDb->pSchema);
122199 assert( pIndex->pSchema==pTable->pSchema
122204 &pIndex->pSchema->idxHash, zName, 0
122206 assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) );
122262 p = sqlite3HashInsert(&pDb->pSchema->tblHash, zTabName, 0);
122682 pTable->pSchema = db->aDb[iDb].pSchema;
122786 pHash = &(db->aDb[1].pSchema->trigHash);
122835 pRet->retTrig.pSchema = db->aDb[1].pSchema;
122836 pRet->retTrig.pTabSchema = db->aDb[1].pSchema;
122841 pHash = &(db->aDb[1].pSchema->trigHash);
123421 (int)(1+(unsigned)db->aDb[iDb].pSchema->schema_cookie));
123907 for(k=sqliteHashFirst(&pTab->pSchema->tblHash); k; k=sqliteHashNext(k)){
124089 iDb = sqlite3SchemaToIndex(db, p->pSchema);
124277 if( pDb->pSchema->pSeqTab==0 ){
124303 Schema *pSchema = p->pSchema;
124306 pOld = sqlite3HashInsert(&pSchema->tblHash, p->zName, p);
124322 p->pSchema->pSeqTab = p;
124382 iDb = sqlite3SchemaToIndex(db, p->pSchema);
124544 assert( sqlite3SchemaMutexHeld(db, 0, pTable->pSchema) );
124554 pTable->pSchema->schemaFlags |= DB_UnresetViews;
124576 for(i=sqliteHashFirst(&db->aDb[idx].pSchema->tblHash); i;i=sqliteHashNext(i)){
124613 pHash = &pDb->pSchema->tblHash;
124620 pHash = &pDb->pSchema->idxHash;
124695 assert( pIdx->pSchema==pTab->pSchema );
124703 int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
124760 assert( pTrigger->pSchema==pTab->pSchema ||
124761 pTrigger->pSchema==db->aDb[1].pSchema );
124870 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
125064 assert( sqlite3SchemaMutexHeld(db, 0, p->pSchema) );
125065 pNextTo = (FKey *)sqlite3HashInsert(&p->pSchema->fkeyHash,
125134 int iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);
125354 if( pName2->n==0 && pTab && pTab->pSchema==db->aDb[1].pSchema ){
125369 if( iDb==1 && db->aDb[iDb].pSchema!=pTab->pSchema ){
125381 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
125531 pIndex->pSchema = db->aDb[iDb].pSchema;
125542 if( pDb->pSchema->file_format>=4 ){
125741 assert( sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) );
125750 p = sqlite3HashInsert(&pIndex->pSchema->idxHash,
125975 iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);
126597 assert( db->aDb[1].pSchema );
126809 int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
126834 for(k=sqliteHashFirst(&pDb->pSchema->tblHash); k; k=sqliteHashNext(k)){
126902 iDb = sqlite3SchemaToIndex(db, pIndex->pTable->pSchema);
127567 Schema *pSchema = (Schema *)p;
127571 temp1 = pSchema->tblHash;
127572 temp2 = pSchema->trigHash;
127573 sqlite3HashInit(&pSchema->trigHash);
127574 sqlite3HashClear(&pSchema->idxHash);
127579 sqlite3HashInit(&pSchema->tblHash);
127585 sqlite3HashClear(&pSchema->fkeyHash);
127586 pSchema->pSeqTab = 0;
127587 if( pSchema->schemaFlags & DB_SchemaLoaded ){
127588 pSchema->iGeneration++;
127590 pSchema->schemaFlags &= ~(DB_SchemaLoaded|DB_ResetWanted);
127770 int iDb = sqlite3SchemaToIndex(db, pView->pSchema);
128006 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
128101 assert( pIdx->pSchema==pTab->pSchema );
132085 return (FKey *)sqlite3HashFind(&pTab->pSchema->fkeyHash, pTab->zName);
132114 Hash *pHash = &db->aDb[iDb].pSchema->tblHash;
132317 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
132735 int iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
132808 pTrigger->pSchema = pTab->pSchema;
132809 pTrigger->pTabSchema = pTab->pSchema;
132860 assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pTab->pSchema) );
132868 sqlite3HashInsert(&pTab->pSchema->fkeyHash, z, pFKey->pNextTo);
133305 assert( pParse->db->aDb[iDb].pSchema!=0 );
133311 Table *pSeqTab = pParse->db->aDb[iDb].pSchema->pSeqTab;
133382 assert( sqlite3SchemaMutexHeld(db, 0, pDb->pSchema) );
133383 sqlite3OpenTable(pParse, 0, p->iDb, pDb->pSchema->pSeqTab, OP_OpenRead);
133445 assert( sqlite3SchemaMutexHeld(db, 0, pDb->pSchema) );
133448 sqlite3OpenTable(pParse, 0, p->iDb, pDb->pSchema->pSeqTab, OP_OpenWrite);
133842 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
135610 if( pTab->pSchema->file_format<2 ) return;
135770 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
135784 assert( pIdx->pSchema==pTab->pSchema );
135970 if( pSrc->tnum==pDest->tnum && pSrc->pSchema==pDest->pSchema ){
136070 if( pSrcIdx->tnum==pDestIdx->tnum && pSrc->pSchema==pDest->pSchema
136110 iDbSrc = sqlite3SchemaToIndex(db, pSrc->pSchema);
139289 pDb->pSchema->cache_size = size;
139290 sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
139593 returnSingleInt(v, pDb->pSchema->cache_size);
139596 pDb->pSchema->cache_size = size;
139597 sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
140001 pHash = &db->aDb[ii].pSchema->tblHash;
140020 pHash = &db->aDb[ii].pSchema->tblHash;
140058 for(i=sqliteHashFirst(&pDb->pSchema->tblHash); i; i=sqliteHashNext(i)){
140093 int iIdxDb = sqlite3SchemaToIndex(db, pIdx->pSchema);
140130 int iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema);
140223 int iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema);
140269 k = sqliteHashFirst(&db->aDb[iDb].pSchema->tblHash);
140279 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
140460 pTbls = &db->aDb[i].pSchema->tblHash;
141216 Schema *pSchema; /* The current schema */
141245 pSchema = db->aDb[iDb].pSchema;
141246 for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){
142017 assert( db->aDb[iDb].pSchema );
142095 pDb->pSchema->schema_cookie = meta[BTREE_SCHEMA_VERSION-1];
142130 pDb->pSchema->enc = ENC(db);
142132 if( pDb->pSchema->cache_size==0 ){
142136 pDb->pSchema->cache_size = size;
142138 pDb->pSchema->cache_size = SQLITE_DEFAULT_CACHE_SIZE;
142140 sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
142149 pDb->pSchema->file_format = (u8)meta[BTREE_FILE_FORMAT-1];
142150 if( pDb->pSchema->file_format==0 ){
142151 pDb->pSchema->file_format = 1;
142153 if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
142332 if( cookie!=db->aDb[iDb].pSchema->schema_cookie ){
142351 SQLITE_PRIVATE int sqlite3SchemaToIndex(sqlite3 *db, Schema *pSchema){
142354 /* If pSchema is NULL, then return -32768. This happens when code in
142366 if( pSchema ){
142369 if( db->aDb[i].pSchema==pSchema ){
144592 int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
144880 if( pNC->pParse && pTab->pSchema ){
144881 int iDb = sqlite3SchemaToIndex(pNC->pParse->db, pTab->pSchema);
148947 && pTab->pSchema!=db->aDb[1].pSchema
149078 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
149972 if( pItem->pTab->pSchema!=pThis->pTab->pSchema ) continue;
149975 if( pItem->pTab->pSchema==0 && pThis->pSelect->selId!=pS1->selId ){
151321 const int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
151768 pTmpSchema = pParse->db->aDb[1].pSchema;
151773 if( pTrig->pTabSchema==pTab->pSchema
151787 pTrig->pTabSchema = pTab->pSchema;
151878 && pTab->pSchema==db->aDb[1].pSchema ){
151915 if( sqlite3HashFind(&(db->aDb[iDb].pSchema->trigHash),zName) ){
151949 int iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema);
151978 pTrigger->pSchema = db->aDb[iDb].pSchema;
151979 pTrigger->pTabSchema = pTab->pSchema;
152042 iDb = sqlite3SchemaToIndex(pParse->db, pTrig->pSchema);
152107 Hash *pHash = &db->aDb[iDb].pSchema->trigHash;
152113 }else if( pLink->pSchema==pLink->pTabSchema ){
152353 pTrigger = sqlite3HashFind(&(db->aDb[j].pSchema->trigHash), zName);
152389 iDb = sqlite3SchemaToIndex(pParse->db, pTrigger->pSchema);
152392 assert( (pTable && pTable->pSchema==pTrigger->pSchema) || iDb==1 );
152426 pHash = &(db->aDb[iDb].pSchema->trigHash);
152429 if( pTrigger->pSchema==pTrigger->pTabSchema ){
152468 if( NEVER(db->aDb[1].pSchema==0) ) return 0;
152469 if( sqliteHashFirst(&db->aDb[1].pSchema->trigHash)==0 ) return 0;
152580 Schema *pSchema = pStep->pTrig->pSchema;
152582 if( pSchema!=db->aDb[1].pSchema ){
152583 pSrc->a[0].pSchema = pSchema;
153185 assert( p->pSchema!=0 );
153187 assert( p->pSchema==p->pTabSchema
153188 || p->pSchema==pParse->db->aDb[1].pSchema );
153637 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
155220 sqlite3BtreeSetCacheSize(pTemp, db->aDb[iDb].pSchema->cache_size);
155379 pDb->pSchema = 0;
155635 assert( db==0 || sqlite3SchemaMutexHeld(db, 0, p->pSchema) );
155813 int iDb = sqlite3SchemaToIndex(db, pTable->pSchema);
155878 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
155904 Schema *pSchema = pTab->pSchema;
155908 pOld = sqlite3HashInsert(&pSchema->tblHash, zName, pTab);
155993 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
156663 pTab->pSchema = db->aDb[0].pSchema;
168766 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
168861 assert( pIx->pSchema==pTab->pSchema );
169173 int iDb = sqlite3SchemaToIndex(db, pIx->pSchema);
180977 Schema *pSchema = db->aDb[i].pSchema;
180978 if( pSchema ){
180979 for(p=sqliteHashFirst(&pSchema->tblHash); p; p=sqliteHashNext(p)){
181160 pDb->pSchema = 0;
181165 if( db->aDb[1].pSchema ){
181166 sqlite3SchemaClear(db->aDb[1].pSchema);
181227 sqlite3DbFree(db, db->aDb[1].pSchema);
183265 db->aDb[0].pSchema = sqlite3SchemaGet(db, db->aDb[0].pBt);
183270 db->aDb[1].pSchema = sqlite3SchemaGet(db, 0);
183934 assert( db==0 || db->aDb[0].pSchema!=0 );
183935 if( db && (y = db->aDb[0].pSchema->schema_cookie)!=0 ){ x = y; }
230214 db->aDb[0].pSchema->schema_cookie -= 32;
230226 db->aDb[0].pSchema->schema_cookie -= 32;