Trying to use tblobfield value as blob parameter
Posted: Tue 04 Oct 2011 16:50
oracle10g Direct <- tuniconnection <-tuniquery
We can store a literal string into an Oracle Blob field
with:
s:='hello to the entire world.';
q.SQL.add('update test set blob1= :blob1 ');
q.parambyname('blob1').asblob:= bytesof(s);
q.parambyname('blob1').paramtype:=ptInput;
q.ExecSQL;
//oracle WORKS if the paramtype is explictly set
** BUT we can't seem to use a field value in the same way.
q.sql.add('select logo_graphic from logos where id=28');
q.open;
q2.sql.add('update test set blob2= :blob2');
q2.parambyname('blob2').asblob:= tblobfield(q.fieldbyname('logo_graphic')).value;
q2.parambyname('blob2').paramtype:=ptInput;
q2.execsql;
This reliably clears the table field under oracle while
it works OK for IB,FB,SQL Server.
(yes the selected field definitely provides bytes of data)
We have tried:
-using .asbytes rather than .value
-explicitly assigning a datatype of ftOraBlob instead
-explicitly setting bound to true
-and on and on.
Our goal as always is to employ a code idiom that works
for all our database types.
If anyone has sucessfully assigned a tblobfield value into
and oracle parameter and it arrives in the blob of a table table,
please give us a hint...
thanks,
tonyM
We can store a literal string into an Oracle Blob field
with:
s:='hello to the entire world.';
q.SQL.add('update test set blob1= :blob1 ');
q.parambyname('blob1').asblob:= bytesof(s);
q.parambyname('blob1').paramtype:=ptInput;
q.ExecSQL;
//oracle WORKS if the paramtype is explictly set
** BUT we can't seem to use a field value in the same way.
q.sql.add('select logo_graphic from logos where id=28');
q.open;
q2.sql.add('update test set blob2= :blob2');
q2.parambyname('blob2').asblob:= tblobfield(q.fieldbyname('logo_graphic')).value;
q2.parambyname('blob2').paramtype:=ptInput;
q2.execsql;
This reliably clears the table field under oracle while
it works OK for IB,FB,SQL Server.
(yes the selected field definitely provides bytes of data)
We have tried:
-using .asbytes rather than .value
-explicitly assigning a datatype of ftOraBlob instead
-explicitly setting bound to true
-and on and on.
Our goal as always is to employ a code idiom that works
for all our database types.
If anyone has sucessfully assigned a tblobfield value into
and oracle parameter and it arrives in the blob of a table table,
please give us a hint...
thanks,
tonyM