num_limits.h
#define LIMIT_INDEXES_ADJUST 4
static const signed char limit_indexes[79]= {
0, /* 0 */
-3, /* 1 */
-6, /* 2 */
-9, /* 3 */
-12, /* 4 */
-15, /* 5 */
-18, /* 6 */
-21, /* 7 */
-24, /* 8 */
-27, /* 9 */
-30, /* 10 */
-32, /* 11 */
-34, /* 12 */
-36, /* 13 */
-38, /* 14 */
-40, /* 15 */
-42, /* 16 */
-44, /* 17 */
-46, /* 18 */
-48, /* 19 */
-50, /* 20 */
-51, /* 21 */
-52, /* 22 */
-53, /* 23 */
-54, /* 24 */
-55, /* 25 */
-56, /* 26 */
-57, /* 27 */
-58, /* 28 */
-59, /* 29 */
-59, /* 30 */
-59, /* 31 */
-59, /* 32 */
-60, /* 33 */
-61, /* 34 */
-62, /* 35 */
-63, /* 36 */
-64, /* 37 */
-65, /* 38 */
-66, /* 39 */
-66, /* 40 */
-66, /* 41 */
-66, /* 42 */
-66, /* 43 */
-66, /* 44 */
-66, /* 45 */
-66, /* 46 */
-66, /* 47 */
-66, /* 48 */
-66, /* 49 */
-65, /* 50 */
-64, /* 51 */
-63, /* 52 */
-62, /* 53 */
-61, /* 54 */
-60, /* 55 */
-59, /* 56 */
-58, /* 57 */
-57, /* 58 */
-55, /* 59 */
-53, /* 60 */
-51, /* 61 */
-49, /* 62 */
-47, /* 63 */
-45, /* 64 */
-44, /* 65 */
-43, /* 66 */
-42, /* 67 */
-41, /* 68 */
-39, /* 69 */
-37, /* 70 */
-35, /* 71 */
-33, /* 72 */
-31, /* 73 */
-29, /* 74 */
-27, /* 75 */
-25, /* 76 */
-23, /* 77 */
-21, /* 78 */
};
static const TDS_WORD limits[]= {
0x00000001u, /* 0 */
0x0000000au, /* 1 */
0x00000064u, /* 2 */
0x000003e8u, /* 3 */
0x00002710u, /* 4 */
0x000186a0u, /* 5 */
0x000f4240u, /* 6 */
0x00989680u, /* 7 */
0x05f5e100u, /* 8 */
0x3b9aca00u, /* 9 */
0x00000002u, /* 10 */
0x540be400u, /* 11 */
0x00000017u, /* 12 */
0x4876e800u, /* 13 */
0x000000e8u, /* 14 */
0xd4a51000u, /* 15 */
0x00000918u, /* 16 */
0x4e72a000u, /* 17 */
0x00005af3u, /* 18 */
0x107a4000u, /* 19 */
0x00038d7eu, /* 20 */
0xa4c68000u, /* 21 */
0x002386f2u, /* 22 */
0x6fc10000u, /* 23 */
0x01634578u, /* 24 */
0x5d8a0000u, /* 25 */
0x0de0b6b3u, /* 26 */
0xa7640000u, /* 27 */
0x8ac72304u, /* 28 */
0x89e80000u, /* 29 */
0x00000005u, /* 30 */
0x6bc75e2du, /* 31 */
0x63100000u, /* 32 */
0x00000036u, /* 33 */
0x35c9adc5u, /* 34 */
0xdea00000u, /* 35 */
0x0000021eu, /* 36 */
0x19e0c9bau, /* 37 */
0xb2400000u, /* 38 */
0x0000152du, /* 39 */
0x02c7e14au, /* 40 */
0xf6800000u, /* 41 */
0x0000d3c2u, /* 42 */
0x1bceccedu, /* 43 */
0xa1000000u, /* 44 */
0x00084595u, /* 45 */
0x16140148u, /* 46 */
0x4a000000u, /* 47 */
0x0052b7d2u, /* 48 */
0xdcc80cd2u, /* 49 */
0xe4000000u, /* 50 */
0x033b2e3cu, /* 51 */
0x9fd0803cu, /* 52 */
0xe8000000u, /* 53 */
0x204fce5eu, /* 54 */
0x3e250261u, /* 55 */
0x10000000u, /* 56 */
0x00000001u, /* 57 */
0x431e0faeu, /* 58 */
0x6d7217cau, /* 59 */
0xa0000000u, /* 60 */
0x0000000cu, /* 61 */
0x9f2c9cd0u, /* 62 */
0x4674edeau, /* 63 */
0x40000000u, /* 64 */
0x0000007eu, /* 65 */
0x37be2022u, /* 66 */
0xc0914b26u, /* 67 */
0x80000000u, /* 68 */
0x000004eeu, /* 69 */
0x2d6d415bu, /* 70 */
0x85acef81u, /* 71 */
0x0000314du, /* 72 */
0xc6448d93u, /* 73 */
0x38c15b0au, /* 74 */
0x0001ed09u, /* 75 */
0xbead87c0u, /* 76 */
0x378d8e64u, /* 77 */
0x00134261u, /* 78 */
0x72c74d82u, /* 79 */
0x2b878fe8u, /* 80 */
0x00c097ceu, /* 81 */
0x7bc90715u, /* 82 */
0xb34b9f10u, /* 83 */
0x0785ee10u, /* 84 */
0xd5da46d9u, /* 85 */
0x00f436a0u, /* 86 */
0x4b3b4ca8u, /* 87 */
0x5a86c47au, /* 88 */
0x098a2240u, /* 89 */
0x00000002u, /* 90 */
0xf050fe93u, /* 91 */
0x8943acc4u, /* 92 */
0x5f655680u, /* 93 */
0x0000001du, /* 94 */
0x6329f1c3u, /* 95 */
0x5ca4bfabu, /* 96 */
0xb9f56100u, /* 97 */
0x00000125u, /* 98 */
0xdfa371a1u, /* 99 */
0x9e6f7cb5u, /* 100 */
0x4395ca00u, /* 101 */
0x00000b7au, /* 102 */
0xbc627050u, /* 103 */
0x305adf14u, /* 104 */
0xa3d9e400u, /* 105 */
0x000072cbu, /* 106 */
0x5bd86321u, /* 107 */
0xe38cb6ceu, /* 108 */
0x6682e800u, /* 109 */
0x00047bf1u, /* 110 */
0x9673df52u, /* 111 */
0xe37f2410u, /* 112 */
0x011d1000u, /* 113 */
0x002cd76fu, /* 114 */
0xe086b93cu, /* 115 */
0xe2f768a0u, /* 116 */
0x0b22a000u, /* 117 */
0x01c06a5eu, /* 118 */
0xc5433c60u, /* 119 */
0xddaa1640u, /* 120 */
0x6f5a4000u, /* 121 */
0x118427b3u, /* 122 */
0xb4a05bc8u, /* 123 */
0xa8a4de84u, /* 124 */
0x59868000u, /* 125 */
0xaf298d05u, /* 126 */
0x0e4395d6u, /* 127 */
0x9670b12bu, /* 128 */
0x7f410000u, /* 129 */
0x00000006u, /* 130 */
0xd79f8232u, /* 131 */
0x8ea3da61u, /* 132 */
0xe066ebb2u, /* 133 */
0xf88a0000u, /* 134 */
0x00000044u, /* 135 */
0x6c3b15f9u, /* 136 */
0x926687d2u, /* 137 */
0xc40534fdu, /* 138 */
0xb5640000u, /* 139 */
0x000002acu, /* 140 */
0x3a4edbbfu, /* 141 */
0xb8014e3bu, /* 142 */
0xa83411e9u, /* 143 */
0x15e80000u, /* 144 */
0x00001abau, /* 145 */
0x4714957du, /* 146 */
0x300d0e54u, /* 147 */
0x9208b31au, /* 148 */
0xdb100000u, /* 149 */
0x00010b46u, /* 150 */
0xc6cdd6e3u, /* 151 */
0xe0828f4du, /* 152 */
0xb456ff0cu, /* 153 */
0x8ea00000u, /* 154 */
0x000a70c3u, /* 155 */
0xc40a64e6u, /* 156 */
0xc5199909u, /* 157 */
0x0b65f67du, /* 158 */
0x92400000u, /* 159 */
0x006867a5u, /* 160 */
0xa867f103u, /* 161 */
0xb2fffa5au, /* 162 */
0x71fba0e7u, /* 163 */
0xb6800000u, /* 164 */
0x04140c78u, /* 165 */
0x940f6a24u, /* 166 */
0xfdffc788u, /* 167 */
0x73d4490du, /* 168 */
0x21000000u, /* 169 */
0x28c87cb5u, /* 170 */
0xc89a2571u, /* 171 */
0xebfdcb54u, /* 172 */
0x864ada83u, /* 173 */
0x4a000000u, /* 174 */
0x00000001u, /* 175 */
0x97d4df19u, /* 176 */
0xd6057673u, /* 177 */
0x37e9f14du, /* 178 */
0x3eec8920u, /* 179 */
0xe4000000u, /* 180 */
0x0000000fu, /* 181 */
0xee50b702u, /* 182 */
0x5c36a080u, /* 183 */
0x2f236d04u, /* 184 */
0x753d5b48u, /* 185 */
0xe8000000u, /* 186 */
0x0000009fu, /* 187 */
0x4f272617u, /* 188 */
0x9a224501u, /* 189 */
0xd762422cu, /* 190 */
0x946590d9u, /* 191 */
0x10000000u, /* 192 */
0x00000639u, /* 193 */
0x17877cecu, /* 194 */
0x0556b212u, /* 195 */
0x69d695bdu, /* 196 */
0xcbf7a87au, /* 197 */
0xa0000000u, /* 198 */
0x00003e3au, /* 199 */
0xeb4ae138u, /* 200 */
0x3562f4b8u, /* 201 */
0x2261d969u, /* 202 */
0xf7ac94cau, /* 203 */
0x40000000u, /* 204 */
0x00026e4du, /* 205 */
0x30eccc32u, /* 206 */
0x15dd8f31u, /* 207 */
0x57d27e23u, /* 208 */
0xacbdcfe6u, /* 209 */
0x80000000u, /* 210 */
0x00184f03u, /* 211 */
0xe93ff9f4u, /* 212 */
0xdaa797edu, /* 213 */
0x6e38ed64u, /* 214 */
0xbf6a1f01u, /* 215 */
0x00f31627u, /* 216 */
0x1c7fc390u, /* 217 */
0x8a8bef46u, /* 218 */
0x4e3945efu, /* 219 */
0x7a25360au, /* 220 */
0x097edd87u, /* 221 */
0x1cfda3a5u, /* 222 */
0x697758bfu, /* 223 */
0x0e3cbb5au, /* 224 */
0xc5741c64u, /* 225 */
0x5ef4a747u, /* 226 */
0x21e86476u, /* 227 */
0x1ea97776u, /* 228 */
0x8e5f518bu, /* 229 */
0xb6891be8u, /* 230 */
0x00000003u, /* 231 */
0xb58e88c7u, /* 232 */
0x5313ec9du, /* 233 */
0x329eaaa1u, /* 234 */
0x8fb92f75u, /* 235 */
0x215b1710u, /* 236 */
0x00000025u, /* 237 */
0x179157c9u, /* 238 */
0x3ec73e23u, /* 239 */
0xfa32aa4fu, /* 240 */
0x9d3bda93u, /* 241 */
0x4d8ee6a0u, /* 242 */
0x00000172u, /* 243 */
0xebad6ddcu, /* 244 */
0x73c86d67u, /* 245 */
0xc5faa71cu, /* 246 */
0x245689c1u, /* 247 */
0x07950240u, /* 248 */
0x00000e7du, /* 249 */
0x34c64a9cu, /* 250 */
0x85d4460du, /* 251 */
0xbbca8719u, /* 252 */
0x6b61618au, /* 253 */
0x4bd21680u, /* 254 */
0x000090e4u, /* 255 */
0x0fbeea1du, /* 256 */
0x3a4abc89u, /* 257 */
0x55e946feu, /* 258 */
0x31cdcf66u, /* 259 */
0xf634e100u, /* 260 */
0x0005a8e8u, /* 261 */
0x9d752524u, /* 262 */
0x46eb5d5du, /* 263 */
0x5b1cc5edu, /* 264 */
0xf20a1a05u, /* 265 */
0x9e10ca00u, /* 266 */
0x00389916u, /* 267 */
0x2693736au, /* 268 */
0xc531a5a5u, /* 269 */
0x8f1fbb4bu, /* 270 */
0x74650438u, /* 271 */
0x2ca7e400u, /* 272 */
0x0235faddu, /* 273 */
0x81c2822bu, /* 274 */
0xb3f07877u, /* 275 */
0x973d50f2u, /* 276 */
0x8bf22a31u, /* 277 */
0xbe8ee800u, /* 278 */
0x161bcca7u, /* 279 */
0x119915b5u, /* 280 */
0x0764b4abu, /* 281 */
0xe8652979u, /* 282 */
0x7775a5f1u, /* 283 */
0x71951000u, /* 284 */
0xdd15fe86u, /* 285 */
0xaffad912u, /* 286 */
0x49ef0eb7u, /* 287 */
0x13f39ebeu, /* 288 */
0xaa987b6eu, /* 289 */
0x6fd2a000u, /* 290 */
};
tds_quote_string
size_t tds_quote_string(TDSSOCKET *tds, char *buffer, const char *str, int len)
Quote a string.
Definition: query.c:2241
tds_column_funcs
Definition: tds.h:647
tds_get_locale
TDSLOCALE * tds_get_locale(void)
Get locale information.
Definition: locale.c:50
tds_dynamic
Holds information for a dynamic (also called prepared) query.
Definition: tds.h:981
tdsdump_off
void tdsdump_off(TDSDUMP_OFF_ITEM *off_item)
Temporarily turn off logging for current thread.
Definition: log.c:81
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_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:1248
tds_start_query
void tds_start_query(TDSSOCKET *tds, unsigned char packet_type)
Start query packet of a given type.
Definition: query.c:332
tds_column_funcs::put_data
tds_func_put_data * put_data
Send column data to server.
Definition: tds.h:666
tds_dstr_init
static void tds_dstr_init(DSTR *s)
init a string with empty
Definition: string.h:53
tds7_put_query_params
static void tds7_put_query_params(TDSSOCKET *tds, const char *query, size_t query_len)
Output params types and query (required by sp_prepare/sp_executesql/sp_prepexec)
Definition: query.c:1064
tds_submit_unprepare
TDSRET tds_submit_unprepare(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Send a unprepare request for a prepared query.
Definition: query.c:1797
tds_next_placeholder_ucs2le
static const char * tds_next_placeholder_ucs2le(const char *start, const char *end, int named)
Found the next placeholder (? or @param) in a string.
Definition: query.c:644
tdsdaterec::quarter
TDS_INT quarter
quarter (0-3)
Definition: tds.h:161
tds_socket::frozen_packets
TDSPACKET * frozen_packets
list of packets frozen, points to first one.
Definition: tds.h:1207
tds_env::charset
char * charset
character set encoding
Definition: tds.h:972
tds_packet
Definition: tds.h:1061
tdsdaterec
Used by tds_datecrack.
Definition: tds.h:159
tds_dynamic::defer_close
bool defer_close
true if dynamic was marker to be closed when connection is idle
Definition: tds.h:1001
tds_dstr_empty
#define tds_dstr_empty(s)
Make a string empty.
Definition: string.h:91
tds_file_stream::left
char * left
buffer for store bytes readed that could be the terminator
Definition: bulk.c:1015
tds_cursor::cursor_rows
TDS_INT cursor_rows
< number of updatable columns
Definition: tds.h:955
tds_deferred_cursor_dealloc
TDSRET tds_deferred_cursor_dealloc(TDSCONNECTION *conn, TDSCURSOR *cursor)
Deallocate cursor on idle.
Definition: query.c:3057
tds_set_param_type
void tds_set_param_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
Set type of column initializing all dependency.
Definition: data.c:246
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_time::tm_min
int tm_min
minutes (0-59)
Definition: convert.c:60
tds_put_data_info
static TDSRET tds_put_data_info(TDSSOCKET *tds, TDSCOLUMN *curcol, int flags)
Put data information to wire.
Definition: query.c:1533
tds_cursor::status
TDS_CURSOR_STATUS status
cursor parameter
Definition: tds.h:957
tds_submit_query_params
TDSRET tds_submit_query_params(TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head)
Sends a language string to the database server for processing.
Definition: query.c:350
tds_iconv_alloc
int tds_iconv_alloc(TDSCONNECTION *conn)
Allocate iconv stuff.
Definition: iconv.c:316
tds_output_stream::buffer
char * buffer
write buffer.
Definition: stream.h:50
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
tds_file_stream::f
FILE * f
file to read from
Definition: bulk.c:1007
tds_time::tm_ns
int tm_ns
nanoseconds (0-999999999)
Definition: convert.c:62
tds_connection::cursors
TDSCURSOR * cursors
linked list of cursors allocated for this connection contains only cursors allocated on the server
Definition: tds.h:1111
tds_socket::has_status
bool has_status
true is ret_status is valid
Definition: tds.h:1249
tdsmoney
Definition: proto.h:39
TDS_DONE_COUNT
@ TDS_DONE_COUNT
count field in packet is valid
Definition: tds.h:256
tds_login::password
DSTR password
password of account login
Definition: tds.h:537
tdsdaterec::decimicrosecond
TDS_INT decimicrosecond
0-9999999
Definition: tds.h:169
tds_locale
Definition: tds.h:584
tds_prtype
const char * tds_prtype(int type)
Returns string representation of the given type.
Definition: token.c:3056
tds_socket::in_pos
unsigned in_pos
current position in in_buf
Definition: tds.h:1196
TDS_DATETIMEALL::date
TDS_INT date
date, 0 = 1900-01-01
Definition: tds.h:148
tds_freeze_written
size_t tds_freeze_written(TDSFREEZE *freeze)
Compute how many bytes has been written from freeze.
Definition: packet.c:935
tds_iconv_from_collate
TDSICONV * tds_iconv_from_collate(TDSCONNECTION *conn, TDS_UCHAR collate[5])
Get iconv information from a LCID (to support different column encoding under MSSQL2K)
Definition: iconv.c:1251
tds_strftime
size_t tds_strftime(char *buf, size_t maxsize, const char *format, const TDSDATEREC *dr, int prec)
format a date string according to an "extended" strftime(3) formatting definition.
Definition: convert.c:3002
tds_swap_numeric
static void tds_swap_numeric(TDS_NUMERIC *num)
Converts numeric from Microsoft representation to internal one (Sybase).
Definition: data.c:1674
tds.h
Main include file for libtds.
tds_pbcb::pb
char * pb
buffer
Definition: bulk.c:61
tds_socket_read
static int tds_socket_read(TDSCONNECTION *conn, TDSSOCKET *tds, unsigned char *buf, int buflen)
Read from an OS socket @TODO remove tds, save error somewhere, report error in another way.
Definition: net.c:725
tds_connection::env
TDSENV env
environment is shared between all sessions
Definition: tds.h:1105
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
tdsdaterec::day
TDS_INT day
day of month (1-31)
Definition: tds.h:163
tds_read_conf_section
bool tds_read_conf_section(FILE *in, const char *section, TDSCONFPARSE tds_conf_parse, void *param)
Read a section of configuration file (INI style file)
Definition: config.c:503
tds_dstr_isempty
static int tds_dstr_isempty(const DSTR *s)
test if string is empty
Definition: string.h:60
tds7_write_param_def_from_query
static TDSRET tds7_write_param_def_from_query(TDSSOCKET *tds, const char *converted_query, size_t converted_query_len, TDSPARAMINFO *params) TDS_WUR
Write string with parameters definition, useful for TDS7+.
Definition: query.c:903
tds_get_socket_error
static int tds_get_socket_error(TDS_SYS_SOCKET sock)
Returns error stored in the socket.
Definition: net.c:217
tds_staticin_stream
input stream to read data from a static buffer
Definition: stream.h:81
tds_bcp_done
TDSRET tds_bcp_done(TDSSOCKET *tds, int *rows_copied)
Tell we finished sending BCP data to server.
Definition: bulk.c:836
tds_socket::login
TDSLOGIN * login
config for login stuff.
Definition: tds.h:1262
tds7_get_instance_ports
int tds7_get_instance_ports(FILE *output, struct addrinfo *addr)
Get port of all instances.
Definition: net.c:1091
tds_generic_put
TDSRET tds_generic_put(TDSSOCKET *tds, TDSCOLUMN *curcol, int bcp7)
Write data to wire.
Definition: data.c:919
tds_encoding::canonic
unsigned char canonic
internal numeric index into array of all encodings
Definition: tds.h:628
tds_cursor
Holds informations about a cursor.
Definition: tds.h:941
tds_socket::out_buf
unsigned char * out_buf
Output buffer.
Definition: tds.h:1189
tds_file_stream::stream
TDSINSTREAM stream
common fields, must be the first field
Definition: bulk.c:1005
tds_socket_set_nonblocking
int tds_socket_set_nonblocking(TDS_SYS_SOCKET sock)
Set socket to non-blocking.
Definition: net.c:168
tds_init_login
TDSLOGIN * tds_init_login(TDSLOGIN *login, TDSLOCALE *locale)
Initialize login structure with locale information and other stuff for connection.
Definition: mem.c:800
tds_freeze_abort
TDSRET tds_freeze_abort(TDSFREEZE *freeze)
Discard all data written after the freeze.
Definition: packet.c:961
tds_get_conversion_type
TDS_SERVER_TYPE tds_get_conversion_type(TDS_SERVER_TYPE srctype, int colsize)
Return type suitable for conversions (convert all nullable types to fixed type)
Definition: tds_types.h:125
tds_set_cur_dyn
void tds_set_cur_dyn(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Set current dynamic.
Definition: query.c:192
tds_connection::product_version
TDS_UINT product_version
version of product (Sybase/MS and full version)
Definition: tds.h:1097
tds_socket_set_nosigpipe
int tds_socket_set_nosigpipe(TDS_SYS_SOCKET sock, int on)
Set socket to not throw SIGPIPE.
Definition: net.c:72
tds_cursor::cursor_id
TDS_INT cursor_id
cursor id returned by the server after cursor declare
Definition: tds.h:945
tds_alloc_dynamic
TDSDYNAMIC * tds_alloc_dynamic(TDSCONNECTION *conn, const char *id)
Allocate a dynamic statement.
Definition: mem.c:160
tds_convert
TDS_INT tds_convert(const TDSCONTEXT *tds_ctx, int srctype, const void *src, TDS_UINT srclen, int desttype, CONV_RESULT *cr)
tds_convert convert a type to another.
Definition: convert.c:1901
tds_freeze_close_len
TDSRET tds_freeze_close_len(TDSFREEZE *freeze, int32_t size)
Stop keeping data for this specific freeze.
Definition: packet.c:1031
tds_set_column_type
void tds_set_column_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
Set type of column initializing all dependency.
Definition: data.c:224
tds7_send_execute
static TDSRET tds7_send_execute(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Send dynamic request on TDS 7+ to be executed.
Definition: query.c:1593
TDSBLOB
struct tds_blob TDSBLOB
Information about blobs (e.g.
tdsdaterec::weekday
TDS_INT weekday
day of week (0-6, 0 = sunday)
Definition: tds.h:165
tds_socket::rows_affected
TDS_INT8 rows_affected
rows updated/deleted/inserted/selected, TDS_NO_COUNT if not valid
Definition: tds.h:1258
tds_socket::send_packet
TDSPACKET * send_packet
packet we are preparing to send
Definition: tds.h:1235
tds_start_query_head
static TDSRET tds_start_query_head(TDSSOCKET *tds, unsigned char packet_type, TDSHEADERS *head)
Start query packet of a given type.
Definition: query.c:291
tds_column::column_prec
TDS_TINYINT column_prec
precision for decimal/numeric
Definition: tds.h:707
tds_socket::in_buf
unsigned char * in_buf
Input buffer.
Definition: tds.h:1181
tds_save_env
Definition: login.c:180
tds_socket::cur_cursor
TDSCURSOR * cur_cursor
cursor in use
Definition: tds.h:1247
tds_close_socket
void tds_close_socket(TDSSOCKET *tds)
Close current socket.
Definition: net.c:548
parse_numeric
static const char * parse_numeric(const char *buf, const char *pend, bool *p_negative, size_t *p_digits, size_t *p_decimals)
Parse a string for numbers.
Definition: convert.c:3445
tds_skip_quoted
const char * tds_skip_quoted(const char *s)
Skip quoting string (like 'sfsf', "dflkdj" or [dfkjd])
Definition: query.c:515
conv_result
Definition: convert.h:34
pollfd
Definition: poll.h:52
tds_connection::dyns
TDSDYNAMIC * dyns
list of dynamic allocated for this connection contains only dynamic allocated on the server
Definition: tds.h:1116
tds_alloc_row
TDSRET tds_alloc_row(TDSRESULTINFO *res_info)
Allocate space for row store return NULL on out of memory.
Definition: mem.c:524
tds_goodread
int tds_goodread(TDSSOCKET *tds, unsigned char *buf, int buflen)
Loops until we have received some characters return -1 on failure.
Definition: net.c:914
tds_time::tm_mon
int tm_mon
month (0-11)
Definition: convert.c:57
tds_packet::data_len
unsigned data_len
data length, this does not account SMP header, only TDS part
Definition: tds.h:1075
MD5Context
Definition: md5.h:8
binary_to_result
static TDS_INT binary_to_result(int desttype, const void *data, size_t len, CONV_RESULT *cr)
Copy binary data to to result and return len or TDS_CONVERT_NOMEM.
Definition: convert.c:196
tds_cursor_dealloc
TDSRET tds_cursor_dealloc(TDSSOCKET *tds, TDSCURSOR *cursor)
Send a deallocation request to server.
Definition: query.c:3006
tds_socket::in_row
bool in_row
true if we are getting rows
Definition: tds.h:1250
tds_iconv_get_info
TDSICONV * tds_iconv_get_info(TDSCONNECTION *conn, int canonic_client, int canonic_server)
Get a iconv info structure, allocate and initialize if needed.
Definition: iconv.c:764
tds_login::server_realm_name
DSTR server_realm_name
server realm name (in freetds.conf)
Definition: tds.h:529
poll.h
Provide poll call where missing.
tds_datain_stream_init
void tds_datain_stream_init(TDSDATAINSTREAM *stream, TDSSOCKET *tds, size_t wire_size)
Initialize a data input stream.
Definition: stream.c:204
tds_count_placeholders_ucs2le
static int tds_count_placeholders_ucs2le(const char *query, const char *query_end)
Count the number of placeholders ('?') in a query.
Definition: query.c:692
tds_errno_message_flags
Definition: iconv.h:78
tds_get_dynid
static char * tds_get_dynid(TDSCONNECTION *conn, char *id)
Get an id for dynamic query based on TDS information.
Definition: mem.c:94
tds_ntlm_auth
Definition: challenge.c:564
tds_dynamic::emulated
TDS_TINYINT emulated
this dynamic query cannot be prepared so libTDS have to construct a simple query.
Definition: tds.h:997
tds_datain_stream
input stream to read data from tds protocol
Definition: stream.h:63
tds_generic_get
TDSRET tds_generic_get(TDSSOCKET *tds, TDSCOLUMN *curcol)
Read a data from wire.
Definition: data.c:713
tds_canonical_charset_name
const char * tds_canonical_charset_name(const char *charset_name)
Determine canonical iconv character set name.
Definition: iconv.c:988
tds_set_server
bool tds_set_server(TDSLOGIN *tds_login, const char *server) TDS_WUR
Set the servername in a TDSLOGIN structure.
Definition: login.c:129
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:881
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_send_emulated_execute
static TDSRET tds_send_emulated_execute(TDSSOCKET *tds, const char *query, TDSPARAMINFO *params)
Emulate prepared execute traslating to a normal language.
Definition: query.c:3269
tds_column_funcs::put_info
tds_func_put_info * put_info
Send metadata column information to server.
Definition: tds.h:656
tds_submit_queryf
TDSRET tds_submit_queryf(TDSSOCKET *tds, const char *queryf,...)
Format and submit a query.
Definition: query.c:467
tds_get_varint_size
int tds_get_varint_size(TDSCONNECTION *conn, int datatype)
tds_get_varint_size() returns the size of a variable length integer returned in a result string
Definition: tds_types.h:57
tds_dynamic::params
TDSPARAMINFO * params
query parameters.
Definition: tds.h:1011
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:266
tds_dstr_dup
DSTR * tds_dstr_dup(DSTR *s, const DSTR *src)
Duplicate a string from another dynamic string.
Definition: tdsstring.c:134
tds_submit_begin_tran
TDSRET tds_submit_begin_tran(TDSSOCKET *tds)
Send a rollback request.
Definition: query.c:3665
tdsdatetime
Definition: proto.h:50
retry_addr
Definition: net.c:364
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_variant
Store variant informations.
Definition: tds.h:608
tds_cursor::type
TDS_INT type
row fetched from this cursor
Definition: tds.h:960
tdsdaterec::dayofyear
TDS_INT dayofyear
day of year (1-366)
Definition: tds.h:164
tds_lookup_dynamic
TDSDYNAMIC * tds_lookup_dynamic(TDSCONNECTION *conn, const char *id)
Finds a dynamic given string id.
Definition: token.c:2587
tds_get_null_type
TDS_SERVER_TYPE tds_get_null_type(TDS_SERVER_TYPE srctype)
Get same type but nullable.
Definition: convert.c:2936
tds_quote_id_rpc
size_t tds_quote_id_rpc(TDSSOCKET *tds, char *buffer, const char *id, int idlen)
Quote an id for a RPC call.
Definition: query.c:2216
tds4_send_emulated_rpc
static TDSRET tds4_send_emulated_rpc(TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params)
Send RPC as string query.
Definition: query.c:1873
tds_input_stream
define a stream of data used for input
Definition: stream.h:30
tds_save_msg
Definition: login.c:174
tds_dstr_setlen
DSTR * tds_dstr_setlen(DSTR *s, size_t length)
limit length of string, MUST be <= current length
Definition: tdsstring.c:145
tds_message
Definition: tds.h:880
tds_login::db_filename
DSTR db_filename
database filename to attach (MSSQL)
Definition: tds.h:531
TDS72_SMP_HEADER
TDS 7.2 SMP packet header.
Definition: proto.h:361
string_to_int8
static TDS_INT string_to_int8(const char *buf, const char *pend, TDS_INT8 *res)
convert a number in string to TDS_INT8
Definition: convert.c:3378
tds_dstr_set
DSTR * tds_dstr_set(DSTR *s, char *src)
set a string from another buffer.
Definition: tdsstring.c:107
TDSPBCB
struct tds_pbcb TDSPBCB
Holds clause buffer.
tds_send_cancel
TDSRET tds_send_cancel(TDSSOCKET *tds)
tds_send_cancel() sends an empty packet (8 byte header only) tds_process_cancel should be called dire...
Definition: query.c:2026
MD4Context
Definition: md4.h:9
tds_cursor::query
char * query
SQL query.
Definition: tds.h:951
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_column
Metadata about columns in regular and compute rows.
Definition: tds.h:693
tds7_bcp_send_colmetadata
static TDSRET tds7_bcp_send_colmetadata(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Send BCP metadata to server.
Definition: bulk.c:736
tdsiconvinfo
Definition: iconv.h:92
tds_cursor::next
struct tds_cursor * next
next in linked list, keep first
Definition: tds.h:942
tds71_submit_prepexec
TDSRET tds71_submit_prepexec(TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params)
Creates a temporary stored procedure in the server and execute it.
Definition: query.c:1401
tds_connection
Definition: tds.h:1095
tds_cursor::ref_count
TDS_INT ref_count
reference counter so client can retain safely a pointer
Definition: tds.h:943
tds_datain_stream::wire_size
size_t wire_size
bytes still to read
Definition: stream.h:65
tds5_put_params
static TDSRET tds5_put_params(TDSSOCKET *tds, TDSPARAMINFO *info, int flags) TDS_WUR
Send parameters to server.
Definition: query.c:1693
tds_get_byte
unsigned char tds_get_byte(TDSSOCKET *tds)
Return a single byte from the input buffer.
Definition: read.c:72
tds_socket_write
static int tds_socket_write(TDSCONNECTION *conn, TDSSOCKET *tds, const unsigned char *buf, int buflen)
Write to an OS socket.
Definition: net.c:760
tds5_bcp_add_fixed_columns
static int tds5_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:507
tds_submit_optioncmd
TDSRET tds_submit_optioncmd(TDSSOCKET *tds, TDS_OPTION_CMD command, TDS_OPTION option, TDS_OPTION_ARG *param, TDS_INT param_size)
Send option commands to server.
Definition: query.c:3389
tds_dstr_get
DSTR * tds_dstr_get(TDSSOCKET *tds, DSTR *s, size_t len)
Reads a string from wire and put in a DSTR.
Definition: read.c:293
tds_skip_comment
const char * tds_skip_comment(const char *s)
Skip a comment in a query.
Definition: query.c:490
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:1185
tds_connection::s
TDS_SYS_SOCKET s
tcp socket, INVALID_SOCKET if not connected
Definition: tds.h:1100
tds_time::tm_sec
int tm_sec
seconds (0-59)
Definition: convert.c:61
tds_put_param_as_string
static TDSRET tds_put_param_as_string(TDSSOCKET *tds, TDSPARAMINFO *params, int n)
Send a parameter to server.
Definition: query.c:3189
tds_next_placeholder
const char * tds_next_placeholder(const char *start)
Get position of next placeholder.
Definition: query.c:535
tds_socket::out_flag
unsigned char out_flag
output buffer type
Definition: tds.h:1200
tdsunique
Definition: proto.h:62
tds_goodwrite
int tds_goodwrite(TDSSOCKET *tds, const unsigned char *buffer, size_t buflen)
Definition: net.c:985
tds_dynamic::next
struct tds_dynamic * next
next in linked list, keep first
Definition: tds.h:982
tds_bcpcoldata
Definition: tds.h:632
tds_socket::in_cancel
volatile unsigned char in_cancel
indicate we are waiting a cancel reply; discard tokens till acknowledge; 1 mean we have to send cance...
Definition: tds.h:1252
tdsmoney4
Definition: proto.h:45
string_to_numeric
static int string_to_numeric(const char *instr, const char *pend, CONV_RESULT *cr)
convert a number in string to a TDSNUMERIC
Definition: convert.c:2289
tds_get_string
size_t tds_get_string(TDSSOCKET *tds, size_t string_len, char *dest, size_t dest_size)
Fetch a string from the wire.
Definition: read.c:166
tds_datecrack
TDSRET tds_datecrack(TDS_INT datetype, const void *di, TDSDATEREC *dr)
Convert from db date format to a structured date format.
Definition: convert.c:3182
tds_cursor::defer_close
bool defer_close
true if cursor was marker to be closed when connection is idle
Definition: tds.h:950
tds_dynamic::ref_count
TDS_INT ref_count
reference counter so client can retain safely a pointer
Definition: tds.h:983
tds_file_stream::terminator
const char * terminator
terminator
Definition: bulk.c:1010
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_SENDING
@ TDS_SENDING
client would send data
Definition: tds.h:796
tds_blob
Information about blobs (e.g.
Definition: tds.h:597
tds_process_login_tokens
TDSRET tds_process_login_tokens(TDSSOCKET *tds)
tds_process_login_tokens() is called after sending the login packet to the server.
Definition: token.c:411
tds_login::bulk_copy
unsigned int bulk_copy
if bulk copy should be enabled
Definition: tds.h:558
tds_put_data
static TDSRET tds_put_data(TDSSOCKET *tds, TDSCOLUMN *curcol)
Write data to wire.
Definition: query.c:279
tds_login::new_password
DSTR new_password
new password to set (TDS 7.2+)
Definition: tds.h:538
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_read_packet
int tds_read_packet(TDSSOCKET *tds)
Read in one 'packet' from the server.
Definition: packet.c:527
tds_multiple
Definition: tds.h:1023
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:1147
tds_dynamic_stream
output stream to write data to a dynamic buffer
Definition: stream.h:99
tds_dstr
Structure to hold a string.
Definition: string.h:36
tds_login::tds_version
TDS_USMALLINT tds_version
TDS version.
Definition: tds.h:522
tds5_fix_dot_query
static char * tds5_fix_dot_query(const char *query, size_t *query_len, TDSPARAMINFO *params)
Substitute ?-style placeholders with named (@param) ones.
Definition: query.c:227
tds_result_info
Hold information for any results.
Definition: tds.h:773
tdsdaterec::hour
TDS_INT hour
0-23
Definition: tds.h:166
tds_alloc_param_result
TDSPARAMINFO * tds_alloc_param_result(TDSPARAMINFO *old_param)
Adds a output parameter to TDSPARAMINFO.
Definition: mem.c:284
tds_socket::cur_dyn
TDSDYNAMIC * cur_dyn
dynamic structure in use
Definition: tds.h:1260
stringz_to_numeric
static int stringz_to_numeric(const char *instr, CONV_RESULT *cr)
convert a zero terminated string to NUMERIC
Definition: convert.c:2283
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:219
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:904
tds_socket::current_results
TDSRESULTINFO * current_results
Current query information.
Definition: tds.h:1242
tds_login::ip_addrs
struct addrinfo * ip_addrs
ip(s) of server
Definition: tds.h:548
tds_cursor::cursor_name
char * cursor_name
name of the cursor
Definition: tds.h:944
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
tdsdaterec::month
TDS_INT month
month number (0-11)
Definition: tds.h:162
TDS_WRITING
@ TDS_WRITING
client is writing data
Definition: tds.h:795
tdsdaterec::second
TDS_INT second
0-59
Definition: tds.h:168
tds_alloc_param_data
void * tds_alloc_param_data(TDSCOLUMN *curparam)
Allocate data for a parameter.
Definition: mem.c:364
tds_cursor_check_allocated
static bool tds_cursor_check_allocated(TDSCONNECTION *conn, TDSCURSOR *cursor)
Check if a cursor is allocated into the server.
Definition: query.c:2991
tds_select
int tds_select(TDSSOCKET *tds, unsigned tds_sel, int timeout_seconds)
Select on a socket until it's available or the timeout expires.
Definition: net.c:610
TDS_PUT_N_AS_UCS2
#define TDS_PUT_N_AS_UCS2(tds, s)
Utility to convert a constant ascii string to ucs2 and send to server.
Definition: query.c:110
tds_pbcb::from_malloc
unsigned int from_malloc
true is buffer came from malloc
Definition: bulk.c:65
tds_get_size_by_type
int tds_get_size_by_type(TDS_SERVER_TYPE servertype)
Return the number of bytes needed by specified type.
Definition: tds_types.h:9
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:1077
string_to_uint8
static TDS_INT string_to_uint8(const char *buf, const char *pend, TDS_UINT8 *res)
convert a number in string to TDS_UINT8
Definition: convert.c:3407
tds_submit_execute
TDSRET tds_submit_execute(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Sends a previously prepared dynamic statement to the server.
Definition: query.c:1630
tds_free_input_params
void tds_free_input_params(TDSDYNAMIC *dyn)
Frees all allocated input parameters of a dynamic statement.
Definition: mem.c:206
tds_login::server_name
DSTR server_name
server name (in freetds.conf)
Definition: tds.h:520
tds_socket::in_len
unsigned in_len
input buffer length
Definition: tds.h:1198
tds_socket::out_pos
unsigned out_pos
current position in out_buf
Definition: tds.h:1197
tds7_write_param_def_from_params
static TDSRET tds7_write_param_def_from_params(TDSSOCKET *tds, const char *query, size_t query_len, TDSPARAMINFO *params) TDS_WUR
Write string with parameters definition, useful for TDS7+.
Definition: query.c:964
tds_column::column_size
TDS_INT column_size
maximun size of data.
Definition: tds.h:698
tds_ntlm_get_auth
TDSAUTHENTICATION * tds_ntlm_get_auth(TDSSOCKET *tds)
Build a NTLMSPP packet to send to server.
Definition: challenge.c:721
tds_dstr_alloc
DSTR * tds_dstr_alloc(DSTR *s, size_t length)
allocate space for length char
Definition: tdsstring.c:165
tds_submit_execdirect
TDSRET tds_submit_execdirect(TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head)
Submit a prepared query with parameters.
Definition: query.c:1256
tds_socket::ret_status
TDS_INT ret_status
return status from store procedure
Definition: tds.h:1254
parse_int8
static TDS_INT parse_int8(const char *buf, const char *pend, TDS_UINT8 *res, bool *p_negative)
convert a number in string to TDS_INT8
Definition: convert.c:3348
tds_copy_stream
TDSRET tds_copy_stream(TDSINSTREAM *istream, TDSOUTSTREAM *ostream)
Reads and writes from a stream to another.
Definition: stream.c:163
tds_put_tinyint
#define tds_put_tinyint(tds, ti)
Output a tinyint value.
Definition: tds.h:1473
tdsdaterec::timezone
TDS_INT timezone
-840 - 840 minutes from UTC
Definition: tds.h:170
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
tds5_bcp_add_variable_columns
static int tds5_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:594
tds_column::column_cur_size
TDS_INT column_cur_size
size written in variable (ie: char, text, binary).
Definition: tds.h:740
tds_dynamic::query
char * query
saved query, we need to know original query if prepare is impossible
Definition: tds.h:1013
tds_column::char_conv
TDSICONV * char_conv
refers to previously allocated iconv information
Definition: tds.h:716
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:705
tds_pbcb::cb
unsigned int cb
buffer length
Definition: bulk.c:63
tds_needs_unprepare
int tds_needs_unprepare(TDSCONNECTION *conn, TDSDYNAMIC *dyn)
Check if dynamic request must be unprepared.
Definition: query.c:1752
tds_submit_rollback
TDSRET tds_submit_rollback(TDSSOCKET *tds, int cont)
Send a rollback request.
Definition: query.c:3693
tds_file_stream
input stream to read a file
Definition: bulk.c:1003
tds_staticin_stream_init
void tds_staticin_stream_init(TDSSTATICINSTREAM *stream, const void *ptr, size_t len)
Initialize an input stream for read from a static allocated buffer.
Definition: stream.c:286
tdsdump_open
int tdsdump_open(const char *filename)
Create and truncate a human readable dump file for the TDS traffic.
Definition: log.c:131
tds_fix_column_size
size_t tds_fix_column_size(TDSSOCKET *tds, TDSCOLUMN *curcol)
Get column size for wire.
Definition: query.c:1491
TDS_IS_MSSQL
#define TDS_IS_MSSQL(x)
Check if product is Microsft SQL Server.
Definition: tds.h:1726
string_to_result
static TDS_INT string_to_result(int desttype, const char *s, CONV_RESULT *cr)
Copy a terminated string to result and return len or TDS_CONVERT_NOMEM.
Definition: convert.c:178
tds_get_char_data
TDSRET tds_get_char_data(TDSSOCKET *tds, char *row_buffer, size_t wire_size, TDSCOLUMN *curcol)
Fetch character data the wire.
Definition: read.c:195
tds_dstr_free
void tds_dstr_free(DSTR *s)
free string
Definition: tdsstring.c:62
tds_varmax_stream
Definition: data.c:490
tdsdaterec::year
TDS_INT year
year
Definition: tds.h:160
tds_bcp_init
TDSRET tds_bcp_init(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Initialize BCP information.
Definition: bulk.c:84
tds_dstr_copy
DSTR * tds_dstr_copy(DSTR *s, const char *src)
copy a string from another
Definition: tdsstring.c:122
tdsdump_off_item
Definition: tds.h:1505
tds_capabilities
Definition: tds.h:513
tds_put_string
int tds_put_string(TDSSOCKET *tds, const char *s, int len)
Output a string to wire automatic translate string to unicode if needed.
Definition: write.c:97
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_time::tm_year
int tm_year
year (0=1900)
Definition: convert.c:56
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_login::port
int port
port of database service
Definition: tds.h:521
tds_realloc
void * tds_realloc(void **pp, size_t new_size)
Reallocate a pointer and update it if success.
Definition: mem.c:1878
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:293
tds_save_context
Definition: login.c:187
tds_column::column_scale
TDS_TINYINT column_scale
scale for decimal/numeric
Definition: tds.h:708
tds_dynamic::res_info
TDSPARAMINFO * res_info
query results
Definition: tds.h:1003
tds_login::user_name
DSTR user_name
account for login
Definition: tds.h:536
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:598
TDS_DEAD
@ TDS_DEAD
no connection
Definition: tds.h:799
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:1047
tds_strndup
char * tds_strndup(const void *s, TDS_INTPTR len)
Copy a string of length len to a new allocated buffer This function does not read more than len bytes...
Definition: util.c:406
TDS_DATETIMEALL::offset
TDS_SMALLINT offset
time offset
Definition: tds.h:149
tds_release_dynamic
void tds_release_dynamic(TDSDYNAMIC **pdyn)
Frees dynamic statement.
Definition: mem.c:253
tds_env::database
char * database
database name
Definition: tds.h:974
tds_login::crlfile
DSTR crlfile
certificate revocation file
Definition: tds.h:533
TDS_DATETIMEALL::time
TDS_UINT8 time
time, 7 digit precision
Definition: tds.h:147
tds_error_message
Definition: util.c:237
tds_quote
static size_t tds_quote(TDSSOCKET *tds, char *buffer, char quoting, const char *id, size_t len)
Quote a string properly.
Definition: query.c:2128
names_blob_prefix_t
Definition: challenge.c:72
tds_writetext_end
TDSRET tds_writetext_end(TDSSOCKET *tds)
Finish sending writetext data.
Definition: bulk.c:1202
tds_dynamic::id
char id[30]
id of dynamic.
Definition: tds.h:991
tds_set_cur_cursor
static void tds_set_cur_cursor(TDSSOCKET *tds, TDSCURSOR *cursor)
Set current cursor.
Definition: query.c:2253
tds_authentication
Definition: tds.h:1051
TDS_DATETIMEALL
this structure is not directed connected to a TDS protocol but keeps any DATE/TIME information.
Definition: tds.h:146
tds_bcp_start
TDSRET tds_bcp_start(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Start sending BCP data to server.
Definition: bulk.c:866
tds_connection::pending_close
unsigned int pending_close
true is connection has pending closing (cursors or dynamic)
Definition: tds.h:1127
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
tds_time::tm_mday
int tm_mday
month day (1-31)
Definition: convert.c:58
tds_skip_quoted_ucs2le
static const char * tds_skip_quoted_ucs2le(const char *s, const char *end)
Return pointer to end of a quoted string.
Definition: query.c:618
tds_pbcb
Holds clause buffer.
Definition: bulk.c:59
TDSFILESTREAM
struct tds_file_stream TDSFILESTREAM
input stream to read a file
TDS_IDLE
@ TDS_IDLE
no data expected
Definition: tds.h:794
tds_bcpinfo
Definition: tds.h:1665
tds_headers
Definition: tds.h:576
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_time
Definition: convert.c:55
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 null_error, int offset)
Send one row of data to server.
Definition: bulk.c:468
tds_socket
Information for a server connection.
Definition: tds.h:1167
DSTR_INITIALIZER
#define DSTR_INITIALIZER
Initializer, used to initialize string like in the following example.
Definition: string.h:49
tds_count_placeholders
int tds_count_placeholders(const char *query)
Count the number of placeholders ('?') in a query.
Definition: query.c:571
tds_socket::in_flag
unsigned char in_flag
input buffer type
Definition: tds.h:1199
tds_login::server_spn
DSTR server_spn
server SPN (in freetds.conf)
Definition: tds.h:530
des_key
Definition: des.h:16
tdsdump_on
void tdsdump_on(TDSDUMP_OFF_ITEM *off_item)
Turn logging back on for current thread.
Definition: log.c:101
tdsdatetime4
Definition: proto.h:56
tds_setup_socket
static TDSERRNO tds_setup_socket(TDS_SYS_SOCKET *p_sock, struct addrinfo *addr, unsigned int port, int *p_oserr)
Setup the socket and attempt a connection.
Definition: net.c:249
tdsdaterec::minute
TDS_INT minute
0-59
Definition: tds.h:167
tds7_get_instance_port
int tds7_get_instance_port(struct addrinfo *addr, const char *instance)
Get port of given instance.
Definition: net.c:1227
tds_query_flush_packet
static TDSRET tds_query_flush_packet(TDSSOCKET *tds)
Flush query packet.
Definition: query.c:178
TDS_SYB_VER
#define TDS_SYB_VER(maj, min, x)
Calc a version number for Sybase.
Definition: tds.h:1735
tds_submit_rpc
TDSRET tds_submit_rpc(TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params, TDSHEADERS *head)
Calls a RPC from server.
Definition: query.c:1929
tds_socket::out_buf_max
unsigned int out_buf_max
Maximum size of packet pointed by out_buf.
Definition: tds.h:1195
tds_quoteout_stream
Definition: query.c:3098
TDS_DONE_ERROR
@ TDS_DONE_ERROR
error occurred
Definition: tds.h:253
tds_flush_packet
TDSRET tds_flush_packet(TDSSOCKET *tds)
Flush packet to server.
Definition: write.c:224
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_output_stream
define a stream of data used for output
Definition: stream.h:39
tds_freeze_close
TDSRET tds_freeze_close(TDSFREEZE *freeze)
Stop keeping data for this specific freeze.
Definition: packet.c:996
tds_process_tokens
TDSRET tds_process_tokens(TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsigned flag)
process all streams.
Definition: token.c:531
tds_dynamic::num_id
TDS_INT num_id
numeric id for mssql7+
Definition: tds.h:985
tds_login::server_charset
DSTR server_charset
charset of server e.g.
Definition: tds.h:525
tds_poll_wakeup
Definition: tds.h:1089
tds_option_arg
Definition: tds.h:330
tds_submit_commit
TDSRET tds_submit_commit(TDSSOCKET *tds, int cont)
Send a commit request.
Definition: query.c:3724
tds_freeze
void tds_freeze(TDSSOCKET *tds, TDSFREEZE *freeze, unsigned size_len)
Stop writing to server and cache every packet not sending them to server.
Definition: packet.c:907
tds_answer
Definition: challenge.c:65
TDS_PENDING
@ TDS_PENDING
cilent is waiting for data
Definition: tds.h:797
tds_env::block_size
int block_size
packet size (512-65535)
Definition: tds.h:969
tds_column::column_type
TDS_SERVER_TYPE column_type
This type can be different from wire type because conversion (e.g.
Definition: tds.h:700
tds_write_dump
int tds_write_dump
Tell if TDS debug logging is turned on or off.
Definition: log.c:58
store_monthname
static int store_monthname(const char *, struct tds_time *)
Test if a string is a month name and store correct month number.
Definition: convert.c:2729
tds_context
Definition: tds.h:1033
tds_get_uint
TDS_UINT tds_get_uint(TDSSOCKET *tds)
Get an int32 from the server.
Definition: read.c:127
tds_get_usmallint
TDS_USMALLINT tds_get_usmallint(TDSSOCKET *tds)
Get an int16 from the server.
Definition: read.c:113
tds_deferred_unprepare
TDSRET tds_deferred_unprepare(TDSCONNECTION *conn, TDSDYNAMIC *dyn)
Unprepare dynamic on idle.
Definition: query.c:1774
tds_alloc_compute_result
static TDSCOMPUTEINFO * tds_alloc_compute_result(TDS_USMALLINT num_cols, TDS_USMALLINT by_cols)
Allocate memory for storing compute info return NULL on out of memory.
Definition: mem.c:395
tds_dynamic_stream::size
size_t size
size of data inside buffer
Definition: stream.h:106
tdsnumeric
Definition: proto.h:26
tds_freeze
Definition: tds.h:1575
tds_file_stream::term_len
size_t term_len
terminator length in bytes
Definition: bulk.c:1012
tds_login
Definition: tds.h:519
tds_bcp_start_copy_in
TDSRET tds_bcp_start_copy_in(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Start bulk copy to server.
Definition: bulk.c:916
tds_skip_comment_ucs2le
static const char * tds_skip_comment_ucs2le(const char *s, const char *end)
Skip a comment in a query.
Definition: query.c:589
tds_login::cafile
DSTR cafile
certificate authorities file
Definition: tds.h:532
tdsdump_close
void tdsdump_close(void)
Close the TDS dump log file.
Definition: log.c:212
string_to_int
static TDS_INT string_to_int(const char *buf, const char *pend, TDS_INT *res)
convert a number in string to TDS_INT
Definition: convert.c:3309
tds_submit_prepare
TDSRET tds_submit_prepare(TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params)
Creates a temporary stored procedure in the server.
Definition: query.c:1124
tds_generic_put_info
TDSRET tds_generic_put_info(TDSSOCKET *tds, TDSCOLUMN *col)
Put data information to wire.
Definition: data.c:875
tds_detach_results
void tds_detach_results(TDSRESULTINFO *info)
Detach result info from it current socket.
Definition: mem.c:488
tds_numeric_to_string
TDS_INT tds_numeric_to_string(const TDS_NUMERIC *numeric, char *s)
Definition: numeric.c:95
tds_willconvert
unsigned char tds_willconvert(int srctype, int desttype)
Test if a conversion is possible.
Definition: convert.c:3116
tds_dstr_buf
static char * tds_dstr_buf(DSTR *s)
Returns a buffer to edit the string.
Definition: string.h:71
tds_free_param_result
void tds_free_param_result(TDSPARAMINFO *param_info)
Delete latest parameter.
Definition: mem.c:320
tds_quote_and_put
static void tds_quote_and_put(TDSSOCKET *tds, const char *s, const char *end)
Send a string to server while quoting it.
Definition: query.c:3079
tds_dstr_zero
void tds_dstr_zero(DSTR *s)
clear all string filling with zeroes (mainly for security reason)
Definition: tdsstring.c:55
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:396
tdsdump_col
void tdsdump_col(const TDSCOLUMN *col)
Write a column value to the debug log.
Definition: log.c:455
tds_ascii_to_ucs2
static size_t tds_ascii_to_ucs2(char *buffer, const char *buf)
Accept an ASCII string, convert it to UCS2-LE The input is NUL-terminated, but the output does not co...
Definition: query.c:91
tds_time::tm_hour
int tm_hour
hours (0-23)
Definition: convert.c:59