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

Function db_bind_datastore_key

wallet/wallet.c:5117–5138  ·  view source on GitHub ↗

We join key parts with nuls for now. */

Source from the content-addressed store, hash-verified

5115
5116/* We join key parts with nuls for now. */
5117static void db_bind_datastore_key(struct db_stmt *stmt,
5118 int pos,
5119 const char **key)
5120{
5121 u8 *joined;
5122 size_t len;
5123
5124 if (tal_count(key) == 1) {
5125 db_bind_blob(stmt, pos, (u8 *)key[0], strlen(key[0]));
5126 return;
5127 }
5128
5129 len = strlen(key[0]);
5130 joined = (u8 *)tal_strdup(tmpctx, key[0]);
5131 for (size_t i = 1; i < tal_count(key); i++) {
5132 tal_resize(&joined, len + 1 + strlen(key[i]));
5133 joined[len] = '\0';
5134 memcpy(joined + len + 1, key[i], strlen(key[i]));
5135 len += 1 + strlen(key[i]);
5136 }
5137 db_bind_blob(stmt, pos, joined, len);
5138}
5139
5140static const char **db_col_datastore_key(const tal_t *ctx,
5141 struct db_stmt *stmt,

Callers 4

wallet_datastore_updateFunction · 0.85
wallet_datastore_createFunction · 0.85
wallet_datastore_removeFunction · 0.85
wallet_datastore_firstFunction · 0.85

Calls 1

db_bind_blobFunction · 0.85

Tested by

no test coverage detected