aboutsummaryrefslogtreecommitdiffstats
path: root/g10/sqlite.c
diff options
context:
space:
mode:
authorNeal H. Walfield <[email protected]>2015-10-29 08:36:36 +0000
committerNeal H. Walfield <[email protected]>2015-10-29 09:10:39 +0000
commit421827424fe87855307fe3e803b42ffa02738600 (patch)
tree79f2e83201a19fbc09351f1e161157369e7ce0dc /g10/sqlite.c
parentgpg: Move sqlite helper functions into their own file. (diff)
downloadgnupg-421827424fe87855307fe3e803b42ffa02738600.tar.gz
gnupg-421827424fe87855307fe3e803b42ffa02738600.zip
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 <[email protected]>
Diffstat (limited to 'g10/sqlite.c')
-rw-r--r--g10/sqlite.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/g10/sqlite.c b/g10/sqlite.c
index da3ca964f..ee7514c99 100644
--- a/g10/sqlite.c
+++ b/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;