Skip to content
Permalink
Browse files

Fix handling of longlong fields in memory provider

(cherry-picked from 98a216e)
  • Loading branch information
nyalldawson committed Mar 4, 2016
1 parent c8950e2 commit 2f5c193de512ce2bb1f7c6cea5768fc1322b09fd
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 2f5c193

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