You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 13, 2020. It is now read-only.
public func addObjects <S: Storable> (objects: [S], update: Bool = true) -> Result<Bool> {
guard objects.count > 0 else {
return Result.Success(true)
}
do {
if !(try tableExistsForType(S)) {
//!!! BUG !!! , if objects is different model, they have different table,
createTableForTypeRepresentedByObject(objects.first!)
}
let insertStatement = StatementGenerator.insertStatementForType(S.self, update: update)
try databaseQueue.transaction { (database) -> Void in
let statement = try database.prepare(insertStatement)
defer {
/* If an error occurs, try to finalize the statement */
let _ = try? statement.finalize()
}
for object in objects {
let data = self.dataFromObject(object)
try statement.executeUpdate(data)
}
}
} catch let error {
return Result.Error(error)
}
return Result.Success(true)
}
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: