#[doc = " SAFETY: slice with non-null ptr must points to the valid memory range [ptr..ptr + len)\n ownership of the slice is not transferred - so its either caller owns the data or turso\n as the owner doesn't change - there is no method to free the slice reference - because:\n 1. if tursodb owns it - it will clean it in appropriate time\n 2. if caller owns it - it must clean it in appropriate time with appropriate method and tursodb doesn't know how to properly free the data"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct turso_slice_ref_t {
pub ptr: *const ::std::os::raw::c_void,
pub len: usize,
}
impl Default for turso_slice_ref_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum turso_status_code_t {
TURSO_OK = 0,
TURSO_DONE = 1,
TURSO_ROW = 2,
TURSO_IO = 3,
TURSO_BUSY = 4,
TURSO_INTERRUPT = 5,
TURSO_BUSY_SNAPSHOT = 6,
TURSO_ERROR = 127,
TURSO_MISUSE = 128,
TURSO_CONSTRAINT = 129,
TURSO_READONLY = 130,
TURSO_DATABASE_FULL = 131,
TURSO_NOTADB = 132,
TURSO_CORRUPT = 133,
TURSO_IOERR = 134,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum turso_type_t {
TURSO_TYPE_UNKNOWN = 0,
TURSO_TYPE_INTEGER = 1,
TURSO_TYPE_REAL = 2,
TURSO_TYPE_TEXT = 3,
TURSO_TYPE_BLOB = 4,
TURSO_TYPE_NULL = 5,
}
pub const turso_extension_value_type_t_TURSO_EXTENSION_VALUE_NULL: turso_extension_value_type_t = 0;
pub const turso_extension_value_type_t_TURSO_EXTENSION_VALUE_INTEGER: turso_extension_value_type_t =
1;
pub const turso_extension_value_type_t_TURSO_EXTENSION_VALUE_FLOAT: turso_extension_value_type_t =
2;
pub const turso_extension_value_type_t_TURSO_EXTENSION_VALUE_TEXT: turso_extension_value_type_t = 3;
pub const turso_extension_value_type_t_TURSO_EXTENSION_VALUE_BLOB: turso_extension_value_type_t = 4;
pub const turso_extension_value_type_t_TURSO_EXTENSION_VALUE_ERROR: turso_extension_value_type_t =
5;
pub type turso_extension_value_type_t = ::std::os::raw::c_uint;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_OK: turso_extension_result_code_t =
0;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_ERROR:
turso_extension_result_code_t = 1;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_INVALID_ARGS:
turso_extension_result_code_t = 2;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_UNKNOWN:
turso_extension_result_code_t = 3;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_OOM: turso_extension_result_code_t =
4;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_CORRUPT:
turso_extension_result_code_t = 5;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_NOT_FOUND:
turso_extension_result_code_t = 6;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_ALREADY_EXISTS:
turso_extension_result_code_t = 7;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_PERMISSION_DENIED:
turso_extension_result_code_t = 8;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_ABORTED:
turso_extension_result_code_t = 9;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_OUT_OF_RANGE:
turso_extension_result_code_t = 10;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_UNIMPLEMENTED:
turso_extension_result_code_t = 11;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_INTERNAL:
turso_extension_result_code_t = 12;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_UNAVAILABLE:
turso_extension_result_code_t = 13;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_CUSTOM_ERROR:
turso_extension_result_code_t = 14;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_EOF: turso_extension_result_code_t =
15;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_READ_ONLY:
turso_extension_result_code_t = 16;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_ROWID:
turso_extension_result_code_t = 17;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_ROW: turso_extension_result_code_t =
18;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_INTERRUPT:
turso_extension_result_code_t = 19;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_BUSY: turso_extension_result_code_t =
20;
pub const turso_extension_result_code_t_TURSO_EXTENSION_RESULT_CONSTRAINT_VIOLATION:
turso_extension_result_code_t = 21;
pub type turso_extension_result_code_t = ::std::os::raw::c_uint;
pub const turso_extension_text_subtype_t_TURSO_EXTENSION_TEXT_TEXT: turso_extension_text_subtype_t =
0;
pub const turso_extension_text_subtype_t_TURSO_EXTENSION_TEXT_JSON: turso_extension_text_subtype_t =
1;
pub type turso_extension_text_subtype_t = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct turso_extension_text_t {
pub subtype: turso_extension_text_subtype_t,
pub text: *const u8,
pub len: u32,
}
impl Default for turso_extension_text_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct turso_extension_blob_t {
pub data: *const u8,
pub size: u64,
}
impl Default for turso_extension_blob_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct turso_extension_error_t {
pub code: turso_extension_result_code_t,
pub message: *mut turso_extension_text_t,
}
impl Default for turso_extension_error_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[repr(C)]
#[derive(Copy, Clone)]
pub union turso_extension_value_data_t {
pub int_value: i64,
pub float_value: f64,
pub text: *const turso_extension_text_t,
pub blob: *const turso_extension_blob_t,
pub error: *const turso_extension_error_t,
}
impl Default for turso_extension_value_data_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct turso_value_t {
pub value_type: turso_extension_value_type_t,
pub value: turso_extension_value_data_t,
}
impl Default for turso_value_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct turso_agg_ctx_t {
pub state: *mut ::std::os::raw::c_void,
}
impl Default for turso_agg_ctx_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Frees per-registration state supplied to scalar, aggregate, or collation callbacks."]
pub type turso_context_destructor_t = ::std::option::Option<unsafe extern "C" fn(context: usize)>;
#[doc = " Frees a value returned by a managed scalar or aggregate callback after Turso copies it."]
pub type turso_value_destructor_t =
::std::option::Option<unsafe extern "C" fn(result: *mut turso_value_t)>;
#[doc = " Scalar callback. argv points to argc immutable turso_value_t entries valid only for the call."]
pub type turso_scalar_function_t = ::std::option::Option<
unsafe extern "C" fn(
context: usize,
argc: i32,
argv: *const turso_value_t,
context_destructor: turso_context_destructor_t,
value_destructor: turso_value_destructor_t,
) -> turso_value_t,
>;
#[doc = " Aggregate initializer. Return value is passed unchanged to step/final/destructor callbacks."]
pub type turso_aggregate_init_function_t =
::std::option::Option<unsafe extern "C" fn(context: usize) -> *mut turso_agg_ctx_t>;
#[doc = " Aggregate step callback. argv points to argc immutable turso_value_t entries valid only for the call."]
pub type turso_aggregate_step_function_t = ::std::option::Option<
unsafe extern "C" fn(
context: usize,
aggregate_context: *mut turso_agg_ctx_t,
argc: i32,
argv: *const turso_value_t,
) -> turso_value_t,
>;
#[doc = " Aggregate final callback. The aggregate_context is the value returned by the initializer."]
pub type turso_aggregate_final_function_t = ::std::option::Option<
unsafe extern "C" fn(context: usize, aggregate_context: *mut turso_agg_ctx_t) -> turso_value_t,
>;
#[doc = " Collation callback. Byte ranges are UTF-8 text valid only for the call. Return follows strcmp ordering."]
pub type turso_collation_function_t = ::std::option::Option<
unsafe extern "C" fn(
context: usize,
left_ptr: *const u8,
left_len: usize,
right_ptr: *const u8,
right_len: usize,
) -> i32,
>;
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum turso_tracing_level_t {
TURSO_TRACING_LEVEL_ERROR = 1,
TURSO_TRACING_LEVEL_WARN = 2,
TURSO_TRACING_LEVEL_INFO = 3,
TURSO_TRACING_LEVEL_DEBUG = 4,
TURSO_TRACING_LEVEL_TRACE = 5,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct turso_database {
_unused: [u8; 0],
}
#[doc = " opaque pointer to the TursoDatabase instance\n SAFETY: the database must be opened and closed only once but can be used concurrently"]
pub type turso_database_t = turso_database;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct turso_connection {
_unused: [u8; 0],
}
#[doc = " opaque pointer to the TursoConnection instance\n SAFETY: the connection must be used exclusive and can't be accessed concurrently"]
pub type turso_connection_t = turso_connection;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct turso_statement {
_unused: [u8; 0],
}
#[doc = " opaque pointer to the TursoStatement instance\n SAFETY: the statement must be used exclusive and can't be accessed concurrently"]
pub type turso_statement_t = turso_statement;
unsafe extern "C" {
pub fn turso_version() -> *const ::std::os::raw::c_char;
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct turso_log_t {
pub message: *const ::std::os::raw::c_char,
pub target: *const ::std::os::raw::c_char,
pub file: *const ::std::os::raw::c_char,
pub timestamp: u64,
pub line: usize,
pub level: turso_tracing_level_t,
}
impl Default for turso_log_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct turso_config_t {
#[doc = " SAFETY: turso_log_t log argument fields have lifetime scoped to the logger invocation\n caller must ensure that data is properly copied if it wants it to have longer lifetime"]
pub logger: ::std::option::Option<unsafe extern "C" fn(log: *const turso_log_t)>,
pub log_level: *const ::std::os::raw::c_char,
}
impl Default for turso_config_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Database description."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct turso_database_config_t {
#[doc = " Parameter which defines who drives the IO - callee or the caller (non-zero parameter value interpreted as async IO)"]
pub async_io: u64,
#[doc = " Path to the database file or `:memory:`\n zero-terminated C string"]
pub path: *const ::std::os::raw::c_char,
#[doc = " Optional comma separated list of experimental features to enable\n zero-terminated C string or null pointer"]
pub experimental_features: *const ::std::os::raw::c_char,
#[doc = " optional VFS parameter explicitly specifying FS backend for the database.\n Available options are:\n - \"memory\": in-memory backend\n - \"syscall\": generic syscall backend\n - \"io_uring\": IO uring (supported only on Linux)\n - \"experimental_win_iocp\": Windows IOCP [experimental](supported only on Windows)"]
pub vfs: *const ::std::os::raw::c_char,
#[doc = " optional encryption cipher\n as encryption is experimental - experimental_features must have \"encryption\" in the list"]
pub encryption_cipher: *const ::std::os::raw::c_char,
#[doc = " optional encryption hexkey\n as encryption is experimental - experimental_features must have \"encryption\" in the list"]
pub encryption_hexkey: *const ::std::os::raw::c_char,
}
impl Default for turso_database_config_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
unsafe extern "C" {
#[doc = " Setup global database info"]
pub fn turso_setup(
config: *const turso_config_t,
error_opt_out: *mut *const ::std::os::raw::c_char,
) -> turso_status_code_t;
}
unsafe extern "C" {
#[doc = " Create database holder but do not open it"]
pub fn turso_database_new(
config: *const turso_database_config_t,
database: *mut *const turso_database_t,
error_opt_out: *mut *const ::std::os::raw::c_char,
) -> turso_status_code_t;
}
unsafe extern "C" {
#[doc = " Open database\n Can return TURSO_IO result if async_io=true is set"]
pub fn turso_database_open(
database: *const turso_database_t,
error_opt_out: *mut *const ::std::os::raw::c_char,
) -> turso_status_code_t;
}
unsafe extern "C" {
#[doc = " Connect to the database"]
pub fn turso_database_connect(
self_: *const turso_database_t,
connection: *mut *mut turso_connection_t,
error_opt_out: *mut *const ::std::os::raw::c_char,
) -> turso_status_code_t;
}
unsafe extern "C" {
#[doc = " Set busy timeout for the connection"]
pub fn turso_connection_set_busy_timeout_ms(self_: *const turso_connection_t, timeout_ms: i64);
}
unsafe extern "C" {
#[doc = " Get autocommit state of the connection"]
pub fn turso_connection_get_autocommit(self_: *const turso_connection_t) -> bool;
}
unsafe extern "C" {
#[doc = " Get last insert rowid for the connection or 0 if no inserts happened before"]
pub fn turso_connection_last_insert_rowid(self_: *const turso_connection_t) -> i64;
}
unsafe extern "C" {
#[doc = " Register or replace a per-connection managed scalar function."]
pub fn turso_connection_register_scalar_function(
self_: *const turso_connection_t,
name: *const ::std::os::raw::c_char,
argc: i32,
deterministic: bool,
context: usize,
callback: turso_scalar_function_t,
context_destructor: turso_context_destructor_t,
value_destructor: turso_value_destructor_t,
error_opt_out: *mut *const ::std::os::raw::c_char,
) -> turso_status_code_t;
}
unsafe extern "C" {
#[doc = " Register or replace a per-connection managed aggregate function."]
pub fn turso_connection_register_aggregate_function(
self_: *const turso_connection_t,
name: *const ::std::os::raw::c_char,
argc: i32,
context: usize,
init: turso_aggregate_init_function_t,
step: turso_aggregate_step_function_t,
finalize: turso_aggregate_final_function_t,
context_destructor: turso_context_destructor_t,
aggregate_destructor: turso_context_destructor_t,
value_destructor: turso_value_destructor_t,
error_opt_out: *mut *const ::std::os::raw::c_char,
) -> turso_status_code_t;
}
unsafe extern "C" {
#[doc = " Unregister a per-connection managed scalar or aggregate function."]
pub fn turso_connection_unregister_function(
self_: *const turso_connection_t,
name: *const ::std::os::raw::c_char,
error_opt_out: *mut *const ::std::os::raw::c_char,
) -> turso_status_code_t;
}
unsafe extern "C" {
#[doc = " Register or replace a per-connection managed collation."]
pub fn turso_connection_register_collation(
self_: *const turso_connection_t,
name: *const ::std::os::raw::c_char,
context: usize,
callback: turso_collation_function_t,
context_destructor: turso_context_destructor_t,
error_opt_out: *mut *const ::std::os::raw::c_char,
) -> turso_status_code_t;
}
unsafe extern "C" {
#[doc = " Unregister a per-connection managed collation."]
pub fn turso_connection_unregister_collation(
self_: *const turso_connection_t,
name: *const ::std::os::raw::c_char,
error_opt_out: *mut *const ::std::os::raw::c_char,
) -> turso_status_code_t;
}
unsafe extern "C" {
#[doc = " Enable or disable SQL load_extension() for this connection."]
pub fn turso_connection_enable_load_extension(
self_: *const turso_connection_t,
enabled: bool,
error_opt_out: *mut *const ::std::os::raw::c_char,
) -> turso_status_code_t;
}
unsafe extern "C" {
#[doc = " Load an extension library on this connection using Turso's native extension loader."]
pub fn turso_connection_load_extension(
self_: *const turso_connection_t,
path: *const ::std::os::raw::c_char,
error_opt_out: *mut *const ::std::os::raw::c_char,
) -> turso_status_code_t;
}
unsafe extern "C" {
#[doc = " Prepare single statement in a connection"]
pub fn turso_connection_prepare_single(
self_: *const turso_connection_t,
sql: *const ::std::os::raw::c_char,
statement: *mut *mut turso_statement_t,
error_opt_out: *mut *const ::std::os::raw::c_char,
) -> turso_status_code_t;
}
unsafe extern "C" {
#[doc = " Prepare first statement in a string containing multiple statements in a connection"]
pub fn turso_connection_prepare_first(
self_: *const turso_connection_t,
sql: *const ::std::os::raw::c_char,
statement: *mut *mut turso_statement_t,
tail_idx: *mut usize,
error_opt_out: *mut *const ::std::os::raw::c_char,
) -> turso_status_code_t;
}
unsafe extern "C" {
#[doc = " close the connection preventing any further operations executed over it\n caller still need to call deinit method to reclaim memory from the instance holding connection\n SAFETY: caller must guarantee that no ongoing operations are running over connection before calling turso_connection_close(...) method"]
pub fn turso_connection_close(
self_: *const turso_connection_t,
error_opt_out: *mut *const ::std::os::raw::c_char,
) -> turso_status_code_t;
}
unsafe extern "C" {
#[doc = " Execute single statement\n execute returns TURSO_DONE if execution completed\n execute returns TURSO_IO if async_io was set and execution needs IO in order to make progress"]
pub fn turso_statement_execute(
self_: *const turso_statement_t,
rows_changes: *mut u64,
error_opt_out: *mut *const ::std::os::raw::c_char,
) -> turso_status_code_t;
}
unsafe extern "C" {
#[doc = " Step statement execution once\n Returns TURSO_DONE if execution finished\n Returns TURSO_ROW if execution generated the row (row values can be inspected with corresponding statement methods)\n Returns TURSO_IO if async_io was set and statement needs to execute IO to make progress"]
pub fn turso_statement_step(
self_: *const turso_statement_t,
error_opt_out: *mut *const ::std::os::raw::c_char,
) -> turso_status_code_t;
}
unsafe extern "C" {
#[doc = " Execute one iteration of underlying IO backend after TURSO_IO status code\n This function either return some ERROR status or TURSO_OK"]
pub fn turso_statement_run_io(
self_: *const turso_statement_t,
error_opt_out: *mut *const ::std::os::raw::c_char,
) -> turso_status_code_t;
}
unsafe extern "C" {
#[doc = " Reset a statement\n This method must be called in order to cleanup statement resources and prepare it for re-execution\n Any pending execution will be aborted - be careful and in certain cases ensure that turso_statement_finalize called before turso_statement_reset"]
pub fn turso_statement_reset(
self_: *const turso_statement_t,
error_opt_out: *mut *const ::std::os::raw::c_char,
) -> turso_status_code_t;
}
unsafe extern "C" {
#[doc = " Finalize a statement\n finalize returns TURSO_DONE if finalization completed\n This method must be called in the end of statement execution (either successfull or not)"]
pub fn turso_statement_finalize(
self_: *const turso_statement_t,
error_opt_out: *mut *const ::std::os::raw::c_char,
) -> turso_status_code_t;
}
unsafe extern "C" {
#[doc = " return amount of row modifications (insert/delete operations) made by the most recent executed statement"]
pub fn turso_statement_n_change(self_: *const turso_statement_t) -> i64;
}
unsafe extern "C" {
#[doc = " Get column count"]
pub fn turso_statement_column_count(self_: *const turso_statement_t) -> i64;
}
unsafe extern "C" {
#[doc = " Get the column name at the index\n C string allocated by Turso must be freed after the usage with corresponding turso_str_deinit(...) method"]
pub fn turso_statement_column_name(
self_: *const turso_statement_t,
index: usize,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
#[doc = " Get the column declared type at the index (e.g. \"INTEGER\", \"TEXT\", \"DATETIME\", etc.)\n Returns NULL if the column type is not available.\n C string allocated by Turso must be freed after the usage with corresponding turso_str_deinit(...) method"]
pub fn turso_statement_column_decltype(
self_: *const turso_statement_t,
index: usize,
) -> *const ::std::os::raw::c_char;
}
pub const turso_column_kind_t_TURSO_COLUMN_KIND_NONE: turso_column_kind_t = -1;
pub const turso_column_kind_t_TURSO_COLUMN_KIND_BUILTIN: turso_column_kind_t = 0;
pub const turso_column_kind_t_TURSO_COLUMN_KIND_CUSTOM: turso_column_kind_t = 1;
pub const turso_column_kind_t_TURSO_COLUMN_KIND_DOMAIN: turso_column_kind_t = 2;
pub const turso_column_kind_t_TURSO_COLUMN_KIND_STRUCT: turso_column_kind_t = 3;
pub const turso_column_kind_t_TURSO_COLUMN_KIND_UNION: turso_column_kind_t = 4;
#[doc = " Classification of a result column's declared type.\n\n Returned by turso_statement_column_kind. Values match the\n ColumnTypeKind variants in the Rust API and are kept stable: new kinds\n are appended."]
pub type turso_column_kind_t = ::std::os::raw::c_int;
unsafe extern "C" {
#[doc = " Get the declared type name of the column at `index`.\n\n Returns the same string as turso_statement_column_decltype, but resolved\n through the richer type-info path so the result is consistent with the\n other turso_statement_column_* getters declared below.\n\n Returns NULL when no type info is available (statement finalized, index\n out of bounds, or the result column is not a direct table-column ref).\n C string allocated by Turso must be freed with turso_str_deinit."]
pub fn turso_statement_column_declared_name(
self_: *const turso_statement_t,
index: usize,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
#[doc = " Get the array depth of the column at `index`.\n\n Returns 0 for scalar table columns, n for n-dimensional array columns\n (e.g. INTEGER[][] -> 2), and 0 when no type info is available. To\n distinguish \"scalar column\" from \"no info\", check\n turso_statement_column_kind first: it returns TURSO_COLUMN_KIND_NONE in\n the latter case."]
pub fn turso_statement_column_array_dimensions(
self_: *const turso_statement_t,
index: usize,
) -> u32;
}
unsafe extern "C" {
#[doc = " Get the underlying primitive type name for columns whose declared type\n is a CREATE TYPE or CREATE DOMAIN.\n\n Returns one of \"INTEGER\", \"TEXT\", \"REAL\", \"BLOB\", \"NUMERIC\". Returns NULL\n when the declared type is a built-in primitive directly, when no type\n info is available, or when the column is not a direct table-column\n reference. C string allocated by Turso must be freed with\n turso_str_deinit."]
pub fn turso_statement_column_base_type(
self_: *const turso_statement_t,
index: usize,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
#[doc = " Classify the column's declared type as builtin / custom / domain /\n struct / union (see turso_column_kind_t).\n\n Returns TURSO_COLUMN_KIND_NONE when no type information is available."]
pub fn turso_statement_column_kind(
self_: *const turso_statement_t,
index: usize,
) -> turso_column_kind_t;
}
unsafe extern "C" {
#[doc = " Get the row value at the the index for a current statement state\n SAFETY: returned pointers will be valid only until next invocation of statement operation (step, finalize, reset, etc)\n Caller must make sure that any non-owning memory is copied appropriated if it will be used for longer lifetime"]
pub fn turso_statement_row_value_kind(
self_: *const turso_statement_t,
index: usize,
) -> turso_type_t;
}
unsafe extern "C" {
pub fn turso_statement_row_value_bytes_count(
self_: *const turso_statement_t,
index: usize,
) -> i64;
}
unsafe extern "C" {
pub fn turso_statement_row_value_bytes_ptr(
self_: *const turso_statement_t,
index: usize,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
pub fn turso_statement_row_value_int(self_: *const turso_statement_t, index: usize) -> i64;
}
unsafe extern "C" {
pub fn turso_statement_row_value_double(self_: *const turso_statement_t, index: usize) -> f64;
}
unsafe extern "C" {
#[doc = " Return named argument position in a statement\nReturn positive integer with 1-indexed position if named parameter was found\nReturn -1 if parameter was not found"]
pub fn turso_statement_named_position(
self_: *const turso_statement_t,
name: *const ::std::os::raw::c_char,
) -> i64;
}
unsafe extern "C" {
#[doc = " Return parameters count for the statement\n -1 if pointer is invalid"]
pub fn turso_statement_parameters_count(self_: *const turso_statement_t) -> i64;
}
unsafe extern "C" {
#[doc = " Return the name of the parameter at 1-based index, including the SQL prefix.\nReturns NULL for positional-only parameters or out-of-range indices.\nThe caller must free the returned string with turso_str_deinit."]
pub fn turso_statement_parameter_name(
self_: *const turso_statement_t,
index: i64,
) -> *const ::std::os::raw::c_char;
}
unsafe extern "C" {
#[doc = " Bind a positional argument to a statement"]
pub fn turso_statement_bind_positional_null(
self_: *const turso_statement_t,
position: usize,
) -> turso_status_code_t;
}
unsafe extern "C" {
pub fn turso_statement_bind_positional_int(
self_: *const turso_statement_t,
position: usize,
value: i64,
) -> turso_status_code_t;
}
unsafe extern "C" {
pub fn turso_statement_bind_positional_double(
self_: *const turso_statement_t,
position: usize,
value: f64,
) -> turso_status_code_t;
}
unsafe extern "C" {
pub fn turso_statement_bind_positional_blob(
self_: *const turso_statement_t,
position: usize,
ptr: *const ::std::os::raw::c_char,
len: usize,
) -> turso_status_code_t;
}
unsafe extern "C" {
pub fn turso_statement_bind_positional_text(
self_: *const turso_statement_t,
position: usize,
ptr: *const ::std::os::raw::c_char,
len: usize,
) -> turso_status_code_t;
}
unsafe extern "C" {
#[doc = " Deallocate C string allocated by Turso"]
pub fn turso_str_deinit(self_: *const ::std::os::raw::c_char);
}
unsafe extern "C" {
#[doc = " Deallocate and close a database\n SAFETY: caller must ensure that no other code can concurrently or later call methods over deinited database"]
pub fn turso_database_deinit(self_: *const turso_database_t);
}
unsafe extern "C" {
#[doc = " Deallocate and close a connection\n SAFETY: caller must ensure that no other code can concurrently or later call methods over deinited connection"]
pub fn turso_connection_deinit(self_: *const turso_connection_t);
}
unsafe extern "C" {
#[doc = " Deallocate and close a statement\n SAFETY: caller must ensure that no other code can concurrently or later call methods over deinited statement"]
pub fn turso_statement_deinit(self_: *const turso_statement_t);
}