Skip to content

Commit

Permalink
fix error when no grids is present
Browse files Browse the repository at this point in the history
  • Loading branch information
amarant committed Apr 11, 2024
1 parent cc13735 commit 1f59d2d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 0 additions & 3 deletions rustfmt.toml

This file was deleted.

12 changes: 11 additions & 1 deletion src/mbtiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,18 @@ fn export_grid(
flag_scheme: Scheme,
flag_grid_callback: String,
) -> Result<(), MBTileError> {
// TODO show pregression:
// TODO show progression:
// let grids_zoom_level_count = get_count(&connection, "grids");

let mut has_grids_table_statement = connection.prepare(
"SELECT count(*) FROM sqlite_master WHERE (type='table' OR type='view') AND name='grids';",
)?;
let has_grids_table = has_grids_table_statement
.query_row([], |row| row.get::<usize, i32>(0))
.desc("Can't check if the table grids exists")?;
if has_grids_table == 0 {
return Ok(());
}
let mut grids_statement =
connection.prepare("select zoom_level, tile_column, tile_row, grid from grids;")?;
let mut grids_rows = grids_statement.query(())?;
Expand Down

0 comments on commit 1f59d2d

Please sign in to comment.