1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Remove the experimental sqlite_open_aux_file() API. It will soon be replaced

by ATTACH and DETACH SQL commands. (CVS 889)

FossilOrigin-Name: b6d6e07f3a5cb493f2cf0675bc6061c5afe5c078
This commit is contained in:
drh
2003-03-30 19:17:01 +00:00
parent 9077ba8ee5
commit 3aa31a16e6
7 changed files with 20 additions and 111 deletions

View File

@@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: main.c,v 1.117 2003/03/27 12:51:25 drh Exp $
** $Id: main.c,v 1.118 2003/03/30 19:17:02 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -974,44 +974,3 @@ void *sqlite_trace(sqlite *db, void (*xTrace)(void*,const char*), void *pArg){
return 0;
#endif
}
/*
** Attempt to open the file named in the argument as the auxiliary database
** file. The auxiliary database file is used to store TEMP tables. But
** by using this API, it is possible to trick SQLite into opening two
** separate databases and acting on them as if they were one.
**
** This routine closes the existing auxiliary database file, which will
** cause any previously created TEMP tables to be dropped.
**
** The zName parameter can be a NULL pointer or an empty string to cause
** a temporary file to be opened and automatically deleted when closed.
*/
int sqlite_open_aux_file(sqlite *db, const char *zName, char **pzErrMsg){
int rc;
if( zName && zName[0]==0 ) zName = 0;
if( sqliteSafetyOn(db) ) goto openaux_misuse;
sqliteResetInternalSchema(db);
if( db->aDb[1].pBt!=0 ){
sqliteBtreeClose(db->aDb[1].pBt);
}
rc = sqliteBtreeOpen(zName, 0, MAX_PAGES, &db->aDb[1].pBt);
if( rc ){
if( zName==0 ) zName = "a temporary file";
sqliteSetString(pzErrMsg, "unable to open ", zName,
": ", sqlite_error_string(rc), 0);
sqliteStrRealloc(pzErrMsg);
sqliteSafetyOff(db);
return rc;
}
rc = sqliteInit(db, pzErrMsg);
if( sqliteSafetyOff(db) ) goto openaux_misuse;
sqliteStrRealloc(pzErrMsg);
return rc;
openaux_misuse:
sqliteSetString(pzErrMsg, sqlite_error_string(SQLITE_MISUSE), 0);
sqliteStrRealloc(pzErrMsg);
return SQLITE_MISUSE;
}