Skip to content

Commit 63ffd2d

Browse files
committed
added date type support
1 parent a9a0d9a commit 63ffd2d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/providers/memory/qgsmemoryprovider.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,14 @@ QgsMemoryProvider::QgsMemoryProvider( QString uri )
8181
// So the limits set here are not correct but enable use of data from Shapefiles.
8282
<< QgsVectorDataProvider::NativeType( tr( "Decimal number (real)" ), "double", QVariant::Double, 0, 32, 0, 30 )
8383
<< QgsVectorDataProvider::NativeType( tr( "Text (string)" ), "string", QVariant::String, 0, 255 )
84+
<< QgsVectorDataProvider::NativeType( tr( "Date" ), "date", QVariant::Date, 0, 10 )
8485
;
8586

8687
if ( url.hasQueryItem( "field" ) )
8788
{
8889
QList<QgsField> attributes;
8990
QRegExp reFieldDef( "\\:"
90-
"(int|integer|real|double|string)" // type
91+
"(int|integer|real|double|string|date)" // type
9192
"(?:\\((\\d+)" // length
9293
"(?:\\,(\\d+))?" // precision
9394
"\\))?"
@@ -119,6 +120,12 @@ QgsMemoryProvider::QgsMemoryProvider( QString uri )
119120
length = 20;
120121
precision = 5;
121122
}
123+
else if ( typeName == "date" )
124+
{
125+
type = QVariant::Date;
126+
typeName = "date";
127+
length = 10;
128+
}
122129

123130
if ( reFieldDef.cap( 2 ) != "" )
124131
{
@@ -321,6 +328,7 @@ bool QgsMemoryProvider::addAttributes( const QList<QgsField> &attributes )
321328
case QVariant::Int:
322329
case QVariant::Double:
323330
case QVariant::String:
331+
case QVariant::Date:
324332
break;
325333
default:
326334
QgsDebugMsg( "Field type not supported: " + it->typeName() );

0 commit comments

Comments
 (0)