Skip to content
Permalink
Browse files

Fix handling of longlong fields in memory provider

  • Loading branch information
nyalldawson committed Mar 3, 2016
1 parent b253a96 commit 98a216e0327c72132faa434251f29ee9f2a582bc
Showing with 10 additions and 3 deletions.
  1. +9 −3 src/providers/memory/qgsmemoryprovider.cpp
  2. +1 −0 tests/src/python/test_provider_memory.py
@@ -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 );
@@ -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" )
{
@@ -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'),

0 comments on commit 98a216e

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