NCBI C++ ToolKit
Classes | Macros | Typedefs | Enumerations | Functions | Variables
tds.h File Reference

Main include file for libtds. More...

#include <stdarg.h>
#include <stdio.h>
#include <time.h>
#include <freetds/version.h>
#include <freetds/sysdep_private.h>
#include <freetds/sysdep_types.h>
#include <freetds/thread.h>
#include <freetds/bool.h>
#include <freetds/macros.h>
#include <freetds/utils/string.h>
#include <freetds/replacements.h>
#include <freetds/pushvis.h>
#include <freetds/proto.h>
#include <freetds/popvis.h>
+ Include dependency graph for tds.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

struct  tds_compiletime_settings
 A structure to hold all the compile-time settings. More...
 
struct  TDS_DATETIMEALL
 this structure is not directed connected to a TDS protocol but keeps any DATE/TIME information. More...
 
struct  tdsdaterec
 Used by tds_datecrack. More...
 
union  tds_option_arg
 
union  tds_align_struct
 
struct  tds_capability_type
 
struct  tds_capabilities
 
struct  tds_login
 
struct  tds_headers
 
struct  tds_locale
 
struct  tds_blob
 Information about blobs (e.g. More...
 
struct  tds_variant
 Store variant informations. More...
 
struct  tds_encoding
 Information relevant to libiconv. More...
 
struct  tds_bcpcoldata
 
struct  tds_column_funcs
 
struct  tds_column
 Metadata about columns in regular and compute rows. More...
 
struct  tds_result_info
 Hold information for any results. More...
 
struct  tds_message
 
struct  tds_upd_col
 
struct  tds_cursor_status
 
struct  tds_cursor
 Holds informations about a cursor. More...
 
struct  tds_env
 Current environment as reported by the server. More...
 
struct  tds_dynamic
 Holds information for a dynamic (also called prepared) query. More...
 
struct  tds_multiple
 
struct  tds_context
 
struct  tds_authentication
 
struct  tds_packet
 
struct  tds_poll_wakeup
 
struct  tds_connection
 
struct  tds_socket
 Information for a server connection. More...
 
struct  tds_tvp_row
 
struct  tds_tvp
 
struct  tdsdump_off_item
 
struct  tds_freeze
 
struct  tds5_colinfo
 
struct  tds_bcpinfo
 

Macros

#define TDS_INVALID_TYPE   ((TDS_SERVER_TYPE) 0)
 
#define TDS_NO_MORE_RESULTS   ((TDSRET)1)
 
#define TDS_SUCCESS   ((TDSRET)0)
 
#define TDS_FAIL   ((TDSRET)-1)
 
#define TDS_CANCELLED   ((TDSRET)-2)
 
#define TDS_FAILED(rc)   ((rc)<0)
 
#define TDS_SUCCEED(rc)   ((rc)>=0)
 
#define TDS_PROPAGATE(rc)    do { TDSRET _tds_ret = (rc); if (TDS_FAILED(_tds_ret)) return _tds_ret; } while(0)
 
#define TDS_INT_CONTINUE   1
 
#define TDS_INT_CANCEL   2
 
#define TDS_INT_TIMEOUT   3
 
#define TDS_NO_COUNT   -1
 
#define TDS_ROW_RESULT   4040
 
#define TDS_PARAM_RESULT   4042
 
#define TDS_STATUS_RESULT   4043
 
#define TDS_MSG_RESULT   4044
 
#define TDS_COMPUTE_RESULT   4045
 
#define TDS_CMD_DONE   4046
 
#define TDS_CMD_SUCCEED   4047
 
#define TDS_CMD_FAIL   4048
 
#define TDS_ROWFMT_RESULT   4049
 
#define TDS_COMPUTEFMT_RESULT   4050
 
#define TDS_DESCRIBE_RESULT   4051
 
#define TDS_DONE_RESULT   4052
 
#define TDS_DONEPROC_RESULT   4053
 
#define TDS_DONEINPROC_RESULT   4054
 
#define TDS_OTHERS_RESULT   4055
 
#define TDS_TOKEN_FLAG(flag)   TDS_RETURN_##flag = (1 << (TDS_TOKEN_RES_##flag*2)), TDS_STOPAT_##flag = (2 << (TDS_TOKEN_RES_##flag*2))
 
#define TDS_NULLTERM   -9
 
#define TDS_BYTE_SWAP16(value)
 
#define TDS_BYTE_SWAP32(value)
 
#define is_end_token(x)   ((x) >= TDS_DONE_TOKEN && (x) <= TDS_DONEINPROC_TOKEN)
 
#define is_fixed_type(x)   ((tds_type_flags_ms[x] & TDS_TYPEFLAG_FIXED) != 0)
 
#define is_nullable_type(x)   ((tds_type_flags_ms[x] & TDS_TYPEFLAG_NULLABLE) != 0)
 
#define is_variable_type(x)   ((tds_type_flags_ms[x] & TDS_TYPEFLAG_VARIABLE) != 0)
 
#define is_variant_inner_type(x)   ((tds_type_flags_ms[x] & TDS_TYPEFLAG_VARIANT) != 0)
 
#define is_blob_type(x)   ((x)==SYBTEXT || (x)==SYBIMAGE || (x)==SYBNTEXT)
 
#define is_blob_col(x)
 
#define is_numeric_type(x)   ((x)==SYBNUMERIC || (x)==SYBDECIMAL)
 
#define is_datetime_type(x)   ((tds_type_flags_ms[x] & TDS_TYPEFLAG_DATETIME) != 0)
 return true if type is a datetime (but not date or time) More...
 
#define is_unicode_type(x)   ((tds_type_flags_ms[x] & TDS_TYPEFLAG_UNICODE) != 0)
 
#define is_collate_type(x)   ((tds_type_flags_ms[x] & TDS_TYPEFLAG_COLLATE) != 0)
 
#define is_ascii_type(x)   ((tds_type_flags_ms[x] & TDS_TYPEFLAG_ASCII) != 0)
 
#define is_binary_type(x)   ((tds_type_flags_ms[x] & TDS_TYPEFLAG_BINARY) != 0)
 
#define is_char_type(x)   ((tds_type_flags_ms[x] & (TDS_TYPEFLAG_ASCII|TDS_TYPEFLAG_UNICODE)) != 0)
 
#define is_similar_type(x, y)   (is_char_type(x) && is_char_type(y))
 
#define TDS_MAX_CAPABILITY   32
 
#define MAXPRECISION   77
 
#define TDS_MAX_CONN   4096
 
#define TDS_MAX_DYNID_LEN   30
 
#define TDS_DEF_SERVER   "SYBASE"
 
#define TDS_DEF_BLKSZ   512
 
#define TDS_DEF_CHARSET   "iso_1"
 
#define TDS_DEF_LANG   "us_english"
 
#define TDS_DEFAULT_VERSION   0x000
 
#define TDS_DEF_PORT   1433
 
#define TDS_STR_VERSION   "tds version"
 
#define TDS_STR_BLKSZ   "initial block size"
 
#define TDS_STR_SWAPDT   "swap broken dates"
 
#define TDS_STR_DUMPFILE   "dump file"
 
#define TDS_STR_DEBUGLVL   "debug level"
 
#define TDS_STR_DEBUGFLAGS   "debug flags"
 
#define TDS_STR_TIMEOUT   "timeout"
 
#define TDS_STR_QUERY_TIMEOUT   "query timeout"
 
#define TDS_STR_CONNTIMEOUT   "connect timeout"
 
#define TDS_STR_HOSTNAME   "hostname"
 
#define TDS_STR_HOST   "host"
 
#define TDS_STR_PORT   "port"
 
#define TDS_STR_TEXTSZ   "text size"
 
#define TDS_STR_EMUL_LE   "emulate little endian"
 
#define TDS_STR_CHARSET   "charset"
 
#define TDS_STR_CLCHARSET   "client charset"
 
#define TDS_STR_USE_UTF_16   "use utf-16"
 
#define TDS_STR_LANGUAGE   "language"
 
#define TDS_STR_APPENDMODE   "dump file append"
 
#define TDS_STR_DATETIMEFMT   "date format"
 
#define TDS_STR_DATEFMT   "date-only format"
 
#define TDS_STR_TIMEFMT   "time-only format"
 
#define TDS_STR_INSTANCE   "instance"
 
#define TDS_STR_ASA_DATABASE   "asa database"
 
#define TDS_STR_DATABASE   "database"
 
#define TDS_STR_ENCRYPTION   "encryption"
 
#define TDS_STR_USENTLMV2   "use ntlmv2"
 
#define TDS_STR_USELANMAN   "use lanman"
 
#define TDS_STR_ENCRYPTION_OFF   "off"
 
#define TDS_STR_ENCRYPTION_REQUEST   "request"
 
#define TDS_STR_ENCRYPTION_REQUIRE   "require"
 
#define TDS_GSSAPI_DELEGATION   "enable gssapi delegation"
 
#define TDS_STR_MUTUAL_AUTHENTICATION   "mutual authentication"
 
#define TDS_STR_REALM   "realm"
 
#define TDS_STR_SPN   "spn"
 
#define TDS_STR_CAFILE   "ca file"
 
#define TDS_STR_CRLFILE   "crl file"
 
#define TDS_STR_CHECKSSLHOSTNAME   "check certificate hostname"
 
#define TDS_STR_DBFILENAME   "database filename"
 
#define TDS_STR_READONLY_INTENT   "read-only intent"
 
#define TLS_STR_OPENSSL_CIPHERS   "openssl ciphers"
 
#define TDS_STR_ENABLE_TLS_V1   "enable tls v1"
 
#define TDS_ALIGN_SIZE   sizeof(tds_align_struct)
 
#define TDS_MAX_LOGIN_STR_SZ   128
 
#define TDS_DBG_LOGIN   __FILE__, ((__LINE__ << 4) | 11)
 
#define TDS_DBG_HEADER   __FILE__, ((__LINE__ << 4) | 10)
 
#define TDS_DBG_FUNC   __FILE__, ((__LINE__ << 4) | 7)
 
#define TDS_DBG_INFO2   __FILE__, ((__LINE__ << 4) | 6)
 
#define TDS_DBG_INFO1   __FILE__, ((__LINE__ << 4) | 5)
 
#define TDS_DBG_NETWORK   __FILE__, ((__LINE__ << 4) | 4)
 
#define TDS_DBG_WARN   __FILE__, ((__LINE__ << 4) | 3)
 
#define TDS_DBG_ERROR   __FILE__, ((__LINE__ << 4) | 2)
 
#define TDS_DBG_SEVERE   __FILE__, ((__LINE__ << 4) | 1)
 
#define TDS_DBGFLAG_FUNC   0x80
 
#define TDS_DBGFLAG_INFO2   0x40
 
#define TDS_DBGFLAG_INFO1   0x20
 
#define TDS_DBGFLAG_NETWORK   0x10
 
#define TDS_DBGFLAG_WARN   0x08
 
#define TDS_DBGFLAG_ERROR   0x04
 
#define TDS_DBGFLAG_SEVERE   0x02
 
#define TDS_DBGFLAG_ALL   0xfff
 
#define TDS_DBGFLAG_LOGIN   0x0800
 
#define TDS_DBGFLAG_HEADER   0x0400
 
#define TDS_DBGFLAG_PID   0x1000
 
#define TDS_DBGFLAG_TIME   0x2000
 
#define TDS_DBGFLAG_SOURCE   0x4000
 
#define TDS_DBGFLAG_THREAD   0x8000
 
#define tds_packet_zero_data_start(pkt)   do { } while(0)
 
#define tds_packet_get_data_start(pkt)   0
 
#define tds_get_ctx(tds)   ((tds)->conn->tds_ctx)
 
#define tds_set_ctx(tds, val)   do { ((tds)->conn->tds_ctx) = (val); } while(0)
 
#define tds_get_parent(tds)   ((tds)->parent)
 
#define tds_set_parent(tds, val)   do { ((tds)->parent) = (val); } while(0)
 
#define tds_get_s(tds)   ((tds)->conn->s)
 
#define tds_set_s(tds, val)   do { ((tds)->conn->s) = (val); } while(0)
 
#define TDS_RESIZE(p, n_elem)    tds_realloc((void **) &(p), sizeof(*(p)) * (size_t) (n_elem))
 
#define tds_new(type, n)   ((type *) malloc(sizeof(type) * (n)))
 
#define tds_new0(type, n)   ((type *) calloc(n, sizeof(type)))
 
#define tds_convert_string_free(original, converted)    do { if (original != converted) free((char*) converted); } while(0)
 
#define tds_put_tinyint(tds, ti)   tds_put_byte(tds,ti)
 Output a tinyint value. More...
 
#define tds_get_smallint(tds)   ((TDS_SMALLINT) tds_get_usmallint(tds))
 
#define tds_get_int(tds)   ((TDS_INT) tds_get_uint(tds))
 
#define tds_get_int8(tds)   ((TDS_INT8) tds_get_uint8(tds))
 
#define TDSDUMP_LOG_FAST   if (TDS_UNLIKELY(tds_write_dump)) tdsdump_do_log
 
#define tdsdump_log   TDSDUMP_LOG_FAST
 
#define TDSDUMP_BUF_FAST   if (TDS_UNLIKELY(tds_write_dump)) tdsdump_do_dump_buf
 
#define tdsdump_dump_buf   TDSDUMP_BUF_FAST
 
#define TDSSELREAD   POLLIN
 
#define TDSSELWRITE   POLLOUT
 
#define TDS_START_LEN_GENERIC(tds_socket, len)
 
#define TDS_END_LEN   while(0); } while(tds_freeze_close(current_freeze), 0); } while(0);
 
#define TDS_START_LEN_TINYINT(tds_socket)   TDS_START_LEN_GENERIC(tds_socket, 1)
 
#define TDS_START_LEN_USMALLINT(tds_socket)   TDS_START_LEN_GENERIC(tds_socket, 2)
 
#define TDS_START_LEN_UINT(tds_socket)   TDS_START_LEN_GENERIC(tds_socket, 4)
 
#define tds_capability_has_req(conn, cap)    tds_capability_enabled(&conn->capabilities.types[0], cap)
 
#define tds_capability_has_res(conn, cap)    tds_capability_enabled(&conn->capabilities.types[1], cap)
 
#define IS_TDS42(x)   (x->tds_version==0x402)
 
#define IS_TDS46(x)   (x->tds_version==0x406)
 
#define IS_TDS50(x)   (x->tds_version==0x500)
 
#define IS_TDS70(x)   (x->tds_version==0x700)
 
#define IS_TDS71(x)   (x->tds_version==0x701)
 
#define IS_TDS72(x)   (x->tds_version==0x702)
 
#define IS_TDS73(x)   (x->tds_version==0x703)
 
#define IS_TDS50_PLUS(x)   ((x)->tds_version>=0x500)
 
#define IS_TDS7_PLUS(x)   ((x)->tds_version>=0x700)
 
#define IS_TDS71_PLUS(x)   ((x)->tds_version>=0x701)
 
#define IS_TDS72_PLUS(x)   ((x)->tds_version>=0x702)
 
#define IS_TDS73_PLUS(x)   ((x)->tds_version>=0x703)
 
#define IS_TDS74_PLUS(x)   ((x)->tds_version>=0x704)
 
#define TDS_MAJOR(x)   ((x)->tds_version >> 8)
 
#define TDS_MINOR(x)   ((x)->tds_version & 0xff)
 
#define IS_TDSDEAD(x)   (((x) == NULL) || (x)->state == TDS_DEAD)
 
#define TDS_IS_SYBASE(x)   (!((x)->conn->product_version & 0x80000000u))
 Check if product is Sybase (such as Adaptive Server Enterrprice). More...
 
#define TDS_IS_MSSQL(x)   (((x)->conn->product_version & 0x80000000u)!=0)
 Check if product is Microsft SQL Server. More...
 
#define TDS_MS_VER(maj, min, x)   (0x80000000u|((maj)<<24)|((min)<<16)|(x))
 Calc a version number for mssql. More...
 
#define TDS_SYB_VER(maj, min, x)   (((maj)<<24)|((min)<<16)|(x)<<8)
 Calc a version number for Sybase. More...
 
#define TDS_PUT_INT(tds, v)   tds_put_int((tds), ((TDS_INT)(v)))
 
#define TDS_PUT_SMALLINT(tds, v)   tds_put_smallint((tds), ((TDS_SMALLINT)(v)))
 
#define TDS_PUT_BYTE(tds, v)   tds_put_byte((tds), ((unsigned char)(v)))
 

Typedefs

typedef struct tdsiconvinfo TDSICONV
 
typedef struct tds_connection TDSCONNECTION
 
typedef struct tds_socket TDSSOCKET
 
typedef struct tds_column TDSCOLUMN
 
typedef struct tds_bcpinfo TDSBCPINFO
 
typedef struct tds_compiletime_settings TDS_COMPILETIME_SETTINGS
 A structure to hold all the compile-time settings. More...
 
typedef char TDS_CHAR
 
typedef uint8_t TDS_UCHAR
 
typedef uint8_t TDS_TINYINT
 
typedef int16_t TDS_SMALLINT
 
typedef uint16_t TDS_USMALLINT
 
typedef int32_t TDS_INT
 
typedef uint32_t TDS_UINT
 
typedef int64_t TDS_INT8
 
typedef uint64_t TDS_UINT8
 
typedef tds_sysdep_real32_type TDS_REAL
 
typedef tds_sysdep_real64_type TDS_FLOAT
 
typedef struct tdsdaterec TDSDATEREC
 Used by tds_datecrack. More...
 
typedef int TDSRET
 
typedef union tds_option_arg TDS_OPTION_ARG
 
typedef enum tds_encryption_level TDS_ENCRYPTION_LEVEL
 
typedef struct tds_capability_type TDS_CAPABILITY_TYPE
 
typedef struct tds_capabilities TDS_CAPABILITIES
 
typedef struct tds_login TDSLOGIN
 
typedef struct tds_headers TDSHEADERS
 
typedef struct tds_locale TDSLOCALE
 
typedef struct tds_blob TDSBLOB
 Information about blobs (e.g. More...
 
typedef struct tds_variant TDSVARIANT
 Store variant informations. More...
 
typedef struct tds_encoding TDS_ENCODING
 Information relevant to libiconv. More...
 
typedef struct tds_bcpcoldata BCPCOLDATA
 
typedef TDSRET tds_func_get_info(TDSSOCKET *tds, TDSCOLUMN *col)
 
typedef TDSRET tds_func_get_data(TDSSOCKET *tds, TDSCOLUMN *col)
 
typedef TDS_INT tds_func_row_len(TDSCOLUMN *col)
 
typedef TDSRET tds_func_put_info(TDSSOCKET *tds, TDSCOLUMN *col)
 
typedef TDSRET tds_func_put_data(TDSSOCKET *tds, TDSCOLUMN *col, int bcp7)
 
typedef int tds_func_check(const TDSCOLUMN *col)
 
typedef struct tds_column_funcs TDSCOLUMNFUNCS
 
typedef struct tds_result_info TDSRESULTINFO
 Hold information for any results. More...
 
typedef enum tds_states TDS_STATE
 values for tds->state More...
 
typedef enum tds_operations TDS_OPERATION
 
typedef struct tds_result_info TDSCOMPUTEINFO
 
typedef TDSRESULTINFO TDSPARAMINFO
 
typedef struct tds_message TDSMESSAGE
 
typedef struct tds_upd_col TDSUPDCOL
 
typedef struct tds_cursor_status TDS_CURSOR_STATUS
 
typedef enum tds_cursor_operation TDS_CURSOR_OPERATION
 
typedef enum tds_cursor_fetch TDS_CURSOR_FETCH
 
typedef struct tds_cursor TDSCURSOR
 Holds informations about a cursor. More...
 
typedef struct tds_env TDSENV
 Current environment as reported by the server. More...
 
typedef struct tds_dynamic TDSDYNAMIC
 Holds information for a dynamic (also called prepared) query. More...
 
typedef struct tds_multiple TDSMULTIPLE
 
typedef struct tds_context TDSCONTEXT
 
typedef int(* err_handler_t) (const TDSCONTEXT *, TDSSOCKET *, TDSMESSAGE *)
 
typedef struct tds_authentication TDSAUTHENTICATION
 
typedef struct tds_packet TDSPACKET
 
typedef struct tds_poll_wakeup TDSPOLLWAKEUP
 
typedef struct tds_tvp_row TDS_TVP_ROW
 
typedef struct tds_tvp TDS_TVP
 
typedef void(* TDSCONFPARSE) (const char *option, const char *value, void *param)
 
typedef struct tdsdump_off_item TDSDUMP_OFF_ITEM
 
typedef struct tds_freeze TDSFREEZE
 
typedef struct tds5_colinfo TDS5COLINFO
 
typedef TDSRET(* tds_bcp_get_col_data) (TDSBCPINFO *bulk, TDSCOLUMN *bcpcol, int offset)
 
typedef void(* tds_bcp_null_error) (TDSBCPINFO *bulk, int index, int offset)
 

Enumerations

enum  tds_token_results {
  TDS_TOKEN_RES_OTHERS , TDS_TOKEN_RES_ROWFMT , TDS_TOKEN_RES_COMPUTEFMT , TDS_TOKEN_RES_PARAMFMT ,
  TDS_TOKEN_RES_DONE , TDS_TOKEN_RES_ROW , TDS_TOKEN_RES_COMPUTE , TDS_TOKEN_RES_PROC ,
  TDS_TOKEN_RES_MSG , TDS_TOKEN_RES_ENV , TDS_TOKEN_RES_OTHERS , TDS_TOKEN_RES_ROWFMT ,
  TDS_TOKEN_RES_COMPUTEFMT , TDS_TOKEN_RES_PARAMFMT , TDS_TOKEN_RES_DONE , TDS_TOKEN_RES_ROW ,
  TDS_TOKEN_RES_COMPUTE , TDS_TOKEN_RES_PROC , TDS_TOKEN_RES_MSG , TDS_TOKEN_RES_ENV
}
 
enum  tds_token_flags {
  TDS_HANDLE_ALL = 0 , TDS_RETURN_OTHERS = (1 << (TDS_TOKEN_RES_OTHERS *2)) , TDS_STOPAT_OTHERS = (2 << (TDS_TOKEN_RES_OTHERS *2)) , TDS_RETURN_ROWFMT = (1 << (TDS_TOKEN_RES_ROWFMT *2)) ,
  TDS_STOPAT_ROWFMT = (2 << (TDS_TOKEN_RES_ROWFMT *2)) , TDS_RETURN_COMPUTEFMT = (1 << (TDS_TOKEN_RES_COMPUTEFMT *2)) , TDS_STOPAT_COMPUTEFMT = (2 << (TDS_TOKEN_RES_COMPUTEFMT *2)) , TDS_RETURN_PARAMFMT = (1 << (TDS_TOKEN_RES_PARAMFMT *2)) ,
  TDS_STOPAT_PARAMFMT = (2 << (TDS_TOKEN_RES_PARAMFMT *2)) , TDS_RETURN_DONE = (1 << (TDS_TOKEN_RES_DONE *2)) , TDS_STOPAT_DONE = (2 << (TDS_TOKEN_RES_DONE *2)) , TDS_RETURN_ROW = (1 << (TDS_TOKEN_RES_ROW *2)) ,
  TDS_STOPAT_ROW = (2 << (TDS_TOKEN_RES_ROW *2)) , TDS_RETURN_COMPUTE = (1 << (TDS_TOKEN_RES_COMPUTE *2)) , TDS_STOPAT_COMPUTE = (2 << (TDS_TOKEN_RES_COMPUTE *2)) , TDS_RETURN_PROC = (1 << (TDS_TOKEN_RES_PROC *2)) ,
  TDS_STOPAT_PROC = (2 << (TDS_TOKEN_RES_PROC *2)) , TDS_RETURN_MSG = (1 << (TDS_TOKEN_RES_MSG *2)) , TDS_STOPAT_MSG = (2 << (TDS_TOKEN_RES_MSG *2)) , TDS_RETURN_ENV = (1 << (TDS_TOKEN_RES_ENV *2)) ,
  TDS_STOPAT_ENV = (2 << (TDS_TOKEN_RES_ENV *2)) , TDS_TOKEN_RESULTS = TDS_RETURN_ROWFMT|TDS_RETURN_COMPUTEFMT|TDS_RETURN_DONE|TDS_STOPAT_ROW|TDS_STOPAT_COMPUTE|TDS_RETURN_PROC , TDS_TOKEN_TRAILING = TDS_STOPAT_ROWFMT|TDS_STOPAT_COMPUTEFMT|TDS_STOPAT_ROW|TDS_STOPAT_COMPUTE|TDS_STOPAT_MSG|TDS_STOPAT_OTHERS , TDS_HANDLE_ALL = 0 ,
  TDS_RETURN_OTHERS = (1 << (TDS_TOKEN_RES_OTHERS *2)) , TDS_STOPAT_OTHERS = (2 << (TDS_TOKEN_RES_OTHERS *2)) , TDS_RETURN_ROWFMT = (1 << (TDS_TOKEN_RES_ROWFMT *2)) , TDS_STOPAT_ROWFMT = (2 << (TDS_TOKEN_RES_ROWFMT *2)) ,
  TDS_RETURN_COMPUTEFMT = (1 << (TDS_TOKEN_RES_COMPUTEFMT *2)) , TDS_STOPAT_COMPUTEFMT = (2 << (TDS_TOKEN_RES_COMPUTEFMT *2)) , TDS_RETURN_PARAMFMT = (1 << (TDS_TOKEN_RES_PARAMFMT *2)) , TDS_STOPAT_PARAMFMT = (2 << (TDS_TOKEN_RES_PARAMFMT *2)) ,
  TDS_RETURN_DONE = (1 << (TDS_TOKEN_RES_DONE *2)) , TDS_STOPAT_DONE = (2 << (TDS_TOKEN_RES_DONE *2)) , TDS_RETURN_ROW = (1 << (TDS_TOKEN_RES_ROW *2)) , TDS_STOPAT_ROW = (2 << (TDS_TOKEN_RES_ROW *2)) ,
  TDS_RETURN_COMPUTE = (1 << (TDS_TOKEN_RES_COMPUTE *2)) , TDS_STOPAT_COMPUTE = (2 << (TDS_TOKEN_RES_COMPUTE *2)) , TDS_RETURN_PROC = (1 << (TDS_TOKEN_RES_PROC *2)) , TDS_STOPAT_PROC = (2 << (TDS_TOKEN_RES_PROC *2)) ,
  TDS_RETURN_MSG = (1 << (TDS_TOKEN_RES_MSG *2)) , TDS_STOPAT_MSG = (2 << (TDS_TOKEN_RES_MSG *2)) , TDS_RETURN_ENV = (1 << (TDS_TOKEN_RES_ENV *2)) , TDS_STOPAT_ENV = (2 << (TDS_TOKEN_RES_ENV *2)) ,
  TDS_TOKEN_RESULTS = TDS_RETURN_ROWFMT|TDS_RETURN_COMPUTEFMT|TDS_RETURN_DONE|TDS_STOPAT_ROW|TDS_STOPAT_COMPUTE|TDS_RETURN_PROC , TDS_TOKEN_TRAILING = TDS_STOPAT_ROWFMT|TDS_STOPAT_COMPUTEFMT|TDS_STOPAT_ROW|TDS_STOPAT_COMPUTE|TDS_STOPAT_MSG|TDS_STOPAT_OTHERS
}
 
enum  tds_end {
  TDS_DONE_FINAL = 0x00 , TDS_DONE_MORE_RESULTS = 0x01 , TDS_DONE_ERROR = 0x02 , TDS_DONE_INXACT = 0x04 ,
  TDS_DONE_PROC = 0x08 , TDS_DONE_COUNT = 0x10 , TDS_DONE_CANCELLED = 0x20 , TDS_DONE_EVENT = 0x40 ,
  TDS_DONE_SRVERROR = 0x100 , TDS_DONE_NO_TRAN = 0 , TDS_DONE_TRAN_SUCCEED = 1 , TDS_DONE_TRAN_PROGRESS = 2 ,
  TDS_DONE_STMT_ABORT = 3 , TDS_DONE_TRAN_ABORT = 4 , TDS_DONE_FINAL = 0x00 , TDS_DONE_MORE_RESULTS = 0x01 ,
  TDS_DONE_ERROR = 0x02 , TDS_DONE_INXACT = 0x04 , TDS_DONE_PROC = 0x08 , TDS_DONE_COUNT = 0x10 ,
  TDS_DONE_CANCELLED = 0x20 , TDS_DONE_EVENT = 0x40 , TDS_DONE_SRVERROR = 0x100 , TDS_DONE_NO_TRAN = 0 ,
  TDS_DONE_TRAN_SUCCEED = 1 , TDS_DONE_TRAN_PROGRESS = 2 , TDS_DONE_STMT_ABORT = 3 , TDS_DONE_TRAN_ABORT = 4
}
 Flags returned in TDS_DONE token. More...
 
enum  TDSERRNO {
  TDSEOK = ((TDSRET)0) , TDSEVERDOWN = 100 , TDSEICONVIU = 2400 , TDSEICONVAVAIL = 2401 ,
  TDSEICONVO = 2402 , TDSEICONVI = 2403 , TDSEICONV2BIG = 2404 , TDSEPORTINSTANCE = 2500 ,
  TDSESYNC = 20001 , TDSEFCON = 20002 , TDSETIME = 20003 , TDSEREAD = 20004 ,
  TDSEWRIT = 20006 , TDSESOCK = 20008 , TDSECONN = 20009 , TDSEMEM = 20010 ,
  TDSEINTF = 20012 , TDSEUHST = 20013 , TDSEPWD = 20014 , TDSESEOF = 20017 ,
  TDSERPND = 20019 , TDSEBTOK = 20020 , TDSEOOB = 20022 , TDSECLOS = 20056 ,
  TDSEUSCT = 20058 , TDSEUTDS = 20146 , TDSEEUNR = 20185 , TDSECAP = 20203 ,
  TDSENEG = 20210 , TDSEUMSG = 20212 , TDSECAPTYP = 20213 , TDSECONF = 20214 ,
  TDSEBPROBADTYP = 20250 , TDSECLOSEIN = 20292 , TDSEOK = ((TDSRET)0) , TDSEVERDOWN = 100 ,
  TDSEINPROGRESS , TDSEICONVIU = 2400 , TDSEICONVAVAIL = 2401 , TDSEICONVO = 2402 ,
  TDSEICONVI = 2403 , TDSEICONV2BIG = 2404 , TDSEPORTINSTANCE = 2500 , TDSESYNC = 20001 ,
  TDSEFCON = 20002 , TDSETIME = 20003 , TDSEREAD = 20004 , TDSEWRIT = 20006 ,
  TDSESOCK = 20008 , TDSECONN = 20009 , TDSEMEM = 20010 , TDSEINTF = 20012 ,
  TDSEUHST = 20013 , TDSEPWD = 20014 , TDSESEOF = 20017 , TDSERPND = 20019 ,
  TDSEBTOK = 20020 , TDSEOOB = 20022 , TDSECLOS = 20056 , TDSEUSCT = 20058 ,
  TDSEUTDS = 20146 , TDSEEUNR = 20185 , TDSECAP = 20203 , TDSENEG = 20210 ,
  TDSEUMSG = 20212 , TDSECAPTYP = 20213 , TDSECONF = 20214 , TDSEBPROBADTYP = 20250 ,
  TDSECLOSEIN = 20292
}
 
enum  {
  TDS_CUR_ISTAT_UNUSED = 0x00 , TDS_CUR_ISTAT_DECLARED = 0x01 , TDS_CUR_ISTAT_OPEN = 0x02 , TDS_CUR_ISTAT_CLOSED = 0x04 ,
  TDS_CUR_ISTAT_RDONLY = 0x08 , TDS_CUR_ISTAT_UPDATABLE = 0x10 , TDS_CUR_ISTAT_ROWCNT = 0x20 , TDS_CUR_ISTAT_DEALLOC = 0x40
}
 
enum  tds_encryption_level {
  TDS_ENCRYPTION_OFF , TDS_ENCRYPTION_REQUEST , TDS_ENCRYPTION_REQUIRE , TDS_ENCRYPTION_DEFAULT ,
  TDS_ENCRYPTION_OFF , TDS_ENCRYPTION_REQUEST , TDS_ENCRYPTION_REQUIRE
}
 
enum  {
  TDS_TYPEFLAG_INVALID = 0 , TDS_TYPEFLAG_NULLABLE = 1 , TDS_TYPEFLAG_FIXED = 2 , TDS_TYPEFLAG_VARIABLE = 4 ,
  TDS_TYPEFLAG_COLLATE = 8 , TDS_TYPEFLAG_ASCII = 16 , TDS_TYPEFLAG_UNICODE = 32 , TDS_TYPEFLAG_BINARY = 64 ,
  TDS_TYPEFLAG_DATETIME = 128 , TDS_TYPEFLAG_NUMERIC = 256 , TDS_TYPEFLAG_VARIANT = 512
}
 
enum  tds_states {
  TDS_IDLE , TDS_WRITING , TDS_SENDING , TDS_PENDING ,
  TDS_READING , TDS_DEAD , TDS_IDLE , TDS_WRITING ,
  TDS_SENDING , TDS_PENDING , TDS_READING , TDS_DEAD
}
 values for tds->state More...
 
enum  tds_operations {
  TDS_OP_NONE = 0 , TDS_OP_CURSOR = TDS_SP_CURSOR , TDS_OP_CURSOROPEN = TDS_SP_CURSOROPEN , TDS_OP_CURSORPREPARE = TDS_SP_CURSORPREPARE ,
  TDS_OP_CURSOREXECUTE = TDS_SP_CURSOREXECUTE , TDS_OP_CURSORPREPEXEC = TDS_SP_CURSORPREPEXEC , TDS_OP_CURSORUNPREPARE = TDS_SP_CURSORUNPREPARE , TDS_OP_CURSORFETCH = TDS_SP_CURSORFETCH ,
  TDS_OP_CURSOROPTION = TDS_SP_CURSOROPTION , TDS_OP_CURSORCLOSE = TDS_SP_CURSORCLOSE , TDS_OP_EXECUTESQL = TDS_SP_EXECUTESQL , TDS_OP_PREPARE = TDS_SP_PREPARE ,
  TDS_OP_EXECUTE = TDS_SP_EXECUTE , TDS_OP_PREPEXEC = TDS_SP_PREPEXEC , TDS_OP_PREPEXECRPC = TDS_SP_PREPEXECRPC , TDS_OP_UNPREPARE = TDS_SP_UNPREPARE ,
  TDS_OP_DYN_DEALLOC = 100 , TDS_OP_NONE = 0 , TDS_OP_CURSOR = TDS_SP_CURSOR , TDS_OP_CURSOROPEN = TDS_SP_CURSOROPEN ,
  TDS_OP_CURSORPREPARE = TDS_SP_CURSORPREPARE , TDS_OP_CURSOREXECUTE = TDS_SP_CURSOREXECUTE , TDS_OP_CURSORPREPEXEC = TDS_SP_CURSORPREPEXEC , TDS_OP_CURSORUNPREPARE = TDS_SP_CURSORUNPREPARE ,
  TDS_OP_CURSORFETCH = TDS_SP_CURSORFETCH , TDS_OP_CURSOROPTION = TDS_SP_CURSOROPTION , TDS_OP_CURSORCLOSE = TDS_SP_CURSORCLOSE , TDS_OP_EXECUTESQL = TDS_SP_EXECUTESQL ,
  TDS_OP_PREPARE = TDS_SP_PREPARE , TDS_OP_EXECUTE = TDS_SP_EXECUTE , TDS_OP_PREPEXEC = TDS_SP_PREPEXEC , TDS_OP_PREPEXECRPC = TDS_SP_PREPEXECRPC ,
  TDS_OP_UNPREPARE = TDS_SP_UNPREPARE , TDS_OP_DYN_DEALLOC = 100
}
 
enum  TDS_CURSOR_STATE {
  TDS_CURSOR_STATE_UNACTIONED = 0 , TDS_CURSOR_STATE_REQUESTED = 1 , TDS_CURSOR_STATE_SENT = 2 , TDS_CURSOR_STATE_ACTIONED = 3 ,
  TDS_CURSOR_STATE_UNACTIONED = 0 , TDS_CURSOR_STATE_REQUESTED = 1 , TDS_CURSOR_STATE_SENT = 2 , TDS_CURSOR_STATE_ACTIONED = 3
}
 
enum  tds_cursor_operation {
  TDS_CURSOR_POSITION = 0 , TDS_CURSOR_UPDATE = 1 , TDS_CURSOR_DELETE = 2 , TDS_CURSOR_INSERT = 4 ,
  TDS_CURSOR_POSITION = 0 , TDS_CURSOR_UPDATE = 1 , TDS_CURSOR_DELETE = 2 , TDS_CURSOR_INSERT = 4
}
 
enum  tds_cursor_fetch {
  TDS_CURSOR_FETCH_NEXT = 1 , TDS_CURSOR_FETCH_PREV , TDS_CURSOR_FETCH_FIRST , TDS_CURSOR_FETCH_LAST ,
  TDS_CURSOR_FETCH_ABSOLUTE , TDS_CURSOR_FETCH_RELATIVE , TDS_CURSOR_FETCH_NEXT = 1 , TDS_CURSOR_FETCH_PREV ,
  TDS_CURSOR_FETCH_FIRST , TDS_CURSOR_FETCH_LAST , TDS_CURSOR_FETCH_ABSOLUTE , TDS_CURSOR_FETCH_RELATIVE
}
 
enum  TDS_MULTIPLE_TYPE {
  TDS_MULTIPLE_QUERY , TDS_MULTIPLE_EXECUTE , TDS_MULTIPLE_RPC , TDS_MULTIPLE_QUERY ,
  TDS_MULTIPLE_EXECUTE , TDS_MULTIPLE_RPC
}
 
enum  TDS_ICONV_ENTRY {
  client2ucs2 , client2server_chardata , initial_char_conv_count , client2ucs2 ,
  client2server_chardata , initial_char_conv_count
}
 
enum  tds_bcp_directions {
  TDS_BCP_IN = 1 , TDS_BCP_OUT = 2 , TDS_BCP_QUERYOUT = 3 , TDS_BCP_IN = 1 ,
  TDS_BCP_OUT = 2 , TDS_BCP_QUERYOUT = 3
}
 bcp direction More...
 

Functions

static bool is_tds_type_valid (int type)
 
const TDS_COMPILETIME_SETTINGStds_get_compiletime_settings (void)
 Return a structure capturing the compile-time settings provided to the configure script. More...
 
bool tds_read_conf_section (FILE *in, const char *section, TDSCONFPARSE tds_conf_parse, void *parse_param)
 Read a section of configuration file (INI style file) More...
 
bool tds_read_conf_file (TDSLOGIN *login, const char *server)
 Read configuration info for given server return 0 on error. More...
 
void tds_parse_conf_section (const char *option, const char *value, void *param)
 
TDSLOGINtds_read_config_info (TDSSOCKET *tds, TDSLOGIN *login, TDSLOCALE *locale)
 tds_read_config_info() will fill the tds connection structure based on configuration information gathered in the following order: 1) Program specified in TDSLOGIN structure 2) The environment variables TDSVER, TDSDUMP, TDSPORT, TDSQUERY, TDSHOST 3) A config file with the following search order: a) a readable file specified by environment variable FREETDSCONF b) a readable file in ~/.freetds.conf c) a readable file in $prefix/etc/freetds.conf 3) ~/.interfaces if exists 4) $SYBASE/interfaces if exists 5) TDS_DEF_* default values More...
 
