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>
This commit is contained in:
Christian Decker 2019-08-28 22:38:32 +02:00 committed by Rusty Russell
parent 742bcdb2bc
commit ec8efe02e1
2 changed files with 5 additions and 6 deletions

View File

@ -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 ||

View File

@ -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,