Assign a Blob between a TOracleDataset and a TOracleQuery

Mathieu

Member
HI,
I try to understand how to use correctly the DOA component.
I have a TOracleDataset (MySelectBLOB) which includes a BLOB Field (It is useful to work with a TDatasource)

I have also a TOracleQuery (InsertMyBlob) which is used to insert the selected blob of MySelectBLOB in another table;

To realize this, here are what I do :
//Insert into mytable(thekey, theblob)
//Values (:MYKEY, empty_blob());
//Returning theblob INTO :MYBLOB
InsertMyBlob.SetVariable('MYKEY', 1);
LOB := TLOBLocator.Create(InsertMyBlob.Session, otBlob);
InsertMyBlob.SetComplexVariable('MYBLOB', LOB);
InsertMyBlob.ExecSql;

and now...problem..I can't do this :
LOB := MySelectBLOB.LOBField('theblob');
because the LOBField is a method of the TOracleQuery.

How is it possible to do ?
Thank's
 
The TOracleDataSet does indeed not have a LOBField method, but relies on the standard TDataSet and TField functionality. Therefore you can access the 'theblob' field as a standard TBLOBField. It has a SaveToStream method, so instead of the final assignment statement in your example you can simply do something like this:

TBLOBField(MySelectBLOB.FieldByName('theblob')).SaveToStream(LOB);

Or, if you have persistent fields:

TheBlob.SaveToStream(LOB);

------------------
Marco Kalter
Allround Automations
 
Back
Top