mirror of
https://github.com/isar/rusqlite.git
synced 2025-10-30 05:18:56 +08:00
Introduce to_sqlite_error
643c0f699f
One small step to support creating loadable extension
This commit is contained in:
@@ -6,4 +6,4 @@ pub(crate) use small_cstr::SmallCString;
|
||||
|
||||
// Doesn't use any modern features or vtab stuff, but is only used by them.
|
||||
mod sqlite_string;
|
||||
pub(crate) use sqlite_string::SqliteMallocString;
|
||||
pub(crate) use sqlite_string::{alloc, SqliteMallocString};
|
||||
|
||||
@@ -7,6 +7,12 @@ use std::marker::PhantomData;
|
||||
use std::os::raw::{c_char, c_int};
|
||||
use std::ptr::NonNull;
|
||||
|
||||
// Space to hold this string must be obtained
|
||||
// from an SQLite memory allocation function
|
||||
pub(crate) fn alloc(s: &str) -> *mut c_char {
|
||||
SqliteMallocString::from_str(s).into_raw()
|
||||
}
|
||||
|
||||
/// A string we own that's allocated on the SQLite heap. Automatically calls
|
||||
/// `sqlite3_free` when dropped, unless `into_raw` (or `into_inner`) is called
|
||||
/// on it. If constructed from a rust string, `sqlite3_malloc` is used.
|
||||
|
||||
Reference in New Issue
Block a user