MCPcopy Index your code
hub / github.com/antirez/botlib / sqlSelectInt

Function sqlSelectInt

sqlite_wrap.c:219–232  ·  view source on GitHub ↗

Wrapper for sqlGenericQuery() to do a SELECT and return directly * the integer of the first row, or zero on error. */

Source from the content-addressed store, hash-verified

217/* Wrapper for sqlGenericQuery() to do a SELECT and return directly
218 * the integer of the first row, or zero on error. */
219int64_t sqlSelectInt(sqlite3 *dbhandle, const char *sql, ...) {
220 sqlRow row;
221 int64_t i = 0;
222 va_list ap;
223 va_start(ap,sql);
224 int rc = sqlGenericQuery(dbhandle,&row,sql,ap);
225 if (rc == SQLITE_ROW) {
226 sqlNextRow(&row);
227 i = row.col[0].i;
228 sqlEnd(&row);
229 }
230 va_end(ap);
231 return i;
232}
233
234/* ==========================================================================
235 * Key value store abstraction. This implements a trivial KV store on top

Callers

nothing calls this directly

Calls 3

sqlGenericQueryFunction · 0.85
sqlNextRowFunction · 0.85
sqlEndFunction · 0.85

Tested by

no test coverage detected