By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,960 Members | 990 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,960 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

Apr 20 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
PRiya wrote:
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.

--
Phlip
http://www.greencheese.org/ZeekLand <-- NOT a blog!!!
Apr 20 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.