Page 1 of 2

RAW data looks wrong when Unicode is enabled

Posted: Tue 14 Aug 2012 13:51
by jdorlon
Hello,

When I select from a RAW column, I am seeing wrong results when unicode is enabled. I beleive something changed recently in ODAC to cause this.

To see this, drop a TOraSession, a TSmartQuery, a TDataSource, and a TDBGrid on a form. Hook them all up and try this:

Code: Select all

  
  //OraCall.OCIUnicode := true;
  //OraSession1.Options.UseUnicode := True;
  OraSession1.Server := '...';
  OraSession1.Username:= '...';
  OraSession1.Password:= '...';
  OraSession1.Connected := true;
  SmartQuery1.SQL.Text := 'Select paddr from v$session';
  SmartQuery1.Options.RawAsString := True;
  SmartQuery1.Active := true;
Then try it again with the first two lines uncommented. The results looks wrong with Unicode enabled.

Versions:
Delphi XE2, 32 bit.
ODAC 8.2.8
Oracle Client and server 11gR2.

Thanks.

John Dorlon

Re: RAW data looks wrong when Unicode is enabled

Posted: Tue 14 Aug 2012 14:47
by AlexP
hello,

We couldn't reproduce the problem - independently on both UniCode settings, RAW data are displayed equally correctly, in both Direct and OCI modes. Please specify the NLS settings of your Oracle client and server

Re: RAW data looks wrong when Unicode is enabled

Posted: Tue 14 Aug 2012 15:04
by jdorlon
Thank you for the fast reply.

Here is the result of "select * from v$NLS_Parameters"

Code: Select all

PARAMETER	VALUE
NLS_LANGUAGE	AMERICAN
NLS_TERRITORY	AMERICA
NLS_CURRENCY	$
NLS_ISO_CURRENCY	AMERICA
NLS_NUMERIC_CHARACTERS	.,
NLS_CALENDAR	GREGORIAN
NLS_DATE_FORMAT	DD-MON-RR
NLS_DATE_LANGUAGE	AMERICAN
NLS_CHARACTERSET	AL32UTF8
NLS_SORT	BINARY
NLS_TIME_FORMAT	HH.MI.SSXFF AM
NLS_TIMESTAMP_FORMAT	DD-MON-RR HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT	HH.MI.SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT	DD-MON-RR HH.MI.SSXFF AM TZR
NLS_DUAL_CURRENCY	$
NLS_NCHAR_CHARACTERSET	AL16UTF16
NLS_COMP	BINARY
NLS_LENGTH_SEMANTICS	BYTE
NLS_NCHAR_CONV_EXCP	FALSE
On my client, the NLS_LANG is set to AMERICAN_AMERICA.WE8MSWIN1252

Here is what my result looks like with unicode enabled (scroll to the bottom, it gets interesting):

Code: Select all

PADDR
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000007
000000000000000000000000000007FF
0000000000000000000000000007FF93
00000000000000000000000007FF93A3
000000000000000000000007FF93A3F9
0000000000000000000007FF93A3F968
00000000000000000007FF93A3F968
000000000000000007FF93A3F968
0000000000000007FF93A3F968
00000000000007FF93A3F968
000000000007FF93A3F968
0000000007FF93A3F968
00000007FF93A3F968
000007FF93A3F968
and with it off:

Code: Select all

PADDR
000007FF93A1CC88
000007FF93A1EE48
000007FF93A21008
000007FF93A25388
000007FF93A2B8C8
000007FF93A231C8
000007FF93A27548
000007FF93A29708
000007FF93A36188
000007FF93A3E888
000007FF93A33FC8
000007FF93A3A508
000007FF93A42C08
000007FF93A3C6C8
000007FF93A38348
000007FF93A40A48
000007FF93A1DD68
000007FF93A1FF28
000007FF93A220E8
000007FF93A242A8
000007FF93A26468
000007FF93A28628
000007FF93A2A7E8
000007FF93A37268
000007FF93A350A8
000007FF93A32EE8
000007FF93A3B5E8
000007FF93A3D7A8
000007FF93A41B28
000007FF93A39428
000007FF93A3F968
If there is something else I can provide please let me know.

Re: RAW data looks wrong when Unicode is enabled

Posted: Tue 14 Aug 2012 15:33
by jdorlon
It gets weirder.

With unicode enabled, if I select SADDR (another RAW column) from V$Session, I get this:

Code: Select all

SADDR
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000007
000000000000000000000000000007FF
0000000000000000000000000007FF90
00000000000000000000000007FF907C
000000000000000000000007FF907CE1
0000000000000000000007FF907CE130
00000000000000000007FF907CE130
000000000000000007FF907CE130
0000000000000007FF907CE130
00000000000007FF907CE130
000000000007FF907CE130
0000000007FF907CE130
00000007FF907CE130
000007FF907CE130
but if I select SADDR and MACHINE, I get this:

Code: Select all

