Skip to content

Commit

Permalink
Merge pull request #287 from libsql/lucio/transient
Browse files Browse the repository at this point in the history
libsql: Use `SQLITE_TRANSIENT` for text/blob
  • Loading branch information
penberg authored Aug 16, 2023
2 parents ef470f4 + 3a77fa5 commit 3d46e4b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions crates/libsql-sys/src/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl Statement {
idx,
value.as_ptr() as *const c_char,
value.len() as i32,
None,
SQLITE_TRANSIENT(),
);
}
}
Expand All @@ -64,7 +64,7 @@ impl Statement {
idx,
value.as_ptr() as *const std::ffi::c_void,
value.len() as i32,
None,
SQLITE_TRANSIENT(),
);
}
}
Expand Down Expand Up @@ -198,3 +198,9 @@ fn len_as_c_int(len: usize) -> Result<c_int> {
Ok(len as c_int)
}
}

#[must_use]
#[allow(non_snake_case)]
pub fn SQLITE_TRANSIENT() -> crate::ffi::sqlite3_destructor_type {
Some(unsafe { std::mem::transmute(-1_isize) })
}

0 comments on commit 3d46e4b

Please sign in to comment.