From 1a386b7071f0e5d4f7265ac12f6a7aff0706aaa0 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Thu, 28 Sep 2023 16:57:50 -0400 Subject: [PATCH] Fix unit tests to use blobs only --- Cargo.lock | 24 +++++++++--------- martin-mbtiles/src/mbtiles.rs | 5 ++-- .../fixtures/files/world_cities_diff.mbtiles | Bin 3584 -> 3584 bytes .../files/world_cities_modified.mbtiles | Bin 49152 -> 49152 bytes 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 097c9d88..a09f224f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -298,9 +298,9 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstream" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" +checksum = "bff2cf94a3dbe2d57cbd56485e1bd7436455058034d6c2d47be51d4e5e4bc6ab" dependencies = [ "anstyle", "anstyle-parse", @@ -312,15 +312,15 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b84bf0a05bbb2a83e5eb6fa36bb6e87baa08193c35ff52bbf6b38d8af2890e46" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" dependencies = [ "utf8parse", ] @@ -336,9 +336,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "2.1.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" +checksum = "0238ca56c96dfa37bdf7c373c8886dd591322500aceeeccdb2216fe06dc2f796" dependencies = [ "anstyle", "windows-sys", @@ -614,9 +614,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.5" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824956d0dca8334758a5b7f7e50518d66ea319330cbceedcf76905c2f6ab30e3" +checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" dependencies = [ "clap_builder", "clap_derive", @@ -624,9 +624,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.5" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "122ec64120a49b4563ccaedcbea7818d069ed8e9aa6d829b82d8a4128936b2ab" +checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" dependencies = [ "anstream", "anstyle", diff --git a/martin-mbtiles/src/mbtiles.rs b/martin-mbtiles/src/mbtiles.rs index b37cbd8d..add902fe 100644 --- a/martin-mbtiles/src/mbtiles.rs +++ b/martin-mbtiles/src/mbtiles.rs @@ -564,7 +564,8 @@ where let query = query( // The md5_concat func will return NULL if there are no rows in the tiles table. // For our use case, we will treat it as an empty string, and hash that. - // Note that in some weird rare cases, a column with blob type may be stored as an integer value + // `tile_data` values must be stored as a blob per MBTiles spec + // `md5` functions will fail if the value is not text/blob/null "SELECT hex( coalesce( @@ -572,7 +573,7 @@ where cast(zoom_level AS text), cast(tile_column AS text), cast(tile_row AS text), - cast(tile_data as blob) + tile_data ), md5('') ) diff --git a/tests/fixtures/files/world_cities_diff.mbtiles b/tests/fixtures/files/world_cities_diff.mbtiles index 275f3316553c4b7e350951419655f2b24e7cc710..bcb123d983543e4ada9c40d8f0c6b4fadb1096cc 100644 GIT binary patch delta 78 zcmZpWX^@#9&B!@X#+j9qK`-2EW6E4+UdB%h%#1e~7=JR}WPGw&kmWR^0w)tICnu+f hL4~0K4>KzxBclil3yVR8i4g+>13M6J{>jSD0RY%*5DowU delta 65 zcmZpWX^@#9&B#7c#+j9!K`-sq#+13tybKHs%#6<&7=JQ;Vtl??kmClUFaswuDjSD0RRaf4YdFO diff --git a/tests/fixtures/files/world_cities_modified.mbtiles b/tests/fixtures/files/world_cities_modified.mbtiles index 82fa5564d7e1ccb0aa9ad9e33a9489fe6ada9b6f..e6d104bf730a9af5db838195f345bae9e6b817e2 100644 GIT binary patch delta 86 zcmV-c0IC0gfCGSl1CSd56OkN41rq=+S4y#Dt4{$=vk*|Z1p$b$frJ7J2?YfS2?-Q1 scrh@uSy-({0j-kQ0KT*b+m7hT`>%zvA)&7h@n*{=PvNHB;KBd~h#Lmjf$_WIUBO}(j hGj5p7zCeX>!^XxIE*{QCS5`(KU;%>7dsexK0sy>V7Lot}