Closed
Description
As already mentioned in #339 the try! will cause a program to crash if multiple programs access the database at the same time.
This is not only happening when using Scalar but also when using
SELECT * FROM table
let table = Table("TProperties")
var all = [Row]()
do{
all = Array(try db.prepare(table))
}catch{
print("getSettings failed")
}
The reason behind it is the Generator type
extension Statement : GeneratorType {
public func next() -> [Binding?]? {
return try! step() ? Array(row) : nil
}
}
My solution for it is the following change but i couldn't test yet if it is really working
extension Statement : GeneratorType {
public func next() -> [Binding?]? {
var result:[Binding?]?
do{
result = try step() ? Array(row) : nil
}catch{
result = nil
}
return result
//return try! step() ? Array(row) : nil
}
}
Metadata
Metadata
Assignees
Labels
No labels