mirror of
https://github.com/isar/rusqlite.git
synced 2025-09-15 04:02:18 +08:00
Remove old_sqlite
feature
And associated bindgen_3.6.8.rs
This commit is contained in:
23
src/lib.rs
23
src/lib.rs
@@ -314,12 +314,6 @@ pub const TEMP_DB: DatabaseName<'static> = DatabaseName::Temp;
|
||||
|
||||
// Currently DatabaseName is only used by the backup and blob mods, so hide
|
||||
// this (private) impl to avoid dead code warnings.
|
||||
#[cfg(any(
|
||||
feature = "backup",
|
||||
feature = "blob",
|
||||
feature = "session",
|
||||
not(feature = "old_sqlite")
|
||||
))]
|
||||
impl DatabaseName<'_> {
|
||||
#[inline]
|
||||
fn as_cstring(&self) -> Result<SmallCString> {
|
||||
@@ -961,22 +955,16 @@ impl Connection {
|
||||
|
||||
/// Determine if all associated prepared statements have been reset.
|
||||
#[inline]
|
||||
#[cfg(not(feature = "old_sqlite"))] // 3.8.6
|
||||
#[cfg_attr(docsrs, doc(cfg(not(feature = "old_sqlite"))))]
|
||||
pub fn is_busy(&self) -> bool {
|
||||
self.db.borrow().is_busy()
|
||||
}
|
||||
|
||||
/// Flush caches to disk mid-transaction
|
||||
#[cfg(not(feature = "old_sqlite"))] // 3.10.0
|
||||
#[cfg_attr(docsrs, doc(cfg(not(feature = "old_sqlite"))))]
|
||||
pub fn cache_flush(&self) -> Result<()> {
|
||||
self.db.borrow_mut().cache_flush()
|
||||
}
|
||||
|
||||
/// Determine if a database is read-only
|
||||
#[cfg(not(feature = "old_sqlite"))] // 3.7.11
|
||||
#[cfg_attr(docsrs, doc(cfg(not(feature = "old_sqlite"))))]
|
||||
pub fn is_readonly(&self, db_name: DatabaseName<'_>) -> Result<bool> {
|
||||
self.db.borrow().db_readonly(db_name)
|
||||
}
|
||||
@@ -1176,7 +1164,6 @@ impl InterruptHandle {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "old_sqlite"))] // 3.7.10
|
||||
unsafe fn db_filename(db: *mut ffi::sqlite3) -> Option<PathBuf> {
|
||||
let db_name = DatabaseName::Main.as_cstring().unwrap();
|
||||
let db_filename = ffi::sqlite3_db_filename(db, db_name.as_ptr());
|
||||
@@ -1186,10 +1173,6 @@ unsafe fn db_filename(db: *mut ffi::sqlite3) -> Option<PathBuf> {
|
||||
CStr::from_ptr(db_filename).to_str().ok().map(PathBuf::from)
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "old_sqlite")]
|
||||
unsafe fn db_filename(_: *mut ffi::sqlite3) -> Option<PathBuf> {
|
||||
None
|
||||
}
|
||||
|
||||
#[cfg(doctest)]
|
||||
doc_comment::doctest!("../README.md");
|
||||
@@ -1664,7 +1647,6 @@ mod test {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(feature = "old_sqlite"))]
|
||||
fn test_is_busy() -> Result<()> {
|
||||
let db = Connection::open_in_memory()?;
|
||||
assert!(!db.is_busy());
|
||||
@@ -1695,12 +1677,9 @@ mod test {
|
||||
fn test_notnull_constraint_error() -> Result<()> {
|
||||
// extended error codes for constraints were added in SQLite 3.7.16; if we're
|
||||
// running on our bundled version, we know the extended error code exists.
|
||||
#[cfg(not(feature = "old_sqlite"))]
|
||||
fn check_extended_code(extended_code: c_int) {
|
||||
assert_eq!(extended_code, ffi::SQLITE_CONSTRAINT_NOTNULL);
|
||||
}
|
||||
#[cfg(feature = "old_sqlite")]
|
||||
fn check_extended_code(_extended_code: c_int) {}
|
||||
|
||||
let db = Connection::open_in_memory()?;
|
||||
db.execute_batch("CREATE TABLE foo(x NOT NULL)")?;
|
||||
@@ -2109,14 +2088,12 @@ mod test {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(feature = "old_sqlite"))]
|
||||
fn test_cache_flush() -> Result<()> {
|
||||
let db = Connection::open_in_memory()?;
|
||||
db.cache_flush()
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(feature = "old_sqlite"))]
|
||||
pub fn db_readonly() -> Result<()> {
|
||||
let db = Connection::open_in_memory()?;
|
||||
assert!(!db.is_readonly(MAIN_DB)?);
|
||||
|
Reference in New Issue
Block a user