mirror of
https://github.com/isar/rusqlite.git
synced 2025-03-29 00:32:57 +08:00
expose total_changes()
This commit is contained in:
parent
322073a70d
commit
673a69d3c6
@ -288,6 +288,18 @@ impl InnerConnection {
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn total_changes(&self) -> u64 {
|
||||
#[cfg(not(feature = "modern_sqlite"))]
|
||||
unsafe {
|
||||
ffi::sqlite3_total_changes(self.db()) as u64
|
||||
}
|
||||
#[cfg(feature = "modern_sqlite")] // 3.37.0
|
||||
unsafe {
|
||||
ffi::sqlite3_total_changes64(self.db()) as u64
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_autocommit(&self) -> bool {
|
||||
unsafe { ffi::sqlite3_get_autocommit(self.db()) != 0 }
|
||||
|
10
src/lib.rs
10
src/lib.rs
@ -1005,6 +1005,16 @@ impl Connection {
|
||||
self.db.borrow().changes()
|
||||
}
|
||||
|
||||
/// Return the total number of rows modified, inserted or deleted by all
|
||||
/// completed INSERT, UPDATE or DELETE statements since the database
|
||||
/// connection was opened, including those executed as part of trigger programs.
|
||||
///
|
||||
/// See <https://www.sqlite.org/c3ref/total_changes.html>
|
||||
#[inline]
|
||||
pub fn total_changes(&self) -> u64 {
|
||||
self.db.borrow().total_changes()
|
||||
}
|
||||
|
||||
/// Test for auto-commit mode.
|
||||
/// Autocommit mode is on by default.
|
||||
#[inline]
|
||||
|
Loading…
x
Reference in New Issue
Block a user