void tds_fix_login (TDSLOGIN *login)
 Fix configuration after reading it. More...
 
TDS_USMALLINTtds_config_verstr (const char *tdsver, TDSLOGIN *login)
 Set TDS version from given string. More...
 
struct addrinfotds_lookup_host (const char *servername)
 Get the IP address for a hostname. More...
 
TDSRET tds_lookup_host_set (const char *servername, struct addrinfo **addr)
 
const char * tds_addrinfo2str (struct addrinfo *addr, char *name, int namemax)
 
char * tds_get_home_file (const char *file)
 Return filename from HOME directory. More...
 
TDSRET tds_set_interfaces_file_loc (const char *interfloc)
 Set the full name of interface file. More...
 
int tds_parse_boolean (const char *value, int default_value)
 
int tds_config_boolean (const char *option, const char *value, TDSLOGIN *login)
 
TDSLOCALEtds_get_locale (void)
 Get locale information. More...
 
TDSRET tds_alloc_row (TDSRESULTINFO *res_info)
 Allocate space for row store return NULL on out of memory. More...
 
TDSRET tds_alloc_compute_row (TDSCOMPUTEINFO *res_info)
 
BCPCOLDATAtds_alloc_bcp_column_data (unsigned int column_size)
 
TDSDYNAMICtds_lookup_dynamic (TDSCONNECTION *conn, const char *id)
 Finds a dynamic given string id. More...
 
