mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
db: Make the db struct private and provide accessors instead
We will soon generalize the DB, so directly reaching into the `struct db` instance to talk to the sqlite3 connection is bad anyway. This increases flexibility and allows us to tailor the actual implementation to the underlying DB. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
committed by
Rusty Russell
parent
66a47d2761
commit
803007ecdf
@@ -305,7 +305,7 @@ bool invoices_create(struct invoices *invoices,
|
||||
|
||||
db_exec_prepared(invoices->db, stmt);
|
||||
|
||||
pinvoice->id = sqlite3_last_insert_rowid(invoices->db->sql);
|
||||
pinvoice->id = db_last_insert_id(invoices->db);
|
||||
|
||||
/* Install expiration trigger. */
|
||||
if (!invoices->expiration_timer ||
|
||||
@@ -392,7 +392,7 @@ bool invoices_delete(struct invoices *invoices,
|
||||
sqlite3_bind_int64(stmt, 1, invoice.id);
|
||||
db_exec_prepared(invoices->db, stmt);
|
||||
|
||||
if (sqlite3_changes(invoices->db->sql) != 1)
|
||||
if (db_changes(invoices->db) != 1)
|
||||
return false;
|
||||
|
||||
/* Tell all the waiters about the fact that it was deleted. */
|
||||
|
||||
Reference in New Issue
Block a user