db: Implement basic query capabilities

This is the first step towards being able to extract information from query
rows. Only the most basic types are exposed, the others will be built on top
of these primitives.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker
2019-08-03 16:34:03 +02:00
committed by Rusty Russell
parent 98963c58e4
commit d0027b1036
4 changed files with 108 additions and 0 deletions

View File

@@ -249,6 +249,14 @@ void db_bind_blob(struct db_stmt *stmt, int pos, u8 *val, size_t len);
void db_bind_text(struct db_stmt *stmt, int pos, const char *val);
bool db_exec_prepared_v2(struct db_stmt *stmt TAKES);
bool db_step(struct db_stmt *stmt);
u64 db_column_u64(struct db_stmt *stmt, int col);
int db_column_int(struct db_stmt *stmt, int col);
size_t db_column_bytes(struct db_stmt *stmt, int col);
int db_column_is_null(struct db_stmt *stmt, int col);
const void* db_column_blob(struct db_stmt *stmt, int col);
const unsigned char *db_column_text(struct db_stmt *stmt, int col);
bool db_query_prepared(struct db_stmt *stmt);
struct db_stmt *db_prepare_v2_(const char *location, struct db *db,
const char *query_id);