Open project
From TaskDepender
(→Implementation) |
(→Implementation) |
||
Line 19: | Line 19: | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
− | int Admin::Open( char *filename ) | + | int Admin::Open(char *filename) |
{ | { | ||
+ | int returnValue; | ||
if( filename == NULL ) | if( filename == NULL ) | ||
{ | { | ||
Line 28: | Line 29: | ||
{ | { | ||
// Try to open the database. | // Try to open the database. | ||
− | + | returnValue = sqlite3_open_v2( xx, xx, xx ); | |
+ | if( returnValue == SQL_OK ) | ||
+ | |||
} | } | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
+ | The following errors can be returned by the SQL-open function. | ||
+ | |||
+ | http://www.sqlite.org/c3ref/c_abort.html | ||
+ | |||
+ | The following table converts the possible SQLITE error-codes into error-codes for the [[Administration]] | ||
+ | |||
+ | #define SQLITE_OK 0 /* Successful result */ | ||
+ | #define SQLITE_ERROR 1 /* SQL error or missing database */ | ||
+ | #define SQLITE_PERM 3 /* Access permission denied */ | ||
+ | #define SQLITE_BUSY 5 /* The database file is locked */ | ||
+ | #define SQLITE_READONLY 8 /* Attempt to write a readonly database */ | ||
+ | #define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */ | ||
+ | #define SQLITE_CORRUPT 11 /* The database disk image is malformed */ | ||
+ | #define SQLITE_CANTOPEN 14 /* Unable to open the database file */ | ||
+ | #define SQLITE_PROTOCOL 15 /* Database lock protocol error */ | ||
+ | #define SQLITE_NOTADB 26 /* File opened that is not a database file */ | ||
+ | |||
+ | /* end-of-error-codes */ | ||
+ | |||