Main include file for libtds. More...
#include <stdarg.h>
#include <stdio.h>
#include <time.h>
#include "tdsver.h"
#include "tds_sysdep_public.h"
Go to the source code of this file.
Classes | |
union | tds_align_struct |
struct | tds_authentication |
struct | tds_bcpcoldata |
struct | tds_bcpinfo |
struct | tds_blob |
Information about blobs (e.g. More... | |
struct | tds_capabilities |
struct | tds_capability_type |
struct | tds_column |
Metadata about columns in regular and compute rows. More... | |
struct | tds_column_funcs |
struct | tds_compiletime_settings |
A structure to hold all the compile-time settings. More... | |
struct | tds_connection |
struct | tds_context |
struct | tds_cursor |
Holds informations about a cursor. More... | |
struct | tds_cursor_status |
struct | TDS_DATETIMEALL |
struct | tds_dstr |
struct | tds_dynamic |
Holds information for a dynamic (also called prepared) query. More... | |
struct | tds_encoding |
Information relevant to libiconv. More... | |
struct | tds_env |
Current environment as reported by the server. More... | |
struct | tds_locale |
struct | tds_login |
struct | tds_message |
struct | tds_multiple |
union | tds_option_arg |
struct | tds_result_info |
Hold information for any results. More... | |
struct | tds_socket |
Information for a server connection. More... | |
struct | tds_upd_col |
struct | tds_variant |
Store variant informations. More... | |
struct | tdsdaterec |
Used by tds_datecrack. More... | |
Defines | |
#define | is_ascii_type(x) ( x==XSYBCHAR || x==XSYBVARCHAR || x==SYBTEXT || x==SYBCHAR || x==SYBVARCHAR) |
#define | is_blob_col(x) ((x)->column_varint_size > 2) |
#define | is_blob_type(x) (x==SYBTEXT || x==SYBIMAGE || x==SYBNTEXT) |
#define | is_char_type(x) (is_unicode_type(x) || is_ascii_type(x)) |
#define | is_collate_type(x) (x==XSYBVARCHAR || x==XSYBCHAR || x==SYBTEXT || x==XSYBNVARCHAR || x==XSYBNCHAR || x==SYBNTEXT) |
#define | is_end_token(x) |
#define | is_fixed_type(x) |
#define | is_hard_end_token(x) |
#define | is_msg_token(x) |
#define | is_nullable_type(x) |
#define | is_numeric_type(x) (x==SYBNUMERIC || x==SYBDECIMAL) |
#define | is_result_token(x) |
#define | is_similar_type(x, y) ((is_char_type(x) && is_char_type(y)) || ((is_unicode_type(x) && is_unicode_type(y)))) |
#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_TDS71_PLUS(x) ((x)->tds_version>=0x701) |
#define | IS_TDS72(x) (x->tds_version==0x702) |
#define | IS_TDS72_PLUS(x) ((x)->tds_version>=0x702) |
#define | IS_TDS73(x) (x->tds_version==0x703) |
#define | IS_TDS73_PLUS(x) ((x)->tds_version>=0x703) |
#define | IS_TDS7_PLUS(x) ((x)->tds_version>=0x700) |
#define | IS_TDSDEAD(x) (((x) == NULL) || TDS_IS_SOCKET_INVALID(tds_conn(x)->s)) |
#define | is_unicode_type(x) (x==XSYBNVARCHAR || x==XSYBNCHAR || x==SYBNTEXT || x==SYBMSXML) |
#define | is_variable_type(x) |
#define | MAXPRECISION 77 |
#define | TDS_ALIGN_SIZE sizeof(tds_align_struct) |
#define | TDS_BYTE_SWAP16(value) |
#define | TDS_BYTE_SWAP32(value) |
#define | TDS_CANCELLED ((TDSRET)-2) |
#define | TDS_CMD_DONE 4046 |
#define | TDS_CMD_FAIL 4048 |
#define | TDS_CMD_SUCCEED 4047 |
#define | TDS_COMPUTE_RESULT 4045 |
#define | TDS_COMPUTEFMT_RESULT 4050 |
#define | tds_conn(tds) (&(tds)->conn) |
#define | tds_convert_string_free(original, converted) do { if (original != converted) free((char*) converted); } while(0) |
#define | TDS_DBG_ERROR __FILE__, ((__LINE__ << 4) | 2) |
#define | TDS_DBG_FUNC __FILE__, ((__LINE__ << 4) | 7) |
#define | TDS_DBG_HEADER __FILE__, ((__LINE__ << 4) | 10) |
#define | TDS_DBG_INFO1 __FILE__, ((__LINE__ << 4) | 5) |
#define | TDS_DBG_INFO2 __FILE__, ((__LINE__ << 4) | 6) |
#define | TDS_DBG_LOGIN __FILE__, ((__LINE__ << 4) | 11) |
#define | TDS_DBG_NETWORK __FILE__, ((__LINE__ << 4) | 4) |
#define | TDS_DBG_SEVERE __FILE__, ((__LINE__ << 4) | 1) |
#define | TDS_DBG_WARN __FILE__, ((__LINE__ << 4) | 3) |
#define | TDS_DBGFLAG_ALL 0xfff |
#define | TDS_DBGFLAG_ERROR 0x04 |
#define | TDS_DBGFLAG_FUNC 0x80 |
#define | TDS_DBGFLAG_HEADER 0x0400 |
#define | TDS_DBGFLAG_INFO1 0x20 |
#define | TDS_DBGFLAG_INFO2 0x40 |
#define | TDS_DBGFLAG_LOGIN 0x0800 |
#define | TDS_DBGFLAG_NETWORK 0x10 |
#define | TDS_DBGFLAG_PID 0x1000 |
#define | TDS_DBGFLAG_SEVERE 0x02 |
#define | TDS_DBGFLAG_SOURCE 0x4000 |
#define | TDS_DBGFLAG_THREAD 0x8000 |
#define | TDS_DBGFLAG_TIME 0x2000 |
#define | TDS_DBGFLAG_WARN 0x08 |
#define | TDS_DEF_BLKSZ 512 |
#define | TDS_DEF_CHARSET "iso_1" |
#define | TDS_DEF_LANG "us_english" |
#define | TDS_DEF_PORT 4000 |
#define | TDS_DEF_SERVER "SYBASE" |
#define | TDS_DEFAULT_VERSION 0x500 |
#define | TDS_DESCRIBE_RESULT 4051 |
#define | TDS_DONE_RESULT 4052 |
#define | TDS_DONEINPROC_RESULT 4054 |
#define | TDS_DONEPROC_RESULT 4053 |
#define | TDS_FAIL ((TDSRET)-1) |
#define | TDS_FAILED(rc) ((rc)<0) |
#define | tds_get_ctx(tds) (tds_conn(tds)->tds_ctx) |
#define | tds_get_parent(tds) (tds_conn(tds)->parent) |
#define | tds_get_s(tds) (tds_conn(tds)->s) |
#define | TDS_GSSAPI_DELEGATION "enable gssapi delegation" |
#define | TDS_INT_CANCEL 2 |
#define | TDS_INT_CONTINUE 1 |
#define | TDS_INT_TIMEOUT 3 |
#define | TDS_IS_MSSQL(x) ((tds_conn(x)->product_version & 0x80000000u)!=0) |
Check if product is Microsft SQL Server. | |
#define | TDS_IS_SYBASE(x) (!(tds_conn(x)->product_version & 0x80000000u)) |
Check if product is Sybase (such as Adaptive Server Enterrprice). | |
#define | TDS_LIKELY(x) (x) |
#define | TDS_MAJOR(x) ((x)->tds_version >> 8) |
#define | TDS_MAX_CAPABILITY 22 |
#define | TDS_MAX_CONN 4096 |
#define | TDS_MAX_DYNID_LEN 30 |
#define | TDS_MAX_LOGIN_STR_SZ 30 |
#define | TDS_MINOR(x) ((x)->tds_version & 0xff) |
#define | TDS_MS_VER(maj, min, x) (0x80000000u|((maj)<<24)|((min)<<16)|(x)) |
Calc a version number for mssql. | |
#define | TDS_MSG_RESULT 4044 |
#define | TDS_NO_COUNT -1 |
#define | TDS_NO_MORE_RESULTS ((TDSRET)1) |
#define | TDS_NULLTERM -9 |
#define | TDS_OFFSET(str, field) (((char*)&((str*)0)->field)-((char*)0)) |
#define | TDS_OTHERS_RESULT 4055 |
#define | TDS_PARAM_RESULT 4042 |
#define | TDS_PUT_BYTE(tds, v) tds_put_byte((tds), ((unsigned char)(v))) |
#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_tinyint(tds, ti) tds_put_byte(tds,ti) |
Output a tinyint value. | |
#define | TDS_ROW_RESULT 4040 |
#define | TDS_ROWFMT_RESULT 4049 |
#define | tds_set_ctx(tds, val) do { (tds_conn(tds)->tds_ctx) = (val); } while(0) |
#define | tds_set_parent(tds, val) do { (tds_conn(tds)->parent) = (val); } while(0) |
#define | tds_set_s(tds, val) do { (tds_conn(tds)->s) = (val); } while(0) |
#define | TDS_STATUS_RESULT 4043 |
#define | TDS_STR_APPENDMODE "dump file append" |
#define | TDS_STR_ASA_DATABASE "asa database" |
#define | TDS_STR_BLKSZ "initial block size" |
#define | TDS_STR_CHARSET "charset" |
#define | TDS_STR_CLCHARSET "client charset" |
#define | TDS_STR_CONNTIMEOUT "connect timeout" |
#define | TDS_STR_DATEFMT "date format" |
#define | TDS_STR_DEBUGFLAGS "debug flags" |
#define | TDS_STR_DEBUGLVL "debug level" |
#define | TDS_STR_DUMPFILE "dump file" |
#define | TDS_STR_EMUL_LE "emulate little endian" |
#define | TDS_STR_ENCRYPTION "encryption" |
#define | TDS_STR_ENCRYPTION_OFF "off" |
#define | TDS_STR_ENCRYPTION_REQUEST "request" |
#define | TDS_STR_ENCRYPTION_REQUIRE "require" |
#define | TDS_STR_HOST "host" |
#define | TDS_STR_HOSTNAME "hostname" |
#define | TDS_STR_INSTANCE "instance" |
#define | TDS_STR_LANGUAGE "language" |
#define | TDS_STR_PORT "port" |
#define | TDS_STR_QUERY_TIMEOUT "query timeout" |
#define | TDS_STR_REALM "realm" |
#define | TDS_STR_SPN "spn" |
#define | TDS_STR_SWAPDT "swap broken dates" |
#define | TDS_STR_TEXTSZ "text size" |
#define | TDS_STR_TIMEOUT "timeout" |
#define | TDS_STR_USENTLMV2 "use ntlmv2" |
#define | TDS_STR_VERSION "tds version" |
#define | TDS_SUCCEED(rc) ((rc)>=0) |
#define | TDS_SUCCESS ((TDSRET)0) |
#define | TDS_SYB_VER(maj, min, x) (((maj)<<24)|((min)<<16)|(x)<<8) |
Calc a version number for Sybase. | |
#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_UNLIKELY(x) (x) |
#define | TDS_VECTOR_SIZE(x) (sizeof(x)/sizeof(x[0])) |
#define | TDS_ZERO_FREE(x) do {free((x)); (x) = NULL;} while(0) |
#define | tdsdump_log if (TDS_UNLIKELY(tds_write_dump)) tdsdump_log |
Typedefs | |
typedef struct tds_bcpcoldata | BCPCOLDATA |
typedef struct tds_dstr | DSTR |
typedef int(* | err_handler_t )(const TDSCONTEXT *, TDSSOCKET *, TDSMESSAGE *) |
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) |
typedef struct tds_capabilities | TDS_CAPABILITIES |
typedef struct tds_capability_type | TDS_CAPABILITY_TYPE |
typedef char | TDS_CHAR |
typedef struct tds_compiletime_settings | TDS_COMPILETIME_SETTINGS |
A structure to hold all the compile-time settings. | |
typedef enum tds_cursor_fetch | TDS_CURSOR_FETCH |
typedef enum tds_cursor_operation | TDS_CURSOR_OPERATION |
typedef struct tds_cursor_status | TDS_CURSOR_STATUS |
typedef struct tds_encoding | TDS_ENCODING |
Information relevant to libiconv. | |
typedef enum tds_encryption_level | TDS_ENCRYPTION_LEVEL |
typedef tds_sysdep_real64_type | TDS_FLOAT |
typedef tds_sysdep_int32_type | TDS_INT |
typedef tds_sysdep_int64_type | TDS_INT8 |
typedef tds_sysdep_intptr_type | TDS_INTPTR |
typedef union tds_option_arg | TDS_OPTION_ARG |
typedef tds_sysdep_real32_type | TDS_REAL |
typedef tds_sysdep_int16_type | TDS_SMALLINT |
typedef enum tds_states | TDS_STATE |
values for tds->state | |
typedef unsigned char | TDS_TINYINT |
typedef unsigned char | TDS_UCHAR |
typedef unsigned tds_sysdep_int32_type | TDS_UINT |
typedef unsigned tds_sysdep_int64_type | TDS_UINT8 |
typedef unsigned tds_sysdep_int16_type | TDS_USMALLINT |
typedef struct tds_authentication | TDSAUTHENTICATION |
typedef struct tds_bcpinfo | TDSBCPINFO |
typedef struct tds_blob | TDSBLOB |
Information about blobs (e.g. | |
typedef struct tds_column | TDSCOLUMN |
typedef struct tds_column_funcs | TDSCOLUMNFUNCS |
typedef struct tds_result_info | TDSCOMPUTEINFO |
typedef void(* | TDSCONFPARSE )(const char *option, const char *value, void *param) |
typedef struct tds_connection | TDSCONNECTION |
typedef struct tds_context | TDSCONTEXT |
typedef struct tds_cursor | TDSCURSOR |
Holds informations about a cursor. | |
typedef struct tdsdaterec | TDSDATEREC |
Used by tds_datecrack. | |
typedef struct tds_dynamic | TDSDYNAMIC |
Holds information for a dynamic (also called prepared) query. | |
typedef struct tds_env | TDSENV |
Current environment as reported by the server. | |
typedef struct tdsiconvinfo | TDSICONV |
typedef struct tds_locale | TDSLOCALE |
typedef struct tds_login | TDSLOGIN |
typedef struct tds_message | TDSMESSAGE |
typedef struct tds_multiple | TDSMULTIPLE |
typedef TDSRESULTINFO | TDSPARAMINFO |
typedef struct tds_result_info | TDSRESULTINFO |
Hold information for any results. | |
typedef int | TDSRET |
typedef struct tds_socket | TDSSOCKET |
typedef struct tds_upd_col | TDSUPDCOL |
typedef struct tds_variant | TDSVARIANT |
Store variant informations. | |
Enumerations | |
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_SYSNAME_SIZE = 512 } |
enum | tds_bcp_directions { TDS_BCP_IN = 1, TDS_BCP_OUT = 2, TDS_BCP_QUERYOUT = 3 } |
bcp direction | |
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 } |
enum | tds_cursor_operation { TDS_CURSOR_POSITION = 0, TDS_CURSOR_UPDATE = 1, TDS_CURSOR_DELETE = 2, TDS_CURSOR_INSERT = 4 } |
enum | TDS_CURSOR_STATE { TDS_CURSOR_STATE_UNACTIONED = 0, TDS_CURSOR_STATE_REQUESTED = 1, TDS_CURSOR_STATE_SENT = 2, TDS_CURSOR_STATE_ACTIONED = 3 } |
enum | tds_encryption_level { TDS_ENCRYPTION_OFF, TDS_ENCRYPTION_REQUEST, TDS_ENCRYPTION_REQUIRE } |
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 } |
Flags returned in TDS_DONE token. More... | |
enum | TDS_ICONV_ENTRY { client2ucs2, client2server_chardata, iso2server_metadata, initial_char_conv_count } |
enum | TDS_MULTIPLE_TYPE { TDS_MULTIPLE_QUERY, TDS_MULTIPLE_EXECUTE, TDS_MULTIPLE_RPC } |
enum | tds_states { TDS_IDLE, TDS_QUERYING, TDS_PENDING, TDS_READING, TDS_DEAD } |
values for tds->state More... | |
enum | tds_token_flags { TDS_HANDLE_ALL = 0, TDS_TOKEN_FLAG = (OTHERS), TDS_TOKEN_FLAG = (OTHERS), TDS_TOKEN_FLAG = (OTHERS), TDS_TOKEN_FLAG = (OTHERS), TDS_TOKEN_FLAG = (OTHERS), TDS_TOKEN_FLAG = (OTHERS), TDS_TOKEN_FLAG = (OTHERS), TDS_TOKEN_FLAG = (OTHERS), TDS_TOKEN_FLAG = (OTHERS), 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_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 } |
enum | TDSERRNO { TDSEOK = TDS_SUCCESS, 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, TDSEBPROBADTYP = 20250, TDSECLOSEIN = 20292 } |
Functions | |
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 | 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. | |
unsigned char * | tds7_crypt_pass (const unsigned char *clear_pass, size_t len, unsigned char *crypt_pass) |
tds7_crypt_pass() -- 'encrypt' TDS 7.0 style passwords. | |
int | tds7_get_instance_port (const char *ip_addr, const char *instance) |
Get port of given instance. | |
int | tds7_get_instance_ports (FILE *output, const char *ip_addr) |
Get port of all instances. | |
void | tds7_srv_charset_changed (TDSSOCKET *tds, int sql_collate, int lcid) |
TDSSOCKET * | tds_alloc_additional_socket (TDSCONNECTION *conn) |
BCPCOLDATA * | tds_alloc_bcp_column_data (int column_size) |
char * | tds_alloc_client_sqlstate (int msgno) |
TDSCOMPUTEINFO ** | tds_alloc_compute_results (TDSSOCKET *tds, int num_cols, int by_cols) |
TDSRET | tds_alloc_compute_row (TDSCOMPUTEINFO *res_info) |
TDSCONTEXT * | tds_alloc_context (void *parent) |
TDSCURSOR * | tds_alloc_cursor (TDSSOCKET *tds, const char *name, TDS_INT namelen, const char *query, TDS_INT querylen) |
TDSDYNAMIC * | tds_alloc_dynamic (TDSSOCKET *tds, const char *id) |
Allocate a dynamic statement. | |
TDSLOCALE * | tds_alloc_locale (void) |
TDSLOGIN * | tds_alloc_login (int use_environment) |
char * | tds_alloc_lookup_sqlstate (TDSSOCKET *tds, int msgno) |
void * | tds_alloc_param_data (TDSCOLUMN *curparam) |
Allocate data for a parameter. | |
TDSPARAMINFO * | tds_alloc_param_result (TDSPARAMINFO *old_param) |
Adds a output parameter to TDSPARAMINFO. | |
TDSRESULTINFO * | tds_alloc_results (int num_cols) |
TDSRET | tds_alloc_row (TDSRESULTINFO *res_info) |
Allocate space for row store return NULL on out of memory. | |
TDSSOCKET * | tds_alloc_socket (TDSCONTEXT *context, int bufsize) |
TDSRET | tds_bcp_done (TDSSOCKET *tds, int *rows_copied) |
TDSRET | tds_bcp_init (TDSSOCKET *tds, TDSBCPINFO *bcpinfo) |
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) |
TDSRET | tds_bcp_start (TDSSOCKET *tds, TDSBCPINFO *bcpinfo) |
TDSRET | tds_bcp_start_copy_in (TDSSOCKET *tds, TDSBCPINFO *bcpinfo) |
static int | tds_capability_enabled (const TDS_CAPABILITY_TYPE *cap, unsigned cap_num) |
int | tds_close_socket (TDSSOCKET *tds) |
int | tds_config_boolean (const char *value) |
TDS_USMALLINT * | tds_config_verstr (const char *tdsver, TDSLOGIN *login) |
Set TDS version from given string. | |
int | tds_connect_and_login (TDSSOCKET *tds, TDSLOGIN *login) |
int | tds_connection_read (TDSSOCKET *tds, unsigned char *buf, int buflen) |
int | tds_connection_write (TDSSOCKET *tds, unsigned char *buf, int buflen, int final) |
const char * | tds_convert_string (TDSSOCKET *tds, const TDSICONV *char_conv, const char *s, int len, size_t *out_len) |
Convert a string in an allocated buffer. | |
void | tds_convert_string_free (const char *original, const char *converted) |
int | tds_count_placeholders (const char *query) |
Count the number of placeholders in query. | |
TDSRET | tds_cursor_close (TDSSOCKET *tds, TDSCURSOR *cursor) |
TDSRET | tds_cursor_dealloc (TDSSOCKET *tds, TDSCURSOR *cursor) |
Send a deallocation request to server libTDS care for all deallocation stuff (memory and server cursor) Caller should not use cursor pointer anymore. | |
void | tds_cursor_deallocated (TDSSOCKET *tds, TDSCURSOR *cursor) |
TDSRET | tds_cursor_declare (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_open (TDSSOCKET *tds, TDSCURSOR *cursor, TDSPARAMINFO *params, int *send) |
TDSRET | tds_cursor_setname (TDSSOCKET *tds, TDSCURSOR *cursor) |
TDSRET | tds_cursor_setrows (TDSSOCKET *tds, TDSCURSOR *cursor, int *send) |
TDSRET | tds_cursor_update (TDSSOCKET *tds, TDSCURSOR *cursor, TDS_CURSOR_OPERATION op, TDS_INT i_row, TDSPARAMINFO *params) |
TDSRET | tds_datecrack (TDS_INT datetype, const void *di, TDSDATEREC *dr) |
Convert from db date format to a structured date format. | |
size_t | tds_fix_column_size (TDSSOCKET *tds, TDSCOLUMN *curcol) |
Get column size for wire. | |
void | tds_fix_login (TDSLOGIN *login) |
Fix configuration after reading it. | |
TDSRET | tds_flush_packet (TDSSOCKET *tds) |
Flush packet to server. | |
void | tds_free_all_results (TDSSOCKET *tds) |
void | tds_free_bcp_column_data (BCPCOLDATA *coldata) |
void | tds_free_context (TDSCONTEXT *locale) |
void | tds_free_dynamic (TDSSOCKET *tds, TDSDYNAMIC *dyn) |
Frees dynamic statement and remove from TDS. | |
void | tds_free_input_params (TDSDYNAMIC *dyn) |
Frees all allocated input parameters of a dynamic statement. | |
void | tds_free_locale (TDSLOCALE *locale) |
void | tds_free_login (TDSLOGIN *login) |
void | tds_free_msg (TDSMESSAGE *message) |
void | tds_free_param_result (TDSPARAMINFO *param_info) |
Delete latest parameter. | |
void | tds_free_param_results (TDSPARAMINFO *param_info) |
void | tds_free_result_info (TDSRESULTINFO *info) |
void | tds_free_results (TDSRESULTINFO *res_info) |
void | tds_free_row (TDSRESULTINFO *res_info, unsigned char *row) |
void | tds_free_socket (TDSSOCKET *tds) |
unsigned char | tds_get_byte (TDSSOCKET *tds) |
int | tds_get_cardinal_type (int datatype, int usertype) |
TDSRET | tds_get_char_data (TDSSOCKET *tds, char *dest, size_t wire_size, TDSCOLUMN *curcol) |
Fetch character data the wire. | |
const TDS_COMPILETIME_SETTINGS * | tds_get_compiletime_settings (void) |
Return a structure capturing the compile-time settings provided to the configure script. | |
int | tds_get_conversion_type (int srctype, int colsize) |
Return type suitable for conversions (convert all nullable types to fixed type). | |
char * | tds_get_homedir (void) |
Get user home directory. | |
TDS_INT | tds_get_int (TDSSOCKET *tds) |
Get an int32 from the server. | |
TDS_INT8 | tds_get_int8 (TDSSOCKET *tds) |
TDSLOCALE * | tds_get_locale (void) |
Get locale information. | |
void * | tds_get_n (TDSSOCKET *tds, void *dest, int n) |
Get N bytes from the buffer and return them in the already allocated space given to us. | |
int | tds_get_size_by_type (int servertype) |
Return the number of bytes needed by specified type. | |
TDS_SMALLINT | tds_get_smallint (TDSSOCKET *tds) |
Get an int16 from the server. | |
int | tds_get_string (TDSSOCKET *tds, int string_len, char *dest, size_t dest_size) |
Fetch a string from the wire. | |
int | tds_get_token_size (int marker) |
tds_get_token_size() returns the size of a fixed length token used by tds_process_cancel() to determine how to read past a token | |
int | tds_get_varint_size (TDSSOCKET *tds, int datatype) |
tds_get_varint_size() returns the size of a variable length integer returned in a TDS 7.0 result string | |
struct hostent * | tds_gethostbyaddr_r (const char *addr, int len, int type, struct hostent *result, char *buffer, int buflen, int *h_errnop) |
struct hostent * | tds_gethostbyname_r (const char *servername, struct hostent *result, char *buffer, int buflen, int *h_errnop) |
void | tds_getmac (TDS_SYS_SOCKET s, unsigned char mac[6]) |
struct servent * | tds_getservbyname_r (const char *name, const char *proto, struct servent *result, char *buffer, int buflen) |
TDSAUTHENTICATION * | tds_gss_get_auth (TDSSOCKET *tds) |
int | tds_iconv_alloc (TDSSOCKET *tds) |
Allocate iconv stuff. | |
void | tds_iconv_close (TDSSOCKET *tds) |
void | tds_iconv_free (TDSSOCKET *tds) |
TDSICONV * | tds_iconv_from_collate (TDSSOCKET *tds, TDS_UCHAR collate[5]) |
Get iconv information from a LCID (to support different column encoding under MSSQL2K). | |
void | tds_iconv_open (TDSSOCKET *tds, const char *charset) |
TDSLOGIN * | tds_init_login (TDSLOGIN *login, TDSLOCALE *locale) |
Initialize login structure with locale information and other stuff for connection. | |
int | tds_init_write_buf (TDSSOCKET *tds) |
struct tm * | tds_localtime_r (const time_t *timep, struct tm *result) |
TDSDYNAMIC * | tds_lookup_dynamic (TDSSOCKET *tds, const char *id) |
Find a dynamic given string id. | |
TDSRET | tds_lookup_host (const char *servername, char *ip) |
Get the IP address for a hostname. | |
char * | tds_money_to_string (const TDS_MONEY *money, char *s) |
TDSRET | tds_multiple_done (TDSSOCKET *tds, TDSMULTIPLE *multiple) |
TDSRET | tds_multiple_execute (TDSSOCKET *tds, TDSMULTIPLE *multiple, TDSDYNAMIC *dyn) |
TDSRET | tds_multiple_init (TDSSOCKET *tds, TDSMULTIPLE *multiple, TDS_MULTIPLE_TYPE type) |
TDSRET | tds_multiple_query (TDSSOCKET *tds, TDSMULTIPLE *multiple, const char *query, TDSPARAMINFO *params) |
int | tds_needs_unprepare (TDSSOCKET *tds, TDSDYNAMIC *dyn) |
const char * | tds_next_placeholder (const char *start) |
Get position of next placeholder. | |
TDSAUTHENTICATION * | tds_ntlm_get_auth (TDSSOCKET *tds) |
Build a NTLMSPP packet to send to server. | |
TDS_INT | tds_numeric_change_prec_scale (TDS_NUMERIC *numeric, unsigned char new_prec, unsigned char new_scale) |
TDS_INT | tds_numeric_to_string (const TDS_NUMERIC *numeric, char *s) |
TDSERRNO | tds_open_socket (TDSSOCKET *tds, const char *ip_addr, unsigned int port, int timeout, int *p_oserr) |
void | tds_parse_conf_section (const char *option, const char *value, void *param) |
unsigned char | tds_peek (TDSSOCKET *tds) |
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. | |
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. | |
TDSRET | tds_process_tokens (TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsigned flag) |
process all streams. | |
const char * | tds_prtype (int token) |
const char * | tds_prwsaerror (int erc) |
int | tds_put_buf (TDSSOCKET *tds, const unsigned char *buf, int dsize, int ssize) |
int | tds_put_byte (TDSSOCKET *tds, unsigned char c) |
int | tds_put_cancel (TDSSOCKET *tds) |
int | tds_put_int (TDSSOCKET *tds, TDS_INT i) |
int | tds_put_int8 (TDSSOCKET *tds, TDS_INT8 i) |
int | tds_put_n (TDSSOCKET *tds, const void *buf, size_t n) |
int | tds_put_smallint (TDSSOCKET *tds, TDS_SMALLINT si) |
int | tds_put_string (TDSSOCKET *tds, const char *buf, int len) |
Output a string to wire automatic translate string to unicode if needed. | |
int | tds_quote_id (TDSSOCKET *tds, char *buffer, const char *id, int idlen) |
Quote an id. | |
int | tds_quote_string (TDSSOCKET *tds, char *buffer, const char *str, int len) |
Quote a string. | |
int | tds_read_conf_file (TDSLOGIN *login, const char *server) |
Read configuration info for given server return 0 on error. | |
int | 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). | |
TDSLOGIN * | tds_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 | |
int | tds_read_packet (TDSSOCKET *tds) |
Read in one 'packet' from the server. | |
TDSSOCKET * | tds_realloc_socket (TDSSOCKET *tds, size_t bufsize) |
void | tds_release_cursor (TDSSOCKET *tds, TDSCURSOR *cursor) |
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. | |
void | tds_set_app (TDSLOGIN *tds_login, const char *application) |
void | tds_set_bulk (TDSLOGIN *tds_login, TDS_TINYINT enabled) |
void | tds_set_client_charset (TDSLOGIN *tds_login, const char *charset) |
void | tds_set_column_type (TDSSOCKET *tds, TDSCOLUMN *curcol, int type) |
Set type of column initializing all dependency. | |
void | tds_set_database_name (TDSLOGIN *tds_login, const char *dbname) |
void | tds_set_host (TDSLOGIN *tds_login, const char *hostname) |
TDSRET | tds_set_interfaces_file_loc (const char *interfloc) |
Set the full name of interface file. | |
void | tds_set_language (TDSLOGIN *tds_login, const char *language) |
void | tds_set_library (TDSLOGIN *tds_login, const char *library) |
void | tds_set_packet (TDSLOGIN *tds_login, int packet_size) |
void | tds_set_param_type (TDSSOCKET *tds, TDSCOLUMN *curcol, TDS_SERVER_TYPE type) |
Set type of column initializing all dependency. | |
void | tds_set_passwd (TDSLOGIN *tds_login, const char *password) |
void | tds_set_port (TDSLOGIN *tds_login, int port) |
void | tds_set_server (TDSLOGIN *tds_login, const char *server) |
Set the servername in a TDSLOGIN structure. | |
TDS_STATE | tds_set_state (TDSSOCKET *tds, TDS_STATE state) |
Set state of TDS connection, with logging and checking. | |
void | tds_set_user (TDSLOGIN *tds_login, const char *username) |
void | tds_set_version (TDSLOGIN *tds_login, TDS_TINYINT major_ver, TDS_TINYINT minor_ver) |
const char * | tds_skip_quoted (const char *s) |
Skip quoting string (like 'sfsf', "dflkdj" or [dfkjd]). | |
void | tds_srv_charset_changed (TDSSOCKET *tds, const char *charset) |
void | tds_ssl_deinit (TDSCONNECTION *conn) |
TDSRET | tds_ssl_init (TDSSOCKET *tds) |
TDSRET | tds_submit_begin_tran (TDSSOCKET *tds) |
TDSRET | tds_submit_commit (TDSSOCKET *tds, int cont) |
TDSRET | tds_submit_execdirect (TDSSOCKET *tds, const char *query, TDSPARAMINFO *params) |
Submit a prepared query with parameters. | |
TDSRET | tds_submit_execute (TDSSOCKET *tds, TDSDYNAMIC *dyn) |
tds_submit_execute() sends a previously prepared dynamic statement to the server. | |
TDSRET | tds_submit_optioncmd (TDSSOCKET *tds, TDS_OPTION_CMD command, TDS_OPTION option, TDS_OPTION_ARG *param, TDS_INT param_size) |
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. | |
TDSRET | tds_submit_query (TDSSOCKET *tds, const char *query) |
tds_submit_query() sends a language string to the database server for processing. | |
TDSRET | tds_submit_query_params (TDSSOCKET *tds, const char *query, TDSPARAMINFO *params) |
tds_submit_query_params() sends a language string to the database server for processing. | |
TDSRET | tds_submit_queryf (TDSSOCKET *tds, const char *queryf,...) |
TDSRET | tds_submit_rollback (TDSSOCKET *tds, int cont) |
TDSRET | tds_submit_rpc (TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params) |
tds_submit_rpc() call a RPC from server. | |
TDSRET | tds_submit_unprepare (TDSSOCKET *tds, TDSDYNAMIC *dyn) |
Send a unprepare request for a prepared query. | |
int | tds_swap_bytes (unsigned char *buf, int bytes) |
void | tds_swap_numeric (TDS_NUMERIC *num) |
char * | tds_timestamp_str (char *str, int maxlen) |
void | tds_unget_byte (TDSSOCKET *tds) |
Unget will always work as long as you don't call it twice in a row. | |
TDSRET | tds_vstrbuild (char *buffer, int buflen, int *resultlen, const char *text, int textlen, const char *formats, int formatlen, va_list ap) |
TDSRET | tds_write_packet (TDSSOCKET *tds, unsigned char final) |
TDSRET | tds_writetext_continue (TDSSOCKET *tds, const TDS_UCHAR *text, TDS_UINT size) |
TDSRET | tds_writetext_end (TDSSOCKET *tds) |
TDSRET | tds_writetext_start (TDSSOCKET *tds, const char *objname, const char *textptr, const char *timestamp, int with_log, TDS_UINT size) |
void | tdsdump_close (void) |
Close the TDS dump log file. | |
void | tdsdump_col (const TDSCOLUMN *col) |
Write a column value to the debug log. | |
void | tdsdump_dump_buf (const char *file, unsigned int level_line, const char *msg, const void *buf, size_t length) |
Dump the contents of data into the log file in a human readable format. | |
int | tdsdump_isopen (void) |
void | tdsdump_log (const char *file, unsigned int level_line, const char *fmt,...) |
Write a message to the debug log. | |
void | tdsdump_off (void) |
Temporarily turn off logging. | |
void | tdsdump_on (void) |
Turn logging back on. | |
int | tdsdump_open (const char *filename) |
Create and truncate a human readable dump file for the TDS traffic. | |
int | tdserror (const TDSCONTEXT *tds_ctx, TDSSOCKET *tds, int msgno, int errnum) |
Call the client library's error handler (for library-generated errors only). | |
Variables | |
const char | STD_DATETIME_FMT [] |
int | tds_debug_flags |
int | tds_g_append_mode |
const char | tds_hex_digits [] |
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. | |
int | tds_write_dump |
Main include file for libtds.
#define is_end_token | ( | x | ) |
(x==TDS_DONE_TOKEN || \ x==TDS_DONEPROC_TOKEN || \ x==TDS_DONEINPROC_TOKEN)
#define is_fixed_type | ( | x | ) |
(x==SYBINT1 || \ x==SYBINT2 || \ x==SYBINT4 || \ x==SYBINT8 || \ x==SYBREAL || \ x==SYBFLT8 || \ x==SYBDATETIME || \ x==SYBDATETIME4 || \ x==SYBBIT || \ x==SYBMONEY || \ x==SYBMONEY4 || \ x==SYBVOID || \ x==SYBUNIQUE || \ x==SYBMSDATE)
#define is_hard_end_token | ( | x | ) |
(x==TDS_DONE_TOKEN || \ x==TDS_DONEPROC_TOKEN)
#define is_msg_token | ( | x | ) |
(x==TDS_INFO_TOKEN || \ x==TDS_ERROR_TOKEN || \ x==TDS_EED_TOKEN)
#define is_nullable_type | ( | x | ) |
( \ x==SYBBITN || \ x==SYBINTN || \ x==SYBFLTN || \ x==SYBMONEYN || \ x==SYBDATETIMN || \ x==SYBVARCHAR || \ x==SYBBINARY || \ x==SYBVARBINARY || \ x==SYBTEXT || \ x==SYBNTEXT || \ x==SYBIMAGE)
#define is_result_token | ( | x | ) |
(x==TDS_RESULT_TOKEN || \ x==TDS_ROWFMT2_TOKEN || \ x==TDS7_RESULT_TOKEN || \ x==TDS_COLFMT_TOKEN || \ x==TDS_COLNAME_TOKEN || \ x==TDS_RETURNSTATUS_TOKEN)
#define is_variable_type | ( | x | ) |
( \ (x)==SYBTEXT || \ (x)==SYBIMAGE || \ (x)==SYBNTEXT || \ (x)==SYBCHAR || \ (x)==SYBVARCHAR || \ (x)==SYBBINARY || \ (x)==SYBVARBINARY || \ (x)==SYBLONGBINARY || \ (x)==XSYBCHAR || \ (x)==XSYBVARCHAR || \ (x)==XSYBNVARCHAR || \ (x)==XSYBNCHAR)
#define TDS_BYTE_SWAP16 | ( | value | ) |
(((((unsigned short)value)<<8) & 0xFF00) | \ ((((unsigned short)value)>>8) & 0x00FF))
#define TDS_BYTE_SWAP32 | ( | value | ) |
(((((unsigned long)value)<<24) & 0xFF000000) | \ ((((unsigned long)value)<< 8) & 0x00FF0000) | \ ((((unsigned long)value)>> 8) & 0x0000FF00) | \ ((((unsigned long)value)>>24) & 0x000000FF))
#define TDS_IS_MSSQL | ( | x | ) | ((tds_conn(x)->product_version & 0x80000000u)!=0) |
Check if product is Microsft SQL Server.
x should be a TDSSOCKET*.
#define TDS_IS_SYBASE | ( | x | ) | (!(tds_conn(x)->product_version & 0x80000000u)) |
Check if product is Sybase (such as Adaptive Server Enterrprice).
x should be a TDSSOCKET*.
#define TDS_MS_VER | ( | maj, | |||
min, | |||||
x | ) | (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))
#define TDS_SYB_VER | ( | maj, | |||
min, | |||||
x | ) | (((maj)<<24)|((min)<<16)|(x)<<8) |
Calc a version number for Sybase.
typedef struct tds_compiletime_settings TDS_COMPILETIME_SETTINGS |
A structure to hold all the compile-time settings.
This structure is returned by tds_get_compiletime_settings
typedef struct tds_encoding TDS_ENCODING |
Information relevant to libiconv.
The name is an iconv name, not the same as found in master..syslanguages.
Information about blobs (e.g.
text or image). current_row contains this structure.
enum tds_end |
Flags returned in TDS_DONE token.
enum tds_states |
unsigned char* tds7_crypt_pass | ( | const unsigned char * | clear_pass, | |
size_t | len, | |||
unsigned char * | crypt_pass | |||
) |
tds7_crypt_pass() -- 'encrypt' TDS 7.0 style passwords.
the calling function is responsible for ensuring crypt_pass is at least 'len' characters
TDSRET tds_bcp_send_record | ( | TDSSOCKET * | tds, | |
TDSBCPINFO * | bcpinfo, | |||
tds_bcp_get_col_data | get_col_data, | |||
tds_bcp_null_error | ignored, | |||
int | offset | |||
) |
int tds_get_conversion_type | ( | int | srctype, | |
int | colsize | |||
) |
Return type suitable for conversions (convert all nullable types to fixed type).
srctype | type to convert | |
colsize | size of type |
char* tds_get_homedir | ( | void | ) |
Get user home directory.
TDSLOCALE* tds_get_locale | ( | void | ) |
Get locale information.
int tds_iconv_alloc | ( | TDSSOCKET * | tds | ) |
Allocate iconv stuff.
TDS_INT tds_numeric_to_string | ( | const TDS_NUMERIC * | numeric, | |
char * | s | |||
) |
Set type of column initializing all dependency.
curcol | column to set | |
type | type to set |
Set type of column initializing all dependency.
tds | state information for the socket and the TDS protocol | |
curcol | column to set | |
type | type to set |
void 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).
tds_login | points to a TDSLOGIN structure | |
server | the servername, or NULL, or a zero-length string |
Set state of TDS connection, with logging and checking.
tds | state information for the socket and the TDS protocol | |
state | the new state of the connection, cf. TDS_STATE. |
char* tds_timestamp_str | ( | char * | str, | |
int | maxlen | |||
) |
strftime(str, maxlen - 6, "%Y-%m-%d %H:%M:%S", tm);
void tdsdump_col | ( | const TDSCOLUMN * | col | ) |
Write a column value to the debug log.
file | name of the log file | |
col | column to dump |
void tdsdump_dump_buf | ( | const char * | file, | |
unsigned int | level_line, | |||
const char * | msg, | |||
const void * | buf, | |||
size_t | length | |||
) |
Dump the contents of data into the log file in a human readable format.
msg | message to print before dump | |
buf | buffer to dump | |
length | number of bytes in the buffer |
void tdsdump_log | ( | const char * | file, | |
unsigned int | level_line, | |||
const char * | fmt, | |||
... | ||||
) |
Write a message to the debug log.
file | name of the log file | |
level_line | kind of detail to be included | |
fmt | printf-like format string |
void tdsdump_on | ( | void | ) |
Turn logging back on.
You must call tdsdump_open() before calling this routine.
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.
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.
tds_ctx | points to a TDSCONTEXT structure | |
tds | the connection structure, may be NULL if not connected | |
msgno | an enumerated libtds msgno, cf. tds.h | |
errnum | the OS errno, if it matters, else zero |
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.
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