Skip to content

Commit

Permalink
added date type support
Browse files Browse the repository at this point in the history
  • Loading branch information
blazek committed Sep 5, 2013
1 parent a9a0d9a commit 63ffd2d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/providers/memory/qgsmemoryprovider.cpp
Expand Up @@ -81,13 +81,14 @@ QgsMemoryProvider::QgsMemoryProvider( QString uri )
// So the limits set here are not correct but enable use of data from Shapefiles.
<< QgsVectorDataProvider::NativeType( tr( "Decimal number (real)" ), "double", QVariant::Double, 0, 32, 0, 30 )
<< QgsVectorDataProvider::NativeType( tr( "Text (string)" ), "string", QVariant::String, 0, 255 )
<< QgsVectorDataProvider::NativeType( tr( "Date" ), "date", QVariant::Date, 0, 10 )
;

if ( url.hasQueryItem( "field" ) )
{
QList<QgsField> attributes;
QRegExp reFieldDef( "\\:"
"(int|integer|real|double|string)" // type
"(int|integer|real|double|string|date)" // type
"(?:\\((\\d+)" // length
"(?:\\,(\\d+))?" // precision
"\\))?"
Expand Down Expand Up @@ -119,6 +120,12 @@ QgsMemoryProvider::QgsMemoryProvider( QString uri )
length = 20;
precision = 5;
}
else if ( typeName == "date" )
{
type = QVariant::Date;
typeName = "date";
length = 10;
}

if ( reFieldDef.cap( 2 ) != "" )
{
Expand Down Expand Up @@ -321,6 +328,7 @@ bool QgsMemoryProvider::addAttributes( const QList<QgsField> &attributes )
case QVariant::Int:
case QVariant::Double:
case QVariant::String:
case QVariant::Date:
break;
default:
QgsDebugMsg( "Field type not supported: " + it->typeName() );
Expand Down

0 comments on commit 63ffd2d

Please sign in to comment.