|
| 1 | +pub type sqlite3_int64 = ::core::ffi::c_longlong; |
| 2 | +pub type sqlite3_filename = *const ::core::ffi::c_char; |
| 3 | +pub type sqlite3_syscall_ptr = ::core::option::Option<unsafe extern "C" fn()>; |
| 4 | + |
| 5 | +pub const SQLITE_CANTOPEN: i32 = 14; |
| 6 | +pub const SQLITE_ERROR: i32 = 1; |
| 7 | +pub const SQLITE_IOERR: i32 = 10; |
| 8 | +pub const SQLITE_IOERR_SHORT_READ: i32 = 522; |
| 9 | +pub const SQLITE_IOERR_DELETE: i32 = 2570; |
| 10 | +pub const SQLITE_OK: i32 = 0; |
| 11 | +pub const SQLITE_OPEN_DELETEONCLOSE: i32 = 8; |
| 12 | +pub const SQLITE_OPEN_MAIN_DB: i32 = 256; |
| 13 | +pub const SQLITE_OPEN_READWRITE: i32 = 2; |
| 14 | +pub const SQLITE_OPEN_CREATE: i32 = 4; |
| 15 | +pub const SQLITE_NOTFOUND: i32 = 12; |
| 16 | + |
| 17 | +#[repr(C)] |
| 18 | +#[derive(Debug, Copy, Clone)] |
| 19 | +pub struct sqlite3_file { |
| 20 | + pub pMethods: *const sqlite3_io_methods, |
| 21 | +} |
| 22 | + |
| 23 | +#[repr(C)] |
| 24 | +#[derive(Debug, Copy, Clone)] |
| 25 | +pub struct sqlite3_io_methods { |
| 26 | + pub iVersion: ::core::ffi::c_int, |
| 27 | + pub xClose: ::core::option::Option< |
| 28 | + unsafe extern "C" fn(arg1: *mut sqlite3_file) -> ::core::ffi::c_int, |
| 29 | + >, |
| 30 | + pub xRead: ::core::option::Option< |
| 31 | + unsafe extern "C" fn( |
| 32 | + arg1: *mut sqlite3_file, |
| 33 | + arg2: *mut ::core::ffi::c_void, |
| 34 | + iAmt: ::core::ffi::c_int, |
| 35 | + iOfst: sqlite3_int64, |
| 36 | + ) -> ::core::ffi::c_int, |
| 37 | + >, |
| 38 | + pub xWrite: ::core::option::Option< |
| 39 | + unsafe extern "C" fn( |
| 40 | + arg1: *mut sqlite3_file, |
| 41 | + arg2: *const ::core::ffi::c_void, |
| 42 | + iAmt: ::core::ffi::c_int, |
| 43 | + iOfst: sqlite3_int64, |
| 44 | + ) -> ::core::ffi::c_int, |
| 45 | + >, |
| 46 | + pub xTruncate: ::core::option::Option< |
| 47 | + unsafe extern "C" fn( |
| 48 | + arg1: *mut sqlite3_file, |
| 49 | + size: sqlite3_int64, |
| 50 | + ) -> ::core::ffi::c_int, |
| 51 | + >, |
| 52 | + pub xSync: ::core::option::Option< |
| 53 | + unsafe extern "C" fn( |
| 54 | + arg1: *mut sqlite3_file, |
| 55 | + flags: ::core::ffi::c_int, |
| 56 | + ) -> ::core::ffi::c_int, |
| 57 | + >, |
| 58 | + pub xFileSize: ::core::option::Option< |
| 59 | + unsafe extern "C" fn( |
| 60 | + arg1: *mut sqlite3_file, |
| 61 | + pSize: *mut sqlite3_int64, |
| 62 | + ) -> ::core::ffi::c_int, |
| 63 | + >, |
| 64 | + pub xLock: ::core::option::Option< |
| 65 | + unsafe extern "C" fn( |
| 66 | + arg1: *mut sqlite3_file, |
| 67 | + arg2: ::core::ffi::c_int, |
| 68 | + ) -> ::core::ffi::c_int, |
| 69 | + >, |
| 70 | + pub xUnlock: ::core::option::Option< |
| 71 | + unsafe extern "C" fn( |
| 72 | + arg1: *mut sqlite3_file, |
| 73 | + arg2: ::core::ffi::c_int, |
| 74 | + ) -> ::core::ffi::c_int, |
| 75 | + >, |
| 76 | + pub xCheckReservedLock: ::core::option::Option< |
| 77 | + unsafe extern "C" fn( |
| 78 | + arg1: *mut sqlite3_file, |
| 79 | + pResOut: *mut ::core::ffi::c_int, |
| 80 | + ) -> ::core::ffi::c_int, |
| 81 | + >, |
| 82 | + pub xFileControl: ::core::option::Option< |
| 83 | + unsafe extern "C" fn( |
| 84 | + arg1: *mut sqlite3_file, |
| 85 | + op: ::core::ffi::c_int, |
| 86 | + pArg: *mut ::core::ffi::c_void, |
| 87 | + ) -> ::core::ffi::c_int, |
| 88 | + >, |
| 89 | + pub xSectorSize: ::core::option::Option< |
| 90 | + unsafe extern "C" fn(arg1: *mut sqlite3_file) -> ::core::ffi::c_int, |
| 91 | + >, |
| 92 | + pub xDeviceCharacteristics: ::core::option::Option< |
| 93 | + unsafe extern "C" fn(arg1: *mut sqlite3_file) -> ::core::ffi::c_int, |
| 94 | + >, |
| 95 | + pub xShmMap: ::core::option::Option< |
| 96 | + unsafe extern "C" fn( |
| 97 | + arg1: *mut sqlite3_file, |
| 98 | + iPg: ::core::ffi::c_int, |
| 99 | + pgsz: ::core::ffi::c_int, |
| 100 | + arg2: ::core::ffi::c_int, |
| 101 | + arg3: *mut *mut ::core::ffi::c_void, |
| 102 | + ) -> ::core::ffi::c_int, |
| 103 | + >, |
| 104 | + pub xShmLock: ::core::option::Option< |
| 105 | + unsafe extern "C" fn( |
| 106 | + arg1: *mut sqlite3_file, |
| 107 | + offset: ::core::ffi::c_int, |
| 108 | + n: ::core::ffi::c_int, |
| 109 | + flags: ::core::ffi::c_int, |
| 110 | + ) -> ::core::ffi::c_int, |
| 111 | + >, |
| 112 | + pub xShmBarrier: ::core::option::Option< |
| 113 | + unsafe extern "C" fn(arg1: *mut sqlite3_file), |
| 114 | + >, |
| 115 | + pub xShmUnmap: ::core::option::Option< |
| 116 | + unsafe extern "C" fn( |
| 117 | + arg1: *mut sqlite3_file, |
| 118 | + deleteFlag: ::core::ffi::c_int, |
| 119 | + ) -> ::core::ffi::c_int, |
| 120 | + >, |
| 121 | + pub xFetch: ::core::option::Option< |
| 122 | + unsafe extern "C" fn( |
| 123 | + arg1: *mut sqlite3_file, |
| 124 | + iOfst: sqlite3_int64, |
| 125 | + iAmt: ::core::ffi::c_int, |
| 126 | + pp: *mut *mut ::core::ffi::c_void, |
| 127 | + ) -> ::core::ffi::c_int, |
| 128 | + >, |
| 129 | + pub xUnfetch: ::core::option::Option< |
| 130 | + unsafe extern "C" fn( |
| 131 | + arg1: *mut sqlite3_file, |
| 132 | + iOfst: sqlite3_int64, |
| 133 | + p: *mut ::core::ffi::c_void, |
| 134 | + ) -> ::core::ffi::c_int, |
| 135 | + >, |
| 136 | +} |
| 137 | + |
| 138 | +#[repr(C)] |
| 139 | +#[derive(Debug, Copy, Clone)] |
| 140 | +pub struct sqlite3_vfs { |
| 141 | + pub iVersion: ::core::ffi::c_int, |
| 142 | + pub szOsFile: ::core::ffi::c_int, |
| 143 | + pub mxPathname: ::core::ffi::c_int, |
| 144 | + pub pNext: *mut sqlite3_vfs, |
| 145 | + pub zName: *const ::core::ffi::c_char, |
| 146 | + pub pAppData: *mut ::core::ffi::c_void, |
| 147 | + pub xOpen: ::core::option::Option< |
| 148 | + unsafe extern "C" fn( |
| 149 | + arg1: *mut sqlite3_vfs, |
| 150 | + zName: sqlite3_filename, |
| 151 | + arg2: *mut sqlite3_file, |
| 152 | + flags: ::core::ffi::c_int, |
| 153 | + pOutFlags: *mut ::core::ffi::c_int, |
| 154 | + ) -> ::core::ffi::c_int, |
| 155 | + >, |
| 156 | + pub xDelete: ::core::option::Option< |
| 157 | + unsafe extern "C" fn( |
| 158 | + arg1: *mut sqlite3_vfs, |
| 159 | + zName: *const ::core::ffi::c_char, |
| 160 | + syncDir: ::core::ffi::c_int, |
| 161 | + ) -> ::core::ffi::c_int, |
| 162 | + >, |
| 163 | + pub xAccess: ::core::option::Option< |
| 164 | + unsafe extern "C" fn( |
| 165 | + arg1: *mut sqlite3_vfs, |
| 166 | + zName: *const ::core::ffi::c_char, |
| 167 | + flags: ::core::ffi::c_int, |
| 168 | + pResOut: *mut ::core::ffi::c_int, |
| 169 | + ) -> ::core::ffi::c_int, |
| 170 | + >, |
| 171 | + pub xFullPathname: ::core::option::Option< |
| 172 | + unsafe extern "C" fn( |
| 173 | + arg1: *mut sqlite3_vfs, |
| 174 | + zName: *const ::core::ffi::c_char, |
| 175 | + nOut: ::core::ffi::c_int, |
| 176 | + zOut: *mut ::core::ffi::c_char, |
| 177 | + ) -> ::core::ffi::c_int, |
| 178 | + >, |
| 179 | + pub xDlOpen: ::core::option::Option< |
| 180 | + unsafe extern "C" fn( |
| 181 | + arg1: *mut sqlite3_vfs, |
| 182 | + zFilename: *const ::core::ffi::c_char, |
| 183 | + ) -> *mut ::core::ffi::c_void, |
| 184 | + >, |
| 185 | + pub xDlError: ::core::option::Option< |
| 186 | + unsafe extern "C" fn( |
| 187 | + arg1: *mut sqlite3_vfs, |
| 188 | + nByte: ::core::ffi::c_int, |
| 189 | + zErrMsg: *mut ::core::ffi::c_char, |
| 190 | + ), |
| 191 | + >, |
| 192 | + pub xDlSym: ::core::option::Option< |
| 193 | + unsafe extern "C" fn( |
| 194 | + arg1: *mut sqlite3_vfs, |
| 195 | + arg2: *mut ::core::ffi::c_void, |
| 196 | + zSymbol: *const ::core::ffi::c_char, |
| 197 | + ) -> ::core::option::Option< |
| 198 | + unsafe extern "C" fn( |
| 199 | + arg1: *mut sqlite3_vfs, |
| 200 | + arg2: *mut ::core::ffi::c_void, |
| 201 | + zSymbol: *const ::core::ffi::c_char, |
| 202 | + ), |
| 203 | + >, |
| 204 | + >, |
| 205 | + pub xDlClose: ::core::option::Option< |
| 206 | + unsafe extern "C" fn(arg1: *mut sqlite3_vfs, arg2: *mut ::core::ffi::c_void), |
| 207 | + >, |
| 208 | + pub xRandomness: ::core::option::Option< |
| 209 | + unsafe extern "C" fn( |
| 210 | + arg1: *mut sqlite3_vfs, |
| 211 | + nByte: ::core::ffi::c_int, |
| 212 | + zOut: *mut ::core::ffi::c_char, |
| 213 | + ) -> ::core::ffi::c_int, |
| 214 | + >, |
| 215 | + pub xSleep: ::core::option::Option< |
| 216 | + unsafe extern "C" fn( |
| 217 | + arg1: *mut sqlite3_vfs, |
| 218 | + microseconds: ::core::ffi::c_int, |
| 219 | + ) -> ::core::ffi::c_int, |
| 220 | + >, |
| 221 | + pub xCurrentTime: ::core::option::Option< |
| 222 | + unsafe extern "C" fn( |
| 223 | + arg1: *mut sqlite3_vfs, |
| 224 | + arg2: *mut f64, |
| 225 | + ) -> ::core::ffi::c_int, |
| 226 | + >, |
| 227 | + pub xGetLastError: ::core::option::Option< |
| 228 | + unsafe extern "C" fn( |
| 229 | + arg1: *mut sqlite3_vfs, |
| 230 | + arg2: ::core::ffi::c_int, |
| 231 | + arg3: *mut ::core::ffi::c_char, |
| 232 | + ) -> ::core::ffi::c_int, |
| 233 | + >, |
| 234 | + pub xCurrentTimeInt64: ::core::option::Option< |
| 235 | + unsafe extern "C" fn( |
| 236 | + arg1: *mut sqlite3_vfs, |
| 237 | + arg2: *mut sqlite3_int64, |
| 238 | + ) -> ::core::ffi::c_int, |
| 239 | + >, |
| 240 | + pub xSetSystemCall: ::core::option::Option< |
| 241 | + unsafe extern "C" fn( |
| 242 | + arg1: *mut sqlite3_vfs, |
| 243 | + zName: *const ::core::ffi::c_char, |
| 244 | + arg2: sqlite3_syscall_ptr, |
| 245 | + ) -> ::core::ffi::c_int, |
| 246 | + >, |
| 247 | + pub xGetSystemCall: ::core::option::Option< |
| 248 | + unsafe extern "C" fn( |
| 249 | + arg1: *mut sqlite3_vfs, |
| 250 | + zName: *const ::core::ffi::c_char, |
| 251 | + ) -> sqlite3_syscall_ptr, |
| 252 | + >, |
| 253 | + pub xNextSystemCall: ::core::option::Option< |
| 254 | + unsafe extern "C" fn( |
| 255 | + arg1: *mut sqlite3_vfs, |
| 256 | + zName: *const ::core::ffi::c_char, |
| 257 | + ) -> *const ::core::ffi::c_char, |
| 258 | + >, |
| 259 | +} |
| 260 | + |
| 261 | +unsafe extern "C" { |
| 262 | + pub fn sqlite3_vfs_find(zVfsName: *const ::core::ffi::c_char) -> *mut sqlite3_vfs; |
| 263 | +} |
| 264 | + |
| 265 | +unsafe extern "C" { |
| 266 | + pub fn sqlite3_vfs_register( |
| 267 | + arg1: *mut sqlite3_vfs, |
| 268 | + makeDflt: ::core::ffi::c_int, |
| 269 | + ) -> ::core::ffi::c_int; |
| 270 | +} |
| 271 | + |
| 272 | +unsafe extern "C" { |
| 273 | + pub fn sqlite3_vfs_unregister(arg1: *mut sqlite3_vfs) -> ::core::ffi::c_int; |
| 274 | +} |
0 commit comments