FreeTDS API
character_sets.h
1 /*
2  * These are the canonical names for character sets accepted by GNU iconv.
3  * See its documentation for the standard it follows.
4  *
5  * GNU iconv accepts other character set names, too, and your favorite operating system
6  * very likely uses still other names to represent the _same_ character set.
7  *
8  * Alternative character set names are mapped to these canonical ones in
9  * alternative_character_sets.h and are accessed with canonical_charset();
10  */
11  {"ISO-8859-1", 1, 1}
12  , {"UTF-8", 1, 4}
13  , {"UCS-2LE", 2, 2}
14  , {"UCS-2BE", 2, 2}
15  , {"UCS-2", 2, 2}
16  , {"US-ASCII", 1, 1}
17  , {"UCS-4", 4, 4}
18  , {"UCS-4BE", 4, 4}
19  , {"UCS-4LE", 4, 4}
20  , {"UTF-16", 2, 4}
21  , {"UTF-16BE", 2, 4}
22  , {"UTF-16LE", 2, 4}
23  , {"UTF-32", 4, 4}
24  , {"UTF-32BE", 4, 4}
25  , {"UTF-32LE", 4, 4}
26  , {"UTF-7", 1, 4}
27  , {"UCS-2-INTERNAL", 2, 2}
28  , {"UCS-2-SWAPPED", 2, 2}
29  , {"UCS-4-INTERNAL", 4, 4}
30  , {"UCS-4-SWAPPED", 4, 4}
31  , {"C99", 1, 1}
32  , {"JAVA", 1, 1}
33  , {"ISO-8859-2", 1, 1}
34  , {"ISO-8859-3", 1, 1}
35  , {"ISO-8859-4", 1, 1}
36  , {"ISO-8859-5", 1, 1}
37  , {"ISO-8859-6", 1, 1}
38  , {"ISO-8859-7", 1, 1}
39  , {"ISO-8859-8", 1, 1}
40  , {"ISO-8859-9", 1, 1}
41  , {"ISO-8859-10", 1, 1}
42  , {"ISO-8859-13", 1, 1}
43  , {"ISO-8859-14", 1, 1}
44  , {"ISO-8859-15", 1, 1}
45  , {"ISO-8859-16", 1, 1}
46  , {"KOI8-R", 1, 1}
47  , {"KOI8-U", 1, 1}
48  , {"KOI8-RU", 1, 1}
49  , {"CP1250", 1, 1}
50  , {"CP1251", 1, 1}
51  , {"CP1252", 1, 1}
52  , {"CP1253", 1, 1}
53  , {"CP1254", 1, 1}
54  , {"CP1255", 1, 1}
55  , {"CP1256", 1, 1}
56  , {"CP1257", 1, 1}
57  , {"CP1258", 1, 1}
58  , {"CP850", 1, 1}
59  , {"CP862", 1, 1}
60  , {"CP866", 1, 1}
61  , {"CP437", 1, 1}
62  , {"MAC", 1, 1}
63  , {"MACCENTRALEUROPE", 1, 1}
64  , {"MACICELAND", 1, 1}
65  , {"MACCROATIAN", 1, 1}
66  , {"MACROMANIA", 1, 1}
67  , {"MACCYRILLIC", 1, 1}
68  , {"MACUKRAINE", 1, 1}
69  , {"MACGREEK", 1, 1}
70  , {"MACTURKISH", 1, 1}
71  , {"MACHEBREW", 1, 1}
72  , {"MACARABIC", 1, 1}
73  , {"MACTHAI", 1, 1}
74  , {"ROMAN8", 1, 1}
75  , {"NEXTSTEP", 1, 1}
76  , {"ARMSCII-8", 1, 1}
77  , {"GEORGIAN-ACADEMY", 1, 1}
78  , {"GEORGIAN-PS", 1, 1}
79  , {"KOI8-T", 1, 1}
80  , {"MULELAO-1", 1, 1}
81  , {"CP1133", 1, 1}
82  , {"ISO-IR-166", 1, 1}
83  , {"CP874", 1, 1}
84  , {"CP936", 1, 2}
85  , {"CN", 1, 1}
86  , {"CP932", 1, 2}
87  , {"CN-GB", 1, 2}
88  , {"CP950", 1, 2}
89  , {"CP949", 1, 2}
90  , {"CP1361", 1, 2}
91  , {"BIG-5", 1, 2}
92  , {"BIG5-HKSCS", 1, 2}
93  , {"SJIS", 1, 2}
94  , {"EUC-KR", 1, 2}
95  , {"VISCII", 1, 1}
96  , {"ISO-IR-14", 1, 1}
97  , {"EUC-JP", 1, 3}
98  , {"EUC-TW", 1, 4}
99  , {"ISO-2022-JP", 1, 1}
100  , {"ISO-2022-KR", 1, 2}
101  , {"ISO-2022-CN", 1, 4}
102  , {"ISO-2022-CN-EXT", 1, 4}
103  , {"ISO-2022-JP-2", 1, 1}
104  , {"GB18030", 1, 4}
105  /*
106  * Beyond this point, I don't know the right answers.
107  * If you can provide the correct min/max (byte/char) values, please
108  * correct them if necessary and move them above the stopper row.
109  * Will the person vetting the last unknown row please turn off the lights?
110  * --jkl April 2003
111  */
112  , {"", 0, 0} /* stopper row */
113 
114  , {"TCVN", 1, 1}
115  , {"JISX0201-1976", 1, 1}
116  , {"ISO-IR-87", 1, 1}
117  , {"ISO-IR-159", 1, 1}
118  , {"CHINESE", 1, 1}
119  , {"CN-GB-ISOIR165", 1, 1}
120  , {"ISO-IR-149", 1, 1}
121  , {"ISO-2022-JP-1", 1, 1}
122  , {"HZ", 1, 1}
123  /* stopper row */
124  , {"", 0, 0}
125 
tds_ntlm_auth
Definition: challenge.c:564
tds_dynamic_stream_init
TDSRET tds_dynamic_stream_init(TDSDYNAMICSTREAM *stream, void **ptr, size_t allocated)
Initialize a dynamic output stream.
Definition: stream.c:354
tds_file_stream
input stream to read a file
Definition: bulk.c:974
des_key
Definition: des.h:16
tds_file_stream::f
FILE * f
file to read from
Definition: bulk.c:978
tds_socket::bulk_query
bool bulk_query
true is query sent was a bulk query so we need to switch state to QUERYING
Definition: tds.h:1245
tds_quote_id
size_t tds_quote_id(TDSSOCKET *tds, char *buffer, const char *id, int idlen)
Quote an id.
Definition: query.c:2171
tds_pbcb::from_malloc
unsigned int from_malloc
true is buffer came from malloc
Definition: bulk.c:65
tds_dynamic_stream::size
size_t size
size of data inside buffer
Definition: stream.h:106
tds_file_stream::terminator
const char * terminator
terminator
Definition: bulk.c:981
tds_errno_message_flags
Definition: iconv.h:78
tds_file_stream::stream
TDSINSTREAM stream
common fields, must be the first field
Definition: bulk.c:976
tds_copy_stream
TDSRET tds_copy_stream(TDSINSTREAM *istream, TDSOUTSTREAM *ostream)
Reads and writes from a stream to another.
Definition: stream.c:163
tds.h
names_blob_prefix_t
Definition: challenge.c:72
tds_bcp_done
TDSRET tds_bcp_done(TDSSOCKET *tds, int *rows_copied)
Tell we finished sending BCP data to server.
Definition: bulk.c:810
tds_column_funcs::put_data
tds_func_put_data * put_data
Send column data to server.
Definition: tds.h:663
tds_convert_stream
TDSRET tds_convert_stream(TDSSOCKET *tds, TDSICONV *char_conv, TDS_ICONV_DIRECTION direction, TDSINSTREAM *istream, TDSOUTSTREAM *ostream)
Reads and writes from a stream converting characters.
Definition: stream.c:71
tds_input_stream::read
int(* read)(struct tds_input_stream *stream, void *ptr, size_t len)
read some data Return 0 if end of stream Return <0 if error (actually not defined)
Definition: stream.h:35
tds_submit_queryf
TDSRET tds_submit_queryf(TDSSOCKET *tds, const char *queryf,...)
Format and submit a query.
Definition: query.c:467
tds_blob
Information about blobs (e.g.
Definition: tds.h:594
tds_file_stream::term_len
size_t term_len
terminator length in bytes
Definition: bulk.c:983
tds_socket::rows_affected
TDS_INT8 rows_affected
rows updated/deleted/inserted/selected, TDS_NO_COUNT if not valid
Definition: tds.h:1255
tds_socket::login
TDSLOGIN * login
config for login stuff.
Definition: tds.h:1259
tds_column::column_prec
TDS_TINYINT column_prec
precision for decimal/numeric
Definition: tds.h:704
tds_result_info
Hold information for any results.
Definition: tds.h:770
tdsiconvinfo
Definition: iconv.h:92
TDS_SENDING
@ TDS_SENDING
client would send data
Definition: tds.h:793
tds_authentication
Definition: tds.h:1048
tds_output_stream::write
int(* write)(struct tds_output_stream *stream, size_t len)
write len bytes from buffer, return <0 if error or len
Definition: stream.h:41
tds_pbcb::pb
char * pb
buffer
Definition: bulk.c:61
tdsdump_dump_buf
void tdsdump_dump_buf(const char *file, unsigned int level_line, const char *msg, const void *buf, size_t length)
Dump the contents of data into the log file in a human readable format.
Definition: log.c:256
tds_socket
Information for a server connection.
Definition: tds.h:1164
tds_convert_string
const char * tds_convert_string(TDSSOCKET *tds, TDSICONV *char_conv, const char *s, int len, size_t *out_len)
Convert a string in an allocated buffer.
Definition: query.c:126
TDS_WRITING
@ TDS_WRITING
client is writing data
Definition: tds.h:792
tds_numeric_bytes_per_prec
const int tds_numeric_bytes_per_prec[]
The following little table is indexed by precision and will tell us the number of bytes required to s...
Definition: numeric.c:41
tds_process_simple_query
TDSRET tds_process_simple_query(TDSSOCKET *tds)
Process results for simple query as "SET TEXTSIZE" or "USE dbname" If the statement returns results,...
Definition: token.c:877
tds_iconv
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).
Definition: iconv.c:590
tds_column_funcs::put_info
tds_func_put_info * put_info
Send metadata column information to server.
Definition: tds.h:653
tds_submit_query
TDSRET tds_submit_query(TDSSOCKET *tds, const char *query)
Sends a language string to the database server for processing.
Definition: query.c:210
tds_get_column_declaration
TDSRET tds_get_column_declaration(TDSSOCKET *tds, TDSCOLUMN *curcol, char *out)
Return declaration for column (like "varchar(20)").
Definition: query.c:718
tds_bcp_start_insert_stmt
static TDSRET tds_bcp_start_insert_stmt(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Prepare the query to be sent to server to request BCP information.
Definition: bulk.c:264
tds_ntlm_get_auth
TDSAUTHENTICATION * tds_ntlm_get_auth(TDSSOCKET *tds)
Build a NTLMSPP packet to send to server.
Definition: challenge.c:721
TDSPBCB
struct tds_pbcb TDSPBCB
Holds clause buffer.
tds7_bcp_send_colmetadata
static TDSRET tds7_bcp_send_colmetadata(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Send BCP metadata to server.
Definition: bulk.c:710
MD4Context
Definition: md4.h:9
tds_get_n
bool tds_get_n(TDSSOCKET *tds, void *dest, size_t need)
Get N bytes from the buffer and return them in the already allocated space given to us.
Definition: read.c:230
tdsdump_log
void tdsdump_log(const char *file, unsigned int level_line, const char *fmt,...)
Write a message to the debug log.
Definition: log.c:354
tds_writetext_continue
TDSRET tds_writetext_continue(TDSSOCKET *tds, const TDS_UCHAR *text, TDS_UINT size)
Send some data in the writetext request started by tds_writetext_start.
Definition: bulk.c:1156
tds_file_stream::left
char * left
buffer for store bytes readed that could be the terminator
Definition: bulk.c:986
tds_column::column_size
TDS_INT column_size
maximun size of data.
Definition: tds.h:695
tds_bcp_add_fixed_columns
static int tds_bcp_add_fixed_columns(TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset, unsigned char *rowbuffer, int start)
Add fixed size columns to the row.
Definition: bulk.c:484
tds_writetext_start
TDSRET tds_writetext_start(TDSSOCKET *tds, const char *objname, const char *textptr, const char *timestamp, int with_log, TDS_UINT size)
Start writing writetext request.
Definition: bulk.c:1118
tds_dstr_cstr
static const char * tds_dstr_cstr(const DSTR *s)
Returns a C version (NUL terminated string) of dstr.
Definition: string.h:78
tds7_build_bulk_insert_stmt
static TDSRET tds7_build_bulk_insert_stmt(TDSSOCKET *tds, TDSPBCB *clause, TDSCOLUMN *bcpcol, int first)
Help to build query to be sent to server.
Definition: bulk.c:217
tds_bcp_row_free
static void tds_bcp_row_free(TDSRESULTINFO *result, unsigned char *row)
Free row data allocated in the result set.
Definition: bulk.c:875
tds_process_tokens
TDSRET tds_process_tokens(TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsigned flag)
process all streams.
Definition: token.c:530
tds_bcp_fread
TDSRET tds_bcp_fread(TDSSOCKET *tds, TDSICONV *char_conv, FILE *stream, const char *terminator, size_t term_len, char **outbuf, size_t *outbytes)
Read a data file, passing the data through iconv().
Definition: bulk.c:1048
tds_dstr_len
static size_t tds_dstr_len(const DSTR *s)
Returns the length of the string in bytes.
Definition: string.h:85
tds_column::column_scale
TDS_TINYINT column_scale
scale for decimal/numeric
Definition: tds.h:705
tds_set_state
TDS_STATE tds_set_state(TDSSOCKET *tds, TDS_STATE state)
Set state of TDS connection, with logging and checking.
Definition: util.c:58
tds_socket::out_flag
unsigned char out_flag
output buffer type
Definition: tds.h:1197
tds_pbcb
Holds clause buffer.
Definition: bulk.c:59
tds_input_stream
define a stream of data used for input
Definition: stream.h:30
tds_bcpinfo
Definition: tds.h:1656
tds_login
Definition: tds.h:518
tds_bcp_init
TDSRET tds_bcp_init(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Initialize BCP information.
Definition: bulk.c:82
tds_bcp_add_variable_columns
static int tds_bcp_add_variable_columns(TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset, TDS_UCHAR *rowbuffer, int start, int *pncols)
Add variable size columns to the row.
Definition: bulk.c:569
tds_column::column_cur_size
TDS_INT column_cur_size
size written in variable (ie: char, text, binary).
Definition: tds.h:737
tds_column::char_conv
TDSICONV * char_conv
refers to previously allocated iconv information
Definition: tds.h:713
tds_column::column_varint_size
TDS_TINYINT column_varint_size
size of length when reading from wire (0, 1, 2 or 4)
Definition: tds.h:702
tdserror
int tdserror(const TDSCONTEXT *tds_ctx, TDSSOCKET *tds, int msgno, int errnum)
Call the client library's error handler (for library-generated errors only)
Definition: util.c:321
tds_answer
Definition: challenge.c:65
tds_bcp_send_record
TDSRET tds_bcp_send_record(TDSSOCKET *tds, TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error ignored, int offset)
Send one row of data to server.
Definition: bulk.c:337
tdsnumeric
Definition: proto.h:26
tds_file_stream_read
static int tds_file_stream_read(TDSINSTREAM *stream, void *ptr, size_t len)
Reads a chunk of data from file stream checking for terminator.
Definition: bulk.c:1018
unix_to_nt_time
static void unix_to_nt_time(uint64_t *nt, struct timeval *tv)
put a 8 byte filetime from a time_t This takes GMT as input
Definition: challenge.c:586
tds_login::password
DSTR password
password of account login
Definition: tds.h:536
tds_writetext_end
TDSRET tds_writetext_end(TDSSOCKET *tds)
Finish sending writetext data.
Definition: bulk.c:1173
tds_bcp_start
TDSRET tds_bcp_start(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Start sending BCP data to server.
Definition: bulk.c:840
TDSFILESTREAM
struct tds_file_stream TDSFILESTREAM
input stream to read a file
tds_dstr_dup
DSTR * tds_dstr_dup(DSTR *s, const DSTR *src)
Duplicate a string from another dynamic string.
Definition: tdsstring.c:134
TDS_PENDING
@ TDS_PENDING
cilent is waiting for data
Definition: tds.h:794
MD5Context
Definition: md5.h:8
tds_column
Metadata about columns in regular and compute rows.
Definition: tds.h:690
tds_flush_packet
TDSRET tds_flush_packet(TDSSOCKET *tds)
Flush packet to server.
Definition: write.c:224
tds_connection
Definition: tds.h:1092
tds_login::user_name
DSTR user_name
account for login
Definition: tds.h:535
tds_column::column_type
TDS_SERVER_TYPE column_type
This type can be different from wire type because conversion (e.g.
Definition: tds.h:697
tds_output_stream::buffer
char * buffer
write buffer.
Definition: stream.h:50
tds_dynamic_stream
output stream to write data to a dynamic buffer
Definition: stream.h:99
tds_bcp_start_copy_in
TDSRET tds_bcp_start_copy_in(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Start bulk copy to server.
Definition: bulk.c:887
tds_answer_challenge
static TDSRET tds_answer_challenge(TDSSOCKET *tds, TDSLOGIN *login, const unsigned char *challenge, uint32_t *flags, const unsigned char *names_blob, int names_blob_len, TDSANSWER *answer, unsigned char **ntlm_v2_response)
Crypt a given password using schema required for NTLMv1 or NTLM2 authentication.
Definition: challenge.c:291
tds_pbcb::cb
unsigned int cb
buffer length
Definition: bulk.c:63