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

Function db_config_find

db/utils.c:271–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269}
270
271static struct db_config *db_config_find(const char *dsn)
272{
273 size_t num_configs;
274 struct db_config **configs = autodata_get(db_backends, &num_configs);
275 const char *sep, *driver_name;
276 sep = strstr(dsn, "://");
277
278 if (!sep)
279 db_fatal("%s doesn't look like a valid data-source name (missing \"://\" separator.", dsn);
280
281 driver_name = tal_strndup(tmpctx, dsn, sep - dsn);
282
283 for (size_t i=0; i<num_configs; i++) {
284 if (streq(driver_name, configs[i]->name)) {
285 tal_free(driver_name);
286 return configs[i];
287 }
288 }
289
290 tal_free(driver_name);
291 return NULL;
292}
293
294static struct db_query_set *db_queries_find(const struct db_config *config)
295{

Callers 1

db_openFunction · 0.85

Calls 2

tal_freeFunction · 0.85
db_fatalFunction · 0.50

Tested by

no test coverage detected