Mega Search
23.2 Million


Sign Up

Make a donation  
No File is Being Created when Using TIBOutputRawFile in Delp  
News Group: embarcadero.public.delphi.database.interbase_express

I have the following procedure:

procedure TForm1.Button1Click(Sender: TObject);
var
   RawOutput: TIBOutputRawFile;
   FileName: string;
begin
      RawOutput:= TIBOutputRawFile.Create;
     try
        with IBSQL1 do begin
             close;
             sql.text:= 'select * from employee';
             RawOutput.FileName :=  'TRANS.ibx';
             BatchOutput(RawOutput);
        end;
     finally
        RawOutput.Free
     end;
end;

In Delphi XE6, even though this procedure is run without any exceptions, no file is being created. It created the file just fine with Delphi XE5 and before.

Has anything changed? Am I missing something?

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 25-Jun-2014, at 10:52 AM EST
From: Mike Norayr Monjian
 
Re: No File is Being Created when Using TIBOutputRawFile in  
News Group: embarcadero.public.delphi.database.interbase_express
> {quote:title=Jeff Overcash (TeamB) wrote:}{quote}
> Mike Norayr Monjian wrote:
> > I have the following procedure:
> > 
> > procedure TForm1.Button1Click(Sender: TObject);
> > var
> >    RawOutput: TIBOutputRawFile;
> >    FileName: string;
> > begin
> >       RawOutput:= TIBOutputRawFile.Create;
> >      try
> >         with IBSQL1 do begin
> >              close;
> >              sql.text:= 'select * from employee';
> >              RawOutput.FileName :=  'TRANS.ibx';
> >              BatchOutput(RawOutput);
> >         end;
> >      finally
> >         RawOutput.Free
> >      end;
> > end;
> > 
> > In Delphi XE6, even though this procedure is run without any exceptions, no file is being created. It created the file just fine with Delphi XE5 and before.
> > 
> > Has anything changed? Am I missing something?
> 
> Yes in finally fixing outputting Unicode character in the delimited file version 
> I messed up RAW file slightly.
> 
> In both TIBOutputRawFile and TIBInputRawFile add a public procedure
> 
> {code}
>      procedure ReadyFile; override;
> {code}
> 
> Then the two new procedures look like
> 
> {code}
> procedure TIBOutputRawFile.ReadyFile;
> begin
>    inherited;
>    FFile := TFileStream.Create(FFilename, fmCreate or fmShareDenyWrite);
> end;
> 
> ...
> 
> procedure TIBInputRawFile.ReadyFile;
> begin
>    inherited;
>    FFile := TFileStream.Create(FFilename, fmOpenRead or fmShareDenyWrite);
> end;
> 
> {code}
> 
> This will have to be delayed till XE7 to actually get into an official update 
> since it requires breaking the interface.
> 
> Sorry about that, the Unicode part needed a pretty big rewrite on the Delimited 
> side of the inheritance tree.
> 
> -- 
> Jeff Overcash (TeamB)
>        (Please do not email me directly unless  asked. Thank You)
> And so I patrol in the valley of the shadow of the tricolor
> I must fear evil. For I am but mortal and mortals can only die.
> Asking questions, pleading answers from the nameless
> faceless watchers that stalk the carpeted  corridors of Whitehall.
>               (Fish)

Thanx, Jeff.

I did the changes. The raw file export & import works fine. As for the delimited file, the export works fine (at least looks fine) but the import results in an "EConvertError with message 'X' is not a valid date and time" exception. FYI, my date format in the regional settings is 'dd/mm/yyyy' and the date fields in the export file look fine. I don't know if the import is trying to read them in Interbase format, i.e. 'mm/dd/yyyy'.

BTW, do I add "$(BDS)\Source\IBX" to the library path or just copy the new IBX.IBSQL.dcu file created to the "$(BDSLIB)\$(Platform)\release" folder?

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 27-Jun-2014, at 4:12 AM EST
From: Mike Norayr Monjian