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.
This commit is contained in:
Brandon Liu
2022-12-12 13:28:51 -08:00
committed by GitHub
parent f1df09f147
commit b9af922650
+2 -2
View File
@@ -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_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); sqlite3_bind_blob(stmt, 3, data, size, NULL);
if (sqlite3_step(stmt) != SQLITE_DONE) { 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, 1, z);
sqlite3_bind_int(stmt, 2, tx); sqlite3_bind_int(stmt, 2, tx);
sqlite3_bind_int(stmt, 3, (1 << z) - 1 - ty); 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) { if (sqlite3_step(stmt) != SQLITE_DONE) {
fprintf(stderr, "sqlite3 map insert failed: %s\n", sqlite3_errmsg(outdb)); fprintf(stderr, "sqlite3 map insert failed: %s\n", sqlite3_errmsg(outdb));