Page 1 of 1

Blob truncated with oracle odbc 11.02

Posted: Fri 06 Dec 2013 14:35
by kronski
Hi,

I'm trying to convert a old application that uses BDE to use unidac instead using delphi XE5.

When I write blobs to the database then the blob gets truncated to 4000 characters.
I write to a clob field with a regular update query using TUniQuery by passing a parameter.
It's the TODBCUniProvider that truncates. TOracleUniProvider works. The old BDE application works and i wrote a C# application that uses System.Data.Odbc.OdbcConnection which also works so the odbc driver works for sure.

Any help would be appreciated.

Code

UniQuery1.sql.text := 'UPDATE tablename set xmldata=:xmldata WHERE id=4';
//UniQuery1.ParamByName('xmldata').LoadFromFile('c:\temp\myxmltest.xml',ftOraClob); // fails
//UniQuery1.ParamByName('xmldata').AsMemo := a_long_str; // fails
UniQuery1.ParamByName('xmldata').LoadFromFile('c:\temp\myxmltest.xml',ftBlob);

End code

Re: Blob truncated with oracle odbc 11.02

Posted: Mon 09 Dec 2013 09:25
by AlexP
Hello,

This behaviour is due to the fact, that for some databases there is a parameter size restriction. Therefore we have added the DefaultStrParamSize option. Its size is 4000 by default. To solve the problem, you should set the correct parameter size, for example:

Code: Select all

var
  s: string;
begin
  UniQuery1.sql.text := 'UPDATE tablename set xmldata=:xmldata WHERE id=4';
  s := StringOfChar('c',5000);
  UniQuery1.ParamByName('xmldata').Size := Length(s);
  UniQuery1.ParamByName('xmldata').AsMemo := s;

Re: Blob truncated with oracle odbc 11.02

Posted: Mon 09 Dec 2013 12:38
by kronski
Hi,

Thanks that solved my issues. :D

Re: Blob truncated with oracle odbc 11.02

Posted: Mon 09 Dec 2013 13:37
by AlexP
Hello,

Glad to see that the problem was solved. If you have any other questions, feel free to contact us.