mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 18:18:03 +00:00
Change method name to bind_at to better reflect args in ext Statement
This commit is contained in:
parent
a2f8b2dfea
commit
4142d813c0
1 changed files with 10 additions and 6 deletions
|
@ -2,7 +2,7 @@ use crate::{types::StepResult, ExtResult, ResultCode, Value};
|
|||
use std::{
|
||||
ffi::{c_char, c_void, CStr, CString},
|
||||
num::NonZeroUsize,
|
||||
rc::{Rc, Weak},
|
||||
rc::Rc,
|
||||
};
|
||||
|
||||
pub type RegisterModuleFn = unsafe extern "C" fn(
|
||||
|
@ -475,13 +475,17 @@ impl Connection {
|
|||
}
|
||||
|
||||
impl Statement {
|
||||
/// Bind a value to a parameter in the prepared statement
|
||||
/// Bind a value to a parameter in the prepared statement.
|
||||
///```ignore
|
||||
/// let stmt = conn.prepare_stmt("select * from users where name = ?");
|
||||
/// stmt.bind(1, Value::from_text("test".into()));
|
||||
pub fn bind(&self, idx: NonZeroUsize, arg: &Value) {
|
||||
let arg = arg as *const Value;
|
||||
unsafe { (*self._ctx).bind_args(idx, arg) }
|
||||
/// stmt.bind_at(1, Value::from_text("test".into()));
|
||||
pub fn bind_at(&self, idx: NonZeroUsize, arg: Value) {
|
||||
let arg_ref = &arg;
|
||||
let arg_ptr = arg_ref as *const Value;
|
||||
unsafe {
|
||||
(*self._ctx).bind_args(idx, arg_ptr);
|
||||
arg.__free_internal_type();
|
||||
}
|
||||
}
|
||||
|
||||
/// Execute the statement and return the next row
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue