Skip to content

Commit

Permalink
Merge pull request #34290 from elpaso/bugfix-gh33585-bigint-categoriz…
Browse files Browse the repository at this point in the history
…ed-3_10

Fix spatialite uniquevalues with bigint
  • Loading branch information
elpaso committed Feb 7, 2020
2 parents aca059a + a818107 commit 68ad59b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/providers/spatialite/qgsspatialiteprovider.cpp
Expand Up @@ -3869,7 +3869,7 @@ QSet<QVariant> QgsSpatiaLiteProvider::uniqueValues( int index, int limit ) const
switch ( sqlite3_column_type( stmt, 0 ) )
{
case SQLITE_INTEGER:
uniqueValues.insert( QVariant( sqlite3_column_int( stmt, 0 ) ) );
uniqueValues.insert( QVariant( sqlite3_column_int64( stmt, 0 ) ) );
break;
case SQLITE_FLOAT:
uniqueValues.insert( QVariant( sqlite3_column_double( stmt, 0 ) ) );
Expand Down
12 changes: 12 additions & 0 deletions tests/src/python/test_provider_spatialite.py
Expand Up @@ -228,6 +228,18 @@ def setUpClass(cls):
sql += "VALUES (8, 'int', GeomFromText('POINT(2 1)', 4326))"
cur.execute(sql)

# bigint table
sql = "CREATE TABLE test_bigint (id BIGINT, value INT)"
cur.execute(sql)
sql = "SELECT AddGeometryColumn('test_bigint', 'position', 4326, 'LINESTRING', 'XYM')"
cur.execute(sql)
sql = """
INSERT INTO test_bigint (id, value, position) VALUES
(987654321012345, 1, ST_GeomFromtext('LINESTRINGM(10.416255 55.3786316 1577093516, 10.516255 55.4786316 157709)', 4326) ),
(987654321012346, 2, ST_GeomFromtext('LINESTRINGM(10.316255 55.3786316 1577093516, 11.216255 56.3786316 157709)', 4326) )"""

cur.execute(sql)

cur.execute("COMMIT")
con.close()

Expand Down

0 comments on commit 68ad59b

Please sign in to comment.