Skip to content
Permalink
Browse files

Fix spatialite uniquevalues with bigint

Fixes #33585
  • Loading branch information
elpaso committed Jan 22, 2020
1 parent aca059a commit a8181074b9409defc2746196f87f3d82ed11bd89
@@ -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 ) ) );
@@ -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()

0 comments on commit a818107

Please sign in to comment.
You can’t perform that action at this time.