1 #define LIMIT_INDEXES_ADJUST 4
3 static const signed char limit_indexes[79]= {
85 static const TDS_WORD limits[]= {
DSTR new_password
new password to set (TDS 7.2+)
Definition: tds.h:531
DSTR user_name
account for login
Definition: tds.h:529
struct addrinfo * ip_addrs
ip(s) of server
Definition: tds.h:541
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:504
int tds_write_dump
Tell if TDS debug logging is turned on or off.
Definition: log.c:58
int tds_iconv_alloc(TDSCONNECTION *conn)
Allocate iconv stuff.
Definition: iconv.c:266
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
TDS_INT ret_status
return status from store procedure
Definition: tds.h:1203
void tds_detach_results(TDSRESULTINFO *info)
Detach result info from it current socket.
Definition: mem.c:488
DSTR server_charset
charset of server e.g.
Definition: tds.h:518
void tds_free_param_result(TDSPARAMINFO *param_info)
Delete latest parameter.
Definition: mem.c:320
int tds_goodread(TDSSOCKET *tds, unsigned char *buf, int buflen)
Loops until we have received some characters return -1 on failure.
Definition: net.c:916
TDS_INT column_size
maximun size of data.
Definition: tds.h:696
void tdsdump_col(const TDSCOLUMN *col)
Write a column value to the debug log.
Definition: log.c:408
TDS_INT cursor_id
cursor id returned by the server after cursor declare
Definition: tds.h:942
TDS_SYS_SOCKET s
tcp socket, INVALID_SOCKET if not connected
Definition: tds.h:1075
void tdsdump_log(const char *file, unsigned int level_line, const char *fmt,...)
Write a message to the debug log.
Definition: log.c:354
DSTR db_filename
database filename to attach (MSSQL)
Definition: tds.h:524
DSTR crlfile
certificate revocation file
Definition: tds.h:526
TDSPARAMINFO * tds_alloc_param_result(TDSPARAMINFO *old_param)
Adds a output parameter to TDSPARAMINFO.
Definition: mem.c:284
TDSRET tds_alloc_row(TDSRESULTINFO *res_info)
Allocate space for row store return NULL on out of memory.
Definition: mem.c:524
TDSCURSOR * cur_cursor
cursor in use
Definition: tds.h:1199
static void tds_dstr_init(DSTR *s)
init a string with empty
Definition: string.h:53
void tdsdump_off(void)
Temporarily turn off logging.
Definition: log.c:76
int tds7_get_instance_port(struct addrinfo *addr, const char *instance)
Get port of given instance.
Definition: net.c:1229
static int tds_get_socket_error(TDS_SYS_SOCKET sock)
Returns error stored in the socket.
Definition: net.c:217
unsigned int bulk_copy
if bulk copy should be enabled
Definition: tds.h:551
TDSRET tds_flush_packet(TDSSOCKET *tds)
Flush packet to server.
Definition: write.c:285
Holds information for a dynamic (also called prepared) query.
Definition: tds.h:977
unsigned int out_buf_max
Maximum size of packet pointed by out_buf.
Definition: tds.h:1167
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:1206
TDSDYNAMIC * tds_alloc_dynamic(TDSCONNECTION *conn, const char *id)
Allocate a dynamic statement.
Definition: mem.c:160
TDS_STATE tds_set_state(TDSSOCKET *tds, TDS_STATE state)
Set state of TDS connection, with logging and checking.
Definition: util.c:58
void tds_dstr_free(DSTR *s)
free string
Definition: tdsstring.c:62
static int tds_dstr_isempty(const DSTR *s)
test if string is empty
Definition: string.h:60
#define TDS_IS_MSSQL(x)
Check if product is Microsft SQL Server.
Definition: tds.h:1623
DSTR cafile
certificate authorities file
Definition: tds.h:525
Metadata about columns in regular and compute rows.
Definition: tds.h:690
static int tds_socket_write(TDSCONNECTION *conn, TDSSOCKET *tds, const unsigned char *buf, int buflen)
Write to an OS socket.
Definition: net.c:762
DSTR server_spn
server SPN (in freetds.conf)
Definition: tds.h:523
TDSLOGIN * tds_init_login(TDSLOGIN *login, TDSLOCALE *locale)
Initialize login structure with locale information and other stuff for connection.
Definition: mem.c:800
TDSPACKET * send_packet
packet we are preparing to send
Definition: tds.h:1187
char * query
SQL query.
Definition: tds.h:948
int tds_socket_set_nosigpipe(TDS_SYS_SOCKET sock, int on)
Set socket to not throw SIGPIPE.
Definition: net.c:72
unsigned out_pos
current position in out_buf
Definition: tds.h:1169
int tds_goodwrite(TDSSOCKET *tds, const unsigned char *buffer, size_t buflen)
Definition: net.c:987
TDSENV env
environment is shared between all sessions
Definition: tds.h:1080
@ TDS_DEAD
no connection
Definition: tds.h:796
DSTR server_name
server name (in freetds.conf)
Definition: tds.h:513
bool in_row
true if we are getting rows
Definition: tds.h:1202
int block_size
packet size (512-65535)
Definition: tds.h:966
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:248
static const char * tds_dstr_cstr(const DSTR *s)
Returns a C version (NUL terminated string) of dstr.
Definition: string.h:78
TDS_USMALLINT tds_version
TDS version.
Definition: tds.h:515
TDSCURSOR * cursors
linked list of cursors allocated for this connection contains only cursors allocated on the server
Definition: tds.h:1086
void tdsdump_close(void)
Close the TDS dump log file.
Definition: log.c:193
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:727
Hold information for any results.
Definition: tds.h:769
DSTR * tds_dstr_copy(DSTR *s, const char *src)
copy a string from another
Definition: tdsstring.c:122
TDSDYNAMIC * cur_dyn
dynamic structure in use
Definition: tds.h:1212
TDS_INT ref_count
reference counter so client can retain safely a pointer
Definition: tds.h:940
int tds7_get_instance_ports(FILE *output, struct addrinfo *addr)
Get port of all instances.
Definition: net.c:1093
TDSDYNAMIC * tds_lookup_dynamic(TDSCONNECTION *conn, const char *id)
Finds a dynamic given string id.
Definition: token.c:2583
void tdsdump_on(void)
Turn logging back on.
Definition: log.c:88
unsigned char * out_buf
Output buffer.
Definition: tds.h:1161
TDS_SERVER_TYPE column_type
This type can be different from wire type because conversion (e.g.
Definition: tds.h:698
@ TDS_IDLE
no data expected
Definition: tds.h:791
struct tds_dynamic * next
next in linked list, keep first
Definition: tds.h:979
TDSPARAMINFO * res_info
query results
Definition: tds.h:1000
void tds_release_dynamic(TDSDYNAMIC **pdyn)
Frees dynamic statement.
Definition: mem.c:253
const char * tds_canonical_charset_name(const char *charset_name)
Determine canonical iconv character set name.
Definition: iconv.c:958
bool has_status
true is ret_status is valid
Definition: tds.h:1201
char * cursor_name
name of the cursor
Definition: tds.h:941
Provide poll call where missing.
Information about blobs (e.g.
Definition: tds.h:587
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
TDSRESULTINFO * current_results
Current query information.
Definition: tds.h:1194
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
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:612
unsigned char * in_buf
Input buffer.
Definition: tds.h:1154
int port
port of database service
Definition: tds.h:514
void * tds_realloc(void **pp, size_t new_size)
Reallocate a pointer and update it if success.
Definition: mem.c:1821
void tds_dstr_zero(DSTR *s)
clear all string filling with zeroes (mainly for security reason)
Definition: tdsstring.c:55
unsigned char out_flag
output buffer type
Definition: tds.h:1172
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:307
int tds_socket_set_nonblocking(TDS_SYS_SOCKET sock)
Set socket to non-blocking.
Definition: net.c:168
DSTR password
password of account login
Definition: tds.h:530
Information for a server connection.
Definition: tds.h:1141
TDSLOCALE * tds_get_locale(void)
Get locale information.
Definition: locale.c:50
char * charset
character set encoding
Definition: tds.h:969
TDSPARAMINFO * params
query parameters.
Definition: tds.h:1008
TDS_INT num_id
numeric id for mssql7+
Definition: tds.h:982
void tds_close_socket(TDSSOCKET *tds)
Close current socket.
Definition: net.c:548
TDS_INT type
row fetched from this cursor
Definition: tds.h:957
TDSLOGIN * login
config for login stuff.
Definition: tds.h:1214
char id[30]
id of dynamic.
Definition: tds.h:988
const char * tds_prtype(int type)
Returns string representation of the given type.
Definition: token.c:3052
char * query
saved query, we need to know original query if prepare is impossible
Definition: tds.h:1010
int tdsdump_open(const char *filename)
Create and truncate a human readable dump file for the TDS traffic.
Definition: log.c:112
DSTR server_realm_name
server realm name (in freetds.conf)
Definition: tds.h:522
TDS_INT ref_count
reference counter so client can retain safely a pointer
Definition: tds.h:980
void * tds_alloc_param_data(TDSCOLUMN *curparam)
Allocate data for a parameter.
Definition: mem.c:364
static char * tds_get_dynid(TDSCONNECTION *conn, char *id)
Get an id for dynamic query based on TDS information.
Definition: mem.c:94
TDSDYNAMIC * dyns
list of dynamic allocated for this connection contains only dynamic allocated on the server
Definition: tds.h:1091
struct tds_cursor * next
next in linked list, keep first
Definition: tds.h:939
void tds_free_input_params(TDSDYNAMIC *dyn)
Frees all allocated input parameters of a dynamic statement.
Definition: mem.c:206
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
Holds informations about a cursor.
Definition: tds.h:937
TDS_INT column_cur_size
size written in variable (ie: char, text, binary).
Definition: tds.h:737
char * database
database name
Definition: tds.h:971