Lines Matching defs:pSchema

16793   Schema *pSchema;     /* Pointer to database schema (possibly shared) */
16829 ** Db.pSchema->flags field.
16831 #define DbHasProperty(D,I,P) (((D)->aDb[I].pSchema->schemaFlags&(P))==(P))
16832 #define DbHasAnyProperty(D,I,P) (((D)->aDb[I].pSchema->schemaFlags&(P))!=0)
16833 #define DbSetProperty(D,I,P) (D)->aDb[I].pSchema->schemaFlags|=(P)
16834 #define DbClearProperty(D,I,P) (D)->aDb[I].pSchema->schemaFlags&=~(P)
16837 ** Allowed values for the DB.pSchema->flags field.
17161 #define SCHEMA_ENC(db) ((db)->aDb[0].pSchema->enc)
17788 Schema *pSchema; /* Schema that contains this table */
18092 Schema *pSchema; /* Schema containing this index */
18591 Schema *pSchema; /* Schema to which this item is fixed */
19318 Schema *pSchema; /* Schema containing the trigger */
19593 Schema *pSchema; /* Fix items to this schema */
23399 Schema *pSchema = db->aDb[i].pSchema;
23400 if( ALWAYS(pSchema!=0) ){
23404 pSchema->tblHash.count
23405 + pSchema->trigHash.count
23406 + pSchema->idxHash.count
23407 + pSchema->fkeyHash.count
23409 nByte += sqlite3_msize(pSchema->tblHash.ht);
23410 nByte += sqlite3_msize(pSchema->trigHash.ht);
23411 nByte += sqlite3_msize(pSchema->idxHash.ht);
23412 nByte += sqlite3_msize(pSchema->fkeyHash.ht);
23414 for(p=sqliteHashFirst(&pSchema->trigHash); p; p=sqliteHashNext(p)){
23417 for(p=sqliteHashFirst(&pSchema->tblHash); p; p=sqliteHashNext(p)){
67970 ** The pSchema field may be set once under BtShared.mutex and
68014 void *pSchema; /* Pointer to space allocated by sqlite3BtreeSchema() */
68015 void (*xFreeSchema)(void*); /* Destructor for BtShared.pSchema */
68525 ** db->aDb[iDb].pSchema structure. The mutexes required for schema
68531 ** If pSchema is not NULL, then iDb is computed from pSchema and
68534 SQLITE_PRIVATE int sqlite3SchemaMutexHeld(sqlite3 *db, int iDb, Schema *pSchema){
68538 if( pSchema ) iDb = sqlite3SchemaToIndex(db, pSchema);
68803 Schema *pSchema = (Schema *)pBtree->pBt->pSchema;
68822 if( isIndex && (!pSchema || (pSchema->schemaFlags&DB_SchemaLoaded)==0) ){
68833 for(p=sqliteHashFirst(&pSchema->idxHash); p; p=sqliteHashNext(p)){
71495 if( pBt->xFreeSchema && pBt->pSchema ){
71496 pBt->xFreeSchema(pBt->pSchema);
71498 sqlite3DbFree(0, pBt->pSchema);
79545 if( !pBt->pSchema && nBytes ){
79546 pBt->pSchema = sqlite3DbMallocZero(0, nBytes);
79550 return pBt->pSchema;
94323 && (iMeta!=pOp->p3 || pDb->pSchema->iGeneration!=pOp->p4.i)
94345 if( db->aDb[pOp->p1].pSchema->schema_cookie!=iMeta ){
94421 *(u32*)&pDb->pSchema->schema_cookie = *(u32*)&pOp->p3 - pOp->p5;
94426 pDb->pSchema->file_format = pOp->p3;
94569 if( pDb->pSchema->file_format < p->minWriteFileFormat ){
94570 p->minWriteFileFormat = pDb->pSchema->file_format;
97187 sqlite3SchemaClear(db->aDb[iDb].pSchema);
99445 pBlob->zDb = db->aDb[sqlite3SchemaToIndex(db, pTab->pSchema)].zDbSName;
99533 int iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
99537 pTab->pSchema->schema_cookie,
99538 pTab->pSchema->iGeneration);
100774 mxCache = db->aDb[0].pSchema->cache_size;
102751 Schema *pSchema;
102756 pSchema = db->aDb[iDb].pSchema;
102758 for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){
102767 for(k=sqliteHashFirst(&pSchema->idxHash); k; k=sqliteHashNext(k)){
103923 Schema *pSchema = 0; /* Schema of the expression */
103939 ** schema. If not found, pSchema will remain NULL and nothing will match
103955 pSchema = db->aDb[i].pSchema;
103962 pSchema = db->aDb[0].pSchema;
104035 if( pTab->pSchema!=pSchema ) continue;
104036 if( pSchema==0 && strcmp(zDb,"*")!=0 ) continue;
104099 pSchema = pExpr->y.pTab->pSchema;
104144 pSchema = pTab->pSchema;
104417 sqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList);
105798 if( pTab->pSchema!=pParse->db->aDb[1].pSchema ){
107480 pNewItem->pSchema = pOldItem->pSchema;
108603 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
112471 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
112660 iDb = sqlite3SchemaToIndex(db, pNew->pSchema);
112838 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
112869 pNew->pSchema = db->aDb[iDb].pSchema;
112941 iSchema = sqlite3SchemaToIndex(db, pTab->pSchema);
114111 && sCtx.pTab->pSchema==pTrigger->pTabSchema
114500 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
115621 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
115716 assert( iDb==sqlite3SchemaToIndex(db, pIdx->pSchema) );
115950 Schema *pSchema = db->aDb[iDb].pSchema; /* Schema of database iDb */
115963 for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){
115981 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
116478 Schema *pSchema = db->aDb[iDb].pSchema;
116486 for(i=sqliteHashFirst(&pSchema->tblHash); i; i=sqliteHashNext(i)){
116490 for(i=sqliteHashFirst(&pSchema->idxHash); i; i=sqliteHashNext(i)){
116517 for(i=sqliteHashFirst(&pSchema->idxHash); i; i=sqliteHashNext(i)){
116529 for(i=sqliteHashFirst(&pSchema->idxHash); i; i=sqliteHashNext(i)){
116659 pNew->pSchema = 0;
116723 pNew->pSchema = sqlite3SchemaGet(db, pNew->pBt);
116724 if( !pNew->pSchema ){
116726 }else if( pNew->pSchema->file_format && pNew->pSchema->enc!=ENC(db) ){
116814 db->aDb[iDb].pSchema = 0;
116886 assert( db->aDb[1].pSchema );
116887 pEntry = sqliteHashFirst(&db->aDb[1].pSchema->trigHash);
116890 if( pTrig->pTabSchema==pDb->pSchema ){
116891 pTrig->pTabSchema = pTrig->pSchema;
116898 pDb->pSchema = 0;
117060 pItem->pSchema = pFix->pSchema;
117096 pFix->pSchema = db->aDb[iDb].pSchema;
117329 Schema *pSchema, /* The schema of the expression */
117341 iDb = sqlite3SchemaToIndex(pParse->db, pSchema);
117671 Schema *pSchema;
117674 pSchema = db->aDb[iDb].pSchema;
117679 pSchema->schema_cookie, /* P3 */
117680 pSchema->iGeneration /* P4 */
117838 p = sqlite3HashFind(&db->aDb[i].pSchema->tblHash, zName);
117845 p = sqlite3HashFind(&db->aDb[1].pSchema->tblHash,
117850 p = sqlite3HashFind(&db->aDb[i].pSchema->tblHash,
117857 p = sqlite3HashFind(&db->aDb[1].pSchema->tblHash, zName);
117860 p = sqlite3HashFind(&db->aDb[0].pSchema->tblHash, zName);
117865 p = sqlite3HashFind(&db->aDb[i].pSchema->tblHash, zName);
117870 p = sqlite3HashFind(&db->aDb[0].pSchema->tblHash, LEGACY_SCHEMA_TABLE);
117872 p = sqlite3HashFind(&db->aDb[1].pSchema->tblHash,
117949 ** the search to schema (p->pSchema) if it is not NULL. p->pSchema may be
117959 assert( p->pSchema==0 || p->zDatabase==0 );
117960 if( p->pSchema ){
117961 int iDb = sqlite3SchemaToIndex(pParse->db, p->pSchema);
118004 Schema *pSchema = db->aDb[j].pSchema;
118005 assert( pSchema );
118008 p = sqlite3HashFind(&pSchema->idxHash, zName);
118042 pHash = &db->aDb[iDb].pSchema->idxHash;
118111 sqlite3SchemaClear(db->aDb[i].pSchema);
118126 if( pDb->pSchema ){
118128 sqlite3SchemaClear(pDb->pSchema);
118291 assert( pIndex->pSchema==pTable->pSchema
118296 &pIndex->pSchema->idxHash, zName, 0
118298 assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) );
118351 p = sqlite3HashInsert(&pDb->pSchema->tblHash, zTabName, 0);
118787 pTable->pSchema = db->aDb[iDb].pSchema;
118897 pHash = &(db->aDb[1].pSchema->trigHash);
118945 pRet->retTrig.pSchema = db->aDb[1].pSchema;
118946 pRet->retTrig.pTabSchema = db->aDb[1].pSchema;
118951 pHash = &(db->aDb[1].pSchema->trigHash);
119521 (int)(1+(unsigned)db->aDb[iDb].pSchema->schema_cookie));
120004 for(k=sqliteHashFirst(&pTab->pSchema->tblHash); k; k=sqliteHashNext(k)){
120185 iDb = sqlite3SchemaToIndex(db, p->pSchema);
120373 if( pDb->pSchema->pSeqTab==0 ){
120391 Schema *pSchema = p->pSchema;
120394 pOld = sqlite3HashInsert(&pSchema->tblHash, p->zName, p);
120410 p->pSchema->pSeqTab = p;
120467 iDb = sqlite3SchemaToIndex(db, p->pSchema);
120629 assert( sqlite3SchemaMutexHeld(db, 0, pTable->pSchema) );
120639 pTable->pSchema->schemaFlags |= DB_UnresetViews;
120661 for(i=sqliteHashFirst(&db->aDb[idx].pSchema->tblHash); i;i=sqliteHashNext(i)){
120698 pHash = &pDb->pSchema->tblHash;
120705 pHash = &pDb->pSchema->idxHash;
120780 assert( pIdx->pSchema==pTab->pSchema );
120788 int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
120845 assert( pTrigger->pSchema==pTab->pSchema ||
120846 pTrigger->pSchema==db->aDb[1].pSchema );
120955 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
121149 assert( sqlite3SchemaMutexHeld(db, 0, p->pSchema) );
121150 pNextTo = (FKey *)sqlite3HashInsert(&p->pSchema->fkeyHash,
121219 int iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);
121439 if( pName2->n==0 && pTab && pTab->pSchema==db->aDb[1].pSchema ){
121454 if( iDb==1 && db->aDb[iDb].pSchema!=pTab->pSchema ){
121466 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
121616 pIndex->pSchema = db->aDb[iDb].pSchema;
121627 if( pDb->pSchema->file_format>=4 ){
121826 assert( sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) );
121835 p = sqlite3HashInsert(&pIndex->pSchema->idxHash,
122060 iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);
122682 assert( db->aDb[1].pSchema );
122894 int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
122919 for(k=sqliteHashFirst(&pDb->pSchema->tblHash); k; k=sqliteHashNext(k)){
123647 Schema *pSchema = (Schema *)p;
123651 temp1 = pSchema->tblHash;
123652 temp2 = pSchema->trigHash;
123653 sqlite3HashInit(&pSchema->trigHash);
123654 sqlite3HashClear(&pSchema->idxHash);
123659 sqlite3HashInit(&pSchema->tblHash);
123665 sqlite3HashClear(&pSchema->fkeyHash);
123666 pSchema->pSeqTab = 0;
123667 if( pSchema->schemaFlags & DB_SchemaLoaded ){
123668 pSchema->iGeneration++;
123670 pSchema->schemaFlags &= ~(DB_SchemaLoaded|DB_ResetWanted);
123847 int iDb = sqlite3SchemaToIndex(db, pView->pSchema);
124077 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
124172 assert( pIdx->pSchema==pTab->pSchema );
127801 return (FKey *)sqlite3HashFind(&pTab->pSchema->fkeyHash, pTab->zName);
127830 Hash *pHash = &db->aDb[iDb].pSchema->tblHash;
128032 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
128443 int iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
128516 pTrigger->pSchema = pTab->pSchema;
128517 pTrigger->pTabSchema = pTab->pSchema;
128568 assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pTab->pSchema) );
128577 sqlite3HashInsert(&pTab->pSchema->fkeyHash, z, p);
129010 assert( pParse->db->aDb[iDb].pSchema!=0 );
129016 Table *pSeqTab = pParse->db->aDb[iDb].pSchema->pSeqTab;
129087 assert( sqlite3SchemaMutexHeld(db, 0, pDb->pSchema) );
129088 sqlite3OpenTable(pParse, 0, p->iDb, pDb->pSchema->pSeqTab, OP_OpenRead);
129150 assert( sqlite3SchemaMutexHeld(db, 0, pDb->pSchema) );
129153 sqlite3OpenTable(pParse, 0, p->iDb, pDb->pSchema->pSeqTab, OP_OpenWrite);
129357 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
131109 if( pTab->pSchema->file_format<2 ) return;
131267 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
131281 assert( pIdx->pSchema==pTab->pSchema );
131467 if( pSrc->tnum==pDest->tnum && pSrc->pSchema==pDest->pSchema ){
131567 if( pSrcIdx->tnum==pDestIdx->tnum && pSrc->pSchema==pDest->pSchema
131604 iDbSrc = sqlite3SchemaToIndex(db, pSrc->pSchema);
134790 pDb->pSchema->cache_size = size;
134791 sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
135094 returnSingleInt(v, pDb->pSchema->cache_size);
135097 pDb->pSchema->cache_size = size;
135098 sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
135498 pHash = &db->aDb[ii].pSchema->tblHash;
135517 pHash = &db->aDb[ii].pSchema->tblHash;
135555 for(i=sqliteHashFirst(&pDb->pSchema->tblHash); i; i=sqliteHashNext(i)){
135590 int iIdxDb = sqlite3SchemaToIndex(db, pIdx->pSchema);
135627 int iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema);
135720 int iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema);
135766 k = sqliteHashFirst(&db->aDb[iDb].pSchema->tblHash);
135776 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
135957 pTbls = &db->aDb[i].pSchema->tblHash;
136584 Schema *pSchema; /* The current schema */
136601 pSchema = db->aDb[iDb].pSchema;
136602 for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){
137357 assert( db->aDb[iDb].pSchema );
137435 pDb->pSchema->schema_cookie = meta[BTREE_SCHEMA_VERSION-1];
137463 pDb->pSchema->enc = ENC(db);
137465 if( pDb->pSchema->cache_size==0 ){
137469 pDb->pSchema->cache_size = size;
137471 pDb->pSchema->cache_size = SQLITE_DEFAULT_CACHE_SIZE;
137473 sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
137482 pDb->pSchema->file_format = (u8)meta[BTREE_FILE_FORMAT-1];
137483 if( pDb->pSchema->file_format==0 ){
137484 pDb->pSchema->file_format = 1;
137486 if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
137665 if( cookie!=db->aDb[iDb].pSchema->schema_cookie ){
137684 SQLITE_PRIVATE int sqlite3SchemaToIndex(sqlite3 *db, Schema *pSchema){
137687 /* If pSchema is NULL, then return -32768. This happens when code in
137699 if( pSchema ){
137702 if( db->aDb[i].pSchema==pSchema ){
139900 int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
140203 if( pNC->pParse && pTab->pSchema ){
140204 int iDb = sqlite3SchemaToIndex(pNC->pParse->db, pTab->pSchema);
144061 && pTab->pSchema!=db->aDb[1].pSchema
144183 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
144743 if( pItem->pTab->pSchema!=pThis->pTab->pSchema ) continue;
144746 if( pItem->pTab->pSchema==0 && pThis->pSelect->selId!=pS1->selId ){
145977 const int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
146418 pTmpSchema = pParse->db->aDb[1].pSchema;
146423 if( pTrig->pTabSchema==pTab->pSchema
146437 pTrig->pTabSchema = pTab->pSchema;
146528 && pTab->pSchema==db->aDb[1].pSchema ){
146561 if( sqlite3HashFind(&(db->aDb[iDb].pSchema->trigHash),zName) ){
146594 int iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema);
146623 pTrigger->pSchema = db->aDb[iDb].pSchema;
146624 pTrigger->pTabSchema = pTab->pSchema;
146687 iDb = sqlite3SchemaToIndex(pParse->db, pTrig->pSchema);
146752 Hash *pHash = &db->aDb[iDb].pSchema->trigHash;
146758 }else if( pLink->pSchema==pLink->pTabSchema ){
146998 pTrigger = sqlite3HashFind(&(db->aDb[j].pSchema->trigHash), zName);
147034 iDb = sqlite3SchemaToIndex(pParse->db, pTrigger->pSchema);
147037 assert( (pTable && pTable->pSchema==pTrigger->pSchema) || iDb==1 );
147071 pHash = &(db->aDb[iDb].pSchema->trigHash);
147074 if( pTrigger->pSchema==pTrigger->pTabSchema ){
147113 if( NEVER(db->aDb[1].pSchema==0) ) return 0;
147114 if( sqliteHashFirst(&db->aDb[1].pSchema->trigHash)==0 ) return 0;
147225 Schema *pSchema = pStep->pTrig->pSchema;
147227 if( pSchema!=db->aDb[1].pSchema ){
147228 pSrc->a[0].pSchema = pSchema;
147755 assert( p->pSchema!=0 );
147757 assert( p->pSchema==p->pTabSchema
147758 || p->pSchema==pParse->db->aDb[1].pSchema );
148203 iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
149764 sqlite3BtreeSetCacheSize(pTemp, db->aDb[iDb].pSchema->cache_size);
149923 pDb->pSchema = 0;
150179 assert( db==0 || sqlite3SchemaMutexHeld(db, 0, p->pSchema) );
150358 int iDb = sqlite3SchemaToIndex(db, pTable->pSchema);
150423 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
150449 Schema *pSchema = pTab->pSchema;
150453 pOld = sqlite3HashInsert(&pSchema->tblHash, zName, pTab);
150538 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
151183 pTab->pSchema = db->aDb[0].pSchema;
162546 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
162636 assert( pIx->pSchema==pTab->pSchema );
162955 int iDb = sqlite3SchemaToIndex(db, pIx->pSchema);
174593 Schema *pSchema = db->aDb[i].pSchema;
174594 if( pSchema ){
174595 for(p=sqliteHashFirst(&pSchema->tblHash); p; p=sqliteHashNext(p)){
174768 pDb->pSchema = 0;
174773 if( db->aDb[1].pSchema ){
174774 sqlite3SchemaClear(db->aDb[1].pSchema);
174835 sqlite3DbFree(db, db->aDb[1].pSchema);
176881 db->aDb[0].pSchema = sqlite3SchemaGet(db, db->aDb[0].pBt);
176886 db->aDb[1].pSchema = sqlite3SchemaGet(db, 0);
177496 assert( db==0 || db->aDb[0].pSchema!=0 );
177497 if( db && (y = db->aDb[0].pSchema->schema_cookie)!=0 ){ x = y; }