const char * tds_prtype (int token)
 Returns string representation of the given type. More...
 
int tds_get_varint_size (TDSCONNECTION *conn, int datatype)
 tds_get_varint_size() returns the size of a variable length integer returned in a TDS 7.0 result string More...
 
TDS_SERVER_TYPE tds_get_cardinal_type (TDS_SERVER_TYPE datatype, int usertype)
 
TDSRET tds_iconv_open (TDSCONNECTION *conn, const char *charset, int use_utf16)
 
void tds_iconv_close (TDSCONNECTION *conn)
 
void tds_srv_charset_changed (TDSCONNECTION *conn, const char *charset)
 
void tds7_srv_charset_changed (TDSCONNECTION *conn, TDS_UCHAR collate[5])
 
int tds_iconv_alloc (TDSCONNECTION *conn)
 Allocate iconv stuff. More...
 
void tds_iconv_free (TDSCONNECTION *conn)
 
TDSICONVtds_iconv_from_collate (TDSCONNECTION *conn, TDS_UCHAR collate[5])
 Get iconv information from a LCID (to support different column encoding under MSSQL2K) More...
 
void tds_free_socket (TDSSOCKET *tds)
 
void tds_free_all_results (TDSSOCKET *tds)
 
void tds_free_results (TDSRESULTINFO *res_info)
 
void tds_free_param_results (TDSPARAMINFO *param_info)
 
void tds_free_param_result (TDSPARAMINFO *param_info)
 Delete latest parameter. More...
 
void tds_free_msg (TDSMESSAGE *message)
 
void tds_cursor_deallocated (TDSCONNECTION *conn, TDSCURSOR *cursor)
 
void tds_release_cursor (TDSCURSOR **pcursor)
 
void tds_free_bcp_column_data (BCPCOLDATA *coldata)
 
TDSRESULTINFOtds_alloc_results (TDS_USMALLINT num_cols)
 
TDSCOMPUTEINFO ** tds_alloc_compute_results (TDSSOCKET *tds, TDS_USMALLINT num_cols, TDS_USMALLINT by_cols)
 
TDSCONTEXTtds_alloc_context (void *parent)
 
void tds_free_context (TDSCONTEXT *locale)
 
TDSPARAMINFOtds_alloc_param_result (TDSPARAMINFO *old_param)
 Adds a output parameter to TDSPARAMINFO. More...
 
void tds_free_input_params (TDSDYNAMIC *dyn)
 Frees all allocated input parameters of a dynamic statement. More...
 
void tds_release_dynamic (TDSDYNAMIC **dyn)
 Frees dynamic statement. More...
 
static void tds_release_cur_dyn (TDSSOCKET *tds)
 
void tds_dynamic_deallocated (TDSCONNECTION *conn, TDSDYNAMIC *dyn)
 
void tds_set_cur_dyn (TDSSOCKET *tds, TDSDYNAMIC *dyn)
 Set current dynamic. More...
 
TDSSOCKETtds_realloc_socket (TDSSOCKET *tds, unsigned int bufsize)
 
char * tds_alloc_client_sqlstate (int msgno)
 
char * tds_alloc_lookup_sqlstate (TDSSOCKET *tds, int msgno)
 
TDSLOGINtds_alloc_login (int use_environment)
 
TDSDYNAMICtds_alloc_dynamic (TDSCONNECTION *conn, const char *id)
 Allocate a dynamic statement. More...
 
void tds_free_login (TDSLOGIN *login)
 
TDSLOGINtds_init_login (TDSLOGIN *login, TDSLOCALE *locale)
 Initialize login structure with locale information and other stuff for connection. More...
 
TDSLOCALEtds_alloc_locale (void)
 
void * tds_alloc_param_data (TDSCOLUMN *curparam)
 Allocate data for a parameter. More...
 
void tds_free_locale (TDSLOCALE *locale)
 
TDSCURSORtds_alloc_cursor (TDSSOCKET *tds, const char *name, size_t namelen, const char *query, size_t querylen)
 
void tds_free_row (TDSRESULTINFO *res_info, unsigned char *row)
 
TDSSOCKETtds_alloc_socket (TDSCONTEXT *context, unsigned int bufsize)
 
TDSSOCKETtds_alloc_additional_socket (TDSCONNECTION *conn)
 
void tds_set_current_results (TDSSOCKET *tds, TDSRESULTINFO *info)
 
void tds_detach_results (TDSRESULTINFO *info)
 Detach result info from it current socket. More...
 
void * tds_realloc (void **pp, size_t new_size)
 Reallocate a pointer and update it if success. More...
 
TDSPACKETtds_alloc_packet (void *buf, unsigned len)
 
TDSPACKETtds_realloc_packet (TDSPACKET *packet, unsigned len)
 
void tds_free_packets (TDSPACKET *packet)
 
TDSBCPINFOtds_alloc_bcpinfo (void)
 
void tds_free_bcpinfo (TDSBCPINFO *bcpinfo)
 
void tds_deinit_bcpinfo (TDSBCPINFO *bcpinfo)
 
void tds_deinit_tvp (TDS_TVP *table)
 
void tds_set_packet (TDSLOGIN *tds_login, int packet_size)
 
void tds_set_port (TDSLOGIN *tds_login, int port)
 
bool tds_set_passwd (TDSLOGIN *tds_login, const char *password) TDS_WUR
 
void tds_set_bulk (TDSLOGIN *tds_login, bool enabled)
 
bool tds_set_user (TDSLOGIN *tds_login, const char *username) TDS_WUR
 
bool tds_set_app (TDSLOGIN *tds_login, const char *application) TDS_WUR
 
bool tds_set_host (TDSLOGIN *tds_login, const char *hostname) TDS_WUR
 
bool tds_set_library (TDSLOGIN *tds_login, const char *library) TDS_WUR
 
bool tds_set_server (TDSLOGIN *tds_login, const char *server) TDS_WUR
 Set the servername in a TDSLOGIN structure. More...
 
bool tds_set_client_charset (TDSLOGIN *tds_login, const char *charset) TDS_WUR
 
bool tds_set_language (TDSLOGIN *tds_login, const char *language) TDS_WUR
 
void tds_set_version (TDSLOGIN *tds_login, TDS_TINYINT major_ver, TDS_TINYINT minor_ver)
 
int tds_connect_and_login (TDSSOCKET *tds, TDSLOGIN *login)
 
void tds_start_query (TDSSOCKET *tds, unsigned char packet_type)
 Start query packet of a given type \tds. More...
 
TDSRET tds_submit_query (TDSSOCKET *tds, const char *query)
 tds_submit_query() sends a language string to the database server for processing. More...
 
TDSRET tds_submit_query_params (TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head)
 tds_submit_query_params() sends a language string to the database server for processing. More...
 
TDSRET tds_submit_queryf (TDSSOCKET *tds, const char *queryf,...)
 Format and submit a query \tds. More...
 
TDSRET tds_submit_prepare (TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params)
 tds_submit_prepare() creates a temporary stored procedure in the server. More...
 
TDSRET tds_submit_execdirect (TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head)
 Submit a prepared query with parameters. More...
 
TDSRET tds71_submit_prepexec (TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params)
 tds71_submit_prepexec() creates a temporary stored procedure in the server. More...
 
TDSRET tds_submit_execute (TDSSOCKET *tds, TDSDYNAMIC *dyn)
 tds_submit_execute() sends a previously prepared dynamic statement to the server. More...
 
TDSRET tds_send_cancel (TDSSOCKET *tds)
 tds_send_cancel() sends an empty packet (8 byte header only) tds_process_cancel should be called directly after this. More...
 
const char * tds_next_placeholder (const char *start)
 Get position of next placeholder. More...
 
int tds_count_placeholders (const char *query)
 Count the number of placeholders in query. More...
 
int tds_needs_unprepare (TDSCONNECTION *conn, TDSDYNAMIC *dyn)
 Check if dynamic request must be unprepared. More...
 
TDSRET tds_deferred_unprepare (TDSCONNECTION *conn, TDSDYNAMIC *dyn)
 Unprepare dynamic on idle. More...
 
TDSRET tds_submit_unprepare (TDSSOCKET *tds, TDSDYNAMIC *dyn)
 Send a unprepare request for a prepared query. More...
 
TDSRET tds_submit_rpc (TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params, TDSHEADERS *head)
 tds_submit_rpc() call a RPC from server. More...
 
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. More...
 
TDSRET tds_submit_begin_tran (TDSSOCKET *tds)
 Send a rollback request. More...
 
TDSRET tds_submit_rollback (TDSSOCKET *tds, bool cont)
 Send a rollback request. More...
 
TDSRET tds_submit_commit (TDSSOCKET *tds, bool cont)
 Send a commit request. More...
 
TDSRET tds_disconnect (TDSSOCKET *tds)
 
size_t tds_quote_id (TDSSOCKET *tds, char *buffer, const char *id, ssize_t idlen)
 Quote an id. More...
 
size_t tds_quote_id_rpc (TDSSOCKET *tds, char *buffer, const char *id, ssize_t idlen)
 Quote an id for a RPC call. More...
 
size_t tds_quote_string (TDSSOCKET *tds, char *buffer, const char *str, ssize_t len)
 Quote a string. More...
 
const char * tds_skip_comment (const char *s)
 Skip a comment in a query. More...
 