SADDR	MACHINE
00REM7VNC5M1	REM7VNC5M1
00REM7VNC5M1	REM7VNC5M1
00REM7VNC5M1	REM7VNC5M1
00REM7VNC5M1	REM7VNC5M1
00REM7VNC5M1	REM7VNC5M1
00REM7VNC5M1	REM7VNC5M1
00REM7VNC5M1	REM7VNC5M1
00REM7VNC5M1	REM7VNC5M1
00REM7VNC5M1	REM7VNC5M1
00REM7VNC5M1	REM7VNC5M1
00REM7VNC5M1	REM7VNC5M1
00MSHOME\CARTOADDEVBASE	MSHOME\CARTOADDEVBASE
00MSHOME\CARTOADDEVBASE	MSHOME\CARTOADDEVBASE
00REM7VNC5M1	REM7VNC5M1
00REM7VNC5M1	REM7VNC5M1
00REM7VNC5M1	REM7VNC5M1
00REM7VNC5M1	REM7VNC5M1
00REM7VNC5M1	REM7VNC5M1
00REM7VNC5M1	REM7VNC5M1
00REM7VNC5M1	REM7VNC5M1
00REM7VNC5M1	REM7VNC5M1
00MSHOME\CARTOADDEVBASE	MSHOME\CARTOADDEVBASE
00REM7VNC5M1	REM7VNC5M1
00REM7VNC5M1	REM7VNC5M1
00MSHOME\CARTOADDEVBASE	MSHOME\CARTOADDEVBASE
00MSHOME\CARTOADDEVBASE	MSHOME\CARTOADDEVBASE
the other columns in V$Session do not have that effect. If I select SADDR, SID, for example, the SADDR column does not change. It still doesn't match what it does with unicode disabled though.

Re: RAW data looks wrong when Unicode is enabled

Posted: Tue 14 Aug 2012 15:46
by jdorlon
it seems any longish VARCHAR2 column will change the output.

select SADDR, '12345678123456781234567812345678'
from v$session

It takes 32 or more characters of varchar2. up to 31, no change.

The query above is giving me this result

Code: Select all

SADDR	'12345678123456781234567812345678'
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678
00123456781234567812345678123456	12345678123456781234567812345678

Re: RAW data looks wrong when Unicode is enabled

Posted: Tue 14 Aug 2012 21:25
by jdorlon
I was also able to reproduce this on a Windows XP machine running Delphi 2009.

I uninstalled all ODAC then reinstalled 8.2.8 again (no source, compiled units only).

I could reproduce the problem there as soon as 8.2.8 was installed.

Re: RAW data looks wrong when Unicode is enabled

Posted: Thu 16 Aug 2012 07:29
by AlexP
hello,

I can't reproduce the problem.
Please specify the exact versions of the Oracle client and server.

Re: RAW data looks wrong when Unicode is enabled

Posted: Thu 16 Aug 2012 13:44
by jdorlon
Aha! It only happens when database is 64 bit. Oracle version doesn't matter.

The client is 11.2.0.1, 32 bit. I tried serveral different servers and the problem only happens on the ones that are 64 bit.

Code: Select all

Doesn't happen
Version    NLS Charset      Platform
9.2.0.8    AL32UTF8         Windows  32 bit
11.2.0.1   WE8MSWIN1252     Windows  32 bit
11.1.0.7   AL32UTF8         Windows  32 bit
10.2.0.1   WE8MSWIN1252     Windows  32 bit


Does happen
11.2.0.2   AL32UTF8         Linux    64 bit
11.2.0.3   AL32UTF8         Windows  64 bit
11.2.0.3   AL32UTF8         Linux    64 bit
10.2.0.2   UTF8             Solaris  64 bit

Re: RAW data looks wrong when Unicode is enabled

Posted: Fri 17 Aug 2012 12:18
by AlexP
hello,

Thank you for the information.
We've reproduced both problems.
We will notify you as soon as we have any results.

Re: RAW data looks wrong when Unicode is enabled

Posted: Tue 21 Aug 2012 11:33
by AlexP
hello,

We have fixed the problem, this fix will be included in the next version of the product.

Re: RAW data looks wrong when Unicode is enabled

Posted: Tue 21 Aug 2012 11:38
by jdorlon
If the changes aren't extensive, could you send them to me? We will be releasing our next version before the next ODAC version. Thank you.

Re: RAW data looks wrong when Unicode is enabled

Posted: Tue 21 Aug 2012 11:55
by AlexP
hello,

If you have a version with source code, please specify the e-mail address where I can send you a fixed module

Re: RAW data looks wrong when Unicode is enabled

Posted: Tue 21 Aug 2012 11:59
by jdorlon
Hello,

John.Dorlon*Quest*com

Thank you.

Re: RAW data looks wrong when Unicode is enabled

Posted: Tue 21 Aug 2012 12:17
by AlexP
Hello,

I have sent you a fixed OraClasses unit to the specified e-mail

Re: RAW data looks wrong when Unicode is enabled

Posted: Tue 21 Aug 2012 14:00
by jdorlon
Thank you Alex. That fixes the problem.