attach.c revision c5c4113dfcabb1eed3d4bdf7609de5170027a794
1N/A#
pragma ident "%Z%%M% %I% %E% SMI" 1N/A** The author disclaims copyright to this source code. In place of 1N/A** a legal notice, here is a blessing: 1N/A** May you do good and not evil. 1N/A** May you find forgiveness for yourself and forgive others. 1N/A** May you share freely, never taking more than you give. 1N/A************************************************************************* 1N/A** This file contains code used to implement the ATTACH and DETACH commands. 1N/A** $Id: attach.c,v 1.10.2.1 2004/05/07 01:46:01 drh Exp $ 1N/A** This routine is called by the parser to process an ATTACH statement: 1N/A** ATTACH DATABASE filename AS dbname 1N/A** The pFilename and pDbname arguments are the tokens that define the 1N/A** filename and dbname in the ATTACH statement. 1N/A "older format master database", 0);
#
endif /* SQLITE_OMIT_AUTHORIZATION */ for(i=0; i<
db->
nDb; i++){
** This routine is called by the parser to process a DETACH statement: ** DETACH DATABASE dbname ** The pDbname argument is the name of the database in the DETACH statement. for(i=0; i<
db->
nDb; i++){
#
endif /* SQLITE_OMIT_AUTHORIZATION */** Initialize a DbFixer structure. This routine must be called prior ** to passing the structure to one of the sqliteFixAAAA() routines below. ** The return value indicates whether or not fixation is required. TRUE ** means we do need to fix the database references, FALSE means we do not. Parse *
pParse,
/* Error messages will be written here */ int iDb,
/* This is the database that must must be used */ const char *
zType,
/* "view", "trigger", or "index" */ const Token *
pName /* Name of the view, trigger, or index */ if(
iDb<0 ||
iDb==
1 )
return 0;
** The following set of routines walk through the parse tree and assign ** a specific database to all table references where the database name ** was left unspecified in the original SQL statement. The pFix structure ** must have been initialized by a prior call to sqliteFixInit(). ** These routines are used to make sure that an index, trigger, or ** view in one database does not refer to objects in a different database. ** (Exception: indices, triggers, and views in the TEMP database are ** allowed to refer to anything.) If a reference is explicitly made ** to an object in a different database, an error message is added to ** pParse->zErrMsg and these routines return non-zero. If everything ** checks out, these routines return 0. "%s %z cannot reference objects in database %s",
Select *
pSelect /* The SELECT statement to be fixed to one database */ Expr *
pExpr /* The expression to be fixed to one database */