Error inserting batch: database disk image is malformed
Error inserting batch: database disk image is malformed
--
You received this message because you are subscribed to the Google Groups "FMDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fmdb+uns...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
// multiple statements, create, delete, update
func execute(sqlStatements statements: String ) -> (Bool, String?) {
var result:(Bool, String?) = (false, nil)
databaseQueue.inTransaction { (db, rollback) in
if !db.executeStatements(statements) {
//TODO: Logging
debugPrint("Failed to perform \(statements) into the database.")
debugPrint(db.lastError(), db.lastErrorMessage())
rollback.initialize(to: true)
result.1 = db.lastErrorMessage()
} else {
result.0 = true
}
}
return result
}
// fetch records
func execute(selectQuery query: String, values:[Any]?) -> (FmdbSelectQueryResult) {
var result:(FMResultSet?, String?) = (nil, nil)
databaseQueue.inTransaction { (db, rollback) in
do {
let results = try db.executeQuery(query, values: values)
result.0 = results
} catch {
result.1 = error.localizedDescription
rollback.pointee = true
}
}
return result
}