SmartQuery as Provider for ClientDataset can't read CLOB with UNICODE content
Posted: Thu 16 Jul 2015 11:18
Hi Support Team.
I send you (@alex_p) a sample app with shows the following problem:
I have a ClientDataset, bound to a TLocalConnection.
The ClientDataset has a Provider, which has a TSmartQuery as Providerdataseet.
I work on a orcle database with unicode character set (AL32UTF8).
For the OracleSession I set
OraSession.Options.UseUnicode := True;
OraSession.Options.UnicodeEnvironment := True;
When I open a table with a unicode-String in a CLOB, I get rubbish.
In the sample app is another ODAC-Dataset, which reads the value "directly".
In this mode everything is fine.
Changing all ClientDatasets to ODCC-Datasets is not an option for me,
this is a big, fat application with 100s of forms and datasets.
I work with Delphi XE2 Update 4, ODAC Version is 9.4.14
How to use the sample:
- Change database connection string (myServer, myUser, myPassword) to your database
- create a CLOB-field in the sample schema scott/tiger in the table emp by pressing "Create CLOB Field"
- the field is created and filled with the famous russian word "Достопримечательности" for employee # 7900
- start
- in the memo field you see only an "R". When you inspect the value (cds.fieldByName( 'CLOB_TEST' ).AsWideString), you will see something like this:
'R'#0'u'#0's'#0's'#0'i'#0'a'#0'n'#0':'#0' '#0#$14#4'>'#4'A'#4'B'#4'>'#4'?'#4'@'#4'8'#4'<'#4'5'#4'G'#4'0'#4'B'#4'5'#4';'#4'L'#4'='#4'>'#4'A'#4'B'#4'8'#4
so I think the UTF-16 String is not converted correctly to a delphi unicde string
- when done testing, you can drop the new field by pressing "Drop CLOB Field"
Thanks for your help.
With regards
Stefan "ostijo" Grosskreutz
I send you (@alex_p) a sample app with shows the following problem:
I have a ClientDataset, bound to a TLocalConnection.
The ClientDataset has a Provider, which has a TSmartQuery as Providerdataseet.
I work on a orcle database with unicode character set (AL32UTF8).
For the OracleSession I set
OraSession.Options.UseUnicode := True;
OraSession.Options.UnicodeEnvironment := True;
When I open a table with a unicode-String in a CLOB, I get rubbish.
In the sample app is another ODAC-Dataset, which reads the value "directly".
In this mode everything is fine.
Changing all ClientDatasets to ODCC-Datasets is not an option for me,
this is a big, fat application with 100s of forms and datasets.
I work with Delphi XE2 Update 4, ODAC Version is 9.4.14
How to use the sample:
- Change database connection string (myServer, myUser, myPassword) to your database
- create a CLOB-field in the sample schema scott/tiger in the table emp by pressing "Create CLOB Field"
- the field is created and filled with the famous russian word "Достопримечательности" for employee # 7900
- start
- in the memo field you see only an "R". When you inspect the value (cds.fieldByName( 'CLOB_TEST' ).AsWideString), you will see something like this:
'R'#0'u'#0's'#0's'#0'i'#0'a'#0'n'#0':'#0' '#0#$14#4'>'#4'A'#4'B'#4'>'#4'?'#4'@'#4'8'#4'<'#4'5'#4'G'#4'0'#4'B'#4'5'#4';'#4'L'#4'='#4'>'#4'A'#4'B'#4'8'#4
so I think the UTF-16 String is not converted correctly to a delphi unicde string
- when done testing, you can drop the new field by pressing "Drop CLOB Field"
Thanks for your help.
With regards
Stefan "ostijo" Grosskreutz