tank_sqlite/
lib.rs

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