Recent

Author Topic: Problem with ODBC and clob data  (Read 4601 times)

MircoN

  • Newbie
  • Posts: 2
Problem with ODBC and clob data
« on: October 16, 2007, 02:12:45 pm »
My system is Linux (SUSE 10.1) and i try to retrive data from IBM DB2 database with ODBC connection (unixODBC).
I use TODBCconnecion and TSQLQuery. All the system work fine for all kind of data (i.e. blob), but with the clob data the result of query is incorrect, like:
 
"⃈…„?@ÅÕåññðð@`@Á™£‰ƒ–“–z@ôõñ ...."

I use for blob and clob:

"if self.SQLQuery1.Fields.Fields.IsBlob then
begin
.       BlobField:=TBlobField(self.SQLQuery1.Fields.Fields);
.      if not(BlobField.IsNull) then  Result:=fb.Value; "
end;

Where is the (my) error?
Can you help me?

MircoN

  • Newbie
  • Posts: 2
RE: Problem with ODBC and clob data
« Reply #1 on: October 22, 2007, 02:50:02 pm »
I have discovered the problem. There is not error: the problem born when the clob data is inserted on database by "AsString" way.
If the clob data is inserted by "AsBlob" way all work fine.
I can't modify the method that write tha clob data on database and so for me is necessary read the clob data in other way.
I have modified the function TODBCConnection.LoadField: I have introduced a castom way for manage the
FieldDef.DataType=ftMemo
(the source code is the same for ftBlob but I have used             SQL_C_CHAR             and                  BlobBufferSize:=StrLenOrInd+1)

 

TinyPortal © 2005-2018