const char * tds_skip_quoted (const char *s)
 Skip quoting string (like 'sfsf', "dflkdj" or [dfkjd]) More...
 
size_t tds_fix_column_size (TDSSOCKET *tds, TDSCOLUMN *curcol)
 Get column size for wire. More...
 
const char * tds_convert_string (TDSSOCKET *tds, TDSICONV *char_conv, const char *s, ssize_t len, size_t *out_len)
 Convert a string in an allocated buffer. More...
 
void tds_convert_string_free (const char *original, const char *converted)
 
TDSRET tds_get_column_declaration (TDSSOCKET *tds, TDSCOLUMN *curcol, char *out)
 Return declaration for column (like "varchar(20)") \tds. More...
 
TDSRET tds_cursor_declare (TDSSOCKET *tds, TDSCURSOR *cursor, TDSPARAMINFO *params, int *send)
 
TDSRET tds_cursor_setrows (TDSSOCKET *tds, TDSCURSOR *cursor, int *send)
 
TDSRET tds_cursor_open (TDSSOCKET *tds, TDSCURSOR *cursor, TDSPARAMINFO *params, int *send)
 
TDSRET tds_cursor_fetch (TDSSOCKET *tds, TDSCURSOR *cursor, TDS_CURSOR_FETCH fetch_type, TDS_INT i_row)
 
TDSRET tds_cursor_get_cursor_info (TDSSOCKET *tds, TDSCURSOR *cursor, TDS_UINT *row_number, TDS_UINT *row_count)
 
TDSRET tds_cursor_close (TDSSOCKET *tds, TDSCURSOR *cursor)
 
TDSRET tds_cursor_dealloc (TDSSOCKET *tds, TDSCURSOR *cursor)
 Send a deallocation request to server. More...
 
TDSRET tds_deferred_cursor_dealloc (TDSCONNECTION *conn, TDSCURSOR *cursor)
 Deallocate cursor on idle. More...
 
TDSRET tds_cursor_update (TDSSOCKET *tds, TDSCURSOR *cursor, TDS_CURSOR_OPERATION op, TDS_INT i_row, TDSPARAMINFO *params)
 
TDSRET tds_cursor_setname (TDSSOCKET *tds, TDSCURSOR *cursor)
 
TDSRET tds_multiple_init (TDSSOCKET *tds, TDSMULTIPLE *multiple, TDS_MULTIPLE_TYPE type, TDSHEADERS *head)
 
TDSRET tds_multiple_done (TDSSOCKET *tds, TDSMULTIPLE *multiple)
 
TDSRET tds_multiple_query (TDSSOCKET *tds, TDSMULTIPLE *multiple, const char *query, TDSPARAMINFO *params)
 
TDSRET tds_multiple_execute (TDSSOCKET *tds, TDSMULTIPLE *multiple, TDSDYNAMIC *dyn)
 
TDSRET tds_process_cancel (TDSSOCKET *tds)
 
TDSRET tds_process_login_tokens (TDSSOCKET *tds)
 tds_process_login_tokens() is called after sending the login packet to the server. More...
 
TDSRET tds_process_simple_query (TDSSOCKET *tds)
 Process results for simple query as "SET TEXTSIZE" or "USE dbname" If the statement returns results, beware they are discarded. More...
 
int tds5_send_optioncmd (TDSSOCKET *tds, TDS_OPTION_CMD tds_command, TDS_OPTION tds_option, TDS_OPTION_ARG *tds_argument, TDS_INT *tds_argsize)
 
TDSRET tds_process_tokens (TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsigned flag)
 process all streams. More...
 
void tds_set_param_type (TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
 Set type of column initializing all dependency. More...
 
void tds_set_column_type (TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
 Set type of column initializing all dependency. More...
 
TDSRET tds_datecrack (TDS_INT datetype, const void *di, TDSDATEREC *dr)
 Convert from db date format to a structured date format. More...
 
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) More...
 
int tds_init_write_buf (TDSSOCKET *tds)
 
int tds_put_n (TDSSOCKET *tds, const void *buf, size_t n)
 
int tds_put_string (TDSSOCKET *tds, const char *buf, int len)
 Output a string to wire automatic translate string to unicode if needed. More...
 
int tds_put_int (TDSSOCKET *tds, TDS_INT i)
 
int tds_put_int8 (TDSSOCKET *tds, TDS_INT8 i)
 
int tds_put_smallint (TDSSOCKET *tds, TDS_SMALLINT si)
 
int tds_put_byte (TDSSOCKET *tds, unsigned char c)
 
TDSRET tds_flush_packet (TDSSOCKET *tds)
 Flush packet to server. More...
 
int tds_put_buf (TDSSOCKET *tds, const unsigned char *buf, int dsize, int ssize)
 
unsigned char tds_get_byte (TDSSOCKET *tds)
 Return a single byte from the input buffer \tds. More...
 
void tds_unget_byte (TDSSOCKET *tds)
 Unget will always work as long as you don't call it twice in a row. More...
 
unsigned char tds_peek (TDSSOCKET *tds)
 Reads a byte from the TDS stream without removing it \tds. More...
 
TDS_USMALLINT tds_get_usmallint (TDSSOCKET *tds)
 Get an int16 from the server. More...
 
TDS_UINT tds_get_uint (TDSSOCKET *tds)
 Get an int32 from the server. More...
 
TDS_UINT8 tds_get_uint8 (TDSSOCKET *tds)
 Get an uint64 from the server. More...
 
size_t tds_get_string (TDSSOCKET *tds, size_t string_len, char *dest, size_t dest_size)
 Fetch a string from the wire. More...
 
TDSRET tds_get_char_data (TDSSOCKET *tds, char *dest, size_t wire_size, TDSCOLUMN *curcol)
 Fetch character data the wire. More...
 
bool tds_get_n (TDSSOCKET *tds, void *dest, size_t n)
 Get N bytes from the buffer and return them in the already allocated space given to us. More...
 
int tds_get_size_by_type (TDS_SERVER_TYPE servertype)
 Return the number of bytes needed by specified type. More...
 
DSTRtds_dstr_get (TDSSOCKET *tds, DSTR *s, size_t len)
 Reads a string from wire and put in a DSTR. More...
 
int tdserror (const TDSCONTEXT *tds_ctx, TDSSOCKET *tds, int msgno, int errnum)
 Call the client library's error handler (for library-generated errors only) More...
 
TDS_STATE tds_set_state (TDSSOCKET *tds, TDS_STATE state)
 Set state of TDS connection, with logging and checking. More...
 
void tds_swap_bytes (void *buf, int bytes)
 
unsigned int tds_gettime_ms (void)
 
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 Please note that some system implementation of strndup do not assure they don't read past len bytes as they use still strlen to check length to copy limiting after strlen to size passed Also this function is different from strndup as it assume that len bytes are valid String returned is NUL terminated. More...
 
void tdsdump_off (TDSDUMP_OFF_ITEM *off_item)
 Temporarily turn off logging for current thread. More...
 
void tdsdump_on (TDSDUMP_OFF_ITEM *off_item)
 Turn logging back on for current thread. More...
 
int tdsdump_isopen (void)
 
int tdsdump_open (const char *filename)
 Create and truncate a human readable dump file for the TDS traffic. More...
 
void tdsdump_close (void)
 Close the TDS dump log file. More...
 
void tdsdump_do_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. More...
 
void tdsdump_col (const TDSCOLUMN *col)
 Write a column value to the debug log. More...
 
void tdsdump_do_log (const char *file, unsigned int level_line, const char *fmt,...)
 Write a message to the debug log. More...
 
TDSERRNO tds_open_socket (TDSSOCKET *tds, struct addrinfo *ipaddr, unsigned int port, int timeout, int *p_oserr)
 
void tds_close_socket (TDSSOCKET *tds)
 Close current socket. More...
 
int tds7_get_instance_ports (FILE *output, struct addrinfo *addr)
 Get port of all instances. More...
 
int tds7_get_instance_port (struct addrinfo *addr, const char *instance)
 Get port of given instance. More...
 
char * tds_prwsaerror (int erc)
 
void tds_prwsaerror_free (char *s)
 
ssize_t tds_connection_read (TDSSOCKET *tds, unsigned char *buf, size_t buflen)
 
ssize_t tds_connection_write (TDSSOCKET *tds, const unsigned char *buf, size_t buflen, int final)
 
int tds_select (TDSSOCKET *tds, unsigned tds_sel, int timeout_seconds)
 Select on a socket until it's available or the timeout expires. More...
 
void tds_connection_close (TDSCONNECTION *conn)
 
ssize_t tds_goodread (TDSSOCKET *tds, unsigned char *buf, size_t buflen)
 Loops until we have received some characters return -1 on failure. More...
 
ssize_t tds_goodwrite (TDSSOCKET *tds, const unsigned char *buffer, size_t buflen)
 
void tds_socket_flush (TDS_SYS_SOCKET sock)
 
int tds_socket_set_nonblocking (TDS_SYS_SOCKET sock)
 Set socket to non-blocking. More...
 
int tds_wakeup_init (TDSPOLLWAKEUP *wakeup)
 
void tds_wakeup_close (TDSPOLLWAKEUP *wakeup)
 
void tds_wakeup_send (TDSPOLLWAKEUP *wakeup, char cancel)
 
static TDS_SYS_SOCKET tds_wakeup_get_fd (const TDSPOLLWAKEUP *wakeup)
 
int tds_read_packet (TDSSOCKET *tds)
 Read in one 'packet' from the server. More...
 
TDSRET tds_write_packet (TDSSOCKET *tds, unsigned char final)
 
int tds_put_cancel (TDSSOCKET *tds)
 
void tds_freeze (TDSSOCKET *tds, TDSFREEZE *freeze, unsigned size_len)
 Stop writing to server and cache every packet not sending them to server. More...
 
unsigned int tds_freeze_written (TDSFREEZE *freeze)
 Compute how many bytes has been written from freeze. More...
 
TDSRET tds_freeze_abort (TDSFREEZE *freeze)
 Discard all data written after the freeze. More...
 
TDSRET tds_freeze_close (TDSFREEZE *freeze)
 Stop keeping data for this specific freeze. More...
 
TDSRET tds_freeze_close_len (TDSFREEZE *freeze, int32_t size)
 Stop keeping data for this specific freeze. More...
 
static void tds_set_current_send_packet (TDSSOCKET *tds, TDSPACKET *pkt)
 
TDSRET tds_vstrbuild (char *buffer, int buflen, int *resultlen, const char *text, int textlen, const char *formats, int formatlen, va_list ap)
 
char * tds_money_to_string (const TDS_MONEY *money, char *s, bool use_2_digits)
 
TDS_INT tds_numeric_to_string (const TDS_NUMERIC *numeric, char *s)
 
TDS_INT tds_numeric_change_prec_scale (TDS_NUMERIC *numeric, unsigned char new_prec, unsigned char new_scale)
 
void tds_getmac (TDS_SYS_SOCKET s, unsigned char mac[6])
 
TDSAUTHENTICATIONtds_ntlm_get_auth (TDSSOCKET *tds)
 Build a NTLMSPP packet to send to server. More...
 
TDSAUTHENTICATIONtds_gss_get_auth (TDSSOCKET *tds)
 
TDSRET tds5_gss_send (TDSSOCKET *tds)
 
void tds_random_buffer (unsigned char *out, int len)
 
TDSAUTHENTICATIONtds5_negotiate_get_auth (TDSSOCKET *tds)
 
static void tds5_negotiate_set_msg_type (TDSAUTHENTICATION *tds_auth, unsigned msg_type)
 
TDSRET tds_bcp_init (TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
 Initialize BCP information. More...
 
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 \tds. More...
 
TDSRET tds_bcp_done (TDSSOCKET *tds, int *rows_copied)
 Tell we finished sending BCP data to server \tds. More...
 
TDSRET tds_bcp_start (TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
 Start sending BCP data to server. More...
 
TDSRET tds_bcp_start_copy_in (TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
 Start bulk copy to server \tds. More...
 
TDSRET tds_bcp_fread (TDSSOCKET *tds, TDSICONV *conv, FILE *stream, const char *terminator, size_t term_len, char **outbuf, size_t *outbytes)
 Read a data file, passing the data through iconv(). More...
 
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. More...
 
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. More...
 
TDSRET tds_writetext_end (TDSSOCKET *tds)
 Finish sending writetext data. More...
 
static bool tds_capability_enabled (const TDS_CAPABILITY_TYPE *cap, unsigned cap_num)
 

Variables

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 store the specified precision. More...
 
const uint16_t tds_type_flags_ms [256]
 
const char STD_DATETIME_FMT []
 
const char tds_hex_digits []
 
int tds_write_dump
 Tell if TDS debug logging is turned on or off. More...
 
int tds_debug_flags
 
int tds_g_append_mode
 

Detailed Description

Main include file for libtds.

Definition in file tds.h.

Macro Definition Documentation

◆ is_ascii_type

#define is_ascii_type (   x)    ((tds_type_flags_ms[x] & TDS_TYPEFLAG_ASCII) != 0)

Definition at line 419 of file tds.h.

◆ is_binary_type

#define is_binary_type (   x)    ((tds_type_flags_ms[x] & TDS_TYPEFLAG_BINARY) != 0)

Definition at line 420 of file tds.h.

◆ is_blob_col

#define is_blob_col (   x)
Value:
(is_blob_type((x)->column_type) \
|| ((x)->column_varint_size == 8) \
|| ((x)->column_type == SYBVARIANT \
&& (x)->column_varint_size == 4))
@ SYBVARIANT
Definition: proto.h:200
#define is_blob_type(x)
Definition: tds.h:403

Definition at line 405 of file tds.h.

◆ is_blob_type

#define is_blob_type (   x)    ((x)==SYBTEXT || (x)==SYBIMAGE || (x)==SYBNTEXT)

Definition at line 403 of file tds.h.

◆ is_char_type

#define is_char_type (   x)    ((tds_type_flags_ms[x] & (TDS_TYPEFLAG_ASCII|TDS_TYPEFLAG_UNICODE)) != 0)

Definition at line 421 of file tds.h.

◆ is_collate_type

#define is_collate_type (   x)    ((tds_type_flags_ms[x] & TDS_TYPEFLAG_COLLATE) != 0)

Definition at line 418 of file tds.h.

◆ is_datetime_type

#define is_datetime_type (   x)    ((tds_type_flags_ms[x] & TDS_TYPEFLAG_DATETIME) != 0)

return true if type is a datetime (but not date or time)

Definition at line 416 of file tds.h.

◆ is_end_token

#define is_end_token (   x)    ((x) >= TDS_DONE_TOKEN && (x) <= TDS_DONEINPROC_TOKEN)

Definition at line 375 of file tds.h.

◆ is_fixed_type

#define is_fixed_type (   x)    ((tds_type_flags_ms[x] & TDS_TYPEFLAG_FIXED) != 0)

Definition at line 397 of file tds.h.

◆ is_nullable_type

#define is_nullable_type (   x)    ((tds_type_flags_ms[x] & TDS_TYPEFLAG_NULLABLE) != 0)

Definition at line 398 of file tds.h.

◆ is_numeric_type

#define is_numeric_type (   x)    ((x)==SYBNUMERIC || (x)==SYBDECIMAL)

Definition at line 414 of file tds.h.

◆ is_similar_type

#define is_similar_type (   x,
 
)    (is_char_type(x) && is_char_type(y))

Definition at line 422 of file tds.h.

◆ IS_TDS42

#define IS_TDS42 (   x)    (x->tds_version==0x402)

Definition at line 1784 of file tds.h.

◆ IS_TDS46

#define IS_TDS46 (   x)    (x->tds_version==0x406)

Definition at line 1785 of file tds.h.

◆ IS_TDS50

#define IS_TDS50 (   x)    (x->tds_version==0x500)

Definition at line 1786 of file tds.h.

◆ IS_TDS50_PLUS

#define IS_TDS50_PLUS (   x)    ((x)->tds_version>=0x500)

Definition at line 1792 of file tds.h.

◆ IS_TDS70

#define IS_TDS70 (   x)    (x->tds_version==0x700)

Definition at line 1787 of file tds.h.

◆ IS_TDS71

#define IS_TDS71 (   x)    (x->tds_version==0x701)

Definition at line 1788 of file tds.h.

◆ IS_TDS71_PLUS

#define IS_TDS71_PLUS (   x)    ((x)->tds_version>=0x701)

Definition at line 1794 of file tds.h.

◆ IS_TDS72

#define IS_TDS72 (   x)    (x->tds_version==0x702)

Definition at line 1789 of file tds.h.

◆ IS_TDS72_PLUS

#define IS_TDS72_PLUS (   x)    ((x)->tds_version>=0x702)

Definition at line 1795 of file tds.h.

◆ IS_TDS73

#define IS_TDS73 (   x)    (x->tds_version==0x703)

Definition at line 1790 of file tds.h.

◆ IS_TDS73_PLUS

#define IS_TDS73_PLUS (   x)    ((x)->tds_version>=0x703)

Definition at line 1796 of file tds.h.

◆ IS_TDS74_PLUS

#define IS_TDS74_PLUS (   x)    ((x)->tds_version>=0x704)

Definition at line 1797 of file tds.h.

◆ IS_TDS7_PLUS

#define IS_TDS7_PLUS (   x)    ((x)->tds_version>=0x700)

Definition at line 1793 of file tds.h.

◆ IS_TDSDEAD

#define IS_TDSDEAD (   x)    (((x) == NULL) || (x)->state == TDS_DEAD)

Definition at line 1802 of file tds.h.

◆ is_unicode_type

#define is_unicode_type (   x)    ((tds_type_flags_ms[x] & TDS_TYPEFLAG_UNICODE) != 0)

Definition at line 417 of file tds.h.

◆ is_variable_type

#define is_variable_type (   x)    ((tds_type_flags_ms[x] & TDS_TYPEFLAG_VARIABLE) != 0)

Definition at line 399 of file tds.h.

◆ is_variant_inner_type

#define is_variant_inner_type (   x)    ((tds_type_flags_ms[x] & TDS_TYPEFLAG_VARIANT) != 0)

Definition at line 400 of file tds.h.

◆ MAXPRECISION

#define MAXPRECISION   77

Definition at line 431 of file tds.h.

◆ TDS_ALIGN_SIZE

#define TDS_ALIGN_SIZE   sizeof(tds_align_struct)

Definition at line 526 of file tds.h.

◆ TDS_BYTE_SWAP16

#define TDS_BYTE_SWAP16 (   value)
Value:
(((((uint16_t)value)<<8) & 0xFF00u) | \
((((uint16_t)value)>>8) & 0x00FFu))
Uint2 uint16_t
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227

Definition at line 365 of file tds.h.

◆ TDS_BYTE_SWAP32

#define TDS_BYTE_SWAP32 (   value)
Value:
(((((uint32_t)value)<<24) & 0xFF000000u)| \
((((uint32_t)value)<< 8) & 0x00FF0000u)| \
((((uint32_t)value)>> 8) & 0x0000FF00u)| \
((((uint32_t)value)>>24) & 0x000000FFu))
#define uint32_t
Definition: config.h:42

Definition at line 369 of file tds.h.

◆ TDS_CANCELLED

#define TDS_CANCELLED   ((TDSRET)-2)

Definition at line 200 of file tds.h.

◆ tds_capability_has_req

#define tds_capability_has_req (   conn,
  cap 
)     tds_capability_enabled(&conn->capabilities.types[0], cap)

Definition at line 1779 of file tds.h.

◆ tds_capability_has_res

#define tds_capability_has_res (   conn,
  cap 
)     tds_capability_enabled(&conn->capabilities.types[1], cap)

Definition at line 1781 of file tds.h.

◆ TDS_CMD_DONE

#define TDS_CMD_DONE   4046

Definition at line 218 of file tds.h.

◆ TDS_CMD_FAIL

#define TDS_CMD_FAIL   4048

Definition at line 220 of file tds.h.

◆ TDS_CMD_SUCCEED

#define TDS_CMD_SUCCEED   4047

Definition at line 219 of file tds.h.

◆ TDS_COMPUTE_RESULT

#define TDS_COMPUTE_RESULT   4045

Definition at line 217 of file tds.h.

◆ TDS_COMPUTEFMT_RESULT

#define TDS_COMPUTEFMT_RESULT   4050

Definition at line 222 of file tds.h.

◆ tds_convert_string_free

#define tds_convert_string_free (   original,
  converted 
)     do { if (original != converted) free((char*) converted); } while(0)

