Specify the character set translations to use when retrieving data from or inserting data into an Adaptive Server Enterprise.
RETCODE bcp_setxlate(dbproc, xlt_tosrv, xlt_todisp) DBPROCESS *dbproc; DBXLATE *xlt_tosrv; DBXLATE *xlt_todisp;
A pointer to the DBPROCESS structure that provides the connection for a particular front end/Adaptive Server Enterprise process. It contains all the information that DB-Library uses to manage communications and data between the front end and Adaptive Server Enterprise.
A pointer to a translation structure. The translation structure is allocated using dbload_xlate. xlt_tosrv indicates the character set translation to use when moving data from the application program to the Adaptive Server Enterprise (the copy in, or DB_IN, direction).
A pointer to a translation structure. The translation structure is allocated using dbload_xlate. xlt_todisp indicates the character set translation to use when moving data from Adaptive Server Enterprise to the application program (the copy out, or DB_OUT, direction).
SUCCEED or FAIL.
bcp_setxlate specifies the character set translations to use when transferring character data between the Adaptive Server Enterprise and a front-end application program using bcp.
The specified character set translations need not be the same as those being used to display or input data on the user’s terminal. The translations may be used to read or write a data file in a completely different character set that is not intended for immediate display.
The following code fragment illustrates the use of bcp_setxlate:
bcp_init(dbproc, "mytable", "bcpdata", "bcperrs", DB_OUT);
bcp_setxlate(dbproc, xlt_tosrv, xlt_todisp);
bcp_columns(dbproc, 3);
bcp_colfmt(dbproc, 1, SYBCHAR, 0, -1, "\t", 1, 1);
bcp_colfmt(dbproc, 2, SYBCHAR, 0, -1, "\t", 1, 2);
bcp_colfmt(dbproc, 3, SYBCHAR, 0, -1, "\n", 1, 3);
bcp_exec(dbproc);