Skip to content
Permalink
Browse files

Adding lonlong to types advertised by delimited text provider

  • Loading branch information
ccrook committed Mar 22, 2015
1 parent 308bbb6 commit 1272870ffce3cab61ccde1f96c1680ea053a9628
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
@@ -88,6 +88,7 @@ QgsDelimitedTextProvider::QgsDelimitedTextProvider( QString uri )
// Add supported types to enable creating expression fields in field calculator
mNativeTypes
<< QgsVectorDataProvider::NativeType( tr( "Whole number (integer)" ), "integer", QVariant::Int, 0, 10 )
<< QgsVectorDataProvider::NativeType( tr( "Whole number (integer - 64 bit)"), "int8", QVariant::LongLong )
<< QgsVectorDataProvider::NativeType( tr( "Decimal number (double)" ), "double precision", QVariant::Double, -1, -1, -1, -1 )
<< QgsVectorDataProvider::NativeType( tr( "Text, unlimited length (text)" ), "text", QVariant::String, -1, -1, -1, -1 )
;
@@ -245,7 +246,7 @@ QStringList QgsDelimitedTextProvider::readCsvtFieldTypes( QString filename, QStr
// not allowed in OGR CSVT files. Also doesn't care if int and string fields have

strTypeList = strTypeList.toLower();
QRegExp reTypeList( "^(?:\\s*(\\\"?)(?:integer|real|long|longlong|string|date|datetime|time)(?:\\(\\d+(?:\\.\\d+)?\\))?\\1\\s*(?:,|$))+" );
QRegExp reTypeList( "^(?:\\s*(\\\"?)(?:integer|real|double|long|longlong|int8|string|date|datetime|time)(?:\\(\\d+(?:\\.\\d+)?\\))?\\1\\s*(?:,|$))+" );
if ( ! reTypeList.exactMatch( strTypeList ) )
{
// Looks like this was supposed to be a CSVT file, so report bad formatted string
@@ -639,7 +640,7 @@ void QgsDelimitedTextProvider::scanFile( bool buildIndexes )
fieldType = QVariant::Int;
typeName = "integer";
}
else if ( csvtTypes[i] == "long" || csvtTypes[i]== "longlong" )
else if ( csvtTypes[i] == "long" || csvtTypes[i]== "longlong" || csvtTypes[i] == "int8" )
{
fieldType = QVariant::LongLong; //QVariant doesn't support long
typeName = "longlong";

0 comments on commit 1272870

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