Load a pair of character set translation tables.
RETCODE dbload_xlate(dbproc, srv_charset, xlate_name, xlt_tosrv, xlt_todisp) DBPROCESS *dbproc; char *srv_charset; char *xlt_name; DBXLATE **xlt_tosrv; DBXLATE **xlt_todisp;
A pointer to the DBPROCESS structure that provides the connection for a particular front-end/server process. It contains all the information that DB-Library uses to manage communications and data between the front end and server.
A pointer to the name of the server’s character set. dbload_xlate looks for a directory of this name in the charsets directory under the main Sybase installation directory. For example, if the server is using the iso_1 character set, dbload_xlate looks for $SYBASE/charsets/iso_1.
A pointer to the name of the file containing the display-specific character set. dbload_xlate looks for this file in the server character set directory.
A pointer to a pointer to a character set translation table used to translate display-specific character strings to the server character strings. The translation table is allocated through dbload_xlate.
A pointer to a pointer to a character set translation table used to translate server character strings to display-specific character strings. The translation table is allocated using dbload_xlate.
SUCCEED or FAIL.
dbload_xlate reads a display-specific localization file and allocates two character set translation tables: one for translations from the server’s character set to the display-specific character set, and another for translations from the display-specific character set to the server’s character set.
The following code fragment illustrates the use of dbload_xlate:
char destbuf[128];
int srcbytes_used;
DBXLATE* xlt_todisp;
DBXLATE *xlt_tosrv;
dbload_xlate((DBPROCESS *)NULL, "iso_1",
"trans.xlt", &xlt-tosrv, &xlt-todisp);
printf("Original string: \n\t%s\n\n",
TEST_STRING);
dbxlate((DBPROCESS *)NULL, TEST_STRING,
strlen(TEST_STRING), destbuf, -1, xlt_todisp,
&srcbytes_used);
printf("Translated to display character set: \
\n\t%s\n\n", destbuf);
dbfree_xlate((DBPROCESS *)NULL, xlt_tosrv,
xlt_todisp);