attach.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
#pragma ident "%Z%%M% %I% %E% SMI"
/*
** 2003 April 6
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code used to implement the ATTACH and DETACH commands.
**
** $Id: attach.c,v 1.10.2.1 2004/05/07 01:46:01 drh Exp $
*/
#include "sqliteInt.h"
/*
** This routine is called by the parser to process an ATTACH statement:
**
** ATTACH DATABASE filename AS dbname
**
** The pFilename and pDbname arguments are the tokens that define the
** filename and dbname in the ATTACH statement.
*/
int rc, i;
Vdbe *v;
v = sqliteGetVdbe(pParse);
sqliteVdbeAddOp(v, OP_Halt, 0, 0);
"older format master database", 0);
return;
}
return;
}
zFile = 0;
if( zFile==0 ) return;
#ifndef SQLITE_OMIT_AUTHORIZATION
return;
}
#endif /* SQLITE_OMIT_AUTHORIZATION */
zName = 0;
if( zName==0 ) return;
return;
}
}
if( aNew==0 ) return;
}else{
if( aNew==0 ) return;
}
if( rc ){
}
#if SQLITE_HAS_CODEC
{
extern int sqliteCodecAttach(sqlite*, int, void*, int);
char *zKey = 0;
int nKey;
}else{
zKey = 0;
nKey = 0;
}
}
#endif
}
if( rc ){
assert( i>=2 );
}
}
}
/*
** 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.
*/
int i;
Vdbe *v;
v = sqliteGetVdbe(pParse);
sqliteVdbeAddOp(v, OP_Halt, 0, 0);
}
return;
}
if( i<2 ){
return;
}
#ifndef SQLITE_OMIT_AUTHORIZATION
return;
}
#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.
*/
int sqliteFixInit(
int iDb, /* This is the database that must must be used */
const char *zType, /* "view", "trigger", or "index" */
){
return 1;
}
/*
** 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.
*/
int sqliteFixSrcList(
){
int i;
const char *zDb;
if( pList==0 ) return 0;
"%s %z cannot reference objects in database %s",
return 1;
}
}
return 0;
}
int sqliteFixSelect(
){
while( pSelect ){
return 1;
}
return 1;
}
return 1;
}
return 1;
}
}
return 0;
}
int sqliteFixExpr(
){
while( pExpr ){
return 1;
}
return 1;
}
return 1;
}
}
return 0;
}
int sqliteFixExprList(
){
int i;
if( pList==0 ) return 0;
return 1;
}
}
return 0;
}
int sqliteFixTriggerStep(
){
while( pStep ){
return 1;
}
return 1;
}
return 1;
}
}
return 0;
}