Definition at line 1477 of file tds.h.

◆ TDS_DBG_ERROR

#define TDS_DBG_ERROR   __FILE__, ((__LINE__ << 4) | 2)

Definition at line 858 of file tds.h.

◆ TDS_DBG_FUNC

#define TDS_DBG_FUNC   __FILE__, ((__LINE__ << 4) | 7)

Definition at line 853 of file tds.h.

◆ TDS_DBG_HEADER

#define TDS_DBG_HEADER   __FILE__, ((__LINE__ << 4) | 10)

Definition at line 852 of file tds.h.

◆ TDS_DBG_INFO1

#define TDS_DBG_INFO1   __FILE__, ((__LINE__ << 4) | 5)

Definition at line 855 of file tds.h.

◆ TDS_DBG_INFO2

#define TDS_DBG_INFO2   __FILE__, ((__LINE__ << 4) | 6)

Definition at line 854 of file tds.h.

◆ TDS_DBG_LOGIN

#define TDS_DBG_LOGIN   __FILE__, ((__LINE__ << 4) | 11)

Definition at line 851 of file tds.h.

◆ TDS_DBG_NETWORK

#define TDS_DBG_NETWORK   __FILE__, ((__LINE__ << 4) | 4)

Definition at line 856 of file tds.h.

◆ TDS_DBG_SEVERE

#define TDS_DBG_SEVERE   __FILE__, ((__LINE__ << 4) | 1)

Definition at line 859 of file tds.h.

◆ TDS_DBG_WARN

#define TDS_DBG_WARN   __FILE__, ((__LINE__ << 4) | 3)

Definition at line 857 of file tds.h.

◆ TDS_DBGFLAG_ALL

#define TDS_DBGFLAG_ALL   0xfff

Definition at line 868 of file tds.h.

◆ TDS_DBGFLAG_ERROR

#define TDS_DBGFLAG_ERROR   0x04

Definition at line 866 of file tds.h.

◆ TDS_DBGFLAG_FUNC

#define TDS_DBGFLAG_FUNC   0x80

Definition at line 861 of file tds.h.

◆ TDS_DBGFLAG_HEADER

#define TDS_DBGFLAG_HEADER   0x0400

Definition at line 870 of file tds.h.

◆ TDS_DBGFLAG_INFO1

#define TDS_DBGFLAG_INFO1   0x20

Definition at line 863 of file tds.h.

◆ TDS_DBGFLAG_INFO2

#define TDS_DBGFLAG_INFO2   0x40

Definition at line 862 of file tds.h.

◆ TDS_DBGFLAG_LOGIN

#define TDS_DBGFLAG_LOGIN   0x0800

Definition at line 869 of file tds.h.

◆ TDS_DBGFLAG_NETWORK

#define TDS_DBGFLAG_NETWORK   0x10

Definition at line 864 of file tds.h.

◆ TDS_DBGFLAG_PID

#define TDS_DBGFLAG_PID   0x1000

Definition at line 871 of file tds.h.

◆ TDS_DBGFLAG_SEVERE

#define TDS_DBGFLAG_SEVERE   0x02

Definition at line 867 of file tds.h.

◆ TDS_DBGFLAG_SOURCE

#define TDS_DBGFLAG_SOURCE   0x4000

Definition at line 873 of file tds.h.

◆ TDS_DBGFLAG_THREAD

#define TDS_DBGFLAG_THREAD   0x8000

Definition at line 874 of file tds.h.

◆ TDS_DBGFLAG_TIME

#define TDS_DBGFLAG_TIME   0x2000

Definition at line 872 of file tds.h.

◆ TDS_DBGFLAG_WARN

#define TDS_DBGFLAG_WARN   0x08

Definition at line 865 of file tds.h.

◆ TDS_DEF_BLKSZ

#define TDS_DEF_BLKSZ   512

Definition at line 437 of file tds.h.

◆ TDS_DEF_CHARSET

#define TDS_DEF_CHARSET   "iso_1"

Definition at line 438 of file tds.h.

◆ TDS_DEF_LANG

#define TDS_DEF_LANG   "us_english"

Definition at line 439 of file tds.h.

◆ TDS_DEF_PORT

#define TDS_DEF_PORT   1433

Definition at line 457 of file tds.h.

◆ TDS_DEF_SERVER

#define TDS_DEF_SERVER   "SYBASE"

Definition at line 436 of file tds.h.

◆ TDS_DEFAULT_VERSION

#define TDS_DEFAULT_VERSION   0x000

Definition at line 456 of file tds.h.

◆ TDS_DESCRIBE_RESULT

#define TDS_DESCRIBE_RESULT   4051

Definition at line 223 of file tds.h.

◆ TDS_DONE_RESULT

#define TDS_DONE_RESULT   4052

Definition at line 224 of file tds.h.

◆ TDS_DONEINPROC_RESULT

#define TDS_DONEINPROC_RESULT   4054

Definition at line 226 of file tds.h.

◆ TDS_DONEPROC_RESULT

#define TDS_DONEPROC_RESULT   4053

Definition at line 225 of file tds.h.

◆ TDS_END_LEN

#define TDS_END_LEN   while(0); } while(tds_freeze_close(current_freeze), 0); } while(0);

Definition at line 1671 of file tds.h.

◆ TDS_FAIL

#define TDS_FAIL   ((TDSRET)-1)

Definition at line 199 of file tds.h.

◆ TDS_FAILED

#define TDS_FAILED (   rc)    ((rc)<0)

Definition at line 201 of file tds.h.

◆ tds_get_ctx

#define tds_get_ctx (   tds)    ((tds)->conn->tds_ctx)

Definition at line 1309 of file tds.h.

◆ tds_get_int

#define tds_get_int (   tds)    ((TDS_INT) tds_get_uint(tds))

Definition at line 1543 of file tds.h.

◆ tds_get_int8

#define tds_get_int8 (   tds)    ((TDS_INT8) tds_get_uint8(tds))

Definition at line 1545 of file tds.h.

◆ tds_get_parent

#define tds_get_parent (   tds)    ((tds)->parent)

Definition at line 1311 of file tds.h.

◆ tds_get_s

#define tds_get_s (   tds)    ((tds)->conn->s)

Definition at line 1313 of file tds.h.

◆ tds_get_smallint

#define tds_get_smallint (   tds)    ((TDS_SMALLINT) tds_get_usmallint(tds))

Definition at line 1541 of file tds.h.

◆ TDS_GSSAPI_DELEGATION

#define TDS_GSSAPI_DELEGATION   "enable gssapi delegation"

Definition at line 495 of file tds.h.

◆ TDS_INT_CANCEL

#define TDS_INT_CANCEL   2

Definition at line 207 of file tds.h.

◆ TDS_INT_CONTINUE

#define TDS_INT_CONTINUE   1

Definition at line 206 of file tds.h.

◆ TDS_INT_TIMEOUT

#define TDS_INT_TIMEOUT   3

Definition at line 208 of file tds.h.

◆ TDS_INVALID_TYPE

#define TDS_INVALID_TYPE   ((TDS_SERVER_TYPE) 0)

Definition at line 155 of file tds.h.

◆ TDS_IS_MSSQL

#define TDS_IS_MSSQL (   x)    (((x)->conn->product_version & 0x80000000u)!=0)

Check if product is Microsft SQL Server.

x should be a TDSSOCKET*.

Definition at line 1807 of file tds.h.

◆ TDS_IS_SYBASE

#define TDS_IS_SYBASE (   x)    (!((x)->conn->product_version & 0x80000000u))

Check if product is Sybase (such as Adaptive Server Enterrprice).

x should be a TDSSOCKET*.

Definition at line 1805 of file tds.h.

◆ TDS_MAJOR

#define TDS_MAJOR (   x)    ((x)->tds_version >> 8)

Definition at line 1799 of file tds.h.

◆ TDS_MAX_CAPABILITY

#define TDS_MAX_CAPABILITY   32

Definition at line 430 of file tds.h.

◆ TDS_MAX_CONN

#define TDS_MAX_CONN   4096

Definition at line 432 of file tds.h.

◆ TDS_MAX_DYNID_LEN

#define TDS_MAX_DYNID_LEN   30

Definition at line 433 of file tds.h.

◆ TDS_MAX_LOGIN_STR_SZ

#define TDS_MAX_LOGIN_STR_SZ   128

Definition at line 540 of file tds.h.

◆ TDS_MINOR

#define TDS_MINOR (   x)    ((x)->tds_version & 0xff)

Definition at line 1800 of file tds.h.

◆ TDS_MS_VER

#define TDS_MS_VER (   maj,
  min,
 
)    (0x80000000u|((maj)<<24)|((min)<<16)|(x))

Calc a version number for mssql.

Use with TDS_MS_VER(7,0,842). For test for a range of version you can use check like if (tds->product_version >= TDS_MS_VER(7,0,0) && tds->product_version < TDS_MS_VER(8,0,0))

Definition at line 1812 of file tds.h.

◆ TDS_MSG_RESULT

#define TDS_MSG_RESULT   4044

Definition at line 216 of file tds.h.

◆ tds_new

#define tds_new (   type,
  n 
)    ((type *) malloc(sizeof(type) * (n)))

Definition at line 1414 of file tds.h.

◆ tds_new0

#define tds_new0 (   type,
  n 
)    ((type *) calloc(n, sizeof(type)))

Definition at line 1415 of file tds.h.

◆ TDS_NO_COUNT

#define TDS_NO_COUNT   -1

Definition at line 211 of file tds.h.

◆ TDS_NO_MORE_RESULTS

#define TDS_NO_MORE_RESULTS   ((TDSRET)1)

Definition at line 197 of file tds.h.

◆ TDS_NULLTERM

#define TDS_NULLTERM   -9

Definition at line 342 of file tds.h.

◆ TDS_OTHERS_RESULT

#define TDS_OTHERS_RESULT   4055

Definition at line 227 of file tds.h.

◆ tds_packet_get_data_start

#define tds_packet_get_data_start (   pkt)    0

Definition at line 1110 of file tds.h.

◆ tds_packet_zero_data_start

#define tds_packet_zero_data_start (   pkt)    do { } while(0)

Definition at line 1109 of file tds.h.

◆ TDS_PARAM_RESULT

#define TDS_PARAM_RESULT   4042

Definition at line 214 of file tds.h.

◆ TDS_PROPAGATE

#define TDS_PROPAGATE (   rc)     do { TDSRET _tds_ret = (rc); if (TDS_FAILED(_tds_ret)) return _tds_ret; } while(0)

Definition at line 203 of file tds.h.

◆ TDS_PUT_BYTE

#define TDS_PUT_BYTE (   tds,
 
)    tds_put_byte((tds), ((unsigned char)(v)))

Definition at line 1829 of file tds.h.

◆ TDS_PUT_INT

#define TDS_PUT_INT (   tds,
 
)    tds_put_int((tds), ((TDS_INT)(v)))

Definition at line 1827 of file tds.h.

◆ TDS_PUT_SMALLINT

#define TDS_PUT_SMALLINT (   tds,
 
)    tds_put_smallint((tds), ((TDS_SMALLINT)(v)))

Definition at line 1828 of file tds.h.

◆ tds_put_tinyint

#define tds_put_tinyint (   tds,
  ti 
)    tds_put_byte(tds,ti)

Output a tinyint value.

Definition at line 1530 of file tds.h.

◆ TDS_RESIZE

#define TDS_RESIZE (   p,
  n_elem 
)     tds_realloc((void **) &(p), sizeof(*(p)) * (size_t) (n_elem))

Definition at line 1412 of file tds.h.

◆ TDS_ROW_RESULT

#define TDS_ROW_RESULT   4040

Definition at line 213 of file tds.h.

◆ TDS_ROWFMT_RESULT

#define TDS_ROWFMT_RESULT   4049

Definition at line 221 of file tds.h.

◆ tds_set_ctx

#define tds_set_ctx (   tds,
  val 
)    do { ((tds)->conn->tds_ctx) = (val); } while(0)

Definition at line 1310 of file tds.h.

◆ tds_set_parent

#define tds_set_parent (   tds,
  val 
)    do { ((tds)->parent) = (val); } while(0)

Definition at line 1312 of file tds.h.

◆ tds_set_s

#define tds_set_s (   tds,
  val 
)    do { ((tds)->conn->s) = (val); } while(0)

Definition at line 1314 of file tds.h.

◆ TDS_START_LEN_GENERIC

