Wrapper for sqlGenericQuery() returning the last inserted ID or 0 * on error. */
| 169 | /* Wrapper for sqlGenericQuery() returning the last inserted ID or 0 |
| 170 | * on error. */ |
| 171 | int sqlInsert(sqlite3 *dbhandle, const char *sql, ...) { |
| 172 | int64_t lastid = 0; |
| 173 | va_list ap; |
| 174 | va_start(ap,sql); |
| 175 | int rc = sqlGenericQuery(dbhandle,NULL,sql,ap); |
| 176 | if (rc == SQLITE_DONE) lastid = sqlite3_last_insert_rowid(dbhandle); |
| 177 | va_end(ap); |
| 178 | return lastid; |
| 179 | } |
| 180 | |
| 181 | /* Wrapper for sqlGenericQuery() returning 1 if the query resulted in |
| 182 | * SQLITE_DONE, otherwise zero. This is good for UPDATE and DELETE |
no test coverage detected