Lines Matching refs:pSchema

11532   Schema *pSchema;     /* Pointer to database schema (possibly shared) */
11568 ** Db.pSchema->flags field.
11570 #define DbHasProperty(D,I,P) (((D)->aDb[I].pSchema->schemaFlags&(P))==(P))
11571 #define DbHasAnyProperty(D,I,P) (((D)->aDb[I].pSchema->schemaFlags&(P))!=0)
11572 #define DbSetProperty(D,I,P) (D)->aDb[I].pSchema->schemaFlags|=(P)
11573 #define DbClearProperty(D,I,P) (D)->aDb[I].pSchema->schemaFlags&=~(P)
11576 ** Allowed values for the DB.pSchema->flags field.
11800 #define SCHEMA_ENC(db) ((db)->aDb[0].pSchema->enc)
12212 Trigger *pTrigger; /* List of triggers stored in pSchema */
12213 Schema *pSchema; /* Schema that contains this table */
12426 Schema *pSchema; /* Schema containing this index */
12843 Schema *pSchema; /* Schema to which this item is fixed */
13367 Schema *pSchema; /* Schema containing the trigger */
13442 Schema *pSchema; /* Fix items to this schema */
15985 Schema *pSchema = db->aDb[i].pSchema;
15986 if( ALWAYS(pSchema!=0) ){
15990 pSchema->tblHash.count
15991 + pSchema->trigHash.count
15992 + pSchema->idxHash.count
15993 + pSchema->fkeyHash.count
15995 nByte += sqlite3MallocSize(pSchema->tblHash.ht);
15996 nByte += sqlite3MallocSize(pSchema->trigHash.ht);
15997 nByte += sqlite3MallocSize(pSchema->idxHash.ht);
15998 nByte += sqlite3MallocSize(pSchema->fkeyHash.ht);
16000 for(p=sqliteHashFirst(&pSchema->trigHash); p; p=sqliteHashNext(p)){
16003 for(p=sqliteHashFirst(&pSchema->tblHash); p; p=sqliteHashNext(p)){
53914 ** The pSchema field may be set once under BtShared.mutex and
53960 void *pSchema; /* Pointer to space allocated by sqlite3BtreeSchema() */
53961 void (*xFreeSchema)(void*); /* Destructor for BtShared.pSchema */
54472 ** db->aDb[iDb].pSchema structure. The mutexes required for schema
54478 ** If pSchema is not NULL, then iDb is computed from pSchema and
54481 SQLITE_PRIVATE int sqlite3SchemaMutexHeld(sqlite3 *db, int iDb, Schema *pSchema){
54484 if( pSchema ) iDb = sqlite3SchemaToIndex(db, pSchema);
54667 Schema *pSchema = (Schema *)pBtree->pBt->pSchema;
54686 if( isIndex && (!pSchema || (pSchema->schemaFlags&DB_SchemaLoaded)==0) ){
54696 for(p=sqliteHashFirst(&pSchema->idxHash); p; p=sqliteHashNext(p)){
57036 if( pBt->xFreeSchema && pBt->pSchema ){
57037 pBt->xFreeSchema(pBt->pSchema);
57039 sqlite3DbFree(0, pBt->pSchema);
63996 if( !pBt->pSchema && nBytes ){
63997 pBt->pSchema = sqlite3DbMallocZero(0, nBytes);
64001 return pBt->pSchema;
76045 iGen = db->aDb[pOp->p1].pSchema->iGeneration;
76066 if( db->aDb[pOp->p1].pSchema->schema_cookie!=iMeta ){
76131 pDb->pSchema->schema_cookie = (int)pIn3->u.i;
76135 pDb->pSchema->file_format = (u8)pIn3->u.i;
76256 if( pDb->pSchema->file_format < p->minWriteFileFormat ){
76257 p->minWriteFileFormat = pDb->pSchema->file_format;
79886 int iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
79890 pTab->pSchema->schema_cookie,
79891 pTab->pSchema->iGeneration);
81088 mxCache = db->aDb[0].pSchema->cache_size;
83698 Schema *pSchema = 0; /* Schema of the expression */
83713 ** schema. If not found, pSchema will remain NULL and nothing will match
83729 pSchema = db->aDb[i].pSchema;
83760 if( zDb && pTab->pSchema!=pSchema ){
83799 pSchema = pExpr->pTab->pSchema;
83822 pSchema = pTab->pSchema;
83986 sqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList);
86033 pNewItem->pSchema = pOldItem->pSchema;
86727 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
89506 const Schema *pTempSchema = pParse->db->aDb[1].pSchema; /* Temp db schema */
89513 if( pTab->pSchema!=pTempSchema ){
89516 if( pTrig->pSchema==pTempSchema ){
89548 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
89554 int iTrigDb = sqlite3SchemaToIndex(pParse->db, pTrig->pSchema);
89624 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
89846 iDb = sqlite3SchemaToIndex(db, pNew->pSchema);
89989 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
90021 pNew->pSchema = db->aDb[iDb].pSchema;
91036 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
91119 assert( iDb==sqlite3SchemaToIndex(db, pIdx->pSchema) );
91331 Schema *pSchema = db->aDb[iDb].pSchema; /* Schema of database iDb */
91344 for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){
91362 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
91880 for(i=sqliteHashFirst(&db->aDb[iDb].pSchema->idxHash);i;i=sqliteHashNext(i)){
91915 for(i=sqliteHashFirst(&db->aDb[iDb].pSchema->idxHash);i;i=sqliteHashNext(i)){
92077 aNew->pSchema = sqlite3SchemaGet(db, aNew->pBt);
92078 if( !aNew->pSchema ){
92080 }else if( aNew->pSchema->file_format && aNew->pSchema->enc!=ENC(db) ){
92159 db->aDb[iDb].pSchema = 0;
92232 pDb->pSchema = 0;
92372 pFix->pSchema = db->aDb[iDb].pSchema;
92412 pItem->pSchema = pFix->pSchema;
92663 Schema *pSchema, /* The schema of the expression */
92674 iDb = sqlite3SchemaToIndex(pParse->db, pSchema);
92974 db->aDb[iDb].pSchema->iGeneration /* P4 */
93110 p = sqlite3HashFind(&db->aDb[j].pSchema->tblHash, zName);
93175 ** the search to schema (p->pSchema) if it is not NULL. p->pSchema may be
93185 assert( p->pSchema==0 || p->zDatabase==0 );
93186 if( p->pSchema ){
93187 int iDb = sqlite3SchemaToIndex(pParse->db, p->pSchema);
93214 Schema *pSchema = db->aDb[j].pSchema;
93215 assert( pSchema );
93218 p = sqlite3HashFind(&pSchema->idxHash, zName);
93252 pHash = &db->aDb[iDb].pSchema->idxHash;
93314 assert( pDb->pSchema!=0 );
93315 sqlite3SchemaClear(pDb->pSchema);
93323 assert( pDb->pSchema!=0 );
93324 sqlite3SchemaClear(pDb->pSchema);
93338 if( pDb->pSchema ){
93339 sqlite3SchemaClear(pDb->pSchema);
93409 assert( pIndex->pSchema==pTable->pSchema );
93413 &pIndex->pSchema->idxHash, zName, 0
93415 assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) );
93454 p = sqlite3HashInsert(&pDb->pSchema->tblHash, zTabName, 0);
93744 pTable->pSchema = db->aDb[iDb].pSchema;
93757 pTable->pSchema->pSeqTab = pTable;
94284 sqlite3VdbeAddOp2(v, OP_Integer, db->aDb[iDb].pSchema->schema_cookie+1, r1);
94681 iDb = sqlite3SchemaToIndex(db, p->pSchema);
94824 if( pDb->pSchema->pSeqTab==0 ){
94843 Schema *pSchema = p->pSchema;
94845 pOld = sqlite3HashInsert(&pSchema->tblHash, p->zName, p);
94900 iDb = sqlite3SchemaToIndex(db, p->pSchema);
95026 assert( sqlite3SchemaMutexHeld(db, 0, pTable->pSchema) );
95037 pTable->pSchema->schemaFlags |= DB_UnresetViews;
95051 for(i=sqliteHashFirst(&db->aDb[idx].pSchema->tblHash); i;i=sqliteHashNext(i)){
95090 pHash = &pDb->pSchema->tblHash;
95097 pHash = &pDb->pSchema->idxHash;
95144 int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
95178 assert( pIdx->pSchema==pTab->pSchema );
95186 int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
95244 assert( pTrigger->pSchema==pTab->pSchema ||
95245 pTrigger->pSchema==db->aDb[1].pSchema );
95313 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
95496 assert( sqlite3SchemaMutexHeld(db, 0, p->pSchema) );
95497 pNextTo = (FKey *)sqlite3HashInsert(&p->pSchema->fkeyHash,
95563 int iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);
95739 if( pName2->n==0 && pTab && pTab->pSchema==db->aDb[1].pSchema ){
95754 if( iDb==1 && db->aDb[iDb].pSchema!=pTab->pSchema ){
95766 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
95902 pIndex->pSchema = db->aDb[iDb].pSchema;
95913 if( pDb->pSchema->file_format>=4 ){
96079 assert( sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) );
96080 p = sqlite3HashInsert(&pIndex->pSchema->idxHash,
96274 iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);
96800 assert( db->aDb[1].pSchema );
96825 pToplevel->cookieValue[iDb] = db->aDb[iDb].pSchema->schema_cookie;
97006 int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
97030 for(k=sqliteHashFirst(&pDb->pSchema->tblHash); k; k=sqliteHashNext(k)){
97647 Schema *pSchema = (Schema *)p;
97649 temp1 = pSchema->tblHash;
97650 temp2 = pSchema->trigHash;
97651 sqlite3HashInit(&pSchema->trigHash);
97652 sqlite3HashClear(&pSchema->idxHash);
97657 sqlite3HashInit(&pSchema->tblHash);
97663 sqlite3HashClear(&pSchema->fkeyHash);
97664 pSchema->pSeqTab = 0;
97665 if( pSchema->schemaFlags & DB_SchemaLoaded ){
97666 pSchema->iGeneration++;
97667 pSchema->schemaFlags &= ~DB_SchemaLoaded;
97794 int iDb = sqlite3SchemaToIndex(db, pView->pSchema);
97994 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
98071 assert( pIdx->pSchema==pTab->pSchema );
101055 return (FKey *)sqlite3HashFind(&pTab->pSchema->fkeyHash, pTab->zName);
101264 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
101718 pTrigger->pSchema = pTab->pSchema;
101719 pTrigger->pTabSchema = pTab->pSchema;
101767 assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pTab->pSchema) );
101777 sqlite3HashInsert(&pTab->pSchema->fkeyHash, z, p);
102071 assert( sqlite3SchemaMutexHeld(db, 0, pDb->pSchema) );
102072 sqlite3OpenTable(pParse, 0, p->iDb, pDb->pSchema->pSeqTab, OP_OpenRead);
102123 assert( sqlite3SchemaMutexHeld(db, 0, pDb->pSchema) );
102124 sqlite3OpenTable(pParse, 0, p->iDb, pDb->pSchema->pSeqTab, OP_OpenWrite);
102324 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
103473 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
103487 assert( pIdx->pSchema==pTab->pSchema );
103770 iDbSrc = sqlite3SchemaToIndex(db, pSrc->pSchema);
106279 pDb->pSchema->cache_size = size;
106280 sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
106570 returnSingleInt(v, "cache_size", pDb->pSchema->cache_size);
106573 pDb->pSchema->cache_size = size;
106574 sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
106884 for(i=sqliteHashFirst(&pDb->pSchema->tblHash); i; i=sqliteHashNext(i)){
107067 k = sqliteHashFirst(&db->aDb[iDb].pSchema->tblHash);
107251 pTbls = &db->aDb[i].pSchema->tblHash;
107935 assert( db->aDb[iDb].pSchema );
108012 pDb->pSchema->schema_cookie = meta[BTREE_SCHEMA_VERSION-1];
108042 pDb->pSchema->enc = ENC(db);
108044 if( pDb->pSchema->cache_size==0 ){
108048 pDb->pSchema->cache_size = size;
108050 pDb->pSchema->cache_size = SQLITE_DEFAULT_CACHE_SIZE;
108052 sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
108061 pDb->pSchema->file_format = (u8)meta[BTREE_FILE_FORMAT-1];
108062 if( pDb->pSchema->file_format==0 ){
108063 pDb->pSchema->file_format = 1;
108065 if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
108245 if( cookie!=db->aDb[iDb].pSchema->schema_cookie ){
108264 SQLITE_PRIVATE int sqlite3SchemaToIndex(sqlite3 *db, Schema *pSchema){
108267 /* If pSchema is NULL, then return -1000000. This happens when code in
108278 if( pSchema ){
108280 if( db->aDb[i].pSchema==pSchema ){
110064 }else if( pTab->pSchema ){
110080 int iDb = sqlite3SchemaToIndex(pNC->pParse->db, pTab->pSchema);
113004 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
114111 const int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
114525 Schema * const pTmpSchema = pParse->db->aDb[1].pSchema;
114532 if( pTmpSchema!=pTab->pSchema ){
114537 if( pTrig->pTabSchema==pTab->pSchema
114621 && pTab->pSchema==db->aDb[1].pSchema ){
114660 if( sqlite3HashFind(&(db->aDb[iDb].pSchema->trigHash),zName) ){
114689 iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema);
114721 pTrigger->pSchema = db->aDb[iDb].pSchema;
114722 pTrigger->pTabSchema = pTab->pSchema;
114761 iDb = sqlite3SchemaToIndex(pParse->db, pTrig->pSchema);
114800 Hash *pHash = &db->aDb[iDb].pSchema->trigHash;
114805 }else if( pLink->pSchema==pLink->pTabSchema ){
114981 pTrigger = sqlite3HashFind(&(db->aDb[j].pSchema->trigHash), zName);
115017 iDb = sqlite3SchemaToIndex(pParse->db, pTrigger->pSchema);
115021 assert( pTable->pSchema==pTrigger->pSchema || iDb==1 );
115075 pHash = &(db->aDb[iDb].pSchema->trigHash);
115078 if( pTrigger->pSchema==pTrigger->pTabSchema ){
115161 iDb = sqlite3SchemaToIndex(db, pStep->pTrig->pSchema);
115527 assert( p->pSchema!=0 );
115529 assert( p->pSchema==p->pTabSchema
115530 || p->pSchema==pParse->db->aDb[1].pSchema );
115754 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
116772 pDb->pSchema = 0;
116958 assert( db==0 || sqlite3SchemaMutexHeld(db, 0, p->pSchema) );
117109 iDb = sqlite3SchemaToIndex(db, pTable->pSchema);
117191 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
117222 Schema *pSchema = pTab->pSchema;
117224 assert( sqlite3SchemaMutexHeld(db, 0, pSchema) );
117225 pOld = sqlite3HashInsert(&pSchema->tblHash, zName, pTab);
117305 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
117910 pTab->pSchema = db->aDb[0].pSchema;
125676 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
125746 assert( pIx->pSchema==pTab->pSchema );
131768 Schema *pSchema = db->aDb[i].pSchema;
131769 if( db->aDb[i].pSchema ){
131770 for(p=sqliteHashFirst(&pSchema->tblHash); p; p=sqliteHashNext(p)){
131910 pDb->pSchema = 0;
131915 if( db->aDb[1].pSchema ){
131916 sqlite3SchemaClear(db->aDb[1].pSchema);
131981 sqlite3DbFree(db, db->aDb[1].pSchema);
133654 db->aDb[0].pSchema = sqlite3SchemaGet(db, db->aDb[0].pBt);
133657 db->aDb[1].pSchema = sqlite3SchemaGet(db, 0);