Wrapper for sqlGenericQuery() to do a SELECT and return directly * the integer of the first row, or zero on error. */
| 217 | /* Wrapper for sqlGenericQuery() to do a SELECT and return directly |
| 218 | * the integer of the first row, or zero on error. */ |
| 219 | int64_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 |
nothing calls this directly
no test coverage detected