problem saving blob field with tsqlquery

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for Oracle in Delphi and C++Builder
Post Reply
tripunkt
Posts: 13
Joined: Wed 06 Jun 2007 11:33

problem saving blob field with tsqlquery

Post by tripunkt » Mon 28 Jul 2008 17:39

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

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 29 Jul 2008 07:01

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;

tripunkt
Posts: 13
Joined: Wed 06 Jun 2007 11:33

Post by tripunkt » Tue 29 Jul 2008 11:55

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

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Thu 31 Jul 2008 08:42

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).

Post Reply