MCPcopy Create free account
hub / github.com/ElementsProject/lightning / db_data_version_get

Function db_data_version_get

db/exec.c:41–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41u32 db_data_version_get(struct db *db)
42{
43 struct db_stmt *stmt;
44 u32 version;
45 stmt = db_prepare_v2(db, SQL("SELECT intval FROM vars WHERE name = 'data_version'"));
46 /* postgres will act upset if the table doesn't exist yet. */
47 if (!db_query_prepared_canfail(stmt)) {
48 tal_free(stmt);
49 return 0;
50 }
51 /* This fails on uninitialized db, so "0" */
52 if (db_step(stmt))
53 version = db_col_int(stmt, "intval");
54 else
55 version = 0;
56 tal_free(stmt);
57 return version;
58}
59
60void db_set_intvar(struct db *db, const char *varname, s64 val)
61{

Callers 3

mainFunction · 0.85
db_setupFunction · 0.85
plugin_hook_db_syncFunction · 0.85

Calls 4

tal_freeFunction · 0.85
db_stepFunction · 0.85
db_col_intFunction · 0.85

Tested by

no test coverage detected