Subject Re: [Firebird-general] Can Firebird "isql.exe" export to csv or xml?
Author Helen Borrie
At 01:21 AM 13/11/2004 +0000, you wrote:



>2 simple questions...
>
>I wish to run a script command like:
>
>C:\Program Files\Firebird\Firebird_1_5\bin\isql.exe
>-input C:\runthis.sql -output C:\output.txt
>
>Where "output.txt" would be most useful to me
>as xml or csv.
>
>I have looked in The Firebird Book, +google etc,
>but I can't see a switch for delimited output...
>
>isql [<database>] [-e] [-t <terminator>] [-i <inputfile>]
>[-o <outputfile>] [-x|-a] [-d <target db>] [-u <user>]
>[-p <password>] [-page <pagelength>] [-n] [-m] [-q]
>[-s <sql_dialect>] [-r <rolename>] [-c <num cache buffers>]
>[-z] -nowarnings -noautocommit

There is no such switch in isql.

And the question isn't simple. XML, quo vadis? What do you mean by
"output as xml"? There are certainly ways to output data as text, but you
need an application program and your own DTD to make XML out of it.


>Is there a simple way to get more useable tables of output?

Generically, in the engine, no. There are plenty of tools around that do
this. See the Downloads>Contributed section of the IBPhoenix website. The
free IB_SQL toolkit from www.ibobjects.com has an export tool that can
output CSV.

>maybe some instruction could go in the DDL/SQL commands (ie in
>the "runthis.sql" input file mentioned above)

For an output task that you are going to do repeatedly, using one or more
stored procedures is an attractive option. You can combine the speed and
flexibility of PSQL with the convenience of the external table; you can
customise the output to your heart's content - including adding XML tags of
your own design and choosing - and it's something you can make to run in a
batch script or a daemon in combination with isql.

If you download the companion source code kit from the Apress website, (
http://www.apress.com/book/bookDisplay.html?bID=301) you will find the
stored procedures that I used to output, from the internal msg.fdb, the
text columns that became Appendix X of the book. That was CSV, but it
could have been anything else I might have wanted to make it.

Helen