MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / sqlReadIntProperty

Function sqlReadIntProperty

tools/upgrade-flux-file.cc:135–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135long sqlReadIntProperty(sqlite3* db, const std::string& name)
136{
137 if (!hasProperties(db))
138 return 0;
139
140 sqlite3_stmt* stmt;
141 sqlCheck(db,
142 sqlite3_prepare_v2(db,
143 "SELECT value FROM properties WHERE key=:key",
144 -1,
145 &stmt,
146 NULL));
147 sql_bind_string(db, stmt, ":key", name.c_str());
148
149 int i = sqlite3_step(stmt);
150 long result = 0;
151 if (i != SQLITE_DONE)
152 {
153 if (i != SQLITE_ROW)
154 error("failed to read from database: {}", sqlite3_errmsg(db));
155
156 result = sqlite3_column_int(stmt, 0);
157 }
158 sqlCheck(db, sqlite3_finalize(stmt));
159 return result;
160}
161
162int sqlGetVersion(sqlite3* db)
163{

Callers 1

sqlGetVersionFunction · 0.85

Calls 4

hasPropertiesFunction · 0.85
sqlCheckFunction · 0.85
sql_bind_stringFunction · 0.85
errorFunction · 0.85

Tested by

no test coverage detected