tank_sqlite/
lib.rs

1mod cbox;
2mod connection;
3mod driver;
4mod extract;
5mod prepared;
6mod sql_writer;
7mod transaction;
8
9use std::{ffi::CStr, ptr};
10
11pub(crate) use cbox::*;
12pub use connection::*;
13pub use driver::*;
14pub use prepared::*;
15pub use transaction::*;
16
17pub(crate) fn error_message_from_ptr(ptr: &'_ *const i8) -> &'_ str {
18    unsafe {
19        if *ptr != ptr::null() {
20            CStr::from_ptr(*ptr)
21                .to_str()
22                .unwrap_or("Unknown error (the error message was not a valid C string)")
23        } else {
24            "Unknown error (could not extract the error message)"
25        }
26    }
27}