mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
Adding lonlong to types advertised by delimited text provider
This commit is contained in:
parent
308bbb66bd
commit
1272870ffc
@ -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";
|
||||
|
Loading…
x
Reference in New Issue
Block a user