commit - dcec993201a430c8f02ce3c20e450d472fe6cabe
commit + 703acc9173987c8a9ea49800cb096680a723618d
blob - f78e1d14c74e488a815fcce7cc03c68237b90d65
blob + 7e4cef618dc5b34ed8dabb754e351e60900af6eb
--- sqlite3/errors.ha
+++ sqlite3/errors.ha
def sqlite_row: int = 100;
def sqlite_done: int = 101;
-export type sqlite_error = !void;
-export type sqlite_internal = !void;
-export type sqlite_perm = !void;
-export type sqlite_abort = !void;
-export type sqlite_busy = !void;
-export type sqlite_locked = !void;
-// ...
-export type sqlite_unknown_error = !void;
+export type generic = !void;
+export type internal = !void;
+export type perm = !void;
+export type abort_requested = !void;
+export type busy = !void;
+export type locked = !void;
+export type nomem = !void;
+export type readonly = !void;
+export type interrupt = !void;
+export type ioerr = !void;
+export type corrupt = !void;
+export type notfound = !void;
+export type full = !void;
+export type cantopen = !void;
+export type protocol = !void;
+export type empty = !void; // Internal only
+export type schema = !void;
+export type toobig = !void;
+export type constraint = !void;
+export type mismatch = !void;
+export type misuse = !void;
+export type nolfs = !void;
+export type auth = !void;
+export type format = !void; // Not used
+export type range = !void;
+export type notadb = !void;
+export type notice = !void;
+export type warning = !void;
-export type error = !(sqlite_error | sqlite_internal | sqlite_perm |
- sqlite_abort | sqlite_busy | sqlite_locked |
- sqlite_unknown_error);
+export type error = !(
+ generic |
+ internal |
+ perm |
+ abort_requested |
+ busy |
+ locked |
+ nomem |
+ readonly |
+ interrupt |
+ ioerr |
+ corrupt |
+ notfound |
+ full |
+ cantopen |
+ protocol |
+ empty |
+ schema |
+ toobig |
+ constraint |
+ mismatch |
+ misuse |
+ nolfs |
+ auth |
+ format |
+ range |
+ notadb |
+ notice |
+ warning
+);
export fn strerror(err: error) str = {
- return "";
+ match (err) {
+ case internal => return "Internal logic error in SQLite";
+ case perm => return "Access permission denied";
+ case abort_requested => return "Callback routine requested an abort";
+ case busy => return "The database file is locked";
+ case locked => return "A table in the dabatase is locked";
+ case nomem => return "A malloc() failed";
+ case readonly => return "Attempt to write a readonly database";
+ case interrupt => return "Operation terminated by sqlite3_interrupt()";
+ case ioerr => return "Some kind of disk I/O error occurred";
+ case corrupt => return "The database disk image is malformed";
+ case notfound => return "Unknown opcode in sqlite3_file_control()";
+ case full => return "Insertion failed because database is full";
+ case cantopen => return "Unable to open the database file";
+ case protocol => return "Database lock protocol error";
+ case empty => return "Internal use only";
+ case schema => return "The database schema changed";
+ case toobig => return "String or BLOB exceeds size limit";
+ case constraint => return "Abort due to constraint violation";
+ case mismatch => return "Data type mismatch";
+ case misuse => return "Library used incorrectly";
+ case nolfs => return "Uses OS features not supported on host";
+ case auth => return "Authorization denied";
+ case format => return "Not used";
+ case range => return "2nd parameter to sqlite3::bind out of range";
+ case notadb => return "File opened that is not a database file";
+ case notice => return "Notifications from sqlite3_log()";
+ case warning => return "Warnings from sqlite3_log()";
+ case => return "Generic error";
+ };
};
fn code2err(code: int) error = {
switch (code) {
- case 1 => return sqlite_error;
- case => return sqlite_unknown_error;
+ case 2 => return internal;
+ case 3 => return perm;
+ case 4 => return abort_requested;
+ case 5 => return busy;
+ case 6 => return locked;
+ case 7 => return nomem;
+ case 8 => return readonly;
+ case 9 => return interrupt;
+ case 10 => return ioerr;
+ case 11 => return corrupt;
+ case 12 => return notfound;
+ case 13 => return full;
+ case 14 => return cantopen;
+ case 15 => return protocol;
+ case 16 => return empty;
+ case 17 => return schema;
+ case 18 => return toobig;
+ case 19 => return constraint;
+ case 20 => return mismatch;
+ case 21 => return misuse;
+ case 22 => return nolfs;
+ case 23 => return auth;
+ case 24 => return format;
+ case 25 => return range;
+ case 26 => return notadb;
+ case 27 => return notice;
+ case 28 => return warning;
+
+ case => return generic;
};
};
blob - f8183b8d93b60e64fc44c3442b4168c2b45717dd
blob + 3257770b7fa4109acb305de5201ac6c1caf0aa4a
--- sqlite3/sqlite3.ha
+++ sqlite3/sqlite3.ha
export def OPEN_EXCLUSIVE: int = 0x00000010; // VFS only
export def OPEN_AUTOPROXY: int = 0x00000020; // VFS only
export def OPEN_URI: int = 0x00000040;
-// ...
+export def OPEN_MEMORY: int = 0x00000080;
+export def OPEN_MAIN_DB: int = 0x00000100; // VFS only
+export def OPEN_TEMP_DB: int = 0x00000200; // VFS only
+export def OPEN_TRANSIENT_DB: int = 0x00000400; // VFS ONLY
+export def OPEN_MAIN_JOURNAL: int = 0x00000800; // VFS ONLY
+export def OPEN_TEMP_JOURNAL: int = 0x00001000; // VFS ONLY
+export def OPEN_SUBJOURNAL: int = 0x00002000; // VFS ONLY
+export def OPEN_SUPER_JOURNAL: int = 0x00004000; // VFS ONLY
export def OPEN_NOMUTEX: int = 0x00008000;
-// ..
+export def OPEN_FULLMUTEX: int = 0x00010000;
+export def OPEN_SHAREDCACHE: int = 0x00020000;
+export def OPEN_PRIVATECACHE: int = 0x00040000;
export def OPEN_WAL: int = 0x00080000; // VFS only
export def OPEN_NOFOLLOW: int = 0x01000000;
export def OPEN_EXRESCODE: int = 0x02000000;
let ret = libsqlite3_bind_parameter_index(stmt: *opaque, n);
if (ret == 0) {
- return sqlite_error;
+ return range;
};
return ret;