Browse Source

* fcl-db: examples: slight fixes dbftool

git-svn-id: trunk@26246 -
reiniero 11 years ago
parent
commit
50a349eb1c
2 changed files with 9 additions and 12 deletions
  1. 1 1
      packages/fcl-db/examples/dbftool.lpi
  2. 8 11
      packages/fcl-db/examples/dbftool.lpr

+ 1 - 1
packages/fcl-db/examples/dbftool.lpi

@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <CONFIG>
 <CONFIG>
   <ProjectOptions>
   <ProjectOptions>
     <Version Value="9"/>
     <Version Value="9"/>

+ 8 - 11
packages/fcl-db/examples/dbftool.lpr

@@ -36,7 +36,7 @@ type
 
 
   TDBFTool = class(TCustomApplication)
   TDBFTool = class(TCustomApplication)
   private
   private
-    procedure ExportDBF(var MyDbf: TDbf);
+    procedure ExportDBF(var MyDbf: TDbf; ExportFormat: string);
   protected
   protected
     procedure DoRun; override;
     procedure DoRun; override;
   public
   public
@@ -48,7 +48,6 @@ type
   procedure CreateDemoDBFs(Directory: string; TableLevel: integer);
   procedure CreateDemoDBFs(Directory: string; TableLevel: integer);
   // Creates 2 demonstration DBFs in Directory with dbase compatibility level
   // Creates 2 demonstration DBFs in Directory with dbase compatibility level
   // TableLevel
   // TableLevel
-  // and specified codepage (if not CODEPAGE_NOT_SPECIFIED)
   var
   var
     NewDBF: TDBF;
     NewDBF: TDBF;
     i: integer;
     i: integer;
@@ -282,16 +281,14 @@ type
 
 
   { TDBFTool }
   { TDBFTool }
 
 
-  procedure TDBFTool.ExportDBF(var MyDbf: TDbf);
-  // Exports recordset to another format depending on user selection
+  procedure TDBFTool.ExportDBF(var MyDbf: TDbf; ExportFormat: string);
+  // Exports recordset to specified format
   var
   var
-    ExportFormatText: string;
     ExportSettings: TCustomExportFormatSettings;
     ExportSettings: TCustomExportFormatSettings;
     Exporter: TCustomFileExporter;
     Exporter: TCustomFileExporter;
   begin
   begin
-    ExportFormatText := UpperCase(GetOptionValue('exportformat'));
     try
     try
-      case ExportFormatText of
+      case ExportFormat of
         'ACCESS', 'MSACCESS':
         'ACCESS', 'MSACCESS':
         begin
         begin
           Exporter := TXMLXSDExporter.Create(nil);
           Exporter := TXMLXSDExporter.Create(nil);
@@ -390,7 +387,7 @@ type
         end
         end
         else
         else
         begin
         begin
-          writeln('***Error: Unknown export format ' + ExportFormatText + ' specified' + '. Aborting');
+          writeln('***Error: Unknown export format ' + ExportFormat + ' specified' + '. Aborting');
           Exporter := nil;
           Exporter := nil;
           ExportSettings := nil;
           ExportSettings := nil;
           Terminate;
           Terminate;
@@ -422,7 +419,7 @@ type
     TableLevel: integer; //todo: use it
     TableLevel: integer; //todo: use it
   begin
   begin
     // quick check parameters
     // quick check parameters
-    ErrorMsg := CheckOptions('h', 'codepage: createdemo exportformat: help tablelevel:');
+    ErrorMsg := CheckOptions('h', 'createdemo exportformat: help tablelevel:');
     if ErrorMsg <> '' then
     if ErrorMsg <> '' then
     begin
     begin
       ShowException(Exception.Create(ErrorMsg));
       ShowException(Exception.Create(ErrorMsg));
@@ -500,7 +497,7 @@ type
             if HasOption('exportformat') then
             if HasOption('exportformat') then
             begin
             begin
               try
               try
-                ExportDBF(MyDbf);
+                ExportDBF(MyDbf,UpperCase(GetOptionValue('exportformat')));
               except
               except
                 on E: Exception do
                 on E: Exception do
                 begin
                 begin
@@ -551,7 +548,7 @@ type
     writeln(' 30                    Visual FoxPro');
     writeln(' 30                    Visual FoxPro');
     writeln(' --exportformat=<text> export dbfs to format. Format can be:');
     writeln(' --exportformat=<text> export dbfs to format. Format can be:');
     writeln(' access                Microsoft Access XML');
     writeln(' access                Microsoft Access XML');
-    writeln(' adonet                ADO.Net dataset');
+    writeln(' adonet                ADO.Net dataset XML');
     writeln(' csvexcel              Excel/Creativyst format CSV text file (with locale dependent output)');
     writeln(' csvexcel              Excel/Creativyst format CSV text file (with locale dependent output)');
     writeln(' csvRFC4180            LibreOffice/RFC4180 format CSV text file');
     writeln(' csvRFC4180            LibreOffice/RFC4180 format CSV text file');
     writeln(' dataset               Delphi dataset XML');
     writeln(' dataset               Delphi dataset XML');