#define TDS_START_LEN_GENERIC (   tds_socket,
  len 
)
Value:
do { \
TDSFREEZE current_freeze[1]; \
tds_freeze((tds_socket), current_freeze, (len)); do { do
int len
Information for a server connection.
Definition: tds.h:1211

Definition at line 1668 of file tds.h.

◆ TDS_START_LEN_TINYINT

#define TDS_START_LEN_TINYINT (   tds_socket)    TDS_START_LEN_GENERIC(tds_socket, 1)

Definition at line 1673 of file tds.h.

◆ TDS_START_LEN_UINT

#define TDS_START_LEN_UINT (   tds_socket)    TDS_START_LEN_GENERIC(tds_socket, 4)

Definition at line 1675 of file tds.h.

◆ TDS_START_LEN_USMALLINT

#define TDS_START_LEN_USMALLINT (   tds_socket)    TDS_START_LEN_GENERIC(tds_socket, 2)

Definition at line 1674 of file tds.h.

◆ TDS_STATUS_RESULT

#define TDS_STATUS_RESULT   4043

Definition at line 215 of file tds.h.

◆ TDS_STR_APPENDMODE

#define TDS_STR_APPENDMODE   "dump file append"

Definition at line 480 of file tds.h.

◆ TDS_STR_ASA_DATABASE

#define TDS_STR_ASA_DATABASE   "asa database"

Definition at line 485 of file tds.h.

◆ TDS_STR_BLKSZ

#define TDS_STR_BLKSZ   "initial block size"

Definition at line 462 of file tds.h.

◆ TDS_STR_CAFILE

#define TDS_STR_CAFILE   "ca file"

Definition at line 503 of file tds.h.

◆ TDS_STR_CHARSET

#define TDS_STR_CHARSET   "charset"

Definition at line 476 of file tds.h.

◆ TDS_STR_CHECKSSLHOSTNAME

#define TDS_STR_CHECKSSLHOSTNAME   "check certificate hostname"

Definition at line 507 of file tds.h.

◆ TDS_STR_CLCHARSET

#define TDS_STR_CLCHARSET   "client charset"

Definition at line 477 of file tds.h.

◆ TDS_STR_CONNTIMEOUT

#define TDS_STR_CONNTIMEOUT   "connect timeout"

Definition at line 469 of file tds.h.

◆ TDS_STR_CRLFILE

#define TDS_STR_CRLFILE   "crl file"

Definition at line 505 of file tds.h.

◆ TDS_STR_DATABASE

#define TDS_STR_DATABASE   "database"

Definition at line 486 of file tds.h.

◆ TDS_STR_DATEFMT

#define TDS_STR_DATEFMT   "date-only format"

Definition at line 482 of file tds.h.

◆ TDS_STR_DATETIMEFMT

#define TDS_STR_DATETIMEFMT   "date format"

Definition at line 481 of file tds.h.

◆ TDS_STR_DBFILENAME

#define TDS_STR_DBFILENAME   "database filename"

Definition at line 509 of file tds.h.

◆ TDS_STR_DEBUGFLAGS

#define TDS_STR_DEBUGFLAGS   "debug flags"

Definition at line 466 of file tds.h.

◆ TDS_STR_DEBUGLVL

#define TDS_STR_DEBUGLVL   "debug level"

Definition at line 465 of file tds.h.

◆ TDS_STR_DUMPFILE

#define TDS_STR_DUMPFILE   "dump file"

Definition at line 464 of file tds.h.

◆ TDS_STR_EMUL_LE

#define TDS_STR_EMUL_LE   "emulate little endian"

Definition at line 475 of file tds.h.

◆ TDS_STR_ENABLE_TLS_V1

#define TDS_STR_ENABLE_TLS_V1   "enable tls v1"

Definition at line 515 of file tds.h.

◆ TDS_STR_ENCRYPTION

#define TDS_STR_ENCRYPTION   "encryption"

Definition at line 487 of file tds.h.

◆ TDS_STR_ENCRYPTION_OFF

#define TDS_STR_ENCRYPTION_OFF   "off"

Definition at line 491 of file tds.h.

◆ TDS_STR_ENCRYPTION_REQUEST

#define TDS_STR_ENCRYPTION_REQUEST   "request"

Definition at line 492 of file tds.h.

◆ TDS_STR_ENCRYPTION_REQUIRE

#define TDS_STR_ENCRYPTION_REQUIRE   "require"

Definition at line 493 of file tds.h.

◆ TDS_STR_HOST

#define TDS_STR_HOST   "host"

Definition at line 471 of file tds.h.

◆ TDS_STR_HOSTNAME

#define TDS_STR_HOSTNAME   "hostname"

Definition at line 470 of file tds.h.

◆ TDS_STR_INSTANCE

#define TDS_STR_INSTANCE   "instance"

Definition at line 484 of file tds.h.

◆ TDS_STR_LANGUAGE

#define TDS_STR_LANGUAGE   "language"

Definition at line 479 of file tds.h.

◆ TDS_STR_MUTUAL_AUTHENTICATION

#define TDS_STR_MUTUAL_AUTHENTICATION   "mutual authentication"

Definition at line 497 of file tds.h.

◆ TDS_STR_PORT

#define TDS_STR_PORT   "port"

Definition at line 472 of file tds.h.

◆ TDS_STR_QUERY_TIMEOUT

#define TDS_STR_QUERY_TIMEOUT   "query timeout"

Definition at line 468 of file tds.h.

◆ TDS_STR_READONLY_INTENT

#define TDS_STR_READONLY_INTENT   "read-only intent"

Definition at line 511 of file tds.h.

◆ TDS_STR_REALM

#define TDS_STR_REALM   "realm"

Definition at line 499 of file tds.h.

◆ TDS_STR_SPN

#define TDS_STR_SPN   "spn"

Definition at line 501 of file tds.h.

◆ TDS_STR_SWAPDT

#define TDS_STR_SWAPDT   "swap broken dates"

Definition at line 463 of file tds.h.

◆ TDS_STR_TEXTSZ

#define TDS_STR_TEXTSZ   "text size"

Definition at line 473 of file tds.h.

◆ TDS_STR_TIMEFMT

#define TDS_STR_TIMEFMT   "time-only format"

Definition at line 483 of file tds.h.

◆ TDS_STR_TIMEOUT

#define TDS_STR_TIMEOUT   "timeout"

Definition at line 467 of file tds.h.

◆ TDS_STR_USE_UTF_16

#define TDS_STR_USE_UTF_16   "use utf-16"

Definition at line 478 of file tds.h.

◆ TDS_STR_USELANMAN

#define TDS_STR_USELANMAN   "use lanman"

Definition at line 489 of file tds.h.

◆ TDS_STR_USENTLMV2

#define TDS_STR_USENTLMV2   "use ntlmv2"

Definition at line 488 of file tds.h.

◆ TDS_STR_VERSION

#define TDS_STR_VERSION   "tds version"

Definition at line 461 of file tds.h.

◆ TDS_SUCCEED

#define TDS_SUCCEED (   rc)    ((rc)>=0)

Definition at line 202 of file tds.h.

◆ TDS_SUCCESS

#define TDS_SUCCESS   ((TDSRET)0)

Definition at line 198 of file tds.h.

◆ TDS_SYB_VER

#define TDS_SYB_VER (   maj,
  min,
 
)    (((maj)<<24)|((min)<<16)|(x)<<8)

Calc a version number for Sybase.

Definition at line 1816 of file tds.h.

◆ TDS_TOKEN_FLAG

#define TDS_TOKEN_FLAG (   flag)    TDS_RETURN_##flag = (1 << (TDS_TOKEN_RES_##flag*2)), TDS_STOPAT_##flag = (2 << (TDS_TOKEN_RES_##flag*2))

Definition at line 243 of file tds.h.

◆ TDSDUMP_BUF_FAST

#define TDSDUMP_BUF_FAST   if (TDS_UNLIKELY(tds_write_dump)) tdsdump_do_dump_buf

Definition at line 1589 of file tds.h.

◆ tdsdump_dump_buf

#define tdsdump_dump_buf   TDSDUMP_BUF_FAST

Definition at line 1590 of file tds.h.

◆ tdsdump_log

#define tdsdump_log   TDSDUMP_LOG_FAST

Definition at line 1588 of file tds.h.

◆ TDSDUMP_LOG_FAST

#define TDSDUMP_LOG_FAST   if (TDS_UNLIKELY(tds_write_dump)) tdsdump_do_log

Definition at line 1587 of file tds.h.

◆ TDSSELREAD

#define TDSSELREAD   POLLIN

Definition at line 1608 of file tds.h.

◆ TDSSELWRITE

#define TDSSELWRITE   POLLOUT

Definition at line 1609 of file tds.h.

◆ TLS_STR_OPENSSL_CIPHERS

#define TLS_STR_OPENSSL_CIPHERS   "openssl ciphers"

Definition at line 513 of file tds.h.

Typedef Documentation

◆ BCPCOLDATA

typedef struct tds_bcpcoldata BCPCOLDATA

◆ err_handler_t

typedef int(* err_handler_t) (const TDSCONTEXT *, TDSSOCKET *, TDSMESSAGE *)

Definition at line 1055 of file tds.h.

◆ TDS5COLINFO

typedef struct tds5_colinfo TDS5COLINFO

◆ tds_bcp_get_col_data

typedef TDSRET(* tds_bcp_get_col_data) (TDSBCPINFO *bulk, TDSCOLUMN *bcpcol, int offset)

Definition at line 1759 of file tds.h.

◆ tds_bcp_null_error

typedef void(* tds_bcp_null_error) (TDSBCPINFO *bulk, int index, int offset)

Definition at line 1760 of file tds.h.

◆ TDS_CAPABILITIES

◆ TDS_CAPABILITY_TYPE

◆ TDS_CHAR

typedef char TDS_CHAR

Definition at line 141 of file tds.h.

◆ TDS_COMPILETIME_SETTINGS

A structure to hold all the compile-time settings.

This structure is returned by tds_get_compiletime_settings

◆ TDS_CURSOR_FETCH

◆ TDS_CURSOR_OPERATION

◆ TDS_CURSOR_STATUS

◆ TDS_ENCODING

typedef struct tds_encoding TDS_ENCODING

Information relevant to libiconv.

The name is an iconv name, not the same as found in master..syslanguages.

◆ TDS_ENCRYPTION_LEVEL

◆ TDS_FLOAT

Definition at line 151 of file tds.h.

◆ tds_func_check

typedef int tds_func_check(const TDSCOLUMN *col)

Definition at line 668 of file tds.h.

◆ tds_func_get_data

typedef TDSRET tds_func_get_data(TDSSOCKET *tds, TDSCOLUMN *col)

Definition at line 664 of file tds.h.

◆ tds_func_get_info

typedef TDSRET tds_func_get_info(TDSSOCKET *tds, TDSCOLUMN *col)

Definition at line 663 of file tds.h.

◆ tds_func_put_data

typedef TDSRET tds_func_put_data(TDSSOCKET *tds, TDSCOLUMN *col, int bcp7)

Definition at line 667 of file tds.h.

◆ tds_func_put_info

typedef TDSRET tds_func_put_info(TDSSOCKET *tds, TDSCOLUMN *col)

Definition at line 666 of file tds.h.

◆ tds_func_row_len

typedef TDS_INT tds_func_row_len(TDSCOLUMN *col)

Definition at line 665 of file tds.h.

◆ TDS_INT

typedef int32_t TDS_INT

Definition at line 146 of file tds.h.

◆ TDS_INT8

typedef int64_t TDS_INT8

Definition at line 148 of file tds.h.

◆ TDS_OPERATION

◆ TDS_OPTION_ARG

◆ TDS_REAL

Definition at line 150 of file tds.h.

◆ TDS_SMALLINT

Definition at line 144 of file tds.h.

◆ TDS_STATE

typedef enum tds_states TDS_STATE

values for tds->state

◆ TDS_TINYINT

Definition at line 143 of file tds.h.

◆ TDS_TVP

typedef struct tds_tvp TDS_TVP

◆ TDS_TVP_ROW

typedef struct tds_tvp_row TDS_TVP_ROW

◆ TDS_UCHAR

typedef uint8_t TDS_UCHAR

Definition at line 142 of file tds.h.

◆ TDS_UINT

typedef uint32_t TDS_UINT

Definition at line 147 of file tds.h.

◆ TDS_UINT8

Definition at line 149 of file tds.h.

◆ TDS_USMALLINT

Definition at line 145 of file tds.h.

◆ TDSAUTHENTICATION

◆ TDSBCPINFO

typedef struct tds_bcpinfo TDSBCPINFO

Definition at line 1 of file tds.h.

◆ TDSBLOB

typedef struct tds_blob TDSBLOB

Information about blobs (e.g.

text or image). current_row contains this structure.

◆ TDSCOLUMN

typedef struct tds_column TDSCOLUMN

Definition at line 1 of file tds.h.

◆ TDSCOLUMNFUNCS

◆ TDSCOMPUTEINFO

Definition at line 668 of file tds.h.

◆ TDSCONFPARSE

typedef void(* TDSCONFPARSE) (const char *option, const char *value, void *param)

Definition at line 1333 of file tds.h.

◆ TDSCONNECTION

typedef struct tds_connection TDSCONNECTION

Definition at line 1 of file tds.h.

◆ TDSCONTEXT

typedef struct tds_context TDSCONTEXT

Definition at line 901 of file tds.h.

◆ TDSCURSOR

typedef struct tds_cursor TDSCURSOR

Holds informations about a cursor.

◆ TDSDATEREC

typedef struct tdsdaterec TDSDATEREC

Used by tds_datecrack.

◆ TDSDUMP_OFF_ITEM

◆ TDSDYNAMIC

typedef struct tds_dynamic TDSDYNAMIC

Holds information for a dynamic (also called prepared) query.

◆ TDSENV

typedef struct tds_env TDSENV

Current environment as reported by the server.

◆ TDSFREEZE

typedef struct tds_freeze TDSFREEZE

◆ TDSHEADERS

typedef struct tds_headers TDSHEADERS

◆ TDSICONV

typedef struct tdsiconvinfo TDSICONV

Definition at line 1 of file tds.h.

◆ TDSLOCALE

typedef struct tds_locale TDSLOCALE

◆ TDSLOGIN

typedef struct tds_login TDSLOGIN

◆ TDSMESSAGE

typedef struct tds_message TDSMESSAGE

◆ TDSMULTIPLE

typedef struct tds_multiple TDSMULTIPLE

◆ TDSPACKET

typedef struct tds_packet TDSPACKET

◆ TDSPARAMINFO

Definition at line 901 of file tds.h.

◆ TDSPOLLWAKEUP

◆ TDSRESULTINFO

Hold information for any results.

◆ TDSRET

typedef int TDSRET

Definition at line 196 of file tds.h.

◆ TDSSOCKET

typedef struct tds_socket TDSSOCKET

Definition at line 1 of file tds.h.

◆ TDSUPDCOL

typedef struct tds_upd_col TDSUPDCOL

◆ TDSVARIANT

typedef struct tds_variant TDSVARIANT

Store variant informations.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
TDS_CUR_ISTAT_UNUSED 
TDS_CUR_ISTAT_DECLARED 
TDS_CUR_ISTAT_OPEN 
TDS_CUR_ISTAT_CLOSED 
TDS_CUR_ISTAT_RDONLY 
TDS_CUR_ISTAT_UPDATABLE 
TDS_CUR_ISTAT_ROWCNT 
TDS_CUR_ISTAT_DEALLOC 

Definition at line 330 of file tds.h.

◆ anonymous enum

anonymous enum
Enumerator
TDS_TYPEFLAG_INVALID 
TDS_TYPEFLAG_NULLABLE 
TDS_TYPEFLAG_FIXED 
TDS_TYPEFLAG_VARIABLE 
TDS_TYPEFLAG_COLLATE 
TDS_TYPEFLAG_ASCII 
TDS_TYPEFLAG_UNICODE 
TDS_TYPEFLAG_BINARY 
TDS_TYPEFLAG_DATETIME 
TDS_TYPEFLAG_NUMERIC 
TDS_TYPEFLAG_VARIANT 

Definition at line 377 of file tds.h.

◆ tds_bcp_directions

bcp direction

Enumerator
TDS_BCP_IN 
TDS_BCP_OUT 
TDS_BCP_QUERYOUT 
TDS_BCP_IN 
TDS_BCP_OUT 
TDS_BCP_QUERYOUT 

Definition at line 1719 of file tds.h.

◆ tds_cursor_fetch

Enumerator
TDS_CURSOR_FETCH_NEXT 
TDS_CURSOR_FETCH_PREV 
TDS_CURSOR_FETCH_FIRST 
TDS_CURSOR_FETCH_LAST 
TDS_CURSOR_FETCH_ABSOLUTE 
TDS_CURSOR_FETCH_RELATIVE 
TDS_CURSOR_FETCH_NEXT 
TDS_CURSOR_FETCH_PREV 
TDS_CURSOR_FETCH_FIRST 
TDS_CURSOR_FETCH_LAST 
TDS_CURSOR_FETCH_ABSOLUTE 
TDS_CURSOR_FETCH_RELATIVE 

Definition at line 952 of file tds.h.

◆ tds_cursor_operation

Enumerator
TDS_CURSOR_POSITION 
TDS_CURSOR_UPDATE 
TDS_CURSOR_DELETE 
TDS_CURSOR_INSERT 
TDS_CURSOR_POSITION 
TDS_CURSOR_UPDATE 
TDS_CURSOR_DELETE 
TDS_CURSOR_INSERT 

Definition at line 944 of file tds.h.

◆ TDS_CURSOR_STATE

Enumerator
TDS_CURSOR_STATE_UNACTIONED 
TDS_CURSOR_STATE_REQUESTED 
TDS_CURSOR_STATE_SENT 
TDS_CURSOR_STATE_ACTIONED 
TDS_CURSOR_STATE_UNACTIONED 
TDS_CURSOR_STATE_REQUESTED 
TDS_CURSOR_STATE_SENT 
TDS_CURSOR_STATE_ACTIONED 

Definition at line 927 of file tds.h.

◆ tds_encryption_level

Enumerator
TDS_ENCRYPTION_OFF 
TDS_ENCRYPTION_REQUEST 
TDS_ENCRYPTION_REQUIRE 
TDS_ENCRYPTION_DEFAULT 
TDS_ENCRYPTION_OFF 
TDS_ENCRYPTION_REQUEST 
TDS_ENCRYPTION_REQUIRE 

Definition at line 353 of file tds.h.

◆ tds_end

enum tds_end

Flags returned in TDS_DONE token.

Enumerator
TDS_DONE_FINAL 

final result set, command completed successfully.

TDS_DONE_MORE_RESULTS 

more results follow

TDS_DONE_ERROR 

error occurred

TDS_DONE_INXACT 

transaction in progress

TDS_DONE_PROC 

results are from a stored procedure

TDS_DONE_COUNT 

count field in packet is valid

TDS_DONE_CANCELLED 

acknowledging an attention command (usually a cancel)

TDS_DONE_EVENT 
TDS_DONE_SRVERROR 

SQL server server error.

TDS_DONE_NO_TRAN 
TDS_DONE_TRAN_SUCCEED 
TDS_DONE_TRAN_PROGRESS 
TDS_DONE_STMT_ABORT 
TDS_DONE_TRAN_ABORT 
TDS_DONE_FINAL 

final result set, command completed successfully.

TDS_DONE_MORE_RESULTS 

more results follow

TDS_DONE_ERROR 

error occurred

TDS_DONE_INXACT 

transaction in progress

TDS_DONE_PROC 

results are from a stored procedure

TDS_DONE_COUNT 

count field in packet is valid

TDS_DONE_CANCELLED 

acknowledging an attention command (usually a cancel)

TDS_DONE_EVENT 
TDS_DONE_SRVERROR 

SQL server server error.

TDS_DONE_NO_TRAN 
TDS_DONE_TRAN_SUCCEED 
TDS_DONE_TRAN_PROGRESS 
TDS_DONE_STMT_ABORT 
TDS_DONE_TRAN_ABORT 

Definition at line 265 of file tds.h.

◆ TDS_ICONV_ENTRY

Enumerator
client2ucs2 
client2server_chardata 
initial_char_conv_count 
client2ucs2 
client2server_chardata 
initial_char_conv_count 

Definition at line 1068 of file tds.h.

◆ TDS_MULTIPLE_TYPE

Enumerator
TDS_MULTIPLE_QUERY 
TDS_MULTIPLE_EXECUTE 
TDS_MULTIPLE_RPC 
TDS_MULTIPLE_QUERY 
TDS_MULTIPLE_EXECUTE 
TDS_MULTIPLE_RPC 

Definition at line 1041 of file tds.h.

◆ tds_operations

Enumerator
TDS_OP_NONE 
TDS_OP_CURSOR 
TDS_OP_CURSOROPEN 
TDS_OP_CURSORPREPARE 
TDS_OP_CURSOREXECUTE 
TDS_OP_CURSORPREPEXEC 
TDS_OP_CURSORUNPREPARE 
TDS_OP_CURSORFETCH 
TDS_OP_CURSOROPTION 
TDS_OP_CURSORCLOSE 
TDS_OP_EXECUTESQL 
TDS_OP_PREPARE 
TDS_OP_EXECUTE 
TDS_OP_PREPEXEC 
TDS_OP_PREPEXECRPC 
TDS_OP_UNPREPARE 
TDS_OP_DYN_DEALLOC 
TDS_OP_NONE 
TDS_OP_CURSOR 
TDS_OP_CURSOROPEN 
TDS_OP_CURSORPREPARE 
TDS_OP_CURSOREXECUTE 
TDS_OP_CURSORPREPEXEC 
TDS_OP_CURSORUNPREPARE 
TDS_OP_CURSORFETCH 
TDS_OP_CURSOROPTION 
TDS_OP_CURSORCLOSE 
TDS_OP_EXECUTESQL 
TDS_OP_PREPARE 
TDS_OP_EXECUTE 
TDS_OP_PREPEXEC 
TDS_OP_PREPEXECRPC 
TDS_OP_UNPREPARE 
TDS_OP_DYN_DEALLOC 

Definition at line 826 of file tds.h.

◆ tds_states

enum tds_states

values for tds->state

Enumerator
TDS_IDLE 

no data expected

TDS_WRITING 

client is writing data

TDS_SENDING 

client would send data

TDS_PENDING 

cilent is waiting for data

TDS_READING 

client is reading data

TDS_DEAD 

no connection

TDS_IDLE 

no data expected

TDS_WRITING 

client is writing data

TDS_SENDING 

client would send data

TDS_PENDING 

cilent is waiting for data

TDS_READING 

client is reading data

TDS_DEAD 

no connection

Definition at line 816 of file tds.h.

◆ tds_token_flags

Enumerator
TDS_HANDLE_ALL 
TDS_RETURN_OTHERS 
TDS_STOPAT_OTHERS 
TDS_RETURN_ROWFMT 
TDS_STOPAT_ROWFMT 
TDS_RETURN_COMPUTEFMT 
TDS_STOPAT_COMPUTEFMT 
TDS_RETURN_PARAMFMT 
TDS_STOPAT_PARAMFMT 
TDS_RETURN_DONE 
TDS_STOPAT_DONE 
TDS_RETURN_ROW 
TDS_STOPAT_ROW 
TDS_RETURN_COMPUTE 
TDS_STOPAT_COMPUTE 
TDS_RETURN_PROC 
TDS_STOPAT_PROC 
TDS_RETURN_MSG 
TDS_STOPAT_MSG 
TDS_RETURN_ENV 
TDS_STOPAT_ENV 
TDS_TOKEN_RESULTS 
TDS_TOKEN_TRAILING 
TDS_HANDLE_ALL 
TDS_RETURN_OTHERS 
TDS_STOPAT_OTHERS 
TDS_RETURN_ROWFMT 
TDS_STOPAT_ROWFMT 
TDS_RETURN_COMPUTEFMT 
TDS_STOPAT_COMPUTEFMT 
TDS_RETURN_PARAMFMT 
TDS_STOPAT_PARAMFMT 
TDS_RETURN_DONE 
TDS_STOPAT_DONE 
TDS_RETURN_ROW 
TDS_STOPAT_ROW 
TDS_RETURN_COMPUTE 
TDS_STOPAT_COMPUTE 
TDS_RETURN_PROC 
TDS_STOPAT_PROC 
TDS_RETURN_MSG 
TDS_STOPAT_MSG 
TDS_RETURN_ENV 
TDS_STOPAT_ENV 
TDS_TOKEN_RESULTS 
TDS_TOKEN_TRAILING 

Definition at line 245 of file tds.h.

◆ tds_token_results

Enumerator
TDS_TOKEN_RES_OTHERS 
TDS_TOKEN_RES_ROWFMT 
TDS_TOKEN_RES_COMPUTEFMT 
TDS_TOKEN_RES_PARAMFMT 
TDS_TOKEN_RES_DONE 
TDS_TOKEN_RES_ROW 
TDS_TOKEN_RES_COMPUTE 
TDS_TOKEN_RES_PROC 
TDS_TOKEN_RES_MSG 
TDS_TOKEN_RES_ENV 
TDS_TOKEN_RES_OTHERS 
TDS_TOKEN_RES_ROWFMT 
TDS_TOKEN_RES_COMPUTEFMT 
TDS_TOKEN_RES_PARAMFMT 
TDS_TOKEN_RES_DONE 
TDS_TOKEN_RES_ROW 
TDS_TOKEN_RES_COMPUTE 
TDS_TOKEN_RES_PROC 
TDS_TOKEN_RES_MSG 
TDS_TOKEN_RES_ENV 

Definition at line 229 of file tds.h.

◆ TDSERRNO

enum TDSERRNO
Enumerator
TDSEOK 
TDSEVERDOWN 
TDSEICONVIU 
TDSEICONVAVAIL 
TDSEICONVO 
TDSEICONVI 
TDSEICONV2BIG 
TDSEPORTINSTANCE 
TDSESYNC 
TDSEFCON 
TDSETIME 
TDSEREAD 
TDSEWRIT 
TDSESOCK 
TDSECONN 
TDSEMEM 
TDSEINTF 
TDSEUHST 
TDSEPWD 
TDSESEOF 
TDSERPND 
TDSEBTOK 
TDSEOOB 
TDSECLOS 
TDSEUSCT 
TDSEUTDS 
TDSEEUNR 
TDSECAP 
TDSENEG 
TDSEUMSG 
TDSECAPTYP 
TDSECONF 
TDSEBPROBADTYP 
TDSECLOSEIN 
TDSEOK 
TDSEVERDOWN 
TDSEINPROGRESS 
TDSEICONVIU 
TDSEICONVAVAIL 
TDSEICONVO 
TDSEICONVI 
TDSEICONV2BIG 
TDSEPORTINSTANCE 
TDSESYNC 
TDSEFCON 
TDSETIME 
TDSEREAD 
TDSEWRIT 
TDSESOCK 
TDSECONN 
TDSEMEM 
TDSEINTF 
TDSEUHST 
TDSEPWD 
TDSESEOF 
TDSERPND 
TDSEBTOK 
TDSEOOB 
TDSECLOS 
TDSEUSCT 
TDSEUTDS 
TDSEEUNR 
TDSECAP 
TDSENEG 
TDSEUMSG 
TDSECAPTYP 
TDSECONF 
TDSEBPROBADTYP 
TDSECLOSEIN 

Definition at line 292 of file tds.h.

Function Documentation

◆ is_tds_type_valid()

static bool is_tds_type_valid ( int  type)
inlinestatic

Definition at line 424 of file tds.h.

References tds_type_flags_ms, and type.

◆ tds5_gss_send()

TDSRET tds5_gss_send ( TDSSOCKET tds)

Referenced by tds_send_login().

◆ tds5_negotiate_set_msg_type()

static void tds5_negotiate_set_msg_type ( TDSAUTHENTICATION tds_auth,
unsigned  msg_type 
)
inlinestatic

Definition at line 1709 of file tds.h.

References tds_authentication::msg_type.

◆ tds5_send_optioncmd()

int tds5_send_optioncmd ( TDSSOCKET tds,
TDS_OPTION_CMD  tds_command,
TDS_OPTION  tds_option,
TDS_OPTION_ARG tds_argument,
TDS_INT tds_argsize 
)

◆ tds_alloc_additional_socket()

TDSSOCKET* tds_alloc_additional_socket ( TDSCONNECTION conn)

◆ tds_bcp_done()

TDSRET tds_bcp_done ( TDSSOCKET tds,
int rows_copied 
)

Tell we finished sending BCP data to server \tds.

Parameters
[out]rows_copiednumber of rows copied to server

Definition at line 898 of file bulk.c.

References tds_socket::out_flag, tds_socket::rows_affected, tds, TDS_BULK, TDS_DBG_FUNC, TDS_FAIL, TDS_FAILED, tds_flush_packet, TDS_PENDING, tds_process_simple_query, tds_set_state, TDS_SUCCESS, TDS_WRITING, and tdsdump_log.

◆ 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().

Return values
TDS_SUCCESSsuccess
TDS_FAILerror reading the column
TDS_NO_MORE_RESULTSend of file detected

Definition at line 1141 of file bulk.c.

References tds_output_stream::buf_len, tds_output_stream::buffer, free(), NULL, outbuf, r(), tds_dynamic_stream::size, tds_dynamic_stream::stream, tds, tds_convert_stream, tds_copy_stream, tds_dynamic_stream_init, TDS_FAIL, TDS_FAILED, tds_file_stream_read(), tds_new0, TDS_NO_MORE_RESULTS, terminator, to_server, and tds_output_stream::write.

◆ tds_bcp_init()

TDSRET tds_bcp_init ( TDSSOCKET tds,
TDSBCPINFO bcpinfo 
)

◆ 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 \tds.

Parameters
bcpinfoBCP information
get_col_datafunction to call to retrieve data to be sent
ignoredfunction to call if we try to send NULL if not allowed (not used)
offsetpassed to get_col_data and null_error to specify the row to get
Returns
TDS_SUCCESS or TDS_FAIL.

Definition at line 344 of file bulk.c.

References assert, tds_column::bcp_column_data, tds_bcpinfo::bindinfo, tds_bcpinfo::blob_cols, cleanup(), tds_column::column_bindlen, tds_column::column_cur_size, tds_column::column_data, tds_column::column_identity, tds_column::column_lenbind, tds_column::column_nullable, tds_column::column_textpos, tds_column::column_timestamp, tds_column::column_type, tds_column::column_varaddr, tds_column::column_varint_size, tds_result_info::columns, tds_socket::conn, tds_result_info::current_row, tds_bcpcoldata::data, tds_bcpcoldata::datalen, tds_column::funcs, i, tds_bcpinfo::identity_insert_on, is_blob_col, is_blob_type, tds_bcpcoldata::is_null, is_nullable_type, IS_TDS7_PLUS, MIN, tds_bcpinfo::next_col, NULL, tds_result_info::num_cols, offset, tds_column::on_server, tds_socket::out_flag, tds_column_funcs::put_data, tds_result_info::row_size, tds_bcpinfo::rows_sent, tds, tds5_send_record(), tds7_send_record(), tds_bcp_add_fixed_columns(), tds_bcp_add_variable_columns(), tds_bcp_is_bound(), TDS_BULK, TDS_DBG_FUNC, TDS_DBG_INFO1, TDS_FAIL, TDS_FAILED, TDS_NO_MORE_RESULTS, tds_put_byte, tds_put_int, tds_put_n, tds_put_smallint, TDS_PUT_UA2, TDS_ROW_TOKEN, TDS_SENDING, tds_set_state, TDS_SUCCESS, TDS_WRITING, tdsdump_log, tds_bcpinfo::text_sent, and tds_blob::textvalue.

◆ tds_bcp_start()

TDSRET tds_bcp_start ( TDSSOCKET tds,
TDSBCPINFO bcpinfo 
)

◆ tds_bcp_start_copy_in()

TDSRET tds_bcp_start_copy_in ( TDSSOCKET tds,
TDSBCPINFO bcpinfo 
)

◆ tds_capability_enabled()

static bool tds_capability_enabled ( const TDS_CAPABILITY_TYPE cap,
unsigned  cap_num 
)
inlinestatic

Definition at line 1775 of file tds.h.

References tds_capability_type::values.

◆ tds_connect_and_login()

int tds_connect_and_login ( TDSSOCKET tds,
TDSLOGIN login 
)

Definition at line 657 of file login.c.

References login, tds, and tds_connect().

◆ tds_convert_string_free()

void tds_convert_string_free ( const char *  original,
const char *  converted 
)

◆ tds_get_cardinal_type()

TDS_SERVER_TYPE tds_get_cardinal_type ( TDS_SERVER_TYPE  datatype,
int  usertype 
)

◆ 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)

