mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
gpg: Change sqlite3_stepx to pass the sqlite3_stmt * to the callback.
* g10/sqlite.h (enum sqlite_arg_type): Add SQLITE_ARG_BLOB. (sqlite3_stepx_callback): New declaration. (sqlite3_stepx): Change the callback's type to sqlite3_stepx_callback, which passes an additional parameter, the sqlite3_stmt *. Update users. -- Signed-off-by: Neal H. Walfield <neal@g10code.com>
This commit is contained in:
parent
351f4213e1
commit
421827424f
3 changed files with 58 additions and 10 deletions
11
g10/sqlite.c
11
g10/sqlite.c
|
@ -59,7 +59,7 @@ sqlite3_exec_printf (sqlite3 *db,
|
|||
int
|
||||
sqlite3_stepx (sqlite3 *db,
|
||||
sqlite3_stmt **stmtp,
|
||||
int (*callback) (void*,int,char**,char**),
|
||||
sqlite3_stepx_callback callback,
|
||||
void *cookie,
|
||||
char **errmsg,
|
||||
const char *sql, ...)
|
||||
|
@ -150,6 +150,13 @@ sqlite3_stepx (sqlite3 *db,
|
|||
err = sqlite3_bind_text (stmt, i, text, -1, SQLITE_STATIC);
|
||||
break;
|
||||
}
|
||||
case SQLITE_ARG_BLOB:
|
||||
{
|
||||
char *blob = va_arg (va, void *);
|
||||
long long length = va_arg (va, long long);
|
||||
err = sqlite3_bind_blob (stmt, i, blob, length, SQLITE_STATIC);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
/* Internal error. Likely corruption. */
|
||||
log_fatal ("Bad value for parameter type %d.\n", t);
|
||||
|
@ -201,7 +208,7 @@ sqlite3_stepx (sqlite3 *db,
|
|||
}
|
||||
}
|
||||
|
||||
if (callback (cookie, cols, (char **) azVals, (char **) azColName))
|
||||
if (callback (cookie, cols, (char **) azVals, (char **) azColName, stmt))
|
||||
/* A non-zero result means to abort. */
|
||||
{
|
||||
err = SQLITE_ABORT;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue