User Guide

SAP AG November 2002
0x004C, 0x0045, 0x004E, 0x0041,
0x004D,
0x0045, 0x0020, 0x0046, 0x0052,
0x004F,
0x004D, 0x0020, 0x0044, 0x004F,
0x004D,
0x0041, 0x0049, 0x004E, 0x002E,
0x0054,
0x0041, 0x0042, 0x004C, 0x0045,
0x0053,
0x0000};
SQLUCS2 resutlstring [64];
EXEC SQL END DECLARE SECTION;
/* connect ... */
/* parse a unicode SQL statement and give it a statement
name */
EXEC SQL PREPARE stmt1 FROM :sqlstmt;
EXEC SQL DECLARE curs1 CURSOR FOR stm1;
EXEC SQL OPEN curs1;
/* loop over resultset */
WHILE (sqlca.sqlcode != 100)
{
EXEC SQL FETCH curs1 INTO :resultstring;
}
EXEC SQL CLOSE curs1;
For the complete example, see Example 2 [Page
97] (HelloUnicodeDB.cpc).
The data type SQLUCS2 [] marks positive 16-bit wide whole numbers (unsigned short).
Input and output variables can have data type CHAR [] or SQLUCS2 []. The values are
converted into suitable data types internally, if required.
SQL commands can have data type CHAR [] or SQLUCS2 [].
Python
Python 2.*: UNICODE columns can be read and written. UNICODE character strings cannot
be used as SQL statements.
Python 1.5.2: UNICODE-type output values are converted to ASCII. If this conversion fails,
an error is reported.
Example 2
HelloUnicodeDB.cpc is a Precompiler program that uses UNICODE host variables (see
UNICODE in Programming Languages [Page
96], Section C/C++ Precompiler).
HelloUnicodeDB.cpc Definition
/********************************************************************
**
module : HelloUnicodeDB.cpc
-------------------------------------------------------------------
--
responsible : MarcoP
special area: demonstration program precompiler
User Manual: SAP DB 97