mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
db_query: don't remove transaction or set error if query fails.
We return NULL in this case. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
5e46af64fc
commit
360aa15e4d
@ -203,7 +203,6 @@ sqlite3_stmt *PRINTF_FMT(3, 4)
|
||||
va_list ap;
|
||||
char *query;
|
||||
sqlite3_stmt *stmt;
|
||||
int err;
|
||||
|
||||
if (db->in_transaction && db->err)
|
||||
return NULL;
|
||||
@ -214,12 +213,8 @@ sqlite3_stmt *PRINTF_FMT(3, 4)
|
||||
query = tal_vfmt(db, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
err = sqlite3_prepare_v2(db->sql, query, -1, &stmt, NULL);
|
||||
if (err != SQLITE_OK) {
|
||||
db->in_transaction = false;
|
||||
db->err = tal_fmt(db, "%s:%s:%s:%s", caller,
|
||||
sqlite3_errstr(err), query, sqlite3_errmsg(db->sql));
|
||||
}
|
||||
/* Sets stmt to NULL if not SQLITE_OK */
|
||||
sqlite3_prepare_v2(db->sql, query, -1, &stmt, NULL);
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user