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

Function db_bind_datastore_key

wallet/datastore.c:33–52  ·  view source on GitHub ↗

We join key parts with nuls for now. */

Source from the content-addressed store, hash-verified

31
32/* We join key parts with nuls for now. */
33void db_bind_datastore_key(struct db_stmt *stmt, const char **key)
34{
35 u8 *joined;
36 size_t len;
37
38 if (tal_count(key) == 1) {
39 db_bind_blob(stmt, (u8 *)key[0], strlen(key[0]));
40 return;
41 }
42
43 len = strlen(key[0]);
44 joined = (u8 *)tal_strdup(tmpctx, key[0]);
45 for (size_t i = 1; i < tal_count(key); i++) {
46 tal_resize(&joined, len + 1 + strlen(key[i]));
47 joined[len] = '\0';
48 memcpy(joined + len + 1, key[i], strlen(key[i]));
49 len += 1 + strlen(key[i]);
50 }
51 db_bind_blob(stmt, joined, len);
52}
53
54u8 *db_datastore_get(const tal_t *ctx,
55 struct db *db,

Callers 5

db_datastore_getFunction · 0.70
db_datastore_firstFunction · 0.70
db_datastore_updateFunction · 0.70
db_datastore_createFunction · 0.70
db_datastore_removeFunction · 0.70

Calls 1

db_bind_blobFunction · 0.85

Tested by

no test coverage detected