diff --git a/manifest b/manifest index feed4199a3..d54a680515 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Pretty-print\sblobs\sin\svdbe-traces.\s(CVS\s1428) -D 2004-05-21T10:49:48 +C Eliminate\ssome\sunused\scode\s(CVS\s1429) +D 2004-05-21T11:39:05 F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd @@ -37,7 +37,7 @@ F src/func.c cfbb7096efb58e2857e3b312a8958a12774b625a F src/hash.c 440c2f8cb373ee1b4e13a0988489c7cd95d55b6f F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb F src/insert.c e510d62d23b4de4d901e7ccbbe7833b7fb3b9570 -F src/main.c 02969649ff887304534293d714efdbe47e24eb33 +F src/main.c 5604d5a9a6b31720b95e6a2cb4c804c53592f145 F src/md5.c 8e39fdae6d8776b87558e91dcc94740c9b635a9c F src/os.c ddcda92f7fd71b4513c57c1ec797917f206d504e F src/os.h 6e446a17cbeb6c2ce470683a0bb8d9c63abe8607 @@ -195,7 +195,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604 F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4 -P fc94575d77f9865e1553bb70c2e3eda2a0b8669e -R cca19851558a13016ede75fbc3903bef +P 5eb94c97657b34ed2df6455e23875e2840743bda +R df698f64280827d490a25f92b9ffde93 U danielk1977 -Z 37206e6737045cd1363c44f5a04c63c9 +Z b43705fe091d47ae368c00cb70601ef1 diff --git a/manifest.uuid b/manifest.uuid index 10072d4711..1dcd7eba71 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5eb94c97657b34ed2df6455e23875e2840743bda \ No newline at end of file +550a53b3f28ddb288bcb6c21849ca83b0a20bde4 \ No newline at end of file diff --git a/src/main.c b/src/main.c index 0ef79c68b8..8b50ac16f4 100644 --- a/src/main.c +++ b/src/main.c @@ -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.180 2004/05/21 10:08:54 danielk1977 Exp $ +** $Id: main.c,v 1.181 2004/05/21 11:39:05 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -393,84 +393,6 @@ static int binaryCollatingFunc( return rc; } -/* -** Open a new SQLite database. Construct an "sqlite" structure to define -** the state of this database and return a pointer to that structure. -** -** An attempt is made to initialize the in-memory data structures that -** hold the database schema. But if this fails (because the schema file -** is locked) then that step is deferred until the first call to -** sqlite3_exec(). -*/ -sqlite *sqlite3_open(const char *zFilename, int mode, char **pzErrMsg){ - sqlite *db; - int rc, i; - - /* Allocate the sqlite data structure */ - db = sqliteMalloc( sizeof(sqlite) ); - if( pzErrMsg ) *pzErrMsg = 0; - if( db==0 ) goto no_mem_on_open; - db->onError = OE_Default; - db->priorNewRowid = 0; - db->magic = SQLITE_MAGIC_BUSY; - db->nDb = 2; - db->aDb = db->aDbStatic; - /* db->flags |= SQLITE_ShortColNames; */ - sqlite3HashInit(&db->aFunc, SQLITE_HASH_STRING, 1); - sqlite3HashInit(&db->aCollSeq, SQLITE_HASH_STRING, 0); - for(i=0; inDb; i++){ - sqlite3HashInit(&db->aDb[i].tblHash, SQLITE_HASH_STRING, 0); - sqlite3HashInit(&db->aDb[i].idxHash, SQLITE_HASH_STRING, 0); - sqlite3HashInit(&db->aDb[i].trigHash, SQLITE_HASH_STRING, 0); - sqlite3HashInit(&db->aDb[i].aFKey, SQLITE_HASH_STRING, 1); - } - db->pDfltColl = - sqlite3ChangeCollatingFunction(db, "BINARY", 6, 0, binaryCollatingFunc); - - /* Open the backend database driver */ - if( zFilename[0]==':' && strcmp(zFilename,":memory:")==0 ){ - db->temp_store = 2; - } - rc = sqlite3BtreeFactory(db, zFilename, 0, MAX_PAGES, &db->aDb[0].pBt); - if( rc!=SQLITE_OK ){ - switch( rc ){ - default: { - sqlite3SetString(pzErrMsg, "unable to open database: ", - zFilename, (char*)0); - } - } - sqliteFree(db); - sqlite3StrRealloc(pzErrMsg); - return 0; - } - db->aDb[0].zName = "main"; - db->aDb[1].zName = "temp"; - - /* Attempt to read the schema */ - sqlite3RegisterBuiltinFunctions(db); - rc = sqlite3Init(db, pzErrMsg); - db->magic = SQLITE_MAGIC_OPEN; - if( sqlite3_malloc_failed ){ - sqlite3_close(db); - goto no_mem_on_open; - }else if( rc!=SQLITE_OK && rc!=SQLITE_BUSY ){ - sqlite3_close(db); - sqlite3StrRealloc(pzErrMsg); - return 0; - }else if( pzErrMsg ){ - sqliteFree(*pzErrMsg); - *pzErrMsg = 0; - } - - /* Return a pointer to the newly opened database structure */ - return db; - -no_mem_on_open: - sqlite3SetString(pzErrMsg, "out of memory", (char*)0); - sqlite3StrRealloc(pzErrMsg); - return 0; -} - /* ** Return the ROWID of the most recent insert */ @@ -1332,6 +1254,19 @@ int sqlite3_open_new( return openDatabase(zFilename, ppDb, options, TEXT_Utf8); } +sqlite *sqlite3_open(const char *zFilename, int mode, char **pzErrMsg){ + sqlite3 *db; + int rc; + + rc = sqlite3_open_new(zFilename, &db, 0); + if( rc!=SQLITE_OK && pzErrMsg ){ + char *err = sqlite3_errmsg(db); + *pzErrMsg = malloc(strlen(err)+1); + strcpy(*pzErrMsg, err); + } + return db; +} + /* ** Open a new database handle. */