diff --git a/libsqlite3-sys/src/bindgen.rs b/libsqlite3-sys/src/bindgen.rs index 3e79784..b2cf23e 100644 --- a/libsqlite3-sys/src/bindgen.rs +++ b/libsqlite3-sys/src/bindgen.rs @@ -1,6 +1,8 @@ #![allow(raw_pointer_derive, non_snake_case, non_camel_case_types)] -/* Running `target/bindgen /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/sqlite3.h -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/6.0/include` */ +/* automatically generated by rust-bindgen */ +pub type va_list = __builtin_va_list; +pub type __gnuc_va_list = __builtin_va_list; pub enum Struct_sqlite3 { } pub type sqlite3 = Struct_sqlite3; pub type sqlite_int64 = ::libc::c_longlong; @@ -8,97 +10,119 @@ pub type sqlite_uint64 = ::libc::c_ulonglong; pub type sqlite3_int64 = sqlite_int64; pub type sqlite3_uint64 = sqlite_uint64; pub type sqlite3_callback = - ::std::option::Option ::libc::c_int>; pub type sqlite3_file = Struct_sqlite3_file; #[repr(C)] +#[derive(Copy)] pub struct Struct_sqlite3_file { pub pMethods: *const Struct_sqlite3_io_methods, } +impl ::std::clone::Clone for Struct_sqlite3_file { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_sqlite3_file { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} pub type sqlite3_io_methods = Struct_sqlite3_io_methods; #[repr(C)] +#[derive(Copy)] pub struct Struct_sqlite3_io_methods { pub iVersion: ::libc::c_int, pub xClose: ::std::option::Option ::libc::c_int>, - pub xRead: ::std::option::Option ::libc::c_int>, - pub xWrite: ::std::option::Option ::libc::c_int>, - pub xTruncate: ::std::option::Option ::libc::c_int>, - pub xSync: ::std::option::Option ::libc::c_int>, - pub xFileSize: ::std::option::Option ::libc::c_int>, - pub xLock: ::std::option::Option ::libc::c_int>, - pub xUnlock: ::std::option::Option ::libc::c_int>, - pub xCheckReservedLock: ::std::option::Option ::libc::c_int>, - pub xFileControl: ::std::option::Option ::libc::c_int>, - pub xSectorSize: ::std::option::Option ::libc::c_int>, - pub xDeviceCharacteristics: ::std::option::Option ::libc::c_int>, - pub xShmMap: ::std::option::Option ::libc::c_int>, - pub xShmLock: ::std::option::Option ::libc::c_int>, - pub xShmBarrier: ::std::option::Option, - pub xShmUnmap: ::std::option::Option ::libc::c_int>, + pub xSync: ::std::option::Option ::libc::c_int>, + pub xFileSize: ::std::option::Option ::libc::c_int>, + pub xLock: ::std::option::Option ::libc::c_int>, + pub xUnlock: ::std::option::Option ::libc::c_int>, + pub xCheckReservedLock: ::std::option::Option ::libc::c_int>, + pub xFileControl: ::std::option::Option ::libc::c_int>, + pub xSectorSize: ::std::option::Option ::libc::c_int>, + pub xDeviceCharacteristics: ::std::option::Option ::libc::c_int>, + pub xShmMap: ::std::option::Option ::libc::c_int>, + pub xShmLock: ::std::option::Option ::libc::c_int>, + pub xShmBarrier: ::std::option::Option ()>, + pub xShmUnmap: ::std::option::Option ::libc::c_int>, + pub xFetch: ::std::option::Option ::libc::c_int>, + pub xUnfetch: ::std::option::Option ::libc::c_int>, +} +impl ::std::clone::Clone for Struct_sqlite3_io_methods { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_sqlite3_io_methods { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } } pub enum Struct_sqlite3_mutex { } pub type sqlite3_mutex = Struct_sqlite3_mutex; pub type sqlite3_vfs = Struct_sqlite3_vfs; -pub type sqlite3_syscall_ptr = ::std::option::Option; +pub type sqlite3_syscall_ptr = ::std::option::Option ()>; #[repr(C)] +#[derive(Copy)] pub struct Struct_sqlite3_vfs { pub iVersion: ::libc::c_int, pub szOsFile: ::libc::c_int, @@ -106,99 +130,123 @@ pub struct Struct_sqlite3_vfs { pub pNext: *mut sqlite3_vfs, pub zName: *const ::libc::c_char, pub pAppData: *mut ::libc::c_void, - pub xOpen: ::std::option::Option ::libc::c_int>, - pub xDelete: ::std::option::Option ::libc::c_int>, - pub xAccess: ::std::option::Option ::libc::c_int>, - pub xFullPathname: ::std::option::Option ::libc::c_int>, - pub xDlOpen: ::std::option::Option *mut ::libc::c_void>, - pub xDlError: ::std::option::Option, - pub xDlSym: ::std::option::Option - ::std::option::Option>, - pub xDlClose: ::std::option::Option, - pub xRandomness: ::std::option::Option ::libc::c_int>, - pub xSleep: ::std::option::Option ::libc::c_int>, - pub xCurrentTime: ::std::option::Option ::libc::c_int>, - pub xGetLastError: ::std::option::Option ::libc::c_int>, - pub xCurrentTimeInt64: ::std::option::Option ::libc::c_int>, - pub xSetSystemCall: ::std::option::Option ::libc::c_int>, - pub xGetSystemCall: ::std::option::Option sqlite3_syscall_ptr>, - pub xNextSystemCall: ::std::option::Option ::libc::c_int>, + pub xDelete: ::std::option::Option ::libc::c_int>, + pub xAccess: ::std::option::Option ::libc::c_int>, + pub xFullPathname: ::std::option::Option ::libc::c_int>, + pub xDlOpen: ::std::option::Option *mut ::libc::c_void>, + pub xDlError: ::std::option::Option ()>, + pub xDlSym: ::std::option::Option + ::std::option::Option + ()>>, + pub xDlClose: ::std::option::Option ()>, + pub xRandomness: ::std::option::Option ::libc::c_int>, + pub xSleep: ::std::option::Option ::libc::c_int>, + pub xCurrentTime: ::std::option::Option ::libc::c_int>, + pub xGetLastError: ::std::option::Option ::libc::c_int>, + pub xCurrentTimeInt64: ::std::option::Option ::libc::c_int>, + pub xSetSystemCall: ::std::option::Option ::libc::c_int>, + pub xGetSystemCall: ::std::option::Option sqlite3_syscall_ptr>, + pub xNextSystemCall: ::std::option::Option *const ::libc::c_char>, } +impl ::std::clone::Clone for Struct_sqlite3_vfs { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_sqlite3_vfs { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} pub type sqlite3_mem_methods = Struct_sqlite3_mem_methods; #[repr(C)] +#[derive(Copy)] pub struct Struct_sqlite3_mem_methods { pub xMalloc: ::std::option::Option *mut ::libc::c_void>, - pub xFree: ::std::option::Option, - pub xRealloc: ::std::option::Option ()>, + pub xRealloc: ::std::option::Option *mut ::libc::c_void>, pub xSize: ::std::option::Option ::libc::c_int>, @@ -206,10 +254,17 @@ pub struct Struct_sqlite3_mem_methods { -> ::libc::c_int>, pub xInit: ::std::option::Option ::libc::c_int>, - pub xShutdown: ::std::option::Option, + pub xShutdown: ::std::option::Option ()>, pub pAppData: *mut ::libc::c_void, } +impl ::std::clone::Clone for Struct_sqlite3_mem_methods { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_sqlite3_mem_methods { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} pub enum Struct_sqlite3_stmt { } pub type sqlite3_stmt = Struct_sqlite3_stmt; pub enum Struct_Mem { } @@ -217,77 +272,86 @@ pub type sqlite3_value = Struct_Mem; pub enum Struct_sqlite3_context { } pub type sqlite3_context = Struct_sqlite3_context; pub type sqlite3_destructor_type = - ::std::option::Option; + ::std::option::Option ()>; pub type sqlite3_vtab = Struct_sqlite3_vtab; pub type sqlite3_index_info = Struct_sqlite3_index_info; pub type sqlite3_vtab_cursor = Struct_sqlite3_vtab_cursor; pub type sqlite3_module = Struct_sqlite3_module; #[repr(C)] +#[derive(Copy)] pub struct Struct_sqlite3_module { pub iVersion: ::libc::c_int, - pub xCreate: ::std::option::Option ::libc::c_int>, - pub xConnect: ::std::option::Option ::libc::c_int>, - pub xBestIndex: ::std::option::Option ::libc::c_int>, - pub xDisconnect: ::std::option::Option ::libc::c_int>, - pub xDestroy: ::std::option::Option ::libc::c_int>, - pub xOpen: ::std::option::Option ::libc::c_int>, - pub xClose: ::std::option::Option ::libc::c_int>, - pub xFilter: ::std::option::Option ::libc::c_int>, - pub xNext: ::std::option::Option ::libc::c_int>, - pub xEof: ::std::option::Option ::libc::c_int>, - pub xColumn: ::std::option::Option ::libc::c_int>, - pub xRowid: ::std::option::Option ::libc::c_int>, - pub xUpdate: ::std::option::Option ::libc::c_int>, pub xBegin: ::std::option::Option ::libc::c_int>, @@ -295,43 +359,52 @@ pub struct Struct_sqlite3_module { -> ::libc::c_int>, pub xCommit: ::std::option::Option ::libc::c_int>, - pub xRollback: ::std::option::Option ::libc::c_int>, - pub xFindFunction: ::std::option::Option, - ppArg: - *mut *mut ::libc::c_void) + pub xFindFunction: ::std::option::Option + ()>, + ppArg: + *mut *mut ::libc::c_void) -> ::libc::c_int>, - pub xRename: ::std::option::Option ::libc::c_int>, - pub xSavepoint: ::std::option::Option ::libc::c_int>, - pub xRelease: ::std::option::Option ::libc::c_int>, - pub xRollbackTo: ::std::option::Option ::libc::c_int>, } +impl ::std::clone::Clone for Struct_sqlite3_module { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_sqlite3_module { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} #[repr(C)] +#[derive(Copy)] pub struct Struct_sqlite3_index_info { pub nConstraint: ::libc::c_int, pub aConstraint: *mut Struct_sqlite3_index_constraint, @@ -343,158 +416,295 @@ pub struct Struct_sqlite3_index_info { pub needToFreeIdxStr: ::libc::c_int, pub orderByConsumed: ::libc::c_int, pub estimatedCost: ::libc::c_double, + pub estimatedRows: sqlite3_int64, +} +impl ::std::clone::Clone for Struct_sqlite3_index_info { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_sqlite3_index_info { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } } #[repr(C)] +#[derive(Copy)] pub struct Struct_sqlite3_index_constraint { pub iColumn: ::libc::c_int, pub op: ::libc::c_uchar, pub usable: ::libc::c_uchar, pub iTermOffset: ::libc::c_int, } +impl ::std::clone::Clone for Struct_sqlite3_index_constraint { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_sqlite3_index_constraint { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} #[repr(C)] +#[derive(Copy)] pub struct Struct_sqlite3_index_orderby { pub iColumn: ::libc::c_int, pub desc: ::libc::c_uchar, } +impl ::std::clone::Clone for Struct_sqlite3_index_orderby { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_sqlite3_index_orderby { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} #[repr(C)] +#[derive(Copy)] pub struct Struct_sqlite3_index_constraint_usage { pub argvIndex: ::libc::c_int, pub omit: ::libc::c_uchar, } +impl ::std::clone::Clone for Struct_sqlite3_index_constraint_usage { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_sqlite3_index_constraint_usage { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} #[repr(C)] +#[derive(Copy)] pub struct Struct_sqlite3_vtab { pub pModule: *const sqlite3_module, pub nRef: ::libc::c_int, pub zErrMsg: *mut ::libc::c_char, } +impl ::std::clone::Clone for Struct_sqlite3_vtab { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_sqlite3_vtab { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} #[repr(C)] +#[derive(Copy)] pub struct Struct_sqlite3_vtab_cursor { pub pVtab: *mut sqlite3_vtab, } +impl ::std::clone::Clone for Struct_sqlite3_vtab_cursor { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_sqlite3_vtab_cursor { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} pub enum Struct_sqlite3_blob { } pub type sqlite3_blob = Struct_sqlite3_blob; pub type sqlite3_mutex_methods = Struct_sqlite3_mutex_methods; #[repr(C)] +#[derive(Copy)] pub struct Struct_sqlite3_mutex_methods { pub xMutexInit: ::std::option::Option ::libc::c_int>, pub xMutexEnd: ::std::option::Option ::libc::c_int>, pub xMutexAlloc: ::std::option::Option *mut sqlite3_mutex>, - pub xMutexFree: ::std::option::Option, - pub xMutexEnter: ::std::option::Option, - pub xMutexTry: ::std::option::Option ()>, + pub xMutexEnter: ::std::option::Option ()>, + pub xMutexTry: ::std::option::Option ::libc::c_int>, - pub xMutexLeave: ::std::option::Option, - pub xMutexHeld: ::std::option::Option ()>, + pub xMutexHeld: ::std::option::Option ::libc::c_int>, - pub xMutexNotheld: ::std::option::Option ::libc::c_int>, } +impl ::std::clone::Clone for Struct_sqlite3_mutex_methods { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_sqlite3_mutex_methods { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} pub enum Struct_sqlite3_pcache { } pub type sqlite3_pcache = Struct_sqlite3_pcache; pub type sqlite3_pcache_page = Struct_sqlite3_pcache_page; #[repr(C)] +#[derive(Copy)] pub struct Struct_sqlite3_pcache_page { pub pBuf: *mut ::libc::c_void, pub pExtra: *mut ::libc::c_void, } +impl ::std::clone::Clone for Struct_sqlite3_pcache_page { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_sqlite3_pcache_page { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} pub type sqlite3_pcache_methods2 = Struct_sqlite3_pcache_methods2; #[repr(C)] +#[derive(Copy)] pub struct Struct_sqlite3_pcache_methods2 { pub iVersion: ::libc::c_int, pub pArg: *mut ::libc::c_void, pub xInit: ::std::option::Option ::libc::c_int>, - pub xShutdown: ::std::option::Option, - pub xCreate: ::std::option::Option ()>, + pub xCreate: ::std::option::Option *mut sqlite3_pcache>, - pub xCachesize: ::std::option::Option, - pub xPagecount: ::std::option::Option ()>, + pub xPagecount: ::std::option::Option ::libc::c_int>, - pub xFetch: ::std::option::Option *mut sqlite3_pcache_page>, - pub xUnpin: ::std::option::Option, - pub xRekey: ::std::option::Option, - pub xTruncate: ::std::option::Option, - pub xDestroy: ::std::option::Option, - pub xShrink: ::std::option::Option, + pub xUnpin: ::std::option::Option ()>, + pub xRekey: ::std::option::Option ()>, + pub xTruncate: ::std::option::Option ()>, + pub xDestroy: ::std::option::Option ()>, + pub xShrink: ::std::option::Option ()>, +} +impl ::std::clone::Clone for Struct_sqlite3_pcache_methods2 { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_sqlite3_pcache_methods2 { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } } pub type sqlite3_pcache_methods = Struct_sqlite3_pcache_methods; #[repr(C)] +#[derive(Copy)] pub struct Struct_sqlite3_pcache_methods { pub pArg: *mut ::libc::c_void, pub xInit: ::std::option::Option ::libc::c_int>, - pub xShutdown: ::std::option::Option, - pub xCreate: ::std::option::Option ()>, + pub xCreate: ::std::option::Option *mut sqlite3_pcache>, - pub xCachesize: ::std::option::Option, - pub xPagecount: ::std::option::Option ()>, + pub xPagecount: ::std::option::Option ::libc::c_int>, - pub xFetch: ::std::option::Option *mut ::libc::c_void>, - pub xUnpin: ::std::option::Option, - pub xRekey: ::std::option::Option, - pub xTruncate: ::std::option::Option, - pub xDestroy: ::std::option::Option, + pub xUnpin: ::std::option::Option ()>, + pub xRekey: ::std::option::Option ()>, + pub xTruncate: ::std::option::Option ()>, + pub xDestroy: ::std::option::Option ()>, +} +impl ::std::clone::Clone for Struct_sqlite3_pcache_methods { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_sqlite3_pcache_methods { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } } pub enum Struct_sqlite3_backup { } pub type sqlite3_backup = Struct_sqlite3_backup; pub type sqlite3_rtree_geometry = Struct_sqlite3_rtree_geometry; +pub type sqlite3_rtree_query_info = Struct_sqlite3_rtree_query_info; +pub type sqlite3_rtree_dbl = ::libc::c_double; #[repr(C)] +#[derive(Copy)] pub struct Struct_sqlite3_rtree_geometry { pub pContext: *mut ::libc::c_void, pub nParam: ::libc::c_int, - pub aParam: *mut ::libc::c_double, + pub aParam: *mut sqlite3_rtree_dbl, pub pUser: *mut ::libc::c_void, - pub xDelUser: ::std::option::Option, + pub xDelUser: ::std::option::Option ()>, +} +impl ::std::clone::Clone for Struct_sqlite3_rtree_geometry { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_sqlite3_rtree_geometry { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +#[repr(C)] +#[derive(Copy)] +pub struct Struct_sqlite3_rtree_query_info { + pub pContext: *mut ::libc::c_void, + pub nParam: ::libc::c_int, + pub aParam: *mut sqlite3_rtree_dbl, + pub pUser: *mut ::libc::c_void, + pub xDelUser: ::std::option::Option ()>, + pub aCoord: *mut sqlite3_rtree_dbl, + pub anQueue: *mut ::libc::c_uint, + pub nCoord: ::libc::c_int, + pub iLevel: ::libc::c_int, + pub mxLevel: ::libc::c_int, + pub iRowid: sqlite3_int64, + pub rParentScore: sqlite3_rtree_dbl, + pub eParentWithin: ::libc::c_int, + pub eWithin: ::libc::c_int, + pub rScore: sqlite3_rtree_dbl, +} +impl ::std::clone::Clone for Struct_sqlite3_rtree_query_info { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct_sqlite3_rtree_query_info { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } +} +pub type __builtin_va_list = [__va_list_tag; 1usize]; +pub type __va_list_tag = Struct___va_list_tag; +#[repr(C)] +#[derive(Copy)] +pub struct Struct___va_list_tag { + pub gp_offset: ::libc::c_uint, + pub fp_offset: ::libc::c_uint, + pub overflow_arg_area: *mut ::libc::c_void, + pub reg_save_area: *mut ::libc::c_void, +} +impl ::std::clone::Clone for Struct___va_list_tag { + fn clone(&self) -> Self { *self } +} +impl ::std::default::Default for Struct___va_list_tag { + fn default() -> Self { unsafe { ::std::mem::zeroed() } } } extern "C" { pub static mut sqlite3_version: *const ::libc::c_char; @@ -511,28 +721,17 @@ extern "C" { -> *const ::libc::c_char; pub fn sqlite3_threadsafe() -> ::libc::c_int; pub fn sqlite3_close(arg1: *mut sqlite3) -> ::libc::c_int; + pub fn sqlite3_close_v2(arg1: *mut sqlite3) -> ::libc::c_int; pub fn sqlite3_exec(arg1: *mut sqlite3, sql: *const ::libc::c_char, callback: - ::std::option::Option - ::libc::c_int>, - arg2: - *mut ::libc::c_void, - errmsg: - *mut *mut ::libc::c_char) + ::std::option::Option ::libc::c_int>, arg2: *mut ::libc::c_void, errmsg: *mut *mut ::libc::c_char) -> ::libc::c_int; @@ -549,24 +748,15 @@ extern "C" { pub fn sqlite3_last_insert_rowid(arg1: *mut sqlite3) -> sqlite3_int64; pub fn sqlite3_changes(arg1: *mut sqlite3) -> ::libc::c_int; pub fn sqlite3_total_changes(arg1: *mut sqlite3) -> ::libc::c_int; - pub fn sqlite3_interrupt(arg1: *mut sqlite3); + pub fn sqlite3_interrupt(arg1: *mut sqlite3) -> (); pub fn sqlite3_complete(sql: *const ::libc::c_char) -> ::libc::c_int; pub fn sqlite3_complete16(sql: *const ::libc::c_void) -> ::libc::c_int; pub fn sqlite3_busy_handler(arg1: *mut sqlite3, arg2: - ::std::option::Option - ::libc::c_int>, - arg3: - *mut ::libc::c_void) + ::std::option::Option ::libc::c_int>, arg3: *mut ::libc::c_void) -> ::libc::c_int; @@ -578,93 +768,68 @@ extern "C" { pnColumn: *mut ::libc::c_int, pzErrmsg: *mut *mut ::libc::c_char) -> ::libc::c_int; - pub fn sqlite3_free_table(result: *mut *mut ::libc::c_char); + pub fn sqlite3_free_table(result: *mut *mut ::libc::c_char) -> (); pub fn sqlite3_mprintf(arg1: *const ::libc::c_char, ...) -> *mut ::libc::c_char; + pub fn sqlite3_vmprintf(arg1: *const ::libc::c_char, arg2: va_list) + -> *mut ::libc::c_char; pub fn sqlite3_snprintf(arg1: ::libc::c_int, arg2: *mut ::libc::c_char, arg3: *const ::libc::c_char, ...) -> *mut ::libc::c_char; + pub fn sqlite3_vsnprintf(arg1: ::libc::c_int, arg2: *mut ::libc::c_char, + arg3: *const ::libc::c_char, arg4: va_list) + -> *mut ::libc::c_char; pub fn sqlite3_malloc(arg1: ::libc::c_int) -> *mut ::libc::c_void; pub fn sqlite3_realloc(arg1: *mut ::libc::c_void, arg2: ::libc::c_int) -> *mut ::libc::c_void; - pub fn sqlite3_free(arg1: *mut ::libc::c_void); + pub fn sqlite3_free(arg1: *mut ::libc::c_void) -> (); pub fn sqlite3_memory_used() -> sqlite3_int64; pub fn sqlite3_memory_highwater(resetFlag: ::libc::c_int) -> sqlite3_int64; - pub fn sqlite3_randomness(N: ::libc::c_int, P: *mut ::libc::c_void); + pub fn sqlite3_randomness(N: ::libc::c_int, P: *mut ::libc::c_void) -> (); pub fn sqlite3_set_authorizer(arg1: *mut sqlite3, xAuth: - ::std::option::Option - ::libc::c_int>, - pUserData: - *mut ::libc::c_void) + ::std::option::Option ::libc::c_int>, pUserData: *mut ::libc::c_void) -> ::libc::c_int; pub fn sqlite3_trace(arg1: *mut sqlite3, xTrace: - ::std::option::Option, - arg2: - *mut ::libc::c_void)>, + ::std::option::Option ()>, arg2: *mut ::libc::c_void) -> *mut ::libc::c_void; pub fn sqlite3_profile(arg1: *mut sqlite3, xProfile: - ::std::option::Option, - arg2: - *mut ::libc::c_void)>, + ::std::option::Option ()>, arg2: *mut ::libc::c_void) -> *mut ::libc::c_void; pub fn sqlite3_progress_handler(arg1: *mut sqlite3, arg2: ::libc::c_int, arg3: - ::std::option::Option - ::libc::c_int>, - arg4: - *mut ::libc::c_void) + ::std::option::Option ::libc::c_int>, - arg4: *mut ::libc::c_void); + arg4: *mut ::libc::c_void) -> (); pub fn sqlite3_open(filename: *const ::libc::c_char, ppDb: *mut *mut sqlite3) -> ::libc::c_int; pub fn sqlite3_open16(filename: *const ::libc::c_void, @@ -685,6 +850,7 @@ extern "C" { pub fn sqlite3_extended_errcode(db: *mut sqlite3) -> ::libc::c_int; pub fn sqlite3_errmsg(arg1: *mut sqlite3) -> *const ::libc::c_char; pub fn sqlite3_errmsg16(arg1: *mut sqlite3) -> *const ::libc::c_void; + pub fn sqlite3_errstr(arg1: ::libc::c_int) -> *const ::libc::c_char; pub fn sqlite3_limit(arg1: *mut sqlite3, id: ::libc::c_int, newVal: ::libc::c_int) -> ::libc::c_int; pub fn sqlite3_prepare(db: *mut sqlite3, zSql: *const ::libc::c_char, @@ -713,10 +879,10 @@ extern "C" { pub fn sqlite3_bind_blob(arg1: *mut sqlite3_stmt, arg2: ::libc::c_int, arg3: *const ::libc::c_void, n: ::libc::c_int, arg4: - ::std::option::Option) - -> ::libc::c_int; + ::std::option::Option ()>) + -> ::libc::c_int; pub fn sqlite3_bind_double(arg1: *mut sqlite3_stmt, arg2: ::libc::c_int, arg3: ::libc::c_double) -> ::libc::c_int; pub fn sqlite3_bind_int(arg1: *mut sqlite3_stmt, arg2: ::libc::c_int, @@ -728,18 +894,18 @@ extern "C" { pub fn sqlite3_bind_text(arg1: *mut sqlite3_stmt, arg2: ::libc::c_int, arg3: *const ::libc::c_char, n: ::libc::c_int, arg4: - ::std::option::Option) - -> ::libc::c_int; + ::std::option::Option ()>) + -> ::libc::c_int; pub fn sqlite3_bind_text16(arg1: *mut sqlite3_stmt, arg2: ::libc::c_int, arg3: *const ::libc::c_void, arg4: ::libc::c_int, arg5: - ::std::option::Option) - -> ::libc::c_int; + ::std::option::Option ()>) + -> ::libc::c_int; pub fn sqlite3_bind_value(arg1: *mut sqlite3_stmt, arg2: ::libc::c_int, arg3: *const sqlite3_value) -> ::libc::c_int; pub fn sqlite3_bind_zeroblob(arg1: *mut sqlite3_stmt, arg2: ::libc::c_int, @@ -812,101 +978,25 @@ extern "C" { eTextRep: ::libc::c_int, pApp: *mut ::libc::c_void, xFunc: - ::std::option::Option, - xStep: - ::std::option::Option, - xFinal: - ::std::option::Option)>, + ::std::option::Option ()>, xStep: - ::std::option::Option, - xStep: - ::std::option::Option, - xFinal: - ::std::option::Option)>, + ::std::option::Option ()>, xFinal: - ::std::option::Option, - xStep: - ::std::option::Option, - xFinal: - ::std::option::Option)>) + ::std::option::Option ()>) -> ::libc::c_int; pub fn sqlite3_create_function16(db: *mut sqlite3, zFunctionName: *const ::libc::c_void, @@ -914,101 +1004,25 @@ extern "C" { eTextRep: ::libc::c_int, pApp: *mut ::libc::c_void, xFunc: - ::std::option::Option, - xStep: - ::std::option::Option, - xFinal: - ::std::option::Option)>, + ::std::option::Option ()>, xStep: - ::std::option::Option, - xStep: - ::std::option::Option, - xFinal: - ::std::option::Option)>, + ::std::option::Option ()>, xFinal: - ::std::option::Option, - xStep: - ::std::option::Option, - xFinal: - ::std::option::Option)>) + ::std::option::Option ()>) -> ::libc::c_int; pub fn sqlite3_create_function_v2(db: *mut sqlite3, zFunctionName: *const ::libc::c_char, @@ -1016,149 +1030,29 @@ extern "C" { eTextRep: ::libc::c_int, pApp: *mut ::libc::c_void, xFunc: - ::std::option::Option, - xStep: - ::std::option::Option, - xFinal: - ::std::option::Option, - xDestroy: - ::std::option::Option)>, + ::std::option::Option ()>, xStep: - ::std::option::Option, - xStep: - ::std::option::Option, - xFinal: - ::std::option::Option, - xDestroy: - ::std::option::Option)>, + ::std::option::Option ()>, xFinal: - ::std::option::Option, - xStep: - ::std::option::Option, - xFinal: - ::std::option::Option, - xDestroy: - ::std::option::Option)>, + ::std::option::Option ()>, xDestroy: - ::std::option::Option, - xStep: - ::std::option::Option, - xFinal: - ::std::option::Option, - xDestroy: - ::std::option::Option)>) + ::std::option::Option ()>) -> ::libc::c_int; pub fn sqlite3_aggregate_count(arg1: *mut sqlite3_context) -> ::libc::c_int; @@ -1167,21 +1061,15 @@ extern "C" { arg2: *mut sqlite3_stmt) -> ::libc::c_int; pub fn sqlite3_global_recover() -> ::libc::c_int; - pub fn sqlite3_thread_cleanup(); + pub fn sqlite3_thread_cleanup() -> (); pub fn sqlite3_memory_alarm(arg1: - ::std::option::Option, - arg2: - *mut ::libc::c_void, - arg3: - sqlite3_int64)>, + ::std::option::Option ()>, arg2: *mut ::libc::c_void, arg3: sqlite3_int64) -> ::libc::c_int; pub fn sqlite3_value_blob(arg1: *mut sqlite3_value) @@ -1214,141 +1102,82 @@ extern "C" { pub fn sqlite3_set_auxdata(arg1: *mut sqlite3_context, N: ::libc::c_int, arg2: *mut ::libc::c_void, arg3: - ::std::option::Option)>); + ::std::option::Option ()>) -> (); pub fn sqlite3_result_blob(arg1: *mut sqlite3_context, arg2: *const ::libc::c_void, arg3: ::libc::c_int, arg4: - ::std::option::Option)>); + ::std::option::Option ()>) -> (); pub fn sqlite3_result_double(arg1: *mut sqlite3_context, - arg2: ::libc::c_double); + arg2: ::libc::c_double) -> (); pub fn sqlite3_result_error(arg1: *mut sqlite3_context, arg2: *const ::libc::c_char, - arg3: ::libc::c_int); + arg3: ::libc::c_int) -> (); pub fn sqlite3_result_error16(arg1: *mut sqlite3_context, arg2: *const ::libc::c_void, - arg3: ::libc::c_int); - pub fn sqlite3_result_error_toobig(arg1: *mut sqlite3_context); - pub fn sqlite3_result_error_nomem(arg1: *mut sqlite3_context); + arg3: ::libc::c_int) -> (); + pub fn sqlite3_result_error_toobig(arg1: *mut sqlite3_context) -> (); + pub fn sqlite3_result_error_nomem(arg1: *mut sqlite3_context) -> (); pub fn sqlite3_result_error_code(arg1: *mut sqlite3_context, - arg2: ::libc::c_int); - pub fn sqlite3_result_int(arg1: *mut sqlite3_context, - arg2: ::libc::c_int); + arg2: ::libc::c_int) -> (); + pub fn sqlite3_result_int(arg1: *mut sqlite3_context, arg2: ::libc::c_int) + -> (); pub fn sqlite3_result_int64(arg1: *mut sqlite3_context, - arg2: sqlite3_int64); - pub fn sqlite3_result_null(arg1: *mut sqlite3_context); + arg2: sqlite3_int64) -> (); + pub fn sqlite3_result_null(arg1: *mut sqlite3_context) -> (); pub fn sqlite3_result_text(arg1: *mut sqlite3_context, arg2: *const ::libc::c_char, arg3: ::libc::c_int, arg4: - ::std::option::Option)>); + ::std::option::Option ()>) -> (); pub fn sqlite3_result_text16(arg1: *mut sqlite3_context, arg2: *const ::libc::c_void, arg3: ::libc::c_int, arg4: - ::std::option::Option)>); + ::std::option::Option ()>) -> (); pub fn sqlite3_result_text16le(arg1: *mut sqlite3_context, arg2: *const ::libc::c_void, arg3: ::libc::c_int, arg4: - ::std::option::Option)>); + ::std::option::Option ()>) + -> (); pub fn sqlite3_result_text16be(arg1: *mut sqlite3_context, arg2: *const ::libc::c_void, arg3: ::libc::c_int, arg4: - ::std::option::Option)>); + ::std::option::Option ()>) + -> (); pub fn sqlite3_result_value(arg1: *mut sqlite3_context, - arg2: *mut sqlite3_value); + arg2: *mut sqlite3_value) -> (); pub fn sqlite3_result_zeroblob(arg1: *mut sqlite3_context, - n: ::libc::c_int); + n: ::libc::c_int) -> (); pub fn sqlite3_create_collation(arg1: *mut sqlite3, zName: *const ::libc::c_char, eTextRep: ::libc::c_int, pArg: *mut ::libc::c_void, xCompare: - ::std::option::Option - ::libc::c_int>) + ::std::option::Option ::libc::c_int>) -> ::libc::c_int; @@ -1357,132 +1186,66 @@ extern "C" { eTextRep: ::libc::c_int, pArg: *mut ::libc::c_void, xCompare: - ::std::option::Option - ::libc::c_int>, - xDestroy: - ::std::option::Option) + ::std::option::Option ::libc::c_int>, xDestroy: - ::std::option::Option - ::libc::c_int>, - xDestroy: - ::std::option::Option)>) + ::std::option::Option ()>) -> ::libc::c_int; pub fn sqlite3_create_collation16(arg1: *mut sqlite3, zName: *const ::libc::c_void, eTextRep: ::libc::c_int, pArg: *mut ::libc::c_void, xCompare: - ::std::option::Option - ::libc::c_int>) + ::std::option::Option ::libc::c_int>) -> ::libc::c_int; pub fn sqlite3_collation_needed(arg1: *mut sqlite3, arg2: *mut ::libc::c_void, arg3: - ::std::option::Option)>) + ::std::option::Option ()>) -> ::libc::c_int; pub fn sqlite3_collation_needed16(arg1: *mut sqlite3, arg2: *mut ::libc::c_void, arg3: - ::std::option::Option)>) + ::std::option::Option ()>) -> ::libc::c_int; pub fn sqlite3_sleep(arg1: ::libc::c_int) -> ::libc::c_int; pub fn sqlite3_get_autocommit(arg1: *mut sqlite3) -> ::libc::c_int; @@ -1497,60 +1260,39 @@ extern "C" { -> *mut sqlite3_stmt; pub fn sqlite3_commit_hook(arg1: *mut sqlite3, arg2: - ::std::option::Option - ::libc::c_int>, - arg3: - *mut ::libc::c_void) + ::std::option::Option ::libc::c_int>, arg3: *mut ::libc::c_void) -> *mut ::libc::c_void; pub fn sqlite3_rollback_hook(arg1: *mut sqlite3, arg2: - ::std::option::Option, - arg3: - *mut ::libc::c_void)>, + ::std::option::Option ()>, arg3: *mut ::libc::c_void) -> *mut ::libc::c_void; pub fn sqlite3_update_hook(arg1: *mut sqlite3, arg2: - ::std::option::Option, - arg3: - *mut ::libc::c_void)>, + ::std::option::Option ()>, arg3: *mut ::libc::c_void) -> *mut ::libc::c_void; pub fn sqlite3_enable_shared_cache(arg1: ::libc::c_int) -> ::libc::c_int; pub fn sqlite3_release_memory(arg1: ::libc::c_int) -> ::libc::c_int; pub fn sqlite3_db_release_memory(arg1: *mut sqlite3) -> ::libc::c_int; pub fn sqlite3_soft_heap_limit64(N: sqlite3_int64) -> sqlite3_int64; - pub fn sqlite3_soft_heap_limit(N: ::libc::c_int); + pub fn sqlite3_soft_heap_limit(N: ::libc::c_int) -> (); pub fn sqlite3_table_column_metadata(db: *mut sqlite3, zDbName: *const ::libc::c_char, zTableName: *const ::libc::c_char, @@ -1563,23 +1305,23 @@ extern "C" { pPrimaryKey: *mut ::libc::c_int, pAutoinc: *mut ::libc::c_int) -> ::libc::c_int; - #[cfg(feature = "load_extension")] pub fn sqlite3_load_extension(db: *mut sqlite3, zFile: *const ::libc::c_char, zProc: *const ::libc::c_char, pzErrMsg: *mut *mut ::libc::c_char) -> ::libc::c_int; - #[cfg(feature = "load_extension")] pub fn sqlite3_enable_load_extension(db: *mut sqlite3, onoff: ::libc::c_int) -> ::libc::c_int; pub fn sqlite3_auto_extension(xEntryPoint: - ::std::option::Option)>) + ::std::option::Option ()>) -> ::libc::c_int; - pub fn sqlite3_reset_auto_extension(); + pub fn sqlite3_cancel_auto_extension(xEntryPoint: + ::std::option::Option ()>) + -> ::libc::c_int; + pub fn sqlite3_reset_auto_extension() -> (); pub fn sqlite3_create_module(db: *mut sqlite3, zName: *const ::libc::c_char, p: *const sqlite3_module, @@ -1590,19 +1332,9 @@ extern "C" { p: *const sqlite3_module, pClientData: *mut ::libc::c_void, xDestroy: - ::std::option::Option)>) + ::std::option::Option ()>) -> ::libc::c_int; pub fn sqlite3_declare_vtab(arg1: *mut sqlite3, zSQL: *const ::libc::c_char) -> ::libc::c_int; @@ -1630,10 +1362,10 @@ extern "C" { makeDflt: ::libc::c_int) -> ::libc::c_int; pub fn sqlite3_vfs_unregister(arg1: *mut sqlite3_vfs) -> ::libc::c_int; pub fn sqlite3_mutex_alloc(arg1: ::libc::c_int) -> *mut sqlite3_mutex; - pub fn sqlite3_mutex_free(arg1: *mut sqlite3_mutex); - pub fn sqlite3_mutex_enter(arg1: *mut sqlite3_mutex); + pub fn sqlite3_mutex_free(arg1: *mut sqlite3_mutex) -> (); + pub fn sqlite3_mutex_enter(arg1: *mut sqlite3_mutex) -> (); pub fn sqlite3_mutex_try(arg1: *mut sqlite3_mutex) -> ::libc::c_int; - pub fn sqlite3_mutex_leave(arg1: *mut sqlite3_mutex); + pub fn sqlite3_mutex_leave(arg1: *mut sqlite3_mutex) -> (); pub fn sqlite3_mutex_held(arg1: *mut sqlite3_mutex) -> ::libc::c_int; pub fn sqlite3_mutex_notheld(arg1: *mut sqlite3_mutex) -> ::libc::c_int; pub fn sqlite3_db_mutex(arg1: *mut sqlite3) -> *mut sqlite3_mutex; @@ -1663,17 +1395,11 @@ extern "C" { pub fn sqlite3_backup_pagecount(p: *mut sqlite3_backup) -> ::libc::c_int; pub fn sqlite3_unlock_notify(pBlocked: *mut sqlite3, xNotify: - ::std::option::Option, - pNotifyArg: - *mut ::libc::c_void)>, + ::std::option::Option ()>, pNotifyArg: *mut ::libc::c_void) -> ::libc::c_int; pub fn sqlite3_stricmp(arg1: *const ::libc::c_char, @@ -1681,26 +1407,20 @@ extern "C" { pub fn sqlite3_strnicmp(arg1: *const ::libc::c_char, arg2: *const ::libc::c_char, arg3: ::libc::c_int) -> ::libc::c_int; + pub fn sqlite3_strglob(zGlob: *const ::libc::c_char, + zStr: *const ::libc::c_char) -> ::libc::c_int; pub fn sqlite3_log(iErrCode: ::libc::c_int, - zFormat: *const ::libc::c_char, ...); + zFormat: *const ::libc::c_char, ...) -> (); pub fn sqlite3_wal_hook(arg1: *mut sqlite3, arg2: - ::std::option::Option - ::libc::c_int>, - arg3: - *mut ::libc::c_void) + ::std::option::Option ::libc::c_int>, arg3: *mut ::libc::c_void) -> *mut ::libc::c_void; pub fn sqlite3_wal_autocheckpoint(db: *mut sqlite3, N: ::libc::c_int) @@ -1720,27 +1440,29 @@ extern "C" { pub fn sqlite3_rtree_geometry_callback(db: *mut sqlite3, zGeom: *const ::libc::c_char, xGeom: - ::std::option::Option - ::libc::c_int>, - pContext: - *mut ::libc::c_void) + ::std::option::Option ::libc::c_int>, pContext: *mut ::libc::c_void) -> ::libc::c_int; + pub fn sqlite3_rtree_query_callback(db: *mut sqlite3, + zQueryFunc: *const ::libc::c_char, + xQueryFunc: + ::std::option::Option + ::libc::c_int>, + pContext: *mut ::libc::c_void, + xDestructor: + ::std::option::Option ()>) + -> ::libc::c_int; } diff --git a/libsqlite3-sys/src/lib.rs b/libsqlite3-sys/src/lib.rs index b4b5186..5d37276 100644 --- a/libsqlite3-sys/src/lib.rs +++ b/libsqlite3-sys/src/lib.rs @@ -5,7 +5,7 @@ extern crate libc; pub use self::bindgen::*; use std::mem; -use libc::{c_int, c_void}; +use libc::c_int; mod bindgen; @@ -48,10 +48,12 @@ pub const SQLITE_TEXT : c_int = 3; pub const SQLITE_BLOB : c_int = 4; pub const SQLITE_NULL : c_int = 5; -pub type SqliteDestructor = extern "C" fn(*mut c_void); +pub fn SQLITE_STATIC() -> sqlite3_destructor_type { + Some(unsafe { mem::transmute(0isize) }) +} -pub fn SQLITE_TRANSIENT() -> SqliteDestructor { - unsafe { mem::transmute(-1isize) } +pub fn SQLITE_TRANSIENT() -> sqlite3_destructor_type { + Some(unsafe { mem::transmute(-1isize) }) } pub fn code_to_str(code: c_int) -> &'static str { diff --git a/src/types.rs b/src/types.rs index 1900d1d..1d30b30 100644 --- a/src/types.rs +++ b/src/types.rs @@ -104,7 +104,7 @@ impl<'a> ToSql for &'a str { unsafe fn bind_parameter(&self, stmt: *mut sqlite3_stmt, col: c_int) -> c_int { match str_to_cstring(self) { Ok(c_str) => ffi::sqlite3_bind_text(stmt, col, c_str.as_ptr(), -1, - Some(ffi::SQLITE_TRANSIENT())), + ffi::SQLITE_TRANSIENT()), Err(_) => ffi::SQLITE_MISUSE, } } @@ -119,8 +119,7 @@ impl ToSql for String { impl<'a> ToSql for &'a [u8] { unsafe fn bind_parameter(&self, stmt: *mut sqlite3_stmt, col: c_int) -> c_int { ffi::sqlite3_bind_blob( - stmt, col, mem::transmute(self.as_ptr()), self.len() as c_int, - Some(ffi::SQLITE_TRANSIENT())) + stmt, col, mem::transmute(self.as_ptr()), self.len() as c_int, ffi::SQLITE_TRANSIENT()) } }