Tuesday, 27 August 2013

Direct Oracle Access cuts off the end of unicode (wide) strings

Direct Oracle Access cuts off the end of unicode (wide) strings

I am encountering a problem with unicode (wide) string field in Delphi XE2
is not returning last part of string and any database control component
also is not showing whole string completely to the end.
You can see the simple test below.
with TOracleDataSet.Create(self) do
try
Session := OraSession;
SQL.Text := 'CREATE TABLE test1 (fsString10 VARCHAR2(10))');
ExecSQL;
SQL.Text := 'INSERT INTO test1 (fsString10) VALUES ('1234567890')');
ExecSQL;
SQL.Text := 'INSERT INTO test1 (fsString10) VALUES ('é234567890')');
ExecSQL;
SQL.Text := 'INSERT INTO test1 (fsString10) VALUES ('éöóêåíãøùç')');
ExecSQL;
SQL.Text := 'SELECT fsString10 FROM test1';
Open;
while not Eof do
ShowMessage(FieldByName('fsString10').AsString);
// '1234567890' turned into '1234567890'
// 'é234567890' turned into 'é23456789'
// 'éöóêåíãøùç' turned into 'éöóêå'
SQL.Text := 'DROP TABLE test1');
ExecSQL;
finally
Free;
end;
As you can see unicode strings is not properly loaded.
On the other hand the "Direct Oracle Access 4.1.3" component didn't save
chars in the string after half one on post record. Anyway it saves only
first half-string.
Is there a way to fix it?
BytesPerCharacter is set to bcAutoDetect.
I have tried toggling NoUnicodeSupport and all other options with no luck.
Does anyone have any ideas on how to fix this?

No comments:

Post a Comment