mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-22 16:29:20 +08:00
Expose sqlite3_changes
(or sqlite3_changes64
if available)
This commit is contained in:
parent
f8b9ad8907
commit
899784379b
@ -277,14 +277,14 @@ impl InnerConnection {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn changes(&self) -> usize {
|
||||
pub fn changes(&self) -> u64 {
|
||||
#[cfg(not(feature = "modern_sqlite"))]
|
||||
unsafe {
|
||||
ffi::sqlite3_changes(self.db()) as usize
|
||||
ffi::sqlite3_changes(self.db()) as u64
|
||||
}
|
||||
#[cfg(feature = "modern_sqlite")] // 3.37.0
|
||||
unsafe {
|
||||
ffi::sqlite3_changes64(self.db()) as usize
|
||||
ffi::sqlite3_changes64(self.db()) as u64
|
||||
}
|
||||
}
|
||||
|
||||
|
12
src/lib.rs
12
src/lib.rs
@ -1,5 +1,9 @@
|
||||
//! Rusqlite is an ergonomic wrapper for using SQLite from Rust. It attempts to
|
||||
//! expose an interface similar to [rust-postgres](https://github.com/sfackler/rust-postgres).
|
||||
//! Rusqlite is an ergonomic wrapper for using SQLite from Rust.
|
||||
//!
|
||||
//! Historically, the API was based on the one from
|
||||
//! [`rust-postgres`](https://github.com/sfackler/rust-postgres). However, the
|
||||
//! two have diverged in many ways, and no compatibility between the two is
|
||||
//! intended.
|
||||
//!
|
||||
//! ```rust
|
||||
//! use rusqlite::{params, Connection, Result};
|
||||
@ -901,8 +905,10 @@ impl Connection {
|
||||
/// Return the number of rows modified, inserted or deleted by the most
|
||||
/// recently completed INSERT, UPDATE or DELETE statement on the database
|
||||
/// connection.
|
||||
///
|
||||
/// See <https://www.sqlite.org/c3ref/changes.html>
|
||||
#[inline]
|
||||
fn changes(&self) -> usize {
|
||||
pub fn changes(&self) -> u64 {
|
||||
self.db.borrow().changes()
|
||||
}
|
||||
|
||||
|
@ -778,7 +778,7 @@ impl Statement<'_> {
|
||||
let r = self.stmt.step();
|
||||
self.stmt.reset();
|
||||
match r {
|
||||
ffi::SQLITE_DONE => Ok(self.conn.changes()),
|
||||
ffi::SQLITE_DONE => Ok(self.conn.changes() as usize),
|
||||
ffi::SQLITE_ROW => Err(Error::ExecuteReturnedResults),
|
||||
_ => Err(self.conn.decode_result(r).unwrap_err()),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user