diff options
Diffstat (limited to '')
-rw-r--r-- | src/sqlite.c | 14 | ||||
-rw-r--r-- | src/sqlite.h | 3 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/sqlite.c b/src/sqlite.c index 7080928..f064280 100644 --- a/src/sqlite.c +++ b/src/sqlite.c @@ -11,6 +11,7 @@ #include <sqlite3.h> +#include <stddef.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -231,6 +232,19 @@ int sqlite_bind_text(sqlite3_stmt *stmt, int index, const char *value) return ret; } +int sqlite_bind_blob(sqlite3_stmt *stmt, int index, unsigned char *value, size_t nb) +{ + int ret = 0; + + ret = sqlite3_bind_blob64(stmt, index, value, nb, SQLITE_STATIC); + if (ret) { + sqlite_errno(ret, "sqlite3_bind_blob64"); + return ret; + } + + return ret; +} + int sqlite_exec_as_transaction(sqlite3 *db, const char *stmt) { static const char *const fmt = "BEGIN; %s COMMIT;"; diff --git a/src/sqlite.h b/src/sqlite.h index 20386d4..556684f 100644 --- a/src/sqlite.h +++ b/src/sqlite.h @@ -10,6 +10,8 @@ #include <sqlite3.h> +#include <stddef.h> + int sqlite_init(void); void sqlite_destroy(void); @@ -27,6 +29,7 @@ int sqlite_step(sqlite3_stmt *); int sqlite_bind_int(sqlite3_stmt *, int column_index, int value); int sqlite_bind_text(sqlite3_stmt *, int column_index, const char *value); +int sqlite_bind_blob(sqlite3_stmt *, int column_index, unsigned char *value, size_t nb); int sqlite_column_int(sqlite3_stmt *, int column_index); int sqlite_column_text(sqlite3_stmt *, int column_index, char **result); |