mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 15:44:21 +01:00
db: Move statement expansion into the driver
It's better to let the driver decide when and how to expand. It can then report the expanded statement back to the dispatch through the `db_changes_add` function. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
committed by
Rusty Russell
parent
b6d583c26a
commit
742bcdb2bc
@@ -93,10 +93,6 @@ struct db_config {
|
||||
struct db_query *queries;
|
||||
size_t num_queries;
|
||||
|
||||
/* Function used to get a string representation of the executed query
|
||||
* for the `db_write` plugin hook. */
|
||||
const char *(*expand_fn)(struct db_stmt *stmt);
|
||||
|
||||
/* Function used to execute a statement that doesn't result in a
|
||||
* response. */
|
||||
bool (*exec_fn)(struct db_stmt *stmt);
|
||||
@@ -139,4 +135,14 @@ struct db_config {
|
||||
/* Provide a way for DB backends to register themselves */
|
||||
AUTODATA_TYPE(db_backends, struct db_config);
|
||||
|
||||
/**
|
||||
* Report a statement that changes the wallet
|
||||
*
|
||||
* Allows the DB driver to report an expanded statement during
|
||||
* execution. Changes are queued up and reported to the `db_write` plugin hook
|
||||
* upon committing.
|
||||
*/
|
||||
void db_changes_add(struct db_stmt *db_stmt, const char * expanded);
|
||||
|
||||
|
||||
#endif /* LIGHTNING_WALLET_DB_COMMON_H */
|
||||
|
||||
Reference in New Issue
Block a user