Misha Oumantsev
Member
When I store a binary file in CLOB field, I can not read it, because it's corrupted.
I use D2006, DOA 4.0.7.1, Oracle Server 9.2.0.4.0, Oracle Client 10.1.0.4.0
This is Oracle script:
CREATE TABLE BLOB_TEST (BLOB_DATA CLOB);
These are the propeties I set up in design time:
object Session: TOracleSession
Preferences.ConvertCRLF = False
BytesPerCharacter = bcAutoDetect
end
object qryBlobTest: TOracleDataSet
SQL.Strings = (
'SELECT T.*,T.ROWID FROM BLOB_TEST T')
Session = Session
end
This is Delphi code:
begin
qryBlobTest.Insert;
TBlobField(qryBlobTest.FieldByName('BLOB_DATA')).LoadFromFile('c:\temp\1.xls');
qryBlobTest.Post;
TBlobField(qryBlobTest.FieldByName('BLOB_DATA')).SaveToFile('c:\temp\2.xls');
qryBlobTest.Close;
qryBlobTest.Open;
TBlobField(qryBlobTest.FieldByName('BLOB_DATA')).SaveToFile('c:\temp\3.xls');
end;
The result is
File '2.xls' is identical to '1.xls'.
File '3.xls' is corrupted, it has the same size but some bytes have been replaced.
Please help.
I use D2006, DOA 4.0.7.1, Oracle Server 9.2.0.4.0, Oracle Client 10.1.0.4.0
This is Oracle script:
CREATE TABLE BLOB_TEST (BLOB_DATA CLOB);
These are the propeties I set up in design time:
object Session: TOracleSession
Preferences.ConvertCRLF = False
BytesPerCharacter = bcAutoDetect
end
object qryBlobTest: TOracleDataSet
SQL.Strings = (
'SELECT T.*,T.ROWID FROM BLOB_TEST T')
Session = Session
end
This is Delphi code:
begin
qryBlobTest.Insert;
TBlobField(qryBlobTest.FieldByName('BLOB_DATA')).LoadFromFile('c:\temp\1.xls');
qryBlobTest.Post;
TBlobField(qryBlobTest.FieldByName('BLOB_DATA')).SaveToFile('c:\temp\2.xls');
qryBlobTest.Close;
qryBlobTest.Open;
TBlobField(qryBlobTest.FieldByName('BLOB_DATA')).SaveToFile('c:\temp\3.xls');
end;
The result is
File '2.xls' is identical to '1.xls'.
File '3.xls' is corrupted, it has the same size but some bytes have been replaced.
Please help.