diff options
author | drh <drh@noemail.net> | 2004-02-12 19:01:04 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2004-02-12 19:01:04 +0000 |
commit | c602f9ae01492da0c1f893dbd9a02773d1be6b4c (patch) | |
tree | 1bb8c4d47bb1c7b08a7481d00c07fc5b211e4938 /src | |
parent | 4d189ca48f25e2810a83714f817255ccb345dbda (diff) | |
download | sqlite-c602f9ae01492da0c1f893dbd9a02773d1be6b4c.tar.gz sqlite-c602f9ae01492da0c1f893dbd9a02773d1be6b4c.zip |
Add the SQLITE_NOTADB return code for cases when you try to open a file
that does not even remotely resemble an SQLite database file. (CVS 1233)
FossilOrigin-Name: 0c77cee70f078152969933c1d340cea1c86286b0
Diffstat (limited to 'src')
-rw-r--r-- | src/btree.c | 4 | ||||
-rw-r--r-- | src/main.c | 3 | ||||
-rw-r--r-- | src/sqlite.h.in | 3 |
3 files changed, 6 insertions, 4 deletions
diff --git a/src/btree.c b/src/btree.c index 0a12ab41b..40385d6e6 100644 --- a/src/btree.c +++ b/src/btree.c @@ -9,7 +9,7 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* -** $Id: btree.c,v 1.100 2004/02/10 02:57:59 drh Exp $ +** $Id: btree.c,v 1.101 2004/02/12 19:01:05 drh Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** For a detailed discussion of BTrees, refer to @@ -793,7 +793,7 @@ static int lockBtree(Btree *pBt){ PageOne *pP1 = pBt->page1; if( strcmp(pP1->zMagic,zMagicHeader)!=0 || (pP1->iMagic!=MAGIC && swab32(pP1->iMagic)!=MAGIC) ){ - rc = SQLITE_CORRUPT; + rc = SQLITE_NOTADB; goto page1_init_failed; } pBt->needSwab = pP1->iMagic!=MAGIC; diff --git a/src/main.c b/src/main.c index e66d36976..0bf23f5de 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.149 2004/02/12 18:46:39 drh Exp $ +** $Id: main.c,v 1.150 2004/02/12 19:01:05 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -770,6 +770,7 @@ const char *sqlite_error_string(int rc){ case SQLITE_AUTH: z = "authorization denied"; break; case SQLITE_FORMAT: z = "auxiliary database format error"; break; case SQLITE_RANGE: z = "bind index out of range"; break; + case SQLITE_NOTADB: z = "file is encrypted or is not a database";break; default: z = "unknown error"; break; } return z; diff --git a/src/sqlite.h.in b/src/sqlite.h.in index a2c6d1557..6fbc2b3fa 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -12,7 +12,7 @@ ** This header file defines the interface that the SQLite library ** presents to client programs. ** -** @(#) $Id: sqlite.h.in,v 1.55 2004/02/01 01:22:52 drh Exp $ +** @(#) $Id: sqlite.h.in,v 1.56 2004/02/12 19:01:05 drh Exp $ */ #ifndef _SQLITE_H_ #define _SQLITE_H_ @@ -167,6 +167,7 @@ int sqlite_exec( #define SQLITE_AUTH 23 /* Authorization denied */ #define SQLITE_FORMAT 24 /* Auxiliary database format error */ #define SQLITE_RANGE 25 /* 2nd parameter to sqlite_bind out of range */ +#define SQLITE_NOTADB 26 /* File opened that is not a database file */ #define SQLITE_ROW 100 /* sqlite_step() has another row ready */ #define SQLITE_DONE 101 /* sqlite_step() has finished executing */ |