MCPcopy Create free account
hub / github.com/acl-dev/acl / get_key

Method get_key

app/net_tools/net_store.cpp:83–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83bool net_store::get_key(const char* name, acl::string& out)
84{
85 acl::db_handle* db = open_option_tbl();
86 if (db == NULL)
87 return false;
88 acl::string sql;
89 sql.format("select value from option_tbl where name='%s'", name);
90 if (db->sql_select(sql.c_str()) == false)
91 {
92 delete db;
93 return false;
94 }
95
96 const acl::db_row* row = db->get_first_row();
97 if (row == NULL)
98 {
99 delete db;
100 return false;
101 }
102 const char* value = (*row)["value"];
103 if (value == NULL)
104 {
105 db->free_result();
106 delete db;
107 return false;
108 }
109 out = value;
110 return true;
111}
112
113bool net_store::set_key(const char* name, const char* value)
114{

Callers

nothing calls this directly

Calls 6

open_option_tblFunction · 0.85
get_first_rowMethod · 0.80
free_resultMethod · 0.80
formatMethod · 0.45
sql_selectMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected