Print Thread
Delphi XE DOA and Unicode
#39429 02/03/11 12:33 AM
Joined: Nov 2000
Posts: 31
Carlsbad, CA USA
C
clivew Offline OP
Member
OP Offline
Member
C
Joined: Nov 2000
Posts: 31
Carlsbad, CA USA
I have read various posts; but I am still a bit confused.

With Delphi XE all the components and internal strings are now Unicode.

To get my Delphi6 application working in Delphi XE (at least for DOA) what changes do I need (or not need) to make?
I do not necessarily know whether the Oracle databases I run against will be Unicode or not, although the current project I am working on will only use the Latin alphabet.

Thanks,

Clive

Re: Delphi XE DOA and Unicode
clivew #39434 02/03/11 10:40 AM
Joined: Aug 1999
Posts: 22,206
Member
Offline
Member
Joined: Aug 1999
Posts: 22,206
Does your application need to support Unicode? If so, you may need to make some changes because field types will change.

If the application is still restricted to databases with a non-Unicode character set, then no changes are needed as far as Direct Oracle Access is concerned.

There can always be compatibility issues in the application due to the changes in the String data type of course.


Marco Kalter
Allround Automations
Re: Delphi XE DOA and Unicode
Marco Kalter #39442 02/04/11 12:28 AM
Joined: Nov 2000
Posts: 31
Carlsbad, CA USA
C
clivew Offline OP
Member
OP Offline
Member
C
Joined: Nov 2000
Posts: 31
Carlsbad, CA USA
No this application will not have to deal with Unicode.
However now I will be in Delphi XE all the strings in the GUI etc. WILL be Unicode strings. This is why I have the questions.
Will DOA automatically handle the conversions (in and out) needed with:

1. Dynamically built queries?
2. SetVariable, FieldAsString('fieldname'),
fieldByName('fieldname').AsString etc.?

OR do I have to add lots of casts to/from AnsiString?

Thanks,

Clive

Re: Delphi XE DOA and Unicode
clivew #39444 02/04/11 11:23 AM
Joined: Aug 1999
Posts: 22,206
Member
Offline
Member
Joined: Aug 1999
Posts: 22,206
You should not use AnsiString. Just use String and everything should be okay.


Marco Kalter
Allround Automations
Re: Delphi XE DOA and Unicode
Marco Kalter #39517 02/16/11 02:06 AM
Joined: Nov 2000
Posts: 31
Carlsbad, CA USA
C
clivew Offline OP
Member
OP Offline
Member
C
Joined: Nov 2000
Posts: 31
Carlsbad, CA USA
Sorry, still a bit confused now that I have XE installed and DOA on XE just installed.
I see a new option in TOracleSession.preferences called ConvertUTF with no information in the help file.

It has currently defaulted itself to cuUTF8toUTF16.
Is that what it should be?
I do not know what Oracle databases my application ends up running against. We typically just add our schema.

If you will forgive me saying it (assuming I am not being dumb<smile>)
cuUTF8toUTF16 is also a bit cryptic as it does not indicate which direction
(DB->App or App.->DB). At least, not to my mind.

EDIT: Just noticed new ForceWideStringFields property which raises similar questions. Currently defaulted to False and nothing in the help file.

Thanks a lot,
Clive

Last edited by clivew; 02/16/11 02:09 AM. Reason: added query about ForceWideStringFields
Re: Delphi XE DOA and Unicode
clivew #39518 02/16/11 10:41 AM
Joined: Aug 1999
Posts: 22,206
Member
Offline
Member
Joined: Aug 1999
Posts: 22,206
There is an 4.1 addendum available in the Oracle menu of the Delphi IDE. It explains these properties.

If your application does not have to deal with Unicode, you can leave all these properties at their default values.


Marco Kalter
Allround Automations
Re: Delphi XE DOA and Unicode
Marco Kalter #39524 02/16/11 07:33 PM
Joined: Nov 2000
Posts: 31
Carlsbad, CA USA
C
clivew Offline OP
Member
OP Offline
Member
C
Joined: Nov 2000
Posts: 31
Carlsbad, CA USA
I am feeling dumber and dumber as I keep asking questions. Sorry!

1. Thanks for the reference to the addendum, it would not load from the IDE menu; but I found it and read it.

2. All the references are confusing because they keep referring to Unicode in much too abstract a manner. I am wondering if there is some distinction inherent, but not spelled out, in your answers between Unicode strings (ubiquitous in Delphi XE) and special Unicode characters, not necessarily encountered in my application.

To repeat:
My application will now be compiled in Delphi XE, so (as I understand it) ALL strings in my application will now contain wide characters while the database will continue to contain whatever it did before.

Contrary to the addendum_4.1.pdf the ConvertUTF has defaulted to cuUTF8ToUTF16 and not cuNone. Do I leave it or change it to cuNone?

I just need to make sure of the following:
1. My application continues to talk to the database as before although the application will now be defaulting to Unicode (wide char) strings.

2. Other applications that talk to the database will continue to function as before. i.e. Somehow my application has not dumped a set of two byte chars into Oracle instead of one byte chars.

I realize that much of this is based upon my ignorance of what is going on at the deeper levels of the communications between app and database but I really need to make sure that some 800 pound gorilla customers don't descend on me in fighting mood!

Thanks again,
Clive

Re: Delphi XE DOA and Unicode
clivew #39531 02/17/11 11:36 AM
Joined: Aug 1999
Posts: 22,206
Member
Offline
Member
Joined: Aug 1999
Posts: 22,206
All your strings will indeed be 2 byte characters in the application. They will be written to the database in the character set as defined in the database itself. This does not depend on any client setting. Your application will work exactly as before, will read and write the same characters, even though they are now 2 bytes instead of 1 byte.

The ConvertUTF option will indeed be cuUTF8ToUTF16. This is the only option that makes sense in a Delphi XE application. Other options are only relevant for older Delphi versions with single-byte string data type.



Marco Kalter
Allround Automations
Re: Delphi XE DOA and Unicode
Marco Kalter #39541 02/18/11 06:21 AM
Joined: Nov 2000
Posts: 31
Carlsbad, CA USA
C
clivew Offline OP
Member
OP Offline
Member
C
Joined: Nov 2000
Posts: 31
Carlsbad, CA USA
Thanks Marco.

Finally clear, even to me!


Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.043s Queries: 15 (0.015s) Memory: 2.5360 MB (Peak: 3.0378 MB) Data Comp: Off Server Time: 2024-05-01 02:11:03 UTC
Valid HTML 5 and Valid CSS