NCBI C++ ToolKit
|
Handle character conversions to/from server. More...
#include <config.h>
#include <stdarg.h>
#include <stdio.h>
#include <assert.h>
#include <freetds/tds.h>
#include <freetds/iconv.h>
#include "encodings.h"
Go to the source code of this file.
Go to the SVN repository for this file.
Macros | |
#define | CHARSIZE(charset) |
#define | TDS_ICONV_ENCODING_TABLES |
#define | CHUNK_ALLOC 4 |
Enumerations | |
enum | { POS_ISO1 , POS_UTF8 , POS_UCS2LE , POS_UCS2BE } |
Functions | |
static int | collate2charset (int sql_collate, int lcid) |
static size_t | skip_one_input_sequence (iconv_t cd, const TDS_ENCODING *charset, const char **input, size_t *input_size) |
Move the input sequence pointer to the next valid position. More... | |
static int | tds_iconv_info_init (TDSICONV *char_conv, int client_canonical, int server_canonical) |
Open iconv descriptors to convert between character sets (both directions). More... | |
static int | tds_iconv_init (void) |
Initialize charset searching for UTF-8, UCS-2 and ISO8859-1. More... | |
static int | tds_canonical_charset (const char *charset_name) |
Determine canonical iconv character set. More... | |
static void | _iconv_close (iconv_t *cd) |
static void | tds_iconv_info_close (TDSICONV *char_conv) |
static const char * | tds_set_iconv_name (int charset) |
Get iconv name given canonic. More... | |
static void | tds_iconv_reset (TDSICONV *conv) |
int | tds_iconv_alloc (TDSCONNECTION *conn) |
Allocate iconv stuff. More... | |
TDSRET | tds_iconv_open (TDSCONNECTION *conn, const char *charset, int use_utf16) |
void | tds_iconv_close (TDSCONNECTION *conn) |
void | tds_iconv_free (TDSCONNECTION *conn) |
static void | tds_iconv_err (TDSSOCKET *tds, int err) |
size_t | tds_iconv (TDSSOCKET *tds, TDSICONV *conv, TDS_ICONV_DIRECTION io, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) |
Wrapper around iconv(3). More... | |
static TDSICONV * | tds_iconv_get_info (TDSCONNECTION *conn, int canonic_client, int canonic_server) |
Get a iconv info structure, allocate and initialize if needed. More... | |
TDSICONV * | tds_iconv_get (TDSCONNECTION *conn, const char *client_charset, const char *server_charset) |
static void | tds_srv_charset_changed_num (TDSCONNECTION *conn, int canonic_charset_num) |
void | tds_srv_charset_changed (TDSCONNECTION *conn, const char *charset) |
void | tds7_srv_charset_changed (TDSCONNECTION *conn, int sql_collate, int lcid) |
static int | lookup_canonic (const CHARACTER_SET_ALIAS aliases[], const char *charset_name) |
const char * | tds_canonical_charset_name (const char *charset_name) |
Determine canonical iconv character set name. More... | |
TDSICONV * | tds_iconv_from_collate (TDSCONNECTION *conn, TDS_UCHAR collate[5]) |
Get iconv information from a LCID (to support different column encoding under MSSQL2K) More... | |
Variables | |
static const char * | iconv_names [sizeof(canonic_charsets)/sizeof(canonic_charsets[0])] |
static int | iconv_initialized = 0 |
static const char * | ucs2name |
Handle character conversions to/from server.
Definition in file iconv.c.
#define CHARSIZE | ( | charset | ) |
anonymous enum |
int tds_iconv_alloc | ( | TDSCONNECTION * | conn | ) |
Allocate iconv stuff.
Definition at line 286 of file iconv.c.
References assert, client2server_chardata, conn, i, initial_char_conv_count, tds_iconv_reset(), tds_new, tds_new0, and TDS_ZERO_FREE.
Initialize charset searching for UTF-8, UCS-2 and ISO8859-1.
Definition at line 82 of file iconv.c.
References assert, i, ICONV_CONST, iconv_names, POS_ISO1, POS_UCS2BE, POS_UCS2LE, POS_UTF8, util::strcmp(), util::strncmp(), TDS_DBG_INFO1, tds_sys_iconv(), tds_sys_iconv_close(), tds_sys_iconv_open(), tdsdump_log, and ucs2name.
Referenced by tds_iconv_open().
Definition at line 264 of file iconv.c.
References tds_encoding::canonic, tdsiconvdir::cd, tdsiconvdir::charset, conv, tdsiconvinfo::from, tds_encoding::max_bytes_per_char, tds_encoding::min_bytes_per_char, and tds_encoding::name.
Referenced by tds_iconv_alloc(), and tds_iconv_get_info().
Get iconv name given canonic.
Definition at line 199 of file iconv.c.
References assert, i, iconv_initialized, iconv_mtx, iconv_names, NULL, POS_ISO1, POS_UTF8, tds_mutex_lock, tds_mutex_unlock, tds_sys_iconv_close(), tds_sys_iconv_open(), and ucs2name.
Referenced by tds_iconv_info_init().
|
static |
Definition at line 69 of file iconv.c.
Referenced by tds_iconv_open(), and tds_set_iconv_name().
|
static |
Definition at line 68 of file iconv.c.
Referenced by tds_iconv(), tds_iconv_info_init(), tds_iconv_init(), and tds_set_iconv_name().
|
static |
Definition at line 70 of file iconv.c.
Referenced by tds_iconv_init(), and tds_set_iconv_name().