Lines Matching refs:db
30 sqlite *db; in sqliteAttach() local
36 db = pParse->db; in sqliteAttach()
37 if( db->file_format<4 ){ in sqliteAttach()
43 if( db->nDb>=MAX_ATTACHED+2 ){ in sqliteAttach()
65 for(i=0; i<db->nDb; i++){ in sqliteAttach()
66 if( db->aDb[i].zName && sqliteStrICmp(db->aDb[i].zName, zName)==0 ){ in sqliteAttach()
74 if( db->aDb==db->aDbStatic ){ in sqliteAttach()
75 aNew = sqliteMalloc( sizeof(db->aDb[0])*3 ); in sqliteAttach()
77 memcpy(aNew, db->aDb, sizeof(db->aDb[0])*2); in sqliteAttach()
79 aNew = sqliteRealloc(db->aDb, sizeof(db->aDb[0])*(db->nDb+1) ); in sqliteAttach()
82 db->aDb = aNew; in sqliteAttach()
83 aNew = &db->aDb[db->nDb++]; in sqliteAttach()
90 rc = sqliteBtreeFactory(db, zFile, 0, MAX_PAGES, &aNew->pBt); in sqliteAttach()
107 sqliteCodecAttach(db, db->nDb-1, zKey, nKey); in sqliteAttach()
111 db->flags &= ~SQLITE_Initialized; in sqliteAttach()
114 rc = sqliteInit(pParse->db, &pParse->zErrMsg); in sqliteAttach()
117 int i = db->nDb - 1; in sqliteAttach()
119 if( db->aDb[i].pBt ){ in sqliteAttach()
120 sqliteBtreeClose(db->aDb[i].pBt); in sqliteAttach()
121 db->aDb[i].pBt = 0; in sqliteAttach()
123 sqliteResetInternalSchema(db, 0); in sqliteAttach()
138 sqlite *db; in sqliteDetach() local
145 db = pParse->db; in sqliteDetach()
146 for(i=0; i<db->nDb; i++){ in sqliteDetach()
147 pDb = &db->aDb[i]; in sqliteDetach()
152 if( i>=db->nDb ){ in sqliteDetach()
161 if( sqliteAuthCheck(pParse,SQLITE_DETACH,db->aDb[i].zName,0,0)!=SQLITE_OK ){ in sqliteDetach()
168 sqliteResetInternalSchema(db, i); in sqliteDetach()
170 db->nDb--; in sqliteDetach()
171 if( i<db->nDb ){ in sqliteDetach()
172 db->aDb[i] = db->aDb[db->nDb]; in sqliteDetach()
173 memset(&db->aDb[db->nDb], 0, sizeof(db->aDb[0])); in sqliteDetach()
174 sqliteResetInternalSchema(db, i); in sqliteDetach()
192 sqlite *db; in sqliteFixInit() local
195 db = pParse->db; in sqliteFixInit()
196 assert( db->nDb>iDb ); in sqliteFixInit()
198 pFix->zDb = db->aDb[iDb].zName; in sqliteFixInit()