Add changes & totalChanges properties for connection
This commit is contained in:
@@ -131,6 +131,14 @@ extension Connection: ConnectionProtocol {
|
||||
sqlite3_db_readonly(connection, "main") == 1
|
||||
}
|
||||
|
||||
public var changes: Int64 {
|
||||
sqlite3_changes64(connection)
|
||||
}
|
||||
|
||||
public var totalChanges: Int64 {
|
||||
sqlite3_total_changes64(connection)
|
||||
}
|
||||
|
||||
public static func initialize() throws(SQLiteError) {
|
||||
let status = sqlite3_initialize()
|
||||
guard status == SQLITE_OK else {
|
||||
|
||||
@@ -12,6 +12,8 @@ import Foundation
|
||||
///
|
||||
/// - ``isAutocommit``
|
||||
/// - ``isReadonly``
|
||||
/// - ``changes``
|
||||
/// - ``totalChanges``
|
||||
///
|
||||
/// ### Accessing PRAGMA Values
|
||||
///
|
||||
@@ -84,6 +86,14 @@ public protocol ConnectionProtocol: AnyObject {
|
||||
/// - SeeAlso: [Determine if a database is read-only](https://sqlite.org/c3ref/db_readonly.html)
|
||||
var isReadonly: Bool { get }
|
||||
|
||||
/// The number of rows modified by the most recent write operation.
|
||||
/// - SeeAlso: [Count The Number Of Rows Modified](https://sqlite.org/c3ref/changes.html)
|
||||
var changes: Int64 { get }
|
||||
|
||||
/// The total number of rows modified since this connection was opened.
|
||||
/// - SeeAlso: [Total Number Of Rows Modified](https://sqlite.org/c3ref/total_changes.html)
|
||||
var totalChanges: Int64 { get }
|
||||
|
||||
// MARK: - PRAGMA Accessors
|
||||
|
||||
/// The busy timeout of the connection, in milliseconds.
|
||||
|
||||
Reference in New Issue
Block a user