Navigation Menu

Skip to content

Commit

Permalink
Fix handling of longlong fields in memory provider
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Mar 3, 2016
1 parent b253a96 commit 98a216e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/providers/memory/qgsmemoryprovider.cpp
Expand Up @@ -108,8 +108,8 @@ QgsMemoryProvider::QgsMemoryProvider( const QString& uri )
{
QList<QgsField> attributes;
QRegExp reFieldDef( "\\:"
"(int|integer|real|double|string|date|time|datetime)" // type
"(?:\\((\\d+)" // length
"(int|integer|long|int8|real|double|string|date|time|datetime)" // type
"(?:\\((\\-?\\d+)" // length
"(?:\\,(\\d+))?" // precision
"\\))?"
"$", Qt::CaseInsensitive );
Expand All @@ -131,7 +131,13 @@ QgsMemoryProvider::QgsMemoryProvider( const QString& uri )
{
type = QVariant::Int;
typeName = "integer";
length = 10;
length = -1;
}
else if ( typeName == "int8" || typeName == "long" )
{
type = QVariant::LongLong;
typeName = "int8";
length = -1;
}
else if ( typeName == "real" || typeName == "double" )
{
Expand Down
1 change: 1 addition & 0 deletions tests/src/python/test_provider_memory.py
Expand Up @@ -227,6 +227,7 @@ def testSaveFields(self):

# Add some fields to the layer
myFields = [QgsField('TestInt', QVariant.Int, 'integer', 2, 0),
QgsField('TestLong', QVariant.LongLong, 'long', -1, 0),
QgsField('TestDbl', QVariant.Double, 'double', 8, 6),
QgsField('TestString', QVariant.String, 'string', 50, 0),
QgsField('TestDate', QVariant.Date, 'date'),
Expand Down

0 comments on commit 98a216e

Please sign in to comment.