Lines Matching refs:pSchema

10867   Schema *pSchema;     /* Pointer to database schema (possibly shared) */  member
10905 #define DbHasProperty(D,I,P) (((D)->aDb[I].pSchema->schemaFlags&(P))==(P))
10906 #define DbHasAnyProperty(D,I,P) (((D)->aDb[I].pSchema->schemaFlags&(P))!=0)
10907 #define DbSetProperty(D,I,P) (D)->aDb[I].pSchema->schemaFlags|=(P)
10908 #define DbClearProperty(D,I,P) (D)->aDb[I].pSchema->schemaFlags&=~(P)
11135 #define SCHEMA_ENC(db) ((db)->aDb[0].pSchema->enc)
11535 Schema *pSchema; /* Schema that contains this table */ member
11738 Schema *pSchema; /* Schema containing this index */ member
12147 Schema *pSchema; /* Schema to which this item is fixed */ member
12662 Schema *pSchema; /* Schema containing the trigger */ member
12737 Schema *pSchema; /* Fix items to this schema */ member
15227 Schema *pSchema = db->aDb[i].pSchema; in sqlite3_db_status() local
15228 if( ALWAYS(pSchema!=0) ){ in sqlite3_db_status()
15232 pSchema->tblHash.count in sqlite3_db_status()
15233 + pSchema->trigHash.count in sqlite3_db_status()
15234 + pSchema->idxHash.count in sqlite3_db_status()
15235 + pSchema->fkeyHash.count in sqlite3_db_status()
15237 nByte += sqlite3MallocSize(pSchema->tblHash.ht); in sqlite3_db_status()
15238 nByte += sqlite3MallocSize(pSchema->trigHash.ht); in sqlite3_db_status()
15239 nByte += sqlite3MallocSize(pSchema->idxHash.ht); in sqlite3_db_status()
15240 nByte += sqlite3MallocSize(pSchema->fkeyHash.ht); in sqlite3_db_status()
15242 for(p=sqliteHashFirst(&pSchema->trigHash); p; p=sqliteHashNext(p)){ in sqlite3_db_status()
15245 for(p=sqliteHashFirst(&pSchema->tblHash); p; p=sqliteHashNext(p)){ in sqlite3_db_status()
52515 void *pSchema; /* Pointer to space allocated by sqlite3BtreeSchema() */
53012 SQLITE_PRIVATE int sqlite3SchemaMutexHeld(sqlite3 *db, int iDb, Schema *pSchema){
53015 if( pSchema ) iDb = sqlite3SchemaToIndex(db, pSchema);
53197 Schema *pSchema = (Schema *)pBtree->pBt->pSchema;
53216 if( isIndex && (!pSchema || (pSchema->schemaFlags&DB_SchemaLoaded)==0) ){
53226 for(p=sqliteHashFirst(&pSchema->idxHash); p; p=sqliteHashNext(p)){
55349 if( pBt->xFreeSchema && pBt->pSchema ){
55350 pBt->xFreeSchema(pBt->pSchema);
55352 sqlite3DbFree(0, pBt->pSchema);
62120 if( !pBt->pSchema && nBytes ){
62121 pBt->pSchema = sqlite3DbMallocZero(0, nBytes);
62125 return pBt->pSchema;
73935 iGen = db->aDb[pOp->p1].pSchema->iGeneration;
73956 if( db->aDb[pOp->p1].pSchema->schema_cookie!=iMeta ){
74021 pDb->pSchema->schema_cookie = (int)pIn3->u.i;
74025 pDb->pSchema->file_format = (u8)pIn3->u.i;
74146 if( pDb->pSchema->file_format < p->minWriteFileFormat ){
74147 p->minWriteFileFormat = pDb->pSchema->file_format;
77690 int iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
77694 pTab->pSchema->schema_cookie,
77695 pTab->pSchema->iGeneration);
78890 mxCache = db->aDb[0].pSchema->cache_size;
81523 Schema *pSchema = 0; /* Schema of the expression */
81554 pSchema = db->aDb[i].pSchema;
81585 if( zDb && pTab->pSchema!=pSchema ){
81624 pSchema = pExpr->pTab->pSchema;
81647 pSchema = pTab->pSchema;
81806 sqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList);
83836 pNewItem->pSchema = pOldItem->pSchema;
84514 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
87530 const Schema *pTempSchema = pParse->db->aDb[1].pSchema; /* Temp db schema */
87537 if( pTab->pSchema!=pTempSchema ){
87540 if( pTrig->pSchema==pTempSchema ){
87572 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
87578 int iTrigDb = sqlite3SchemaToIndex(pParse->db, pTrig->pSchema);
87648 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
87870 iDb = sqlite3SchemaToIndex(db, pNew->pSchema);
88013 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
88045 pNew->pSchema = db->aDb[iDb].pSchema;
89059 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
89142 assert( iDb==sqlite3SchemaToIndex(db, pIdx->pSchema) );
89355 Schema *pSchema = db->aDb[iDb].pSchema; /* Schema of database iDb */
89368 for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){
89386 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
89904 for(i=sqliteHashFirst(&db->aDb[iDb].pSchema->idxHash);i;i=sqliteHashNext(i)){
89939 for(i=sqliteHashFirst(&db->aDb[iDb].pSchema->idxHash);i;i=sqliteHashNext(i)){
90100 aNew->pSchema = sqlite3SchemaGet(db, aNew->pBt);
90101 if( !aNew->pSchema ){
90103 }else if( aNew->pSchema->file_format && aNew->pSchema->enc!=ENC(db) ){
90182 db->aDb[iDb].pSchema = 0;
90255 pDb->pSchema = 0;
90395 pFix->pSchema = db->aDb[iDb].pSchema;
90435 pItem->pSchema = pFix->pSchema;
90685 Schema *pSchema, /* The schema of the expression */
90696 iDb = sqlite3SchemaToIndex(pParse->db, pSchema);
90995 db->aDb[iDb].pSchema->iGeneration /* P4 */
91129 p = sqlite3HashFind(&db->aDb[j].pSchema->tblHash, zName);
91193 assert( p->pSchema==0 || p->zDatabase==0 );
91194 if( p->pSchema ){
91195 int iDb = sqlite3SchemaToIndex(pParse->db, p->pSchema);
91222 Schema *pSchema = db->aDb[j].pSchema;
91223 assert( pSchema );
91226 p = sqlite3HashFind(&pSchema->idxHash, zName);
91259 pHash = &db->aDb[iDb].pSchema->idxHash;
91321 assert( pDb->pSchema!=0 );
91322 sqlite3SchemaClear(pDb->pSchema);
91330 assert( pDb->pSchema!=0 );
91331 sqlite3SchemaClear(pDb->pSchema);
91345 if( pDb->pSchema ){
91346 sqlite3SchemaClear(pDb->pSchema);
91416 assert( pIndex->pSchema==pTable->pSchema );
91420 &pIndex->pSchema->idxHash, zName, 0
91422 assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) );
91463 p = sqlite3HashInsert(&pDb->pSchema->tblHash, zTabName, 0);
91753 pTable->pSchema = db->aDb[iDb].pSchema;
91766 pTable->pSchema->pSeqTab = pTable;
92264 sqlite3VdbeAddOp2(v, OP_Integer, db->aDb[iDb].pSchema->schema_cookie+1, r1);
92656 iDb = sqlite3SchemaToIndex(db, p->pSchema);
92779 if( pDb->pSchema->pSeqTab==0 ){
92798 Schema *pSchema = p->pSchema;
92800 pOld = sqlite3HashInsert(&pSchema->tblHash, p->zName, p);
92858 iDb = sqlite3SchemaToIndex(db, p->pSchema);
92981 assert( sqlite3SchemaMutexHeld(db, 0, pTable->pSchema) );
92982 pTable->pSchema->schemaFlags |= DB_UnresetViews;
93004 for(i=sqliteHashFirst(&db->aDb[idx].pSchema->tblHash); i;i=sqliteHashNext(i)){
93043 pHash = &pDb->pSchema->tblHash;
93050 pHash = &pDb->pSchema->idxHash;
93097 int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
93131 assert( pIdx->pSchema==pTab->pSchema );
93139 int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
93197 assert( pTrigger->pSchema==pTab->pSchema ||
93198 pTrigger->pSchema==db->aDb[1].pSchema );
93266 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
93449 assert( sqlite3SchemaMutexHeld(db, 0, p->pSchema) );
93450 pNextTo = (FKey *)sqlite3HashInsert(&p->pSchema->fkeyHash,
93516 int iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);
93693 if( pName2->n==0 && pTab && pTab->pSchema==db->aDb[1].pSchema ){
93708 if( iDb==1 && db->aDb[iDb].pSchema!=pTab->pSchema ){
93720 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
93851 pIndex->pSchema = db->aDb[iDb].pSchema;
93862 if( pDb->pSchema->file_format>=4 ){
94002 assert( sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) );
94003 p = sqlite3HashInsert(&pIndex->pSchema->idxHash,
94190 iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);
94695 assert( db->aDb[1].pSchema );
94720 pToplevel->cookieValue[iDb] = db->aDb[iDb].pSchema->schema_cookie;
94897 int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
94921 for(k=sqliteHashFirst(&pDb->pSchema->tblHash); k; k=sqliteHashNext(k)){
95537 Schema *pSchema = (Schema *)p;
95539 temp1 = pSchema->tblHash;
95540 temp2 = pSchema->trigHash;
95541 sqlite3HashInit(&pSchema->trigHash);
95542 sqlite3HashClear(&pSchema->idxHash);
95547 sqlite3HashInit(&pSchema->tblHash);
95553 sqlite3HashClear(&pSchema->fkeyHash);
95554 pSchema->pSeqTab = 0;
95555 if( pSchema->schemaFlags & DB_SchemaLoaded ){
95556 pSchema->iGeneration++;
95557 pSchema->schemaFlags &= ~DB_SchemaLoaded;
95683 int iDb = sqlite3SchemaToIndex(db, pView->pSchema);
95881 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
95956 assert( pIdx->pSchema==pTab->pSchema );
98889 return (FKey *)sqlite3HashFind(&pTab->pSchema->fkeyHash, pTab->zName);
99098 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
99547 pTrigger->pSchema = pTab->pSchema;
99548 pTrigger->pTabSchema = pTab->pSchema;
99596 assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pTab->pSchema) );
99606 sqlite3HashInsert(&pTab->pSchema->fkeyHash, z, p);
99889 assert( sqlite3SchemaMutexHeld(db, 0, pDb->pSchema) );
99890 sqlite3OpenTable(pParse, 0, p->iDb, pDb->pSchema->pSeqTab, OP_OpenRead);
99941 assert( sqlite3SchemaMutexHeld(db, 0, pDb->pSchema) );
99942 sqlite3OpenTable(pParse, 0, p->iDb, pDb->pSchema->pSeqTab, OP_OpenWrite);
100142 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
101275 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
101289 assert( pIdx->pSchema==pTab->pSchema );
101565 iDbSrc = sqlite3SchemaToIndex(db, pSrc->pSchema);
104019 pDb->pSchema->cache_size = size;
104020 sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
104314 returnSingleInt(pParse, "cache_size", pDb->pSchema->cache_size);
104317 pDb->pSchema->cache_size = size;
104318 sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
104656 for(i=sqliteHashFirst(&pDb->pSchema->tblHash); i; i=sqliteHashNext(i)){
104864 k = sqliteHashFirst(&db->aDb[iDb].pSchema->tblHash);
105051 pTbls = &db->aDb[i].pSchema->tblHash;
105748 assert( db->aDb[iDb].pSchema );
105825 pDb->pSchema->schema_cookie = meta[BTREE_SCHEMA_VERSION-1];
105855 pDb->pSchema->enc = ENC(db);
105857 if( pDb->pSchema->cache_size==0 ){
105861 pDb->pSchema->cache_size = size;
105863 pDb->pSchema->cache_size = SQLITE_DEFAULT_CACHE_SIZE;
105865 sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
105874 pDb->pSchema->file_format = (u8)meta[BTREE_FILE_FORMAT-1];
105875 if( pDb->pSchema->file_format==0 ){
105876 pDb->pSchema->file_format = 1;
105878 if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
106058 if( cookie!=db->aDb[iDb].pSchema->schema_cookie ){
106077 SQLITE_PRIVATE int sqlite3SchemaToIndex(sqlite3 *db, Schema *pSchema){
106091 if( pSchema ){
106093 if( db->aDb[i].pSchema==pSchema ){
107862 }else if( pTab->pSchema ){
107878 int iDb = sqlite3SchemaToIndex(pNC->pParse->db, pTab->pSchema);
110760 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
111820 const int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
112325 Schema * const pTmpSchema = pParse->db->aDb[1].pSchema;
112332 if( pTmpSchema!=pTab->pSchema ){
112337 if( pTrig->pTabSchema==pTab->pSchema
112421 && pTab->pSchema==db->aDb[1].pSchema ){
112460 if( sqlite3HashFind(&(db->aDb[iDb].pSchema->trigHash),zName) ){
112489 iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema);
112521 pTrigger->pSchema = db->aDb[iDb].pSchema;
112522 pTrigger->pTabSchema = pTab->pSchema;
112561 iDb = sqlite3SchemaToIndex(pParse->db, pTrig->pSchema);
112600 Hash *pHash = &db->aDb[iDb].pSchema->trigHash;
112605 }else if( pLink->pSchema==pLink->pTabSchema ){
112781 pTrigger = sqlite3HashFind(&(db->aDb[j].pSchema->trigHash), zName);
112817 iDb = sqlite3SchemaToIndex(pParse->db, pTrigger->pSchema);
112821 assert( pTable->pSchema==pTrigger->pSchema || iDb==1 );
112875 pHash = &(db->aDb[iDb].pSchema->trigHash);
112878 if( pTrigger->pSchema==pTrigger->pTabSchema ){
112961 iDb = sqlite3SchemaToIndex(db, pStep->pTrig->pSchema);
113327 assert( p->pSchema!=0 );
113329 assert( p->pSchema==p->pTabSchema
113330 || p->pSchema==pParse->db->aDb[1].pSchema );
113553 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
114536 pDb->pSchema = 0;
114720 assert( db==0 || sqlite3SchemaMutexHeld(db, 0, p->pSchema) );
114877 iDb = sqlite3SchemaToIndex(db, pTable->pSchema);
114959 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
114990 Schema *pSchema = pTab->pSchema;
114992 assert( sqlite3SchemaMutexHeld(db, 0, pSchema) );
114993 pOld = sqlite3HashInsert(&pSchema->tblHash, zName, pTab);
115073 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
122913 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
122979 assert( pIx->pSchema==pTab->pSchema );
128926 Schema *pSchema = db->aDb[i].pSchema;
128927 if( db->aDb[i].pSchema ){
128929 for(p=sqliteHashFirst(&pSchema->tblHash); p; p=sqliteHashNext(p)){
129063 pDb->pSchema = 0;
129068 if( db->aDb[1].pSchema ){
129069 sqlite3SchemaClear(db->aDb[1].pSchema);
129133 sqlite3DbFree(db, db->aDb[1].pSchema);
130801 db->aDb[0].pSchema = sqlite3SchemaGet(db, db->aDb[0].pBt);
130804 db->aDb[1].pSchema = sqlite3SchemaGet(db, 0);