Subject Re: [firebird-support] Re: query that returns the BLOB ID - not the blob...
Author Milan Babuskov
Ken wrote:
> SET BLOB OFF;
> SELECT ID,MEMO FROM TABLE; (MEMO IS THE BLOB field)
>
> ... then, for each ID/MEMO selected, BLOBDUMP 'memo' ID.TXT
>
> What I would end up with is a SERIES of text files where the name of the file is the ID of the record - and the CONTENTS of the file is the contents of the BLOB.
>
> Is this something that I can run - from a script/commandline?

If you use a scripting language like PHP, you can do it in couple lines
of code:

ibase_connect('mydb', 'sysdba', '****') or die(ibase_errmsg());
$res = ibase_query('SELECT ID,MEMO FROM TABLE');
while ($row = ibase_fetch_row($res))
{
$fp = fopen($row[0].'.txt', 'w+');
fwrite($fp, ibase_blob_get($row[1]));
fclose($fp);
}

--
Milan Babuskov

==================================
The easiest way to import XML, CSV
and textual files into Firebird:
http://www.guacosoft.com/xmlwizard
==================================