mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-26 11:31:37 +08:00
Merge remote-tracking branch 'upstream/master' into remove_check_macro
# Conflicts: # src/blob/pos_io.rs
This commit is contained in:
commit
187d1fec07
@ -42,7 +42,7 @@ winsqlite3 = ["min_sqlite_version_3_7_16"]
|
|||||||
openssl-sys = { version = "0.9.58", optional = true }
|
openssl-sys = { version = "0.9.58", optional = true }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
bindgen = { version = "0.58", optional = true, default-features = false, features = ["runtime"] }
|
bindgen = { version = "0.59", optional = true, default-features = false, features = ["runtime"] }
|
||||||
pkg-config = { version = "0.3.19", optional = true }
|
pkg-config = { version = "0.3.19", optional = true }
|
||||||
cc = { version = "1.0", optional = true }
|
cc = { version = "1.0", optional = true }
|
||||||
vcpkg = { version = "0.2", optional = true }
|
vcpkg = { version = "0.2", optional = true }
|
||||||
|
@ -40,7 +40,7 @@ use std::time::Duration;
|
|||||||
|
|
||||||
use crate::ffi;
|
use crate::ffi;
|
||||||
|
|
||||||
use crate::error::{error_from_handle, error_from_sqlite_code};
|
use crate::error::error_from_handle;
|
||||||
use crate::{Connection, DatabaseName, Result};
|
use crate::{Connection, DatabaseName, Result};
|
||||||
|
|
||||||
impl Connection {
|
impl Connection {
|
||||||
@ -169,7 +169,7 @@ pub struct Progress {
|
|||||||
/// A handle to an online backup.
|
/// A handle to an online backup.
|
||||||
pub struct Backup<'a, 'b> {
|
pub struct Backup<'a, 'b> {
|
||||||
phantom_from: PhantomData<&'a Connection>,
|
phantom_from: PhantomData<&'a Connection>,
|
||||||
phantom_to: PhantomData<&'b Connection>,
|
to: &'b Connection,
|
||||||
b: *mut ffi::sqlite3_backup,
|
b: *mut ffi::sqlite3_backup,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ impl Backup<'_, '_> {
|
|||||||
|
|
||||||
Ok(Backup {
|
Ok(Backup {
|
||||||
phantom_from: PhantomData,
|
phantom_from: PhantomData,
|
||||||
phantom_to: PhantomData,
|
to,
|
||||||
b,
|
b,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -263,7 +263,7 @@ impl Backup<'_, '_> {
|
|||||||
ffi::SQLITE_OK => Ok(More),
|
ffi::SQLITE_OK => Ok(More),
|
||||||
ffi::SQLITE_BUSY => Ok(Busy),
|
ffi::SQLITE_BUSY => Ok(Busy),
|
||||||
ffi::SQLITE_LOCKED => Ok(Locked),
|
ffi::SQLITE_LOCKED => Ok(Locked),
|
||||||
_ => Err(error_from_sqlite_code(rc, None)),
|
_ => self.to.decode_result(rc).map(|_| More),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ use std::convert::TryFrom;
|
|||||||
use std::mem::MaybeUninit;
|
use std::mem::MaybeUninit;
|
||||||
use std::slice::from_raw_parts_mut;
|
use std::slice::from_raw_parts_mut;
|
||||||
|
|
||||||
use crate::error::check;
|
|
||||||
use crate::ffi;
|
use crate::ffi;
|
||||||
use crate::{Error, Result};
|
use crate::{Error, Result};
|
||||||
|
|
||||||
@ -45,7 +44,7 @@ impl<'conn> Blob<'conn> {
|
|||||||
// losslessly converted to i32, since `len` came from an i32.
|
// losslessly converted to i32, since `len` came from an i32.
|
||||||
// Sanity check the above.
|
// Sanity check the above.
|
||||||
debug_assert!(i32::try_from(write_start).is_ok() && i32::try_from(buf.len()).is_ok());
|
debug_assert!(i32::try_from(write_start).is_ok() && i32::try_from(buf.len()).is_ok());
|
||||||
check(unsafe {
|
self.conn.decode_result(unsafe {
|
||||||
ffi::sqlite3_blob_write(
|
ffi::sqlite3_blob_write(
|
||||||
self.blob,
|
self.blob,
|
||||||
buf.as_ptr() as *const _,
|
buf.as_ptr() as *const _,
|
||||||
@ -151,7 +150,7 @@ impl<'conn> Blob<'conn> {
|
|||||||
debug_assert!(i32::try_from(read_len).is_ok());
|
debug_assert!(i32::try_from(read_len).is_ok());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
check(ffi::sqlite3_blob_read(
|
self.conn.decode_result(ffi::sqlite3_blob_read(
|
||||||
self.blob,
|
self.blob,
|
||||||
buf.as_mut_ptr() as *mut _,
|
buf.as_mut_ptr() as *mut _,
|
||||||
read_len as i32,
|
read_len as i32,
|
||||||
|
69
src/lib.rs
69
src/lib.rs
@ -1082,7 +1082,7 @@ mod test {
|
|||||||
ensure_sync::<InterruptHandle>();
|
ensure_sync::<InterruptHandle>();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn checked_memory_handle() -> Connection {
|
fn checked_memory_handle() -> Connection {
|
||||||
Connection::open_in_memory().unwrap()
|
Connection::open_in_memory().unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1210,7 +1210,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_close_retry() -> Result<()> {
|
fn test_close_retry() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
|
|
||||||
// force the DB to be busy by preparing a statement; this must be done at the
|
// force the DB to be busy by preparing a statement; this must be done at the
|
||||||
// FFI level to allow us to call .close() without dropping the prepared
|
// FFI level to allow us to call .close() without dropping the prepared
|
||||||
@ -1263,7 +1263,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_execute_batch() -> Result<()> {
|
fn test_execute_batch() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
let sql = "BEGIN;
|
let sql = "BEGIN;
|
||||||
CREATE TABLE foo(x INTEGER);
|
CREATE TABLE foo(x INTEGER);
|
||||||
INSERT INTO foo VALUES(1);
|
INSERT INTO foo VALUES(1);
|
||||||
@ -1281,7 +1281,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_execute() -> Result<()> {
|
fn test_execute() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
db.execute_batch("CREATE TABLE foo(x INTEGER)")?;
|
db.execute_batch("CREATE TABLE foo(x INTEGER)")?;
|
||||||
|
|
||||||
assert_eq!(1, db.execute("INSERT INTO foo(x) VALUES (?)", [1i32])?);
|
assert_eq!(1, db.execute("INSERT INTO foo(x) VALUES (?)", [1i32])?);
|
||||||
@ -1322,7 +1322,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_prepare_column_names() -> Result<()> {
|
fn test_prepare_column_names() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
db.execute_batch("CREATE TABLE foo(x INTEGER);")?;
|
db.execute_batch("CREATE TABLE foo(x INTEGER);")?;
|
||||||
|
|
||||||
let stmt = db.prepare("SELECT * FROM foo")?;
|
let stmt = db.prepare("SELECT * FROM foo")?;
|
||||||
@ -1337,7 +1337,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_prepare_execute() -> Result<()> {
|
fn test_prepare_execute() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
db.execute_batch("CREATE TABLE foo(x INTEGER);")?;
|
db.execute_batch("CREATE TABLE foo(x INTEGER);")?;
|
||||||
|
|
||||||
let mut insert_stmt = db.prepare("INSERT INTO foo(x) VALUES(?)")?;
|
let mut insert_stmt = db.prepare("INSERT INTO foo(x) VALUES(?)")?;
|
||||||
@ -1358,7 +1358,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_prepare_query() -> Result<()> {
|
fn test_prepare_query() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
db.execute_batch("CREATE TABLE foo(x INTEGER);")?;
|
db.execute_batch("CREATE TABLE foo(x INTEGER);")?;
|
||||||
|
|
||||||
let mut insert_stmt = db.prepare("INSERT INTO foo(x) VALUES(?)")?;
|
let mut insert_stmt = db.prepare("INSERT INTO foo(x) VALUES(?)")?;
|
||||||
@ -1393,7 +1393,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_query_map() -> Result<()> {
|
fn test_query_map() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
let sql = "BEGIN;
|
let sql = "BEGIN;
|
||||||
CREATE TABLE foo(x INTEGER, y TEXT);
|
CREATE TABLE foo(x INTEGER, y TEXT);
|
||||||
INSERT INTO foo VALUES(4, \"hello\");
|
INSERT INTO foo VALUES(4, \"hello\");
|
||||||
@ -1412,7 +1412,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_query_row() -> Result<()> {
|
fn test_query_row() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
let sql = "BEGIN;
|
let sql = "BEGIN;
|
||||||
CREATE TABLE foo(x INTEGER);
|
CREATE TABLE foo(x INTEGER);
|
||||||
INSERT INTO foo VALUES(1);
|
INSERT INTO foo VALUES(1);
|
||||||
@ -1441,7 +1441,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_optional() -> Result<()> {
|
fn test_optional() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
|
|
||||||
let result: Result<i64> = db.query_row("SELECT 1 WHERE 0 <> 0", [], |r| r.get(0));
|
let result: Result<i64> = db.query_row("SELECT 1 WHERE 0 <> 0", [], |r| r.get(0));
|
||||||
let result = result.optional();
|
let result = result.optional();
|
||||||
@ -1465,7 +1465,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_pragma_query_row() -> Result<()> {
|
fn test_pragma_query_row() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
"memory",
|
"memory",
|
||||||
@ -1480,7 +1480,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_prepare_failures() -> Result<()> {
|
fn test_prepare_failures() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
db.execute_batch("CREATE TABLE foo(x INTEGER);")?;
|
db.execute_batch("CREATE TABLE foo(x INTEGER);")?;
|
||||||
|
|
||||||
let err = db.prepare("SELECT * FROM does_not_exist").unwrap_err();
|
let err = db.prepare("SELECT * FROM does_not_exist").unwrap_err();
|
||||||
@ -1490,7 +1490,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_last_insert_rowid() -> Result<()> {
|
fn test_last_insert_rowid() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
db.execute_batch("CREATE TABLE foo(x INTEGER PRIMARY KEY)")?;
|
db.execute_batch("CREATE TABLE foo(x INTEGER PRIMARY KEY)")?;
|
||||||
db.execute_batch("INSERT INTO foo DEFAULT VALUES")?;
|
db.execute_batch("INSERT INTO foo DEFAULT VALUES")?;
|
||||||
|
|
||||||
@ -1505,18 +1505,19 @@ mod test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_is_autocommit() {
|
fn test_is_autocommit() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
assert!(
|
assert!(
|
||||||
db.is_autocommit(),
|
db.is_autocommit(),
|
||||||
"autocommit expected to be active by default"
|
"autocommit expected to be active by default"
|
||||||
);
|
);
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(feature = "modern_sqlite")]
|
#[cfg(feature = "modern_sqlite")]
|
||||||
fn test_is_busy() -> Result<()> {
|
fn test_is_busy() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
assert!(!db.is_busy());
|
assert!(!db.is_busy());
|
||||||
let mut stmt = db.prepare("PRAGMA schema_version")?;
|
let mut stmt = db.prepare("PRAGMA schema_version")?;
|
||||||
assert!(!db.is_busy());
|
assert!(!db.is_busy());
|
||||||
@ -1533,7 +1534,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_statement_debugging() -> Result<()> {
|
fn test_statement_debugging() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
let query = "SELECT 12345";
|
let query = "SELECT 12345";
|
||||||
let stmt = db.prepare(query)?;
|
let stmt = db.prepare(query)?;
|
||||||
|
|
||||||
@ -1552,7 +1553,7 @@ mod test {
|
|||||||
#[cfg(not(feature = "modern_sqlite"))]
|
#[cfg(not(feature = "modern_sqlite"))]
|
||||||
fn check_extended_code(_extended_code: c_int) {}
|
fn check_extended_code(_extended_code: c_int) {}
|
||||||
|
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
db.execute_batch("CREATE TABLE foo(x NOT NULL)")?;
|
db.execute_batch("CREATE TABLE foo(x NOT NULL)")?;
|
||||||
|
|
||||||
let result = db.execute("INSERT INTO foo (x) VALUES (NULL)", []);
|
let result = db.execute("INSERT INTO foo (x) VALUES (NULL)", []);
|
||||||
@ -1581,7 +1582,7 @@ mod test {
|
|||||||
#[test]
|
#[test]
|
||||||
#[cfg(feature = "functions")]
|
#[cfg(feature = "functions")]
|
||||||
fn test_interrupt() -> Result<()> {
|
fn test_interrupt() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
|
|
||||||
let interrupt_handle = db.get_interrupt_handle();
|
let interrupt_handle = db.get_interrupt_handle();
|
||||||
|
|
||||||
@ -1629,7 +1630,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_get_raw() -> Result<()> {
|
fn test_get_raw() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
db.execute_batch("CREATE TABLE foo(i, x);")?;
|
db.execute_batch("CREATE TABLE foo(i, x);")?;
|
||||||
let vals = ["foobar", "1234", "qwerty"];
|
let vals = ["foobar", "1234", "qwerty"];
|
||||||
let mut insert_stmt = db.prepare("INSERT INTO foo(i, x) VALUES(?, ?)")?;
|
let mut insert_stmt = db.prepare("INSERT INTO foo(i, x) VALUES(?, ?)")?;
|
||||||
@ -1662,7 +1663,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_from_handle() -> Result<()> {
|
fn test_from_handle() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
let handle = unsafe { db.handle() };
|
let handle = unsafe { db.handle() };
|
||||||
{
|
{
|
||||||
let db = unsafe { Connection::from_handle(handle) }?;
|
let db = unsafe { Connection::from_handle(handle) }?;
|
||||||
@ -1714,7 +1715,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_query_and_then() -> Result<()> {
|
fn test_query_and_then() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
let sql = "BEGIN;
|
let sql = "BEGIN;
|
||||||
CREATE TABLE foo(x INTEGER, y TEXT);
|
CREATE TABLE foo(x INTEGER, y TEXT);
|
||||||
INSERT INTO foo VALUES(4, \"hello\");
|
INSERT INTO foo VALUES(4, \"hello\");
|
||||||
@ -1734,7 +1735,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_query_and_then_fails() -> Result<()> {
|
fn test_query_and_then_fails() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
let sql = "BEGIN;
|
let sql = "BEGIN;
|
||||||
CREATE TABLE foo(x INTEGER, y TEXT);
|
CREATE TABLE foo(x INTEGER, y TEXT);
|
||||||
INSERT INTO foo VALUES(4, \"hello\");
|
INSERT INTO foo VALUES(4, \"hello\");
|
||||||
@ -1764,7 +1765,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_query_and_then_custom_error() -> CustomResult<()> {
|
fn test_query_and_then_custom_error() -> CustomResult<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
let sql = "BEGIN;
|
let sql = "BEGIN;
|
||||||
CREATE TABLE foo(x INTEGER, y TEXT);
|
CREATE TABLE foo(x INTEGER, y TEXT);
|
||||||
INSERT INTO foo VALUES(4, \"hello\");
|
INSERT INTO foo VALUES(4, \"hello\");
|
||||||
@ -1785,7 +1786,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_query_and_then_custom_error_fails() -> Result<()> {
|
fn test_query_and_then_custom_error_fails() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
let sql = "BEGIN;
|
let sql = "BEGIN;
|
||||||
CREATE TABLE foo(x INTEGER, y TEXT);
|
CREATE TABLE foo(x INTEGER, y TEXT);
|
||||||
INSERT INTO foo VALUES(4, \"hello\");
|
INSERT INTO foo VALUES(4, \"hello\");
|
||||||
@ -1827,7 +1828,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_query_row_and_then_custom_error() -> CustomResult<()> {
|
fn test_query_row_and_then_custom_error() -> CustomResult<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
let sql = "BEGIN;
|
let sql = "BEGIN;
|
||||||
CREATE TABLE foo(x INTEGER, y TEXT);
|
CREATE TABLE foo(x INTEGER, y TEXT);
|
||||||
INSERT INTO foo VALUES(4, \"hello\");
|
INSERT INTO foo VALUES(4, \"hello\");
|
||||||
@ -1844,7 +1845,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_query_row_and_then_custom_error_fails() -> Result<()> {
|
fn test_query_row_and_then_custom_error_fails() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
let sql = "BEGIN;
|
let sql = "BEGIN;
|
||||||
CREATE TABLE foo(x INTEGER, y TEXT);
|
CREATE TABLE foo(x INTEGER, y TEXT);
|
||||||
INSERT INTO foo VALUES(4, \"hello\");
|
INSERT INTO foo VALUES(4, \"hello\");
|
||||||
@ -1881,7 +1882,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_dynamic() -> Result<()> {
|
fn test_dynamic() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
let sql = "BEGIN;
|
let sql = "BEGIN;
|
||||||
CREATE TABLE foo(x INTEGER, y TEXT);
|
CREATE TABLE foo(x INTEGER, y TEXT);
|
||||||
INSERT INTO foo VALUES(4, \"hello\");
|
INSERT INTO foo VALUES(4, \"hello\");
|
||||||
@ -1895,7 +1896,7 @@ mod test {
|
|||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_dyn_box() -> Result<()> {
|
fn test_dyn_box() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
db.execute_batch("CREATE TABLE foo(x INTEGER);")?;
|
db.execute_batch("CREATE TABLE foo(x INTEGER);")?;
|
||||||
let b: Box<dyn ToSql> = Box::new(5);
|
let b: Box<dyn ToSql> = Box::new(5);
|
||||||
db.execute("INSERT INTO foo VALUES(?)", [b])?;
|
db.execute("INSERT INTO foo VALUES(?)", [b])?;
|
||||||
@ -1907,7 +1908,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_params() -> Result<()> {
|
fn test_params() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
db.query_row(
|
db.query_row(
|
||||||
"SELECT
|
"SELECT
|
||||||
?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
|
?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
|
||||||
@ -1928,7 +1929,7 @@ mod test {
|
|||||||
#[test]
|
#[test]
|
||||||
#[cfg(not(feature = "extra_check"))]
|
#[cfg(not(feature = "extra_check"))]
|
||||||
fn test_alter_table() -> Result<()> {
|
fn test_alter_table() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
db.execute_batch("CREATE TABLE x(t);")?;
|
db.execute_batch("CREATE TABLE x(t);")?;
|
||||||
// `execute_batch` should be used but `execute` should also work
|
// `execute_batch` should be used but `execute` should also work
|
||||||
db.execute("ALTER TABLE x RENAME TO y;", [])?;
|
db.execute("ALTER TABLE x RENAME TO y;", [])?;
|
||||||
@ -1937,7 +1938,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_batch() -> Result<()> {
|
fn test_batch() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
let sql = r"
|
let sql = r"
|
||||||
CREATE TABLE tbl1 (col);
|
CREATE TABLE tbl1 (col);
|
||||||
CREATE TABLE tbl2 (col);
|
CREATE TABLE tbl2 (col);
|
||||||
@ -1953,7 +1954,7 @@ mod test {
|
|||||||
#[test]
|
#[test]
|
||||||
#[cfg(all(feature = "bundled", not(feature = "bundled-sqlcipher")))] // SQLite >= 3.35.0
|
#[cfg(all(feature = "bundled", not(feature = "bundled-sqlcipher")))] // SQLite >= 3.35.0
|
||||||
fn test_returning() -> Result<()> {
|
fn test_returning() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
db.execute_batch("CREATE TABLE foo(x INTEGER PRIMARY KEY)")?;
|
db.execute_batch("CREATE TABLE foo(x INTEGER PRIMARY KEY)")?;
|
||||||
let row_id =
|
let row_id =
|
||||||
db.query_row::<i64, _, _>("INSERT INTO foo DEFAULT VALUES RETURNING ROWID", [], |r| {
|
db.query_row::<i64, _, _>("INSERT INTO foo DEFAULT VALUES RETURNING ROWID", [], |r| {
|
||||||
@ -1966,7 +1967,7 @@ mod test {
|
|||||||
#[test]
|
#[test]
|
||||||
#[cfg(feature = "modern_sqlite")]
|
#[cfg(feature = "modern_sqlite")]
|
||||||
fn test_cache_flush() -> Result<()> {
|
fn test_cache_flush() -> Result<()> {
|
||||||
let db = checked_memory_handle();
|
let db = Connection::open_in_memory()?;
|
||||||
db.cache_flush()
|
db.cache_flush()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@ impl VTabConnection {
|
|||||||
/// #[repr(C)]
|
/// #[repr(C)]
|
||||||
/// struct MyTab {
|
/// struct MyTab {
|
||||||
/// /// Base class. Must be first
|
/// /// Base class. Must be first
|
||||||
/// base: ffi::sqlite3_vtab,
|
/// base: rusqlite::vtab::sqlite3_vtab,
|
||||||
/// /* Virtual table implementations will typically add additional fields */
|
/// /* Virtual table implementations will typically add additional fields */
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
@ -488,7 +488,7 @@ impl OrderBy<'_> {
|
|||||||
/// #[repr(C)]
|
/// #[repr(C)]
|
||||||
/// struct MyTabCursor {
|
/// struct MyTabCursor {
|
||||||
/// /// Base class. Must be first
|
/// /// Base class. Must be first
|
||||||
/// base: ffi::sqlite3_vtab_cursor,
|
/// base: rusqlite::vtab::sqlite3_vtab_cursor,
|
||||||
/// /* Virtual table implementations will typically add additional fields */
|
/// /* Virtual table implementations will typically add additional fields */
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
Loading…
Reference in New Issue
Block a user