From b9af9226508bbf7e613622cbcb9c82a98d378f1d Mon Sep 17 00:00:00 2001 From: Brandon Liu Date: Tue, 13 Dec 2022 05:28:51 +0800 Subject: [PATCH] Change mbtiles tile_id inserts from blob to text (#41) Change mbtiles tile_id inserts from blob to text to enable querying by text. * previous blob type worked for internal join, but made querying by text impossible without casting. --- mbtiles.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mbtiles.cpp b/mbtiles.cpp index 258b7637..9ec71b12 100644 --- a/mbtiles.cpp +++ b/mbtiles.cpp @@ -120,7 +120,7 @@ void mbtiles_write_tile(sqlite3 *outdb, int z, int tx, int ty, const char *data, } sqlite3_bind_int(stmt, 1, z); - sqlite3_bind_blob(stmt, 2, hash.c_str(), hash.size(), NULL); + sqlite3_bind_text(stmt, 2, hash.c_str(), hash.size(), NULL); sqlite3_bind_blob(stmt, 3, data, size, NULL); if (sqlite3_step(stmt) != SQLITE_DONE) { @@ -141,7 +141,7 @@ void mbtiles_write_tile(sqlite3 *outdb, int z, int tx, int ty, const char *data, sqlite3_bind_int(stmt, 1, z); sqlite3_bind_int(stmt, 2, tx); sqlite3_bind_int(stmt, 3, (1 << z) - 1 - ty); - sqlite3_bind_blob(stmt, 4, hash.c_str(), hash.size(), NULL); + sqlite3_bind_text(stmt, 4, hash.c_str(), hash.size(), NULL); if (sqlite3_step(stmt) != SQLITE_DONE) { fprintf(stderr, "sqlite3 map insert failed: %s\n", sqlite3_errmsg(outdb));