Subject Re: [firebird-support] FB 2.5.1 - cannot read external table file through text editor
Author Mark Rotteveel
On Fri, 12 Oct 2012 01:34:50 -0300, Roberto Carlos <rc.1990@...>
wrote:
>  I am using FB 2.5.1 on Windows 7 64 bits.
> It works perfectly on FlameRobin 0.9.3.2219 Unicode (x64):
> -----------------------
> Create Database test.fdb Default Character Set utf8;
>
> Create Table test15 External 'c:\mytable15.txt'
> (
> code1 Integer,
> code2 Integer,
> name char(20),
> born date default current_date,
> crlf char(2)
> );
> Commit;
>
> Insert Into test15(code1, code2, name, born, crlf) Values(1, 2, 'abc',
> '01.01.2001', ascii_char(13)||ascii_char(10));
> Insert Into test15(code1, code2, name, born, crlf) Values(3, 5, 'def',
> '02.02.2002', ascii_char(13)||ascii_char(10));
> Insert Into test15(code1, code2, name, born, crlf) Values(5, 6, 'ghi',
> '03.03.2003', ascii_char(13)||ascii_char(10));
> Insert Into test15(code1, code2, name, born, crlf) Values(7, 8, 'jkl',
> '04.04.2004', ascii_char(13)||ascii_char(10));
> Insert Into test15(code1, code2, name, born, crlf) Values(9, 0, 'mno',
> '05.05.2005', ascii_char(13)||ascii_char(10));
> Commit;
>
> Select * From test15;
> -----------------------
>
> But when I open c:\mytable15.txt on Notepad++ 6.1.8 (UNICODE), I only
can
> understand column NAME.
> The other columns are not human readble.
> Why I cannot read number and date fields on the text file, but Firebird
> show them perfectly on select statement?
>
> Thanks for any help or hint.

The external table file is not meant to be human readable. It is a very
specific binary format (eg CHAR fields are fixed width, VARCHAR have the
length before it, int is encoded as 4 bytes (network representation),
timestamps etc according to the internal firebird binary format etc. I
believe the details of this format are described in one of the Interbase 6
manuals available on the website.

If you want things to be human readable, then your only real option is to
output everything as CHAR, and if you want to discern rows, make sure that
you add an additional column for the linebreak character(s)

Mark