Browse Source

db: Switch to indirect `db_last_insert_id` version

We are about to delete all the `sqlite3`-specific code from `db.c` and this is
one of the last uses of the old interface.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
pull/2803/head
Christian Decker 5 years ago
committed by Rusty Russell
parent
commit
ec8efe02e1
  1. 3
      wallet/invoices.c
  2. 8
      wallet/wallet.c

3
wallet/invoices.c

@ -304,8 +304,7 @@ bool invoices_create(struct invoices *invoices,
db_exec_prepared_v2(stmt);
pinvoice->id = db_last_insert_id(invoices->db);
tal_free(stmt);
pinvoice->id = db_last_insert_id_v2(take(stmt));
/* Install expiration trigger. */
if (!invoices->expiration_timer ||

8
wallet/wallet.c

@ -1353,8 +1353,8 @@ void wallet_channel_insert(struct wallet *w, struct channel *chan)
db_bind_text(stmt, 1,
type_to_string(tmpctx, struct wireaddr_internal,
&chan->peer->addr));
db_exec_prepared_v2(take(stmt));
chan->peer->dbid = db_last_insert_id(w->db);
db_exec_prepared_v2(stmt);
chan->peer->dbid = db_last_insert_id_v2(take(stmt));
}
/* Insert a stub, that we update, unifies INSERT and UPDATE paths */
@ -1567,8 +1567,8 @@ void wallet_htlc_save_in(struct wallet *wallet,
db_bind_timeabs(stmt, 10, in->received_time);
db_exec_prepared_v2(take(stmt));
in->dbid = db_last_insert_id(wallet->db);
db_exec_prepared_v2(stmt);
in->dbid = db_last_insert_id_v2(take(stmt));
}
void wallet_htlc_save_out(struct wallet *wallet,

Loading…
Cancel
Save