Parameters
srctypetype to convert
colsizesize of type
Returns
type for conversion

Definition at line 124 of file tds_types.h.

References SYB5INT8, SYBBIT, SYBBITN, SYBDATE, SYBDATEN, SYBDATETIME, SYBDATETIME4, SYBDATETIMN, SYBFLT8, SYBFLTN, SYBINT1, SYBINT2, SYBINT4, SYBINT8, SYBINTN, SYBMONEY, SYBMONEY4, SYBMONEYN, SYBREAL, SYBTIME, SYBTIMEN, SYBUINT1, SYBUINT2, SYBUINT4, SYBUINT8, and SYBUINTN.

◆ tds_get_home_file()

char * tds_get_home_file ( const char *  file)

Return filename from HOME directory.

Returns
allocated string or NULL if error

Definition at line 325 of file config.c.

References asprintf, file, free(), NULL, and tds_get_homedir.

Referenced by tds_read_conf_file(), and tds_read_interfaces().

◆ tds_get_locale()

TDSLOCALE* tds_get_locale ( void  )

Get locale information.

Returns
allocated structure with all information or NULL if error

Definition at line 50 of file locale.c.

References buf, FREETDS_LOCALECONFFILE, in(), locale, NULL, strlcpy, tds_alloc_locale, TDS_DBG_INFO1, tds_parse_locale(), tds_read_conf_section, and tdsdump_log.

◆ tds_get_size_by_type()

int tds_get_size_by_type ( TDS_SERVER_TYPE  servertype)

◆ 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 TDS 7.0 result string

tds_get_varint_size() returns the size of a variable length integer returned in a TDS 7.0 result string

