Skip to content

Validating INT vs INTEGER #2169

@RobertSasak

Description

@RobertSasak

Sqlite has two types INT and INTEGER which are the same. However it is possible to create a DB with on or another.

Validation will throw error following error when INT is used.

Invalid data format for MBTile file

Current implementation of validator only accept INTEGER as a type for columns in map table.

WHERE ((name = 'zoom_level' AND type = 'INTEGER')
OR (name = 'tile_column' AND type = 'INTEGER')
OR (name = 'tile_row' AND type = 'INTEGER')

SELECT COUNT(*) = 4
             FROM pragma_table_info('map')
             WHERE ((name = 'zoom_level' AND type = 'INTEGER')
                 OR (name = 'tile_column' AND type = 'INTEGER')
                 OR (name = 'tile_row' AND type = 'INTEGER')
                 OR (name = 'tile_id' AND type = 'TEXT'))

Fix

SELECT COUNT(*) = 4
FROM pragma_table_info('map')
WHERE (name = 'zoom_level' AND type IN ('INTEGER', 'INT'))
   OR (name = 'tile_column' AND type IN ('INTEGER', 'INT'))
   OR (name = 'tile_row' AND type IN ('INTEGER', 'INT'))
   OR (name = 'tile_id' AND type = 'TEXT');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions