diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 4 | ||||
-rw-r--r-- | src/os_os2.c | 2 | ||||
-rw-r--r-- | src/os_unix.c | 5 | ||||
-rw-r--r-- | src/os_win.c | 5 | ||||
-rw-r--r-- | src/sqlite.h.in | 6 | ||||
-rw-r--r-- | src/test1.c | 6 |
6 files changed, 19 insertions, 9 deletions
diff --git a/src/main.c b/src/main.c index 4b93a2ba5..88dfcf0f3 100644 --- a/src/main.c +++ b/src/main.c @@ -816,7 +816,7 @@ const char *sqlite3ErrStr(int rc){ /* SQLITE_INTERRUPT */ "interrupted", /* SQLITE_IOERR */ "disk I/O error", /* SQLITE_CORRUPT */ "database disk image is malformed", - /* SQLITE_NOTFOUND */ 0, + /* SQLITE_NOTFOUND */ "unknown operation", /* SQLITE_FULL */ "database or disk is full", /* SQLITE_CANTOPEN */ "unable to open database file", /* SQLITE_PROTOCOL */ "locking protocol", @@ -2364,6 +2364,8 @@ int sqlite3_file_control(sqlite3 *db, const char *zDbName, int op, void *pArg){ rc = SQLITE_OK; }else if( fd->pMethods ){ rc = sqlite3OsFileControl(fd, op, pArg); + }else{ + rc = SQLITE_NOTFOUND; } sqlite3BtreeLeave(pBtree); } diff --git a/src/os_os2.c b/src/os_os2.c index 7ac0cc7cd..df5ad1026 100644 --- a/src/os_os2.c +++ b/src/os_os2.c @@ -533,7 +533,7 @@ static int os2FileControl(sqlite3_file *id, int op, void *pArg){ return SQLITE_OK; } } - return SQLITE_ERROR; + return SQLITE_NOTFOUND; } /* diff --git a/src/os_unix.c b/src/os_unix.c index edc716c98..fa200ae80 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3135,8 +3135,11 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){ return proxyFileControl(id,op,pArg); } #endif /* SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__) */ + case SQLITE_FCNTL_SYNC_OMITTED: { + return SQLITE_OK; /* A no-op */ + } } - return SQLITE_ERROR; + return SQLITE_NOTFOUND; } /* diff --git a/src/os_win.c b/src/os_win.c index 1be514999..70425178e 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -1183,8 +1183,11 @@ static int winFileControl(sqlite3_file *id, int op, void *pArg){ SimulateIOErrorBenign(0); return SQLITE_OK; } + case SQLITE_FCNTL_SYNC_OMITTED: { + return SQLITE_OK; + } } - return SQLITE_ERROR; + return SQLITE_NOTFOUND; } /* diff --git a/src/sqlite.h.in b/src/sqlite.h.in index f3d709213..eb9774638 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -385,7 +385,7 @@ int sqlite3_exec( #define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite3_interrupt()*/ #define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */ #define SQLITE_CORRUPT 11 /* The database disk image is malformed */ -#define SQLITE_NOTFOUND 12 /* NOT USED. Table or record not found */ +#define SQLITE_NOTFOUND 12 /* Unknown opcode in sqlite3_file_control() */ #define SQLITE_FULL 13 /* Insertion failed because database is full */ #define SQLITE_CANTOPEN 14 /* Unable to open the database file */ #define SQLITE_PROTOCOL 15 /* Database lock protocol error */ @@ -617,7 +617,9 @@ struct sqlite3_file { ** core reserves all opcodes less than 100 for its own use. ** A [SQLITE_FCNTL_LOCKSTATE | list of opcodes] less than 100 is available. ** Applications that define a custom xFileControl method should use opcodes -** greater than 100 to avoid conflicts. +** greater than 100 to avoid conflicts. VFS implementations should +** return [SQLITE_NOTFOUND] for file control opcodes that they do not +** recognize. ** ** The xSectorSize() method returns the sector size of the ** device that underlies the file. The sector size is the diff --git a/src/test1.c b/src/test1.c index bab78451f..cf7e06b9c 100644 --- a/src/test1.c +++ b/src/test1.c @@ -4801,13 +4801,13 @@ static int file_control_test( } if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR; rc = sqlite3_file_control(db, 0, 0, &iArg); - assert( rc==SQLITE_ERROR ); + assert( rc==SQLITE_NOTFOUND ); rc = sqlite3_file_control(db, "notadatabase", SQLITE_FCNTL_LOCKSTATE, &iArg); assert( rc==SQLITE_ERROR ); rc = sqlite3_file_control(db, "main", -1, &iArg); - assert( rc==SQLITE_ERROR ); + assert( rc==SQLITE_NOTFOUND ); rc = sqlite3_file_control(db, "temp", -1, &iArg); - assert( rc==SQLITE_ERROR ); + assert( rc==SQLITE_NOTFOUND || rc==SQLITE_ERROR ); return TCL_OK; } |