Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sqlite3-sys requirement from 0.16.0 to 0.17.0 in the dependencies group #49

Merged
merged 2 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion concatsql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ chrono = "0.4.35"
concatsql_macro = { version = "0.1.0", path = "../concatsql_macro" }

[dependencies.sqlite3-sys]
version = "0.16.0"
version = "0.17.0"
default-features = false
optional = true

Expand Down
13 changes: 8 additions & 5 deletions concatsql/src/sqlite/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ extern crate sqlite3_sys as ffi;

use std::borrow::Cow;
use std::cell::Cell;
use std::ffi::{c_void, CStr, CString};
use std::ffi::{c_int, c_void, CStr, CString};
use std::path::Path;
use std::ptr::{self, NonNull};

Expand Down Expand Up @@ -340,6 +340,9 @@ unsafe fn bind_all(
params: &[Value<'_>],
error_level: &ErrorLevel,
) -> Result<()> {
// https://sqlite.org/c3ref/c_static.html
const SQLITE_TRANSIENT: c_int = -1;

for (index, param) in (1i32..).zip(params.iter()) {
let result = match param {
Value::Null => ffi::sqlite3_bind_null(stmt, index),
Expand All @@ -355,7 +358,7 @@ unsafe fn bind_all(
Some(std::mem::transmute::<
*const c_void,
extern "C" fn(*mut c_void),
>(ffi::SQLITE_TRANSIENT as *const c_void)),
>(SQLITE_TRANSIENT as *const c_void)),
),
Value::Bytes(value) => ffi::sqlite3_bind_blob(
stmt,
Expand All @@ -365,7 +368,7 @@ unsafe fn bind_all(
Some(std::mem::transmute::<
*const c_void,
extern "C" fn(*mut c_void),
>(ffi::SQLITE_TRANSIENT as *const c_void)),
>(SQLITE_TRANSIENT as *const c_void)),
),
Value::IpAddr(value) => {
let value = value.to_string();
Expand All @@ -377,7 +380,7 @@ unsafe fn bind_all(
Some(std::mem::transmute::<
*const c_void,
extern "C" fn(*mut c_void),
>(ffi::SQLITE_TRANSIENT as *const c_void)),
>(SQLITE_TRANSIENT as *const c_void)),
)
}
Value::Time(value) => {
Expand All @@ -390,7 +393,7 @@ unsafe fn bind_all(
Some(std::mem::transmute::<
*const c_void,
extern "C" fn(*mut c_void),
>(ffi::SQLITE_TRANSIENT as *const c_void)),
>(SQLITE_TRANSIENT as *const c_void)),
)
}
};
Expand Down
Loading