wallet: add datastore access routines.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2021-08-25 12:20:12 +09:30
committed by Christian Decker
parent df17387e05
commit 2fb8735f04
5 changed files with 238 additions and 5 deletions

View File

@@ -2006,6 +2006,36 @@ struct db_query db_postgres_queries[] = {
.placeholders = 1,
.readonly = true,
},
{
.name = "SELECT 1 FROM datastore WHERE key = ?;",
.query = "SELECT 1 FROM datastore WHERE key = $1;",
.placeholders = 1,
.readonly = true,
},
{
.name = "INSERT INTO datastore VALUES (?, ?);",
.query = "INSERT INTO datastore VALUES ($1, $2);",
.placeholders = 2,
.readonly = false,
},
{
.name = "DELETE FROM datastore WHERE key = ?",
.query = "DELETE FROM datastore WHERE key = $1",
.placeholders = 1,
.readonly = false,
},
{
.name = "SELECT data FROM datastore WHERE key = ?;",
.query = "SELECT data FROM datastore WHERE key = $1;",
.placeholders = 1,
.readonly = true,
},
{
.name = "SELECT key, data FROM datastore;",
.query = "SELECT key, data FROM datastore;",
.placeholders = 0,
.readonly = true,
},
{
.name = "SELECT name FROM sqlite_master WHERE type='table';",
.query = "SELECT name FROM sqlite_master WHERE type='table';",
@@ -2032,10 +2062,10 @@ struct db_query db_postgres_queries[] = {
},
};
#define DB_POSTGRES_QUERY_COUNT 337
#define DB_POSTGRES_QUERY_COUNT 342
#endif /* HAVE_POSTGRES */
#endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */
// SHA256STAMP:765ebe6f1bf58b1d492d8d1715e423fbe0764e3440c8bd2be8d0a09dccc95a5c
// SHA256STAMP:743e13b59241ab495a7ebd6e0e50887f399e7816cc73fd90154f761f1b484f89