Subject | Re: Problem in retrieving BLOB data |
---|---|
Author | bala_karat |
Post date | 2009-06-01T12:21:27Z |
Thanks Lester Caine.
option 1: no luck. I am getting the error:
"Message: ibase_blob_info() [function.ibase-blob-info]: Unrecognized BLOB ID"
May be I am making some silly mistake. Following is my code now:
$data = ibase_fetch_object($result,IBASE_TEXT);
$blob_data = ibase_blob_info($data->TEST);
$blob_hndl = ibase_blob_open($data->TEST);
echo ibase_blob_get($blob_hndl,$blob_data[0]);
option 2: For this project we are already using codeigniter with ibase. Since we got in to problems with blob, started using the direct php functions for this part. Is it OK to use ADODB also?
With regards,
Bala
option 1: no luck. I am getting the error:
"Message: ibase_blob_info() [function.ibase-blob-info]: Unrecognized BLOB ID"
May be I am making some silly mistake. Following is my code now:
$data = ibase_fetch_object($result,IBASE_TEXT);
$blob_data = ibase_blob_info($data->TEST);
$blob_hndl = ibase_blob_open($data->TEST);
echo ibase_blob_get($blob_hndl,$blob_data[0]);
option 2: For this project we are already using codeigniter with ibase. Since we got in to problems with blob, started using the direct php functions for this part. Is it OK to use ADODB also?
With regards,
Bala
--- In firebird-php@yahoogroups.com, Lester Caine <lester@...> wrote:
>
> bala_karat wrote:
> > Hi !
> >
> > Any problem in retriving blob data? I have been trying different combinations with no success.
> >
> > For the following combination, I get the data echoed as "BINARY"
> >
> > $host = "localhost:C:/BK_Share/file_test/FILE.FDB";
> > ibase_connect($host, "SYSDBA", "masterkey");
> > $result = ibase_query("select TEST from EMPLOYEEMASTER where EMPCODE = '002'");
> > $data = ibase_fetch_object($result);
> > $blob_data = ibase_blob_info($data->TEST);
> > $blob_hndl = ibase_blob_open($data->TEST);
> > echo ibase_blob_get($blob_hndl,$blob_data[0]);
> >
> > The blob data is created manually - a text string. The ultimate requirement is to read pdf files stored in blob fields.
> >
> > Using Apache 2.2.11(Win 32) and PHP 5.2.9-1
>
> Actually that is working correctly ... but if $blob_data[0] is greater
> than the blob size you will get a truncated result
>
> Option 1 ... ibase_fetch_object($result, IBASE_TEXT);
> This will return the text of the blob rather than the blob ID
>
> Option 2 ... read the stream provided by $blob_hndl into a string
> Grab a copy of ADOdb and check out the _BlobDecode()
> (
> http://www.mantisforge.org/dev/phpxref/core/adodb/drivers/adodb-ibase.inc.php.source.html#l571
> will give you an on-line version to look at ... note the inclusion of
> the connection resource for PHP5! )
>
> --
> Lester Caine - G8HFL
> -----------------------------
> Contact - http://lsces.co.uk/wiki/?page=contact
> L.S.Caine Electronic Services - http://lsces.co.uk
> EnquirySolve - http://enquirysolve.com/
> Model Engineers Digital Workshop - http://medw.co.uk//
> Firebird - http://www.firebirdsql.org/index.php
>