Check that only one statement is provided (#397)

Connection.execute
Connection.execute_named
Connection.quer_row
Connection.quer_row_named
This commit is contained in:
gwenn
2018-10-28 10:28:19 +01:00
parent ebf98b4241
commit 77cb50e000
4 changed files with 56 additions and 13 deletions

View File

@@ -1,16 +1,16 @@
use super::ffi;
use super::unlock_notify;
use std::ffi::CStr;
use std::os::raw::c_int;
use std::os::raw::{c_char, c_int};
use std::ptr;
// Private newtype for raw sqlite3_stmts that finalize themselves when dropped.
#[derive(Debug)]
pub struct RawStatement(*mut ffi::sqlite3_stmt);
pub struct RawStatement(*mut ffi::sqlite3_stmt, *const c_char);
impl RawStatement {
pub fn new(stmt: *mut ffi::sqlite3_stmt) -> RawStatement {
RawStatement(stmt)
pub fn new(stmt: *mut ffi::sqlite3_stmt, tail: *const c_char) -> RawStatement {
RawStatement(stmt, tail)
}
pub unsafe fn ptr(&self) -> *mut ffi::sqlite3_stmt {
@@ -100,6 +100,10 @@ impl RawStatement {
}
}
}
pub fn has_tail(&self) -> bool {
!self.1.is_null()
}
}
impl Drop for RawStatement {