File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,6 +67,8 @@ public protocol SQLiteType {
6767 func getByID( from table: SQLTable , id: Int ) throws -> SQLValues
6868 func getLastRow( from table: SQLTable ) throws -> SQLValues
6969 func getLastInsertID( ) -> Int
70+ func getChanges( ) -> Int
71+ func getTotalChanges( ) -> Int
7072 func vacuum( ) throws
7173 func resetAutoincrement( in table: SQLTable ) throws
7274 func query( sql: String , params: [ Any ] ? ) throws
@@ -499,6 +501,16 @@ open class SQLite: SQLiteType {
499501 return Int ( sqlite3_last_insert_rowid ( dbPointer) )
500502 }
501503
504+ /// Returns number of rows changed by last INSERT, UPDATE or DELETE statement
505+ public func getChanges( ) -> Int {
506+ return Int ( sqlite3_changes ( dbPointer) )
507+ }
508+
509+ /// Returns number of rows changed by INSERT, UPDATE or DELETE statements since the DB was opened
510+ public func getTotalChanges( ) -> Int {
511+ return Int ( sqlite3_total_changes ( dbPointer) )
512+ }
513+
502514 /// Repacks the DB to take advantage of deleted data
503515 public func vacuum( ) throws {
504516 let sql = " VACUUM; "
You can’t perform that action at this time.
0 commit comments