Browse Source

db: Fix statement expansion bugs found through dblog mode

travis-experimental
Christian Decker 4 years ago
committed by Rusty Russell
parent
commit
77ca07e91d
  1. 6
      wallet/db_postgres_sqlgen.c
  2. 6
      wallet/db_sqlite3_sqlgen.c
  3. 4
      wallet/statements_gettextgen.po
  4. 2
      wallet/wallet.c

6
wallet/db_postgres_sqlgen.c

@ -1275,8 +1275,8 @@ struct db_query db_postgres_queries[] = {
.readonly = false,
},
{
.name = "UPDATE channels SET state=?, peer_id=?WHERE channels.id=?",
.query = "UPDATE channels SET state=$1, peer_id=$2WHERE channels.id=$3",
.name = "UPDATE channels SET state=?, peer_id=? WHERE channels.id=?",
.query = "UPDATE channels SET state=$1, peer_id=$2 WHERE channels.id=$3",
.placeholders = 3,
.readonly = false,
},
@ -1654,4 +1654,4 @@ struct db_query db_postgres_queries[] = {
#endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */
// SHA256STAMP:5fa02e1dbf8ea4e155e08671e9f36b66c8a5b8ad04226e6695eacf2ea423b8bd
// SHA256STAMP:b58d5903df88487b84515e511c1cd98e5fb15f86cf9676e3125ab56a27c27877

6
wallet/db_sqlite3_sqlgen.c

@ -1275,8 +1275,8 @@ struct db_query db_sqlite3_queries[] = {
.readonly = false,
},
{
.name = "UPDATE channels SET state=?, peer_id=?WHERE channels.id=?",
.query = "UPDATE channels SET state=?, peer_id=?WHERE channels.id=?",
.name = "UPDATE channels SET state=?, peer_id=? WHERE channels.id=?",
.query = "UPDATE channels SET state=?, peer_id=? WHERE channels.id=?",
.placeholders = 3,
.readonly = false,
},
@ -1654,4 +1654,4 @@ struct db_query db_sqlite3_queries[] = {
#endif /* LIGHTNINGD_WALLET_GEN_DB_SQLITE3 */
// SHA256STAMP:5fa02e1dbf8ea4e155e08671e9f36b66c8a5b8ad04226e6695eacf2ea423b8bd
// SHA256STAMP:b58d5903df88487b84515e511c1cd98e5fb15f86cf9676e3125ab56a27c27877

4
wallet/statements_gettextgen.po

@ -843,7 +843,7 @@ msgid "DELETE FROM shachains WHERE id IN ( SELECT shachain_remote_id FROM cha
msgstr ""
#: wallet/wallet.c:1653
msgid "UPDATE channels SET state=?, peer_id=?WHERE channels.id=?"
msgid "UPDATE channels SET state=?, peer_id=? WHERE channels.id=?"
msgstr ""
#: wallet/wallet.c:1667
@ -1089,4 +1089,4 @@ msgstr ""
#: wallet/test/run-wallet.c:1359
msgid "INSERT INTO channels (id) VALUES (1);"
msgstr ""
# SHA256STAMP:c44c0588e8f2139e6530e926acbd3186bbbd65bec871d5274c8480fd8dcbd519
# SHA256STAMP:b5142a6c1570a9fdf0745214134e54ff79e3d91408a91a1555cdb0a546fb0c7b

2
wallet/wallet.c

@ -1651,7 +1651,7 @@ void wallet_channel_close(struct wallet *w, u64 wallet_id)
/* Set the channel to closed and disassociate with peer */
stmt = db_prepare_v2(w->db, SQL("UPDATE channels "
"SET state=?, peer_id=?"
"SET state=?, peer_id=? "
"WHERE channels.id=?"));
db_bind_u64(stmt, 0, CLOSED);
db_bind_null(stmt, 1);

Loading…
Cancel
Save