mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-07 16:14:26 +01:00
db: Add method to count changed rows of a db_stmt
I was hoping to get rid of these by using "ON CONFLICT" upserts, however sqlite3 only started supporting them in version 3.24.0 which is newer than some of our deployment targets. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
committed by
Rusty Russell
parent
d0027b1036
commit
a2b5b1561e
@@ -167,6 +167,12 @@ static void db_sqlite3_stmt_free(struct db_stmt *stmt)
|
||||
stmt->inner_stmt = NULL;
|
||||
}
|
||||
|
||||
static size_t db_sqlite3_count_changes(struct db_stmt *stmt)
|
||||
{
|
||||
sqlite3 *s = stmt->db->conn;
|
||||
return sqlite3_changes(s);
|
||||
}
|
||||
|
||||
struct db_config db_sqlite3_config = {
|
||||
.name = "sqlite3",
|
||||
.queries = db_sqlite3_queries,
|
||||
@@ -185,6 +191,8 @@ struct db_config db_sqlite3_config = {
|
||||
.column_bytes_fn = &db_sqlite3_column_bytes,
|
||||
.column_blob_fn = &db_sqlite3_column_blob,
|
||||
.column_text_fn = &db_sqlite3_column_text,
|
||||
|
||||
.count_changes_fn = &db_sqlite3_count_changes,
|
||||
};
|
||||
|
||||
AUTODATA(db_backends, &db_sqlite3_config);
|
||||
|
||||
Reference in New Issue
Block a user