Răsfoiți Sursa

fcl-db: dbtestframework:
* Fix dbf export test column name collisions; fixes "field not found" when exporting

git-svn-id: trunk@26967 -

reiniero 11 ani în urmă
părinte
comite
b87b2add38

+ 0 - 1
packages/fcl-db/tests/sqldbtoolsunit.pas

@@ -406,7 +406,6 @@ var
 
 function String2Hex(Source: string): string;
 // Converts ASCII codes into hex
-// Inverse of hex2string
 var
   i: integer;
 begin

+ 4 - 3
packages/fcl-db/tests/testdbexport.pas

@@ -127,12 +127,10 @@ begin
       if not FieldSupported(
         Exporter.Dataset.Fields[i].DataType,
         ExportFormat) then
-        FieldMapping.Delete(i);
+          FieldMapping.Delete(i);
     end;
     for i:=0 to FieldMapping.Count-1 do
-    begin
       Exporter.ExportFields.Add.Assign(FieldMapping[i]);
-    end;
     NumberExported := Exporter.Execute;
     Exporter.Dataset.Last;
     Exporter.Dataset.First;
@@ -186,6 +184,7 @@ begin
   try
     ExportFormat:=efDBaseVII;
     ExportSettings.TableFormat:=tfDBaseVII;
+    ExportSettings.AutoRenameFields:=true; //rename conflicting column names
     // Use export subtype position to differentiate output filenames:
     Exporter.FileName := FExportTempDir + inttostr(ord(ExportFormat)) +
       lowercase(rightstr(TestName,5)) +
@@ -213,6 +212,7 @@ begin
   try
     ExportFormat:=efDBaseIV;
     ExportSettings.TableFormat:=tfDBaseIV;
+    ExportSettings.AutoRenameFields:=true; //rename conflicting column names
     Exporter.FileName := FExportTempDir + inttostr(ord(ExportFormat)) +
       lowercase(rightstr(TestName,5)) +
       TDetailedExportExtensions[ExportFormat];
@@ -239,6 +239,7 @@ begin
   try
     ExportFormat:=efFoxpro;
     ExportSettings.TableFormat:=tfFoxPro;
+    ExportSettings.AutoRenameFields:=true; //rename conflicting column names
     Exporter.FileName := FExportTempDir + inttostr(ord(ExportFormat)) +
       lowercase(rightstr(TestName,5)) +
       TDetailedExportExtensions[ExportFormat];