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()
52533 void *pSchema; /* Pointer to space allocated by sqlite3BtreeSchema() */
53030 SQLITE_PRIVATE int sqlite3SchemaMutexHeld(sqlite3 *db, int iDb, Schema *pSchema){
53033 if( pSchema ) iDb = sqlite3SchemaToIndex(db, pSchema);
53215 Schema *pSchema = (Schema *)pBtree->pBt->pSchema;
53234 if( isIndex && (!pSchema || (pSchema->schemaFlags&DB_SchemaLoaded)==0) ){
53244 for(p=sqliteHashFirst(&pSchema->idxHash); p; p=sqliteHashNext(p)){
55367 if( pBt->xFreeSchema && pBt->pSchema ){
55368 pBt->xFreeSchema(pBt->pSchema);
55370 sqlite3DbFree(0, pBt->pSchema);
62138 if( !pBt->pSchema && nBytes ){
62139 pBt->pSchema = sqlite3DbMallocZero(0, nBytes);
62143 return pBt->pSchema;
73953 iGen = db->aDb[pOp->p1].pSchema->iGeneration;
73974 if( db->aDb[pOp->p1].pSchema->schema_cookie!=iMeta ){
74039 pDb->pSchema->schema_cookie = (int)pIn3->u.i;
74043 pDb->pSchema->file_format = (u8)pIn3->u.i;
74164 if( pDb->pSchema->file_format < p->minWriteFileFormat ){
74165 p->minWriteFileFormat = pDb->pSchema->file_format;
77708 int iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
77712 pTab->pSchema->schema_cookie,
77713 pTab->pSchema->iGeneration);
78908 mxCache = db->aDb[0].pSchema->cache_size;
81541 Schema *pSchema = 0; /* Schema of the expression */
81572 pSchema = db->aDb[i].pSchema;
81603 if( zDb && pTab->pSchema!=pSchema ){
81642 pSchema = pExpr->pTab->pSchema;
81665 pSchema = pTab->pSchema;
81824 sqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList);
83854 pNewItem->pSchema = pOldItem->pSchema;
84532 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
87548 const Schema *pTempSchema = pParse->db->aDb[1].pSchema; /* Temp db schema */
87555 if( pTab->pSchema!=pTempSchema ){
87558 if( pTrig->pSchema==pTempSchema ){
87590 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
87596 int iTrigDb = sqlite3SchemaToIndex(pParse->db, pTrig->pSchema);
87666 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
87888 iDb = sqlite3SchemaToIndex(db, pNew->pSchema);
88031 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
88063 pNew->pSchema = db->aDb[iDb].pSchema;
89077 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
89160 assert( iDb==sqlite3SchemaToIndex(db, pIdx->pSchema) );
89373 Schema *pSchema = db->aDb[iDb].pSchema; /* Schema of database iDb */
89386 for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){
89404 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
89922 for(i=sqliteHashFirst(&db->aDb[iDb].pSchema->idxHash);i;i=sqliteHashNext(i)){
89957 for(i=sqliteHashFirst(&db->aDb[iDb].pSchema->idxHash);i;i=sqliteHashNext(i)){
90118 aNew->pSchema = sqlite3SchemaGet(db, aNew->pBt);
90119 if( !aNew->pSchema ){
90121 }else if( aNew->pSchema->file_format && aNew->pSchema->enc!=ENC(db) ){
90200 db->aDb[iDb].pSchema = 0;
90273 pDb->pSchema = 0;
90413 pFix->pSchema = db->aDb[iDb].pSchema;
90453 pItem->pSchema = pFix->pSchema;
90703 Schema *pSchema, /* The schema of the expression */
90714 iDb = sqlite3SchemaToIndex(pParse->db, pSchema);
91013 db->aDb[iDb].pSchema->iGeneration /* P4 */
91147 p = sqlite3HashFind(&db->aDb[j].pSchema->tblHash, zName);
91211 assert( p->pSchema==0 || p->zDatabase==0 );
91212 if( p->pSchema ){
91213 int iDb = sqlite3SchemaToIndex(pParse->db, p->pSchema);
91240 Schema *pSchema = db->aDb[j].pSchema;
91241 assert( pSchema );
91244 p = sqlite3HashFind(&pSchema->idxHash, zName);
91277 pHash = &db->aDb[iDb].pSchema->idxHash;
91339 assert( pDb->pSchema!=0 );
91340 sqlite3SchemaClear(pDb->pSchema);
91348 assert( pDb->pSchema!=0 );
91349 sqlite3SchemaClear(pDb->pSchema);
91363 if( pDb->pSchema ){
91364 sqlite3SchemaClear(pDb->pSchema);
91434 assert( pIndex->pSchema==pTable->pSchema );
91438 &pIndex->pSchema->idxHash, zName, 0
91440 assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) );
91481 p = sqlite3HashInsert(&pDb->pSchema->tblHash, zTabName, 0);
91771 pTable->pSchema = db->aDb[iDb].pSchema;
91784 pTable->pSchema->pSeqTab = pTable;
92282 sqlite3VdbeAddOp2(v, OP_Integer, db->aDb[iDb].pSchema->schema_cookie+1, r1);
92674 iDb = sqlite3SchemaToIndex(db, p->pSchema);
92797 if( pDb->pSchema->pSeqTab==0 ){
92816 Schema *pSchema = p->pSchema;
92818 pOld = sqlite3HashInsert(&pSchema->tblHash, p->zName, p);
92876 iDb = sqlite3SchemaToIndex(db, p->pSchema);
92999 assert( sqlite3SchemaMutexHeld(db, 0, pTable->pSchema) );
93000 pTable->pSchema->schemaFlags |= DB_UnresetViews;
93022 for(i=sqliteHashFirst(&db->aDb[idx].pSchema->tblHash); i;i=sqliteHashNext(i)){
93061 pHash = &pDb->pSchema->tblHash;
93068 pHash = &pDb->pSchema->idxHash;
93115 int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
93149 assert( pIdx->pSchema==pTab->pSchema );
93157 int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
93215 assert( pTrigger->pSchema==pTab->pSchema ||
93216 pTrigger->pSchema==db->aDb[1].pSchema );
93284 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
93467 assert( sqlite3SchemaMutexHeld(db, 0, p->pSchema) );
93468 pNextTo = (FKey *)sqlite3HashInsert(&p->pSchema->fkeyHash,
93534 int iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);
93711 if( pName2->n==0 && pTab && pTab->pSchema==db->aDb[1].pSchema ){
93726 if( iDb==1 && db->aDb[iDb].pSchema!=pTab->pSchema ){
93738 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
93869 pIndex->pSchema = db->aDb[iDb].pSchema;
93880 if( pDb->pSchema->file_format>=4 ){
94020 assert( sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) );
94021 p = sqlite3HashInsert(&pIndex->pSchema->idxHash,
94208 iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);
94713 assert( db->aDb[1].pSchema );
94738 pToplevel->cookieValue[iDb] = db->aDb[iDb].pSchema->schema_cookie;
94915 int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
94939 for(k=sqliteHashFirst(&pDb->pSchema->tblHash); k; k=sqliteHashNext(k)){
95555 Schema *pSchema = (Schema *)p;
95557 temp1 = pSchema->tblHash;
95558 temp2 = pSchema->trigHash;
95559 sqlite3HashInit(&pSchema->trigHash);
95560 sqlite3HashClear(&pSchema->idxHash);
95565 sqlite3HashInit(&pSchema->tblHash);
95571 sqlite3HashClear(&pSchema->fkeyHash);
95572 pSchema->pSeqTab = 0;
95573 if( pSchema->schemaFlags & DB_SchemaLoaded ){
95574 pSchema->iGeneration++;
95575 pSchema->schemaFlags &= ~DB_SchemaLoaded;
95701 int iDb = sqlite3SchemaToIndex(db, pView->pSchema);
95899 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
95974 assert( pIdx->pSchema==pTab->pSchema );
98907 return (FKey *)sqlite3HashFind(&pTab->pSchema->fkeyHash, pTab->zName);
99116 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
99565 pTrigger->pSchema = pTab->pSchema;
99566 pTrigger->pTabSchema = pTab->pSchema;
99614 assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pTab->pSchema) );
99624 sqlite3HashInsert(&pTab->pSchema->fkeyHash, z, p);
99907 assert( sqlite3SchemaMutexHeld(db, 0, pDb->pSchema) );
99908 sqlite3OpenTable(pParse, 0, p->iDb, pDb->pSchema->pSeqTab, OP_OpenRead);
99959 assert( sqlite3SchemaMutexHeld(db, 0, pDb->pSchema) );
99960 sqlite3OpenTable(pParse, 0, p->iDb, pDb->pSchema->pSeqTab, OP_OpenWrite);
100160 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
101293 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
101307 assert( pIdx->pSchema==pTab->pSchema );
101583 iDbSrc = sqlite3SchemaToIndex(db, pSrc->pSchema);
104037 pDb->pSchema->cache_size = size;
104038 sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
104332 returnSingleInt(pParse, "cache_size", pDb->pSchema->cache_size);
104335 pDb->pSchema->cache_size = size;
104336 sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
104674 for(i=sqliteHashFirst(&pDb->pSchema->tblHash); i; i=sqliteHashNext(i)){
104882 k = sqliteHashFirst(&db->aDb[iDb].pSchema->tblHash);
105069 pTbls = &db->aDb[i].pSchema->tblHash;
105766 assert( db->aDb[iDb].pSchema );
105843 pDb->pSchema->schema_cookie = meta[BTREE_SCHEMA_VERSION-1];
105873 pDb->pSchema->enc = ENC(db);
105875 if( pDb->pSchema->cache_size==0 ){
105879 pDb->pSchema->cache_size = size;
105881 pDb->pSchema->cache_size = SQLITE_DEFAULT_CACHE_SIZE;
105883 sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
105892 pDb->pSchema->file_format = (u8)meta[BTREE_FILE_FORMAT-1];
105893 if( pDb->pSchema->file_format==0 ){
105894 pDb->pSchema->file_format = 1;
105896 if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
106076 if( cookie!=db->aDb[iDb].pSchema->schema_cookie ){
106095 SQLITE_PRIVATE int sqlite3SchemaToIndex(sqlite3 *db, Schema *pSchema){
106109 if( pSchema ){
106111 if( db->aDb[i].pSchema==pSchema ){
107880 }else if( pTab->pSchema ){
107896 int iDb = sqlite3SchemaToIndex(pNC->pParse->db, pTab->pSchema);
110778 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
111838 const int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
112343 Schema * const pTmpSchema = pParse->db->aDb[1].pSchema;
112350 if( pTmpSchema!=pTab->pSchema ){
112355 if( pTrig->pTabSchema==pTab->pSchema
112439 && pTab->pSchema==db->aDb[1].pSchema ){
112478 if( sqlite3HashFind(&(db->aDb[iDb].pSchema->trigHash),zName) ){
112507 iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema);
112539 pTrigger->pSchema = db->aDb[iDb].pSchema;
112540 pTrigger->pTabSchema = pTab->pSchema;
112579 iDb = sqlite3SchemaToIndex(pParse->db, pTrig->pSchema);
112618 Hash *pHash = &db->aDb[iDb].pSchema->trigHash;
112623 }else if( pLink->pSchema==pLink->pTabSchema ){
112799 pTrigger = sqlite3HashFind(&(db->aDb[j].pSchema->trigHash), zName);
112835 iDb = sqlite3SchemaToIndex(pParse->db, pTrigger->pSchema);
112839 assert( pTable->pSchema==pTrigger->pSchema || iDb==1 );
112893 pHash = &(db->aDb[iDb].pSchema->trigHash);
112896 if( pTrigger->pSchema==pTrigger->pTabSchema ){
112979 iDb = sqlite3SchemaToIndex(db, pStep->pTrig->pSchema);
113345 assert( p->pSchema!=0 );
113347 assert( p->pSchema==p->pTabSchema
113348 || p->pSchema==pParse->db->aDb[1].pSchema );
113571 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
114554 pDb->pSchema = 0;
114738 assert( db==0 || sqlite3SchemaMutexHeld(db, 0, p->pSchema) );
114895 iDb = sqlite3SchemaToIndex(db, pTable->pSchema);
114977 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
115008 Schema *pSchema = pTab->pSchema;
115010 assert( sqlite3SchemaMutexHeld(db, 0, pSchema) );
115011 pOld = sqlite3HashInsert(&pSchema->tblHash, zName, pTab);
115091 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
122931 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
122997 assert( pIx->pSchema==pTab->pSchema );
128944 Schema *pSchema = db->aDb[i].pSchema;
128945 if( db->aDb[i].pSchema ){
128947 for(p=sqliteHashFirst(&pSchema->tblHash); p; p=sqliteHashNext(p)){
129081 pDb->pSchema = 0;
129086 if( db->aDb[1].pSchema ){
129087 sqlite3SchemaClear(db->aDb[1].pSchema);
129151 sqlite3DbFree(db, db->aDb[1].pSchema);
130819 db->aDb[0].pSchema = sqlite3SchemaGet(db, db->aDb[0].pBt);
130822 db->aDb[1].pSchema = sqlite3SchemaGet(db, 0);