Definition at line 57 of file tds_types.h.

References conn, IS_TDS50, IS_TDS7_PLUS, SYB5INT8, SYBBIT, SYBDATE, SYBDATETIME, SYBDATETIME4, SYBFLT8, SYBIMAGE, SYBINT1, SYBINT2, SYBINT4, SYBINT8, SYBINTERVAL, SYBLONGBINARY, SYBLONGCHAR, SYBMONEY, SYBMONEY4, SYBMSUDT, SYBMSXML, SYBNTEXT, SYBREAL, SYBSINT1, SYBTEXT, SYBTIME, SYBUINT1, SYBUINT2, SYBUINT4, SYBUINT8, SYBUNITEXT, SYBVARIANT, SYBVOID, SYBXML, XSYBBINARY, XSYBCHAR, XSYBNCHAR, XSYBNVARCHAR, XSYBVARBINARY, and XSYBVARCHAR.

◆ tds_getmac()

void tds_getmac ( TDS_SYS_SOCKET  s,
unsigned char  mac[6] 
)

Definition at line 45 of file getmac.c.

References buf, and i.

◆ tds_gettime_ms()

unsigned int tds_gettime_ms ( void  )

Definition at line 209 of file util.c.

References NULL.

◆ tds_gss_get_auth()

TDSAUTHENTICATION* tds_gss_get_auth ( TDSSOCKET tds)

◆ tds_iconv_alloc()

int tds_iconv_alloc ( TDSCONNECTION conn)

Allocate iconv stuff.

Returns
0 for success

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.

◆ tds_money_to_string()

char* tds_money_to_string ( const TDS_MONEY money,
char *  s,
bool  use_2_digits 
)

Definition at line 64 of file numeric.c.

References if(), tdsoldmoney::mnyhigh, tdsoldmoney::mnylow, n, PRIu64, and tdsmoney::tdsoldmoney.

◆ tds_numeric_change_prec_scale()

TDS_INT tds_numeric_change_prec_scale ( TDS_NUMERIC numeric,
unsigned char  new_prec,
unsigned char  new_scale 
)

◆ tds_numeric_to_string()

TDS_INT tds_numeric_to_string ( const TDS_NUMERIC numeric,
char *  s 
)

◆ tds_prwsaerror()

char* tds_prwsaerror ( int  erc)

◆ tds_prwsaerror_free()

void tds_prwsaerror_free ( char *  s)

◆ tds_random_buffer()

void tds_random_buffer ( unsigned char *  out,
int  len 
)

Definition at line 40 of file random.c.

References free(), i, len, and out().

◆ tds_release_cur_dyn()

static void tds_release_cur_dyn ( TDSSOCKET tds)
inlinestatic

Definition at line 1388 of file tds.h.

References tds_socket::cur_dyn, tds, and tds_release_dynamic().

◆ tds_set_app()

bool tds_set_app ( TDSLOGIN tds_login,
const char *  application 
)

Definition at line 112 of file login.c.

References tds_login::app_name, and tds_dstr_copy().

◆ tds_set_bulk()

void tds_set_bulk ( TDSLOGIN tds_login,
bool  enabled 
)

Definition at line 94 of file login.c.

References tds_login::bulk_copy.

◆ tds_set_client_charset()

bool tds_set_client_charset ( TDSLOGIN tds_login,
const char *  charset 
)

Definition at line 162 of file login.c.

References tds_login::client_charset, and tds_dstr_copy().

◆ tds_set_column_type()

void tds_set_column_type ( TDSCONNECTION conn,
TDSCOLUMN curcol,
TDS_SERVER_TYPE  type 
)

Set type of column initializing all dependency.

Parameters
curcolcolumn to set
typetype to set

column_usertype should already be set.

Parameters
curcolcolumn to set
typetype to set

Definition at line 225 of file data.c.

References tds_column::column_cur_size, tds_column::column_size, tds_column::column_type, tds_column::column_usertype, tds_column::column_varint_size, conn, tds_column::funcs, tds_column::on_server, tds_get_cardinal_type(), tds_get_column_funcs(), tds_get_size_by_type, tds_get_varint_size, and type.

Referenced by tds_set_param_type().

◆ tds_set_current_send_packet()

static void tds_set_current_send_packet ( TDSSOCKET tds,
TDSPACKET pkt 
)
inlinestatic

◆ tds_set_host()

bool tds_set_host ( TDSLOGIN tds_login,
const char *  hostname 
)

Definition at line 106 of file login.c.

References tds_login::client_host_name, and tds_dstr_copy().

◆ tds_set_language()

bool tds_set_language ( TDSLOGIN tds_login,
const char *  language 
)

Definition at line 168 of file login.c.

References tds_login::language, and tds_dstr_copy().

◆ tds_set_library()

bool tds_set_library ( TDSLOGIN tds_login,
const char *  library 
)

Definition at line 156 of file login.c.

References tds_login::library, and tds_dstr_copy().

◆ tds_set_packet()

void tds_set_packet ( TDSLOGIN tds_login,
int  packet_size 
)

Definition at line 73 of file login.c.

References tds_login::block_size.

◆ tds_set_param_type()

void tds_set_param_type ( TDSCONNECTION conn,
TDSCOLUMN curcol,
TDS_SERVER_TYPE  type 
)

◆ tds_set_passwd()

bool tds_set_passwd ( TDSLOGIN tds_login,
const char *  password 
)

Definition at line 85 of file login.c.

References tds_login::password, tds_dstr_copy(), and tds_dstr_zero().

◆ tds_set_port()

void tds_set_port ( TDSLOGIN tds_login,
int  port 
)

Definition at line 79 of file login.c.

References tds_login::port.

◆ tds_set_server()

bool tds_set_server ( TDSLOGIN tds_login,
const char *  server 
)

Set the servername in a TDSLOGIN structure.

Normally copies server into tds_login. If server does not point to a plausible name, the environment variables TDSQUERY and DSQUERY are used, in that order. If they don't exist, the "default default" servername is "SYBASE" (although the utility of that choice is a bit murky).

Parameters
tds_loginpoints to a TDSLOGIN structure
serverthe servername, or NULL, or a zero-length string

Normally copies server into tds_login. If server does not point to a plausible name, the environment variables TDSQUERY and DSQUERY are used, in that order. If they don't exist, the "default default" servername is "SYBASE" (although the utility of that choice is a bit murky).

Parameters
tds_loginpoints to a TDSLOGIN structure
serverthe servername, or NULL, or a zero-length string

Definition at line 129 of file login.c.

References i, names, tds_login::server_name, rapidjson::source, TDS_DBG_INFO1, tds_dstr_copy(), TDS_VECTOR_SIZE, and tdsdump_log.

◆ tds_set_state()

TDS_STATE tds_set_state ( TDSSOCKET tds,
TDS_STATE  state 
)

◆ tds_set_user()

bool tds_set_user ( TDSLOGIN tds_login,
const char *  username 
)

Definition at line 100 of file login.c.

References tds_dstr_copy(), and tds_login::user_name.

◆ tds_set_version()

void tds_set_version ( TDSLOGIN tds_login,
TDS_TINYINT  major_ver,
TDS_TINYINT  minor_ver 
)

Definition at line 67 of file login.c.

References tds_login::tds_version.

◆ 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 Please note that some system implementation of strndup do not assure they don't read past len bytes as they use still strlen to check length to copy limiting after strlen to size passed Also this function is different from strndup as it assume that len bytes are valid String returned is NUL terminated.

Parameters
sstring to copy from
lenlength to copy
Returns
string copied or NULL if errors

Copy a string of length len to a new allocated buffer This function does not read more than len bytes Please note that some system implementation of strndup do not assure they don't read past len bytes as they use still strlen to check length to copy limiting after strlen to size passed Also this function is different from strndup as it assume that len bytes are valid String returned is NUL terminated.

Please note that some system implementations of strndup do not assure they don't read past len bytes as they use still strlen to check length to copy limiting after strlen to size passed. String returned is NUL terminated.

Parameters
sstring to copy from
lenlength to copy
Returns
string copied or NULL if errors

Definition at line 414 of file util.c.

References len, NULL, out(), and tds_new.

◆ tds_swap_bytes()

void tds_swap_bytes ( void *  buf,
int  bytes 
)

Definition at line 185 of file util.c.

References buf, last(), and tmp.

◆ tds_vstrbuild()

TDSRET tds_vstrbuild ( char *  buffer,
int  buflen,
int resultlen,
const char *  text,
int  textlen,
const char *  formats,
int  formatlen,
va_list  ap 
)

◆ tds_wakeup_get_fd()

static TDS_SYS_SOCKET tds_wakeup_get_fd ( const TDSPOLLWAKEUP wakeup)
inlinestatic

Definition at line 1620 of file tds.h.

References tds_poll_wakeup::s_signaled.

◆ 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.

You should write in total (with multiple calls to this function) all bytes declared calling tds_writetext_start. \tds

Parameters
textdata to write
sizedata size in bytes

Definition at line 1249 of file bulk.c.

References tds_socket::out_flag, ncbi::grid::netcache::search::fields::size, tds, TDS_BULK, TDS_FAIL, tds_put_n, TDS_SENDING, tds_set_state, TDS_SUCCESS, TDS_WRITING, and text().

◆ tds_writetext_end()

TDSRET tds_writetext_end ( TDSSOCKET tds)

Finish sending writetext data.

\tds

Definition at line 1266 of file bulk.c.

References tds_socket::out_flag, tds, TDS_BULK, TDS_FAIL, tds_flush_packet, TDS_PENDING, tds_set_state, TDS_SUCCESS, and TDS_WRITING.

◆ 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.

This request start a bulk session. \tds

Parameters
objnametable name
textptrTEXTPTR (see sql documentation)
timestampdata timestamp
with_logis log is enabled during insert
sizebytes to be inserted

Definition at line 1211 of file bulk.c.

References tds_socket::bulk_query, tds_socket::out_flag, ncbi::grid::netcache::search::fields::size, tds, TDS_BULK, TDS_FAIL, TDS_FAILED, tds_process_simple_query, tds_put_int, TDS_SENDING, tds_set_state, tds_submit_queryf, TDS_SUCCESS, and TDS_WRITING.

◆ tdsdump_close()

void tdsdump_close ( void  )

Close the TDS dump log file.

Definition at line 207 of file log.c.

References g_dump_filename, g_dump_mutex, g_dumpfile, NULL, tds_mutex_lock, tds_mutex_unlock, tds_write_dump, and TDS_ZERO_FREE.

◆ tdsdump_col()

void tdsdump_col ( const TDSCOLUMN col)

◆ tdsdump_do_dump_buf()

void tdsdump_do_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.

Parameters
filesource file name
level_lineline and level combined. This and file are automatically computed by TDS_DBG_* macros.
msgmessage to print before dump
bufbuffer to dump
lengthnumber of bytes in the buffer

Definition at line 270 of file log.c.

References buf, BYTES_PER_LINE, current_thread_is_excluded(), data, file, g_dump_filename, g_dump_mutex, g_dumpfile, i, isprint(), line_buf, msg(), NULL, tds_debug_flags, tds_g_append_mode, tds_mutex_lock, tds_mutex_unlock, tds_write_dump, tdsdump_append(), tdsdump_elided, and tdsdump_start().

◆ tdsdump_do_log()

void tdsdump_do_log ( const char *  file,
unsigned int  level_line,
const char *  fmt,
  ... 
)

Write a message to the debug log.

Parameters
filename of the log file
level_linekind of detail to be included
fmtprintf-like format string

Definition at line 370 of file log.c.

References current_thread_is_excluded(), file, g_dump_filename, g_dump_mutex, g_dumpfile, NULL, tds_debug_flags, tds_g_append_mode, tds_mutex_lock, tds_mutex_unlock, tds_write_dump, tdsdump_append(), and tdsdump_start().

◆ tdsdump_isopen()

int tdsdump_isopen ( void  )

Definition at line 111 of file log.c.

References g_dump_filename, and g_dumpfile.

Referenced by tdsdump_on().

◆ tdsdump_off()

void tdsdump_off ( TDSDUMP_OFF_ITEM off_item)

Temporarily turn off logging for current thread.

Parameters
off_itemList item to be used by the function. The item will be initialized by the function. It's retained till is removed with tdsdump_on so it must be kept alive.

Definition at line 81 of file log.c.

References g_dump_mutex, tdsdump_off_item::next, off_list, tds_mutex_lock, tds_mutex_unlock, tds_thread_get_current_id(), tds_write_dump, and tdsdump_off_item::thread_id.

◆ tdsdump_on()

void tdsdump_on ( TDSDUMP_OFF_ITEM off_item)

Turn logging back on for current thread.

Parameters
off_itemList item to remove from global list. Previously used by tdsdump_off().

Definition at line 101 of file log.c.

References g_dump_mutex, tdsdump_off_item::next, NULL, off_list, tds_mutex_lock, and tds_mutex_unlock.

◆ tdsdump_open()

int tdsdump_open ( const char *  filename)

Create and truncate a human readable dump file for the TDS traffic.

The name of the file is specified by the filename parameter. If that is given as NULL or an empty string, any existing log file will be closed.

Returns
true if the file was opened, false if it couldn't be opened.

Definition at line 126 of file log.c.

References g_dump_filename, g_dump_mutex, g_dumpfile, NULL, result, util::strcmp(), strdup, t, TDS_DBG_INFO1, tds_debug_flags, tds_g_append_mode, tds_localtime_r, tds_mutex_lock, tds_mutex_unlock, tds_write_dump, TDS_ZERO_FREE, tdsdump_append(), tdsdump_log, and VERSION.

◆ 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)

The client library error handler may return: TDS_INT_CANCEL – Return TDS_FAIL to the calling function. For TDSETIME, closes the connection first. TDS_INT_CONTINUE – For TDSETIME only, retry the network read/write operation. Else invalid. TDS_INT_TIMEOUT – For TDSETIME only, send a TDSCANCEL packet. Else invalid.

These are Sybase semantics, but they serve all purposes. The application tells the library to quit, fail, retry, or attempt to cancel. In the event of a network timeout, a failed operation necessarily means the connection becomes unusable, because no cancellation dialog was concluded with the server.

It is the client library's duty to call the error handler installed by the application, if any, and to interpret the installed handler's return code. It may return to this function one of the above codes only. This function will not check the return code because there's nothing that can be done here except abort. It is merely passed to the calling function, which will (we hope) DTRT.

Parameters
tds_ctxpoints to a TDSCONTEXT structure
tdsthe connection structure, may be NULL if not connected
msgnoan enumerated libtds msgno, cf. tds.h
errnumthe OS errno, if it matters, else zero
Returns
client library function's return code

Definition at line 322 of file util.c.

References assert, CHECK_CONTEXT_EXTRA, CHECK_TDS_EXTRA, tds_context::err_handler, msg(), tds_error_message::msgno, tds_error_message::msgtext, NULL, retname(), s_StrError(), tds_error_message::severity, tds, tds_alloc_client_sqlstate, TDS_DBG_ERROR, TDS_DBG_FUNC, TDS_DBG_SEVERE, tds_error_messages, TDS_INT_CANCEL, TDS_INT_CONTINUE, TDS_INT_TIMEOUT, tds_send_cancel, TDS_ZERO_FREE, tdsdump_log, TDSEOK, TDSETIME, and UTIL_ReleaseBuffer.

Referenced by tds_set_state().

Variable Documentation

◆ STD_DATETIME_FMT

const char STD_DATETIME_FMT[]
extern

Definition at line 93 of file config.c.

◆ tds_debug_flags

int tds_debug_flags
extern

Definition at line 53 of file log.c.

Referenced by tdsdump_do_dump_buf(), tdsdump_do_log(), tdsdump_open(), and tdsdump_start().

◆ tds_g_append_mode

int tds_g_append_mode
extern

Definition at line 54 of file log.c.

Referenced by tdsdump_do_dump_buf(), tdsdump_do_log(), and tdsdump_open().

◆ tds_numeric_bytes_per_prec

const int tds_numeric_bytes_per_prec[]
extern

The following little table is indexed by precision and will tell us the number of bytes required to store the specified precision.

The following little table is indexed by precision and will tell us the number of bytes required to store the specified precision.

Support precision up to 77 digits

Definition at line 41 of file numeric.c.

Referenced by tds_numeric_change_prec_scale(), and tds_numeric_to_string().

◆ tds_type_flags_ms

const uint16_t tds_type_flags_ms[256]
extern

Definition at line 189 of file tds_types.h.

◆ tds_write_dump

int tds_write_dump
extern

Tell if TDS debug logging is turned on or off.

Definition at line 57 of file log.c.

Referenced by tdsdump_close(), tdsdump_do_dump_buf(), tdsdump_do_log(), tdsdump_off(), tdsdump_on(), tdsdump_open(), and tdsdump_state().

Modified on Fri Sep 20 14:57:09 2024 by modify_doxy.py rev. 669887