Skip to content

Commit f227bfb

Browse files
committedOct 23, 2018
[needs-docs] Save vector layer as CSV: add STRING_QUOTING (IF_NEEDED|IF_AMBIGUOUS|ALWAYS) create option to the predefined drop-down widgets. Only available with GDAL >= 2.3 (from that GDAL version the default value changed from IF_NEEDED to IF_AMBIGUOUS, so integer values became double-quoted by default)
1 parent f346dce commit f227bfb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
 

‎src/core/qgsvectorfilewriter.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,17 @@ class QgsVectorFileWriterMetadataContainer
843843
QStringLiteral( "COMMA" ) // Default value
844844
) );
845845

846+
#if defined(GDAL_COMPUTE_VERSION) && GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(2,3,0)
847+
layerOptions.insert( QStringLiteral( "STRING_QUOTING" ), new QgsVectorFileWriter::SetOption(
848+
QObject::tr( "Double-quote strings. IF_AMBIGUOUS means that string values that look like numbers will be quoted." ),
849+
QStringList()
850+
<< QStringLiteral( "IF_AMBIGUOUS" )
851+
<< QStringLiteral( "IF_NEEDED" )
852+
<< QStringLiteral( "ALWAYS" ),
853+
QStringLiteral( "IF_AMBIGUOUS" ) // Default value
854+
) );
855+
#endif
856+
846857
layerOptions.insert( QStringLiteral( "WRITE_BOM" ), new QgsVectorFileWriter::BoolOption(
847858
QObject::tr( "Write a UTF-8 Byte Order Mark (BOM) at the start of the file." ),
848859
false // Default value

0 commit comments

Comments
 (0)
Please sign in to comment.