Pro*c - Using c++ to retrieve unicode data

P

PRiya

Hi,

The common examples provided under "Pro*C/C++ Programming with
Unicode" is
#include <sqlca.h>
main()
{
...
/* Change to STRING datatype: */
EXEC ORACLE OPTION (CHAR_MAP=STRING) ;
text ename[20] ; /* unsigned short type */
varchar address[50] ; /* Pro*C/C++ varchar type */

EXEC SQL SELECT ename, address INTO :ename, :address FROM emp;
/* ename is NULL-terminated */
printf(L"ENAME = %s, ADDRESS = %.*s\n", ename, address.len,
address.arr);
...
}

-----------------------------------------------------------------------------------------------------------------
#include <sqlca.h>
#include <sqlucs2.h>

main()
{
...
/* Change to STRING datatype: */
EXEC ORACLE OPTION (CHAR_MAP=STRING) ;
utext ename[20] ; /* unsigned short type */
uvarchar address[50] ; /* Pro*C/C++ uvarchar type */

EXEC SQL SELECT ename, address INTO :ename, :address FROM emp;
/* ename is NULL-terminated */
wprintf(L"ENAME = %s, ADDRESS = %.*s\n", ename, address.len,
address.arr);
....
}

However, wprintf - Does not hold good for Unix HP. Please find
attached the link which indicates the same -
http://www.linux.com/howtos/Unicode-HOWTO-6.shtml

Hence, left with only one option of using printf(L...But this gives the
following error -

Error 212: "wchar_print.c", line 13 # Argument type 'const wchar_t *'
does not
match expected parameter type 'const char *'.
printf (L"%s \n", "A string");

(a) What needs to be done? And what headers are needed? We do not have
wchar.h and trying to download that from web, runs into a sequence of
getting files like features etc also.

Regards
Priya
 
P

Phlip

PRiya said:
The common examples provided under "Pro*C/C++ Programming with
Unicode"

Pro*C/C++ is an attrocity.

C++ is sufficiently powerful to write real, clear, pure C++ statements that
query databases. There's no benefit, and amazing overhead, to "embedding SQL
in C". That's a pitch to your bosses, not to you.

Oh, and it's off-topic here, because you will get the best answers on a
forum like a Pro*C mailing list.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top