支持ios 16或更高的版本,xcode 15 (Support iOS 16 or later, XCODE 15)
override func onCreate() throws {
DBUtils.createTable(db!, SQLUtils.tableSQL(UserSchema.NAME, autoincrementKey, UserSchema.Cols.ARRAY))
}
override func onUpgrade(oldVersion: Int, newVersion: Int) throws { }
db.query(SQLQuery("SELECT * FROM \(UserSchema.NAME)", nil), UserFactory())
let user = User()
var values:[String:Any] = [:]
values[UserSchema.Cols.UID] = user.uid
values[UserSchema.Cols.NAME] = user.name
values[UserSchema.Cols.SEX] = user.sex
values[UserSchema.Cols.AGE] = user.age
db.insert(SQLInsert(UserSchema.NAME, values))
var values:[String:Any] = [:]
values[UserSchema.Cols.NAME] = item.name
values[UserSchema.Cols.SEX] = item.sex
values[UserSchema.Cols.AGE] = item.age
db.update(SQLUpdate(UserSchema.NAME, values, "\(UserSchema.Cols.UID)=?", [item.uid]))
db.delete(SQLDelete(UserSchema.NAME, "\(UserSchema.Cols.UID)=?", [item.uid]))