Browse Source

* Applied patch from Reinier Olislaghers to quote memo fields (bug 19759)

git-svn-id: trunk@21490 -
michael 13 years ago
parent
commit
f97c4b7b57
1 changed files with 12 additions and 1 deletions
  1. 12 1
      packages/fcl-db/src/export/fpcsvexport.pp

+ 12 - 1
packages/fcl-db/src/export/fpcsvexport.pp

@@ -177,7 +177,14 @@ Var
 begin
   S:=FormatField(EF.Field);
   QS:=FormatSettings.QuoteStrings;
-  If (EF.Field.DataType in StringFieldTypes) and (QS<>[]) then
+  {If specified, quote everything that can contain delimiters;
+  leave numeric, date fields alone:}
+  If (
+  (EF.Field.DataType in StringFieldTypes) or
+  (EF.Field.DataType in MemoFieldTypes) or
+  (EF.Field.DataType in BlobFieldTypes)
+  )
+  and (QS<>[]) then
     begin
     If (qsAlways in QS) or HaveSpace(S,QS) or HaveDelimiter(S,QS) then
       begin
@@ -210,6 +217,10 @@ begin
   FHeaderRow:=True;
   FDelimiter:=',';
   FStringQuoteChar:='"';
+  FQuoteStrings:=[qsSpace, qsDelimiter];
+  {Sensible defaults as reading unquoted strings with delimiters/spaces will
+  either fail by creating phantom fields (qsDelimiter) or delete leading or
+  trailing data/spaces (qsSpace)}
 end;
 
 procedure TCSVFormatSettings.Assign(Source: TPersistent);