mirror of
https://github.com/fluencelabs/sqlite-wasm-connector
synced 2025-03-15 06:20:50 +00:00
commit
a34f7ed906
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "marine-sqlite-connector"
|
||||
version = "0.5.0"
|
||||
version = "0.5.1"
|
||||
license = "Apache-2.0/MIT"
|
||||
authors = [
|
||||
"Daniel Dulaney <ddy@vitronic.com>",
|
||||
|
@ -27,7 +27,7 @@ impl Connection {
|
||||
unsafe {
|
||||
let path = path.as_ref();
|
||||
let path = path.to_string_lossy().into_owned();
|
||||
let result = ffi::sqlite3_open_v2(path, flags.0, String::new());
|
||||
let result = ffi::sqlite3_open_v2(&path, flags.0, &String::new());
|
||||
|
||||
match result.ret_code {
|
||||
ffi::SQLITE_OK => {}
|
||||
|
@ -36,7 +36,7 @@ extern "C" {
|
||||
const char *zVfs /* Name of VFS module to use */
|
||||
);
|
||||
*/
|
||||
pub fn sqlite3_open_v2(filename: String, flags: i32, vfs: String) -> DBOpenDescriptor;
|
||||
pub fn sqlite3_open_v2(filename: &str, flags: i32, vfs: &str) -> DBOpenDescriptor;
|
||||
|
||||
// SQLITE_API int sqlite3_close(sqlite3*);
|
||||
pub fn sqlite3_close(db_handle: u32) -> i32;
|
||||
@ -50,7 +50,7 @@ extern "C" {
|
||||
const char **pzTail /* OUT: Pointer to unused portion of zSql */
|
||||
);
|
||||
*/
|
||||
pub fn sqlite3_prepare_v2(db_handle: u32, sql: String) -> DBPrepareDescriptor;
|
||||
pub fn sqlite3_prepare_v2(db_handle: u32, sql: &str) -> DBPrepareDescriptor;
|
||||
|
||||
/*
|
||||
SQLITE_API int sqlite3_exec(
|
||||
@ -63,7 +63,7 @@ extern "C" {
|
||||
*/
|
||||
pub fn sqlite3_exec(
|
||||
db_handle: u32,
|
||||
sql: String,
|
||||
sql: &str,
|
||||
callback_id: i32,
|
||||
callback_arg: i32,
|
||||
) -> DBExecDescriptor;
|
||||
@ -99,7 +99,7 @@ extern "C" {
|
||||
pub fn sqlite3_reset(stmt_handle: u32) -> i32;
|
||||
|
||||
// SQLITE_API int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
|
||||
pub fn sqlite3_bind_blob(stmt_handle: u32, pos: i32, blob: Vec<u8>, xDel: i32) -> i32;
|
||||
pub fn sqlite3_bind_blob(stmt_handle: u32, pos: i32, blob: &Vec<u8>, xDel: i32) -> i32;
|
||||
|
||||
// SQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double);
|
||||
pub fn sqlite3_bind_double(stmt_handle: u32, pos: i32, value: f64) -> i32;
|
||||
@ -111,7 +111,7 @@ extern "C" {
|
||||
pub fn sqlite3_bind_null(stmt_handle: u32, pos: i32) -> i32;
|
||||
|
||||
// SQLITE_API int sqlite3_bind_text(sqlite3_stmt*,int,const char*,int,void(*)(void*));
|
||||
pub fn sqlite3_bind_text(stmt_handle: u32, pos: i32, text: String, xDel: i32) -> i32;
|
||||
pub fn sqlite3_bind_text(stmt_handle: u32, pos: i32, text: &str, xDel: i32) -> i32;
|
||||
|
||||
// SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt)
|
||||
pub fn sqlite3_column_count(stmt_handle: u32) -> i32;
|
||||
|
@ -128,16 +128,16 @@ impl<'l> Drop for Statement {
|
||||
impl Bindable for &Value {
|
||||
fn bind(self, statement: &mut Statement, i: usize) -> Result<()> {
|
||||
match self {
|
||||
&Value::Binary(ref value) => (value as &[u8]).bind(statement, i),
|
||||
Value::Binary(value) => value.bind(statement, i),
|
||||
&Value::Float(value) => value.bind(statement, i),
|
||||
&Value::Integer(value) => value.bind(statement, i),
|
||||
&Value::String(ref value) => (value as &str).bind(statement, i),
|
||||
&Value::Null => ().bind(statement, i),
|
||||
Value::String(value) => value.as_str().bind(statement, i),
|
||||
Value::Null => ().bind(statement, i),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Bindable for &[u8] {
|
||||
impl Bindable for &Vec<u8> {
|
||||
#[inline]
|
||||
fn bind(self, statement: &mut Statement, i: usize) -> Result<()> {
|
||||
debug_assert!(i > 0, "the indexing starts from 1");
|
||||
|
Loading…
x
Reference in New Issue
Block a user