Page 1 of 1

problem saving blob field with tsqlquery

Posted: Mon 28 Jul 2008 17:39
by tripunkt
Hello,

I'm trying to save a blobstream using tsqlquery.

After executing the query, everything looks fine so far, but for files > 1kb the blob field is empty.

The fieldtype in my database is BLOB.

My code looks like:

FQry.SQL.Add('UPDATE tbl_dbtool_doc SET blbFileBlob = :Blob WHERE intId_pk = 6');
FQry.ParamByName('Blob').LoadFromStream(AStream, ftBlob);
FQry.ExecSQL;

I've also tried to set
FQry.ParamByName('Blob').ParamType := ptOutput;
FQry.ParamByName('Blob').DataType := ftOraBlob;

but then I get an access vialoation in dbexpoda40.dll (v 4.2).

Thanks for your help
Sebastian

Posted: Tue 29 Jul 2008 07:01
by Plash
You need to use the ftOraBlob data type and SQL statement with RETURNING clause. You should also pass ftOraClob to the LoadFromStream method.

Code: Select all

FQry.SQL.Add('UPDATE tbl_dbtool_doc SET blbFileBlob = empty_blob() ' +
  'WHERE intId_pk = 6 RETURNING blbFileBlob INTO :Blob');
FQry.ParamByName('Blob').ParamType := ptInput; 
FQry.ParamByName('Blob').DataType := ftOraBlob; 
FQry.ParamByName('Blob').LoadFromStream(AStream, ftOraBlob); 
FQry.ExecSQL;

Posted: Tue 29 Jul 2008 11:55
by tripunkt
Hi Plash,

thanks for your reply. Your sample code works out of the box. However I get an access violation in dbexpoda40.dll after executing the statement. (TDBXError : Access vialotation at address 04A53FD5 in module "dbexpoda40.dll).

The blob is filled correctly and the exeption occures only in debug mode. It's ok, but not perfect. Any ideas?

best regards
Sebastian

Posted: Thu 31 Jul 2008 08:42
by Plash
We could not reproduce the problem. Please send to dbxoda*devart*com a complete small sample that demonstrates the problem, including the script for creating database objects.

Please specify the exact version of DbxOda (with the build number).