-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Description
Consider, for example, the following statement:
Insert(template: "INSERT INTO \"sessions\" (\"owner_id\", \"started\", \"victim_name\", \"topic\", \"line\", \"chat_id\") VALUES (?, ?, ?, ?, ?, ?)", bindings: [Optional(230594948), Optional(1), Optional(""), Optional(""), Optional(0), Optional(-147636081)])
chat_id is INTEGER PRIMARY KEY and negative value is inserted.
sqlite3_last_insert_rowid() returns -147636081 (as expected)
Lib's lastInsertRowId turns it into nil:
public var lastInsertRowid: Int64? {
let rowid = sqlite3_last_insert_rowid(handle)
return rowid > 0 ? rowid : nil
}
The app crashes because Connection.run() dereferences nil.
Metadata
Metadata
Assignees
Labels
No labels