27 , {
"UCS-2-INTERNAL", 2, 2}
28 , {
"UCS-2-SWAPPED", 2, 2}
29 , {
"UCS-4-INTERNAL", 4, 4}
30 , {
"UCS-4-SWAPPED", 4, 4}
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}
63 , {
"MACCENTRALEUROPE", 1, 1}
64 , {
"MACICELAND", 1, 1}
65 , {
"MACCROATIAN", 1, 1}
66 , {
"MACROMANIA", 1, 1}
67 , {
"MACCYRILLIC", 1, 1}
68 , {
"MACUKRAINE", 1, 1}
70 , {
"MACTURKISH", 1, 1}
77 , {
"GEORGIAN-ACADEMY", 1, 1}
78 , {
"GEORGIAN-PS", 1, 1}
82 , {
"ISO-IR-166", 1, 1}
92 , {
"BIG5-HKSCS", 1, 2}
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}
115 , {
"JISX0201-1976", 1, 1}
116 , {
"ISO-IR-87", 1, 1}
117 , {
"ISO-IR-159", 1, 1}
119 , {
"CN-GB-ISOIR165", 1, 1}
120 , {
"ISO-IR-149", 1, 1}
121 , {
"ISO-2022-JP-1", 1, 1}
Definition: challenge.c:564
TDSRET tds_dynamic_stream_init(TDSDYNAMICSTREAM *stream, void **ptr, size_t allocated)
Initialize a dynamic output stream.
Definition: stream.c:354
input stream to read a file
Definition: bulk.c:974
FILE * f
file to read from
Definition: bulk.c:978
bool bulk_query
true is query sent was a bulk query so we need to switch state to QUERYING
Definition: tds.h:1245
size_t tds_quote_id(TDSSOCKET *tds, char *buffer, const char *id, int idlen)
Quote an id.
Definition: query.c:2171
unsigned int from_malloc
true is buffer came from malloc
Definition: bulk.c:65
size_t size
size of data inside buffer
Definition: stream.h:106
const char * terminator
terminator
Definition: bulk.c:981
TDSINSTREAM stream
common fields, must be the first field
Definition: bulk.c:976
TDSRET tds_copy_stream(TDSINSTREAM *istream, TDSOUTSTREAM *ostream)
Reads and writes from a stream to another.
Definition: stream.c:163
Definition: challenge.c:72
TDSRET tds_bcp_done(TDSSOCKET *tds, int *rows_copied)
Tell we finished sending BCP data to server.
Definition: bulk.c:810
tds_func_put_data * put_data
Send column data to server.
Definition: tds.h:663
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
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
TDSRET tds_submit_queryf(TDSSOCKET *tds, const char *queryf,...)
Format and submit a query.
Definition: query.c:467
Information about blobs (e.g.
Definition: tds.h:594
size_t term_len
terminator length in bytes
Definition: bulk.c:983
TDS_INT8 rows_affected
rows updated/deleted/inserted/selected, TDS_NO_COUNT if not valid
Definition: tds.h:1255
TDSLOGIN * login
config for login stuff.
Definition: tds.h:1259
TDS_TINYINT column_prec
precision for decimal/numeric
Definition: tds.h:704
Hold information for any results.
Definition: tds.h:770
@ TDS_SENDING
client would send data
Definition: tds.h:793
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
char * pb
buffer
Definition: bulk.c:61
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
Information for a server connection.
Definition: tds.h:1164
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
client is writing data
Definition: tds.h:792
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
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
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_func_put_info * put_info
Send metadata column information to server.
Definition: tds.h:653
TDSRET tds_submit_query(TDSSOCKET *tds, const char *query)
Sends a language string to the database server for processing.
Definition: query.c:210
TDSRET tds_get_column_declaration(TDSSOCKET *tds, TDSCOLUMN *curcol, char *out)
Return declaration for column (like "varchar(20)").
Definition: query.c:718
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
TDSAUTHENTICATION * tds_ntlm_get_auth(TDSSOCKET *tds)
Build a NTLMSPP packet to send to server.
Definition: challenge.c:721
struct tds_pbcb TDSPBCB
Holds clause buffer.
static TDSRET tds7_bcp_send_colmetadata(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Send BCP metadata to server.
Definition: bulk.c:710
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
void tdsdump_log(const char *file, unsigned int level_line, const char *fmt,...)
Write a message to the debug log.
Definition: log.c:354
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
char * left
buffer for store bytes readed that could be the terminator
Definition: bulk.c:986
TDS_INT column_size
maximun size of data.
Definition: tds.h:695
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
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
static const char * tds_dstr_cstr(const DSTR *s)
Returns a C version (NUL terminated string) of dstr.
Definition: string.h:78
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
static void tds_bcp_row_free(TDSRESULTINFO *result, unsigned char *row)
Free row data allocated in the result set.
Definition: bulk.c:875
TDSRET tds_process_tokens(TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsigned flag)
process all streams.
Definition: token.c:530
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
static size_t tds_dstr_len(const DSTR *s)
Returns the length of the string in bytes.
Definition: string.h:85
TDS_TINYINT column_scale
scale for decimal/numeric
Definition: tds.h:705
TDS_STATE tds_set_state(TDSSOCKET *tds, TDS_STATE state)
Set state of TDS connection, with logging and checking.
Definition: util.c:58
unsigned char out_flag
output buffer type
Definition: tds.h:1197
Holds clause buffer.
Definition: bulk.c:59
define a stream of data used for input
Definition: stream.h:30
TDSRET tds_bcp_init(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Initialize BCP information.
Definition: bulk.c:82
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_INT column_cur_size
size written in variable (ie: char, text, binary).
Definition: tds.h:737
TDSICONV * char_conv
refers to previously allocated iconv information
Definition: tds.h:713
TDS_TINYINT column_varint_size
size of length when reading from wire (0, 1, 2 or 4)
Definition: tds.h:702
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
Definition: challenge.c:65
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
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
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
DSTR password
password of account login
Definition: tds.h:536
TDSRET tds_writetext_end(TDSSOCKET *tds)
Finish sending writetext data.
Definition: bulk.c:1173
TDSRET tds_bcp_start(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Start sending BCP data to server.
Definition: bulk.c:840
struct tds_file_stream TDSFILESTREAM
input stream to read a file
DSTR * tds_dstr_dup(DSTR *s, const DSTR *src)
Duplicate a string from another dynamic string.
Definition: tdsstring.c:134
@ TDS_PENDING
cilent is waiting for data
Definition: tds.h:794
Metadata about columns in regular and compute rows.
Definition: tds.h:690
TDSRET tds_flush_packet(TDSSOCKET *tds)
Flush packet to server.
Definition: write.c:224
DSTR user_name
account for login
Definition: tds.h:535
TDS_SERVER_TYPE column_type
This type can be different from wire type because conversion (e.g.
Definition: tds.h:697
char * buffer
write buffer.
Definition: stream.h:50
output stream to write data to a dynamic buffer
Definition: stream.h:99
TDSRET tds_bcp_start_copy_in(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Start bulk copy to server.
Definition: bulk.c:887
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
unsigned int cb
buffer length
Definition: bulk.c:63