Navigation Menu

Skip to content

Commit

Permalink
Fix Delimited Text provider types recognition from csvt
Browse files Browse the repository at this point in the history
  • Loading branch information
agiudiceandrea authored and github-actions[bot] committed Nov 22, 2021
1 parent e86e559 commit 5097263
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
Expand Up @@ -222,6 +222,7 @@ QStringList QgsDelimitedTextProvider::readCsvtFieldTypes( const QString &filenam
// This is a slightly generous regular expression in that it allows spaces and unquoted field types
// not allowed in OGR CSVT files. Also doesn't care if int and string fields have

strTypeList = strTypeList.toLower();
const QRegularExpression reTypeList( QRegularExpression::anchoredPattern( QStringLiteral( "^(?:\\s*(\\\"?)(?:integer|real|double|long|longlong|int8|string|date|datetime|time)(?:\\(\\d+(?:\\.\\d+)?\\))?\\1\\s*(?:,|$))+" ) ) );
const QRegularExpressionMatch match = reTypeList.match( strTypeList );
if ( !match.hasMatch() )
Expand All @@ -236,7 +237,7 @@ QStringList QgsDelimitedTextProvider::readCsvtFieldTypes( const QString &filenam
QgsDebugMsgLevel( QStringLiteral( "Field type string: %1" ).arg( strTypeList ), 2 );

int pos = 0;
const QRegularExpression reType( QStringLiteral( "(integer|real|double|string|date|datetime|time)" ) );
const QRegularExpression reType( QStringLiteral( "(integer|real|double|string|datetime|date|time)" ) );
QRegularExpressionMatch typeMatch = reType.match( strTypeList, pos );
while ( typeMatch.hasMatch() )
{
Expand Down

0 comments on commit 5097263

Please sign in to comment.