Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nyurik committed Oct 4, 2023
1 parent d0cef2b commit 3596460
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions martin-mbtiles/src/copier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,26 +201,35 @@ impl MbtileCopierInt {

match dst_type {
Flat => {
let sql = format!("INSERT {on_dupl} INTO tiles {select_from} {sql_cond}");
let sql = format!(
"INSERT {on_dupl} INTO tiles
(zoom_level, tile_column, tile_row, tile_data)
{select_from} {sql_cond}"
);
debug!("Copying to {dst_type} with {sql} {query_args:?}");
rusqlite_conn.execute(&sql, params_from_iter(query_args))?
}
FlatWithHash => {
let sql =
format!("INSERT {on_dupl} INTO tiles_with_hash {select_from} {sql_cond}");
let sql = format!(
"INSERT {on_dupl} INTO tiles_with_hash
(zoom_level, tile_column, tile_row, tile_data, tile_hash)
{select_from} {sql_cond}"
);
debug!("Copying to {dst_type} with {sql} {query_args:?}");
rusqlite_conn.execute(&sql, params_from_iter(query_args))?
}
Normalized => {
let sql = format!(
"INSERT {on_dupl} INTO map (zoom_level, tile_column, tile_row, tile_id)
"INSERT {on_dupl} INTO map
(zoom_level, tile_column, tile_row, tile_id)
SELECT zoom_level, tile_column, tile_row, hash as tile_id
FROM ({select_from} {sql_cond})"
);
debug!("Copying to {dst_type} with {sql} {query_args:?}");
rusqlite_conn.execute(&sql, params_from_iter(&query_args))?;
let sql = format!(
"INSERT OR IGNORE INTO images (tile_id, tile_data)
"INSERT OR IGNORE INTO images
(tile_id, tile_data)
SELECT hash as tile_id, tile_data
FROM ({select_from})"
);
Expand Down

0 comments on commit 3596460

Please sign in to comment.