Subject | Re: Storing PDF into Firebird Blobs |
---|---|
Author | Aage Johansen |
Post date | 2012-05-14T18:02:42Z |
Terry wrote:
Could you please give me an idea of how to use it. You mentioned
using a prepared DSQL component?
Here, MYDSQL is a TIB_DSQL component, with connection and transaction
properties set.
MYDSQL.SQL.Text:='insert into MYTABLE '+
'( ID, PICT, ...) '+
'values '+
'(:ID,:PICT, ...)';
MYDSQL.Prepare; // No longer really necessary
MYDSQL.ParamByName('ID' ).AsInteger:= ... ;
MYDSQL.ParamByName('PICT').LoadFromFile('C:\XYZ.pdf');
...
MYDSQL.ExecSQL;
If the picture arrives via a memorystream you can use
MYDSQL.ParamByName('PICT').Assign(PICT_STREAM);
Totally untested, of course.
TIB_DSQL is not used if you want to return rows from the
operation. In a pinch you can get a single value, as with "select
count(*) from MYTABLE".
Jason wrote:
<<
CreateBlobStream( ) is what you use.
--
Aage J.
>>...
Could you please give me an idea of how to use it. You mentioned
using a prepared DSQL component?
>>It is very close to using the query components.
Here, MYDSQL is a TIB_DSQL component, with connection and transaction
properties set.
MYDSQL.SQL.Text:='insert into MYTABLE '+
'( ID, PICT, ...) '+
'values '+
'(:ID,:PICT, ...)';
MYDSQL.Prepare; // No longer really necessary
MYDSQL.ParamByName('ID' ).AsInteger:= ... ;
MYDSQL.ParamByName('PICT').LoadFromFile('C:\XYZ.pdf');
...
MYDSQL.ExecSQL;
If the picture arrives via a memorystream you can use
MYDSQL.ParamByName('PICT').Assign(PICT_STREAM);
Totally untested, of course.
TIB_DSQL is not used if you want to return rows from the
operation. In a pinch you can get a single value, as with "select
count(*) from MYTABLE".
Jason wrote:
<<
CreateBlobStream( ) is what you use.
>>I haven't actually use this myself.
--
Aage J.