@@ -45,7 +45,30 @@ public enum SQLOrder {
4545/// case NULL
4646public typealias SQLValues = [ ( type: SQLType , value: Any ? ) ]
4747
48- open class SQLite {
48+ public protocol SQLiteType {
49+ func createTable( sql: String ) throws
50+ func checkIfTableExists( _ tableName: String ) throws -> Bool
51+ func dropTable( _ tableName: String , vacuum: Bool ) throws
52+ func deleteAllRows( in tableName: String , vacuum: Bool , resetAutoincrement: Bool ) throws
53+ func dropIndex( in tableName: String , forColumn columnName: String ) throws
54+ func addIndex( to tableName: String , forColumn columnName: String , unique: Bool , order: SQLOrder ) throws
55+ func beginTransaction( ) throws
56+ func endTransaction( ) throws
57+ func insertRow( sql: String , valuesToBind: SQLValues ? ) throws
58+ func updateRow( sql: String , valuesToBind: SQLValues ? ) throws
59+ func deleteRow( sql: String , valuesToBind: SQLValues ? ) throws
60+ func deleteByID( in tableName: String , id: Int ) throws
61+ func getRowCount( in tableName: String ) throws -> Int
62+ func getRowCountWithCondition( sql: String , valuesToBind: SQLValues ? ) throws -> Int
63+ func getRow( sql: String , valuesToBind: SQLValues ? , valuesToGet: SQLValues ) throws -> [ SQLValues ]
64+ func getAllRows( in tableName: String , valuesToGet: SQLValues ) throws -> [ SQLValues ]
65+ func getByID( in tableName: String , id: Int , valuesToGet: SQLValues ) throws -> SQLValues
66+ func vacuum( ) throws
67+ func resetAutoincrement( in tableName: String ) throws
68+ func query( sql: String , valuesToBind: SQLValues ? ) throws
69+ }
70+
71+ open class SQLite : SQLiteType {
4972
5073 public private( set) var dbPointer : OpaquePointer ?
5174
0 commit comments