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

Function db_config_find

db/utils.c:278–299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

db_open_Function · 0.85

Calls 2

db_fatalFunction · 0.85
tal_freeFunction · 0.85

Tested by

no test coverage detected