Logo Search packages:      
Sourcecode: freetds version File versions

tds.h File Reference


Detailed Description

Main include file for libtds

Definition in file tds.h.

#include <stdio.h>
#include <stdarg.h>
#include <time.h>
#include "tdsver.h"
#include "tds_sysdep_public.h"

Go to the source code of this file.

Classes

struct  TDS8_COLLATION
union  tds_align_struct
struct  tds_answer
struct  tds_blob_info
struct  tds_column_info
struct  tds_connect_info
struct  tds_context
struct  tds_dynamic
struct  tds_env_info
struct  tds_locale
struct  tds_login
struct  tds_msg_info
struct  tds_result_info
struct  tds_socket
struct  tdsdaterec
struct  tdsdatetime
struct  tdsdatetime4
union  tdsmoney
struct  tdsmoney4
struct  tdsnumeric
struct  tdsoldmoney
struct  tdsunique
struct  tdsvarbinary
struct  tdsvarchar

Defines

#define CANCEL_PROCESS   2
#define GOTO_1ST_ROW   3
#define is_blob_type(x)   (x==SYBTEXT || x==SYBIMAGE || x==SYBNTEXT)
#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_large_type(x)   (x>128)
#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_TDS42(x)   (x->major_version==4 && x->minor_version==2)
#define IS_TDS46(x)   (x->major_version==4 && x->minor_version==6)
#define IS_TDS50(x)   (x->major_version==5 && x->minor_version==0)
#define IS_TDS70(x)   (x->major_version==7 && x->minor_version==0)
#define IS_TDS7_PLUS(x)   ( IS_TDS70(x) || IS_TDS80(x) )
#define IS_TDS80(x)   (x->major_version==8 && x->minor_version==0)
#define IS_TDSDEAD(x)   (((x) == NULL) || ((x)->s < 0))
#define is_unicode(x)   (x==XSYBNVARCHAR || x==XSYBNCHAR || x==SYBNTEXT)
#define LOGIN   4
#define MAXPRECISION   80
#define PROCESS_RESULTS   1
#define PROCESS_ROWS   0
#define SYBAOPAVG   0x4f
#define SYBAOPAVGU   0x50
#define SYBAOPCNT   0x4b
#define SYBAOPCNTU   0x4c
#define SYBAOPMAX   0x52
#define SYBAOPMIN   0x51
#define SYBAOPSUM   0x4d
#define SYBAOPSUMU   0x4e
#define SYBBINARY   45
#define SYBBIT   50
#define SYBBITN   104
#define SYBCHAR   47
#define SYBDATETIME   61
#define SYBDATETIME4   58
#define SYBDATETIMN   111
#define SYBDECIMAL   106
#define SYBFLT8   62
#define SYBFLTN   109
#define SYBIMAGE   34
#define SYBINT1   48
#define SYBINT2   52
#define SYBINT4   56
#define SYBINT8   127
#define SYBINTN   38
#define SYBMONEY   60
#define SYBMONEY4   122
#define SYBMONEYN   110
#define SYBNTEXT   99
#define SYBNUMERIC   108
#define SYBNVARCHAR   103
#define SYBREAL   59
#define SYBTEXT   35
#define SYBUNIQUE   36
#define SYBVARBINARY   37
#define SYBVARCHAR   39
#define SYBVARIANT   0x62
#define SYBVOID   31
#define TDS5_DYNAMIC_TOKEN   231
#define TDS5_PARAMFMT2_TOKEN   32
#define TDS5_PARAMFMT_TOKEN   236
#define TDS5_PARAMS_TOKEN   215
#define TDS7_COMPUTE_RESULT_TOKEN   136
#define TDS7_RESULT_TOKEN   129
#define TDS_ALIGN_SIZE   sizeof(tds_align_struct)
#define TDS_AUTH_TOKEN   237
#define TDS_BYTE_SWAP16(value)
#define TDS_BYTE_SWAP32(value)
#define TDS_CAPABILITY_TOKEN   226
#define TDS_CMD_DONE   4046
#define TDS_CMD_FAIL   4048
#define TDS_CMD_SUCCEED   4047
#define TDS_CMP_ROW_TOKEN   211
#define TDS_COLFMT_TOKEN   161
#define TDS_COLINFO_TOKEN   165
#define TDS_COLNAME_TOKEN   160
#define TDS_COMP_ROW   -3
#define TDS_COMPUTE_NAMES_TOKEN   167
#define TDS_COMPUTE_RESULT   4045
#define TDS_COMPUTE_RESULT_TOKEN   168
#define TDS_COMPUTEFMT_RESULT   4050
#define TDS_CONTROL_TOKEN   174
#define TDS_DBG_ERROR   2
#define TDS_DBG_FUNC   7
#define TDS_DBG_INFO1   5
#define TDS_DBG_INFO2   6
#define TDS_DBG_NETWORK   4
#define TDS_DBG_SEVERE   1
#define TDS_DBG_WARN   3
#define TDS_DBRPC_TOKEN   230
#define TDS_DEF_BLKSZ   512
#define TDS_DEF_CHARSET   "iso_1"
#define TDS_DEF_LANG   "us_english"
#define TDS_DEF_MAJOR   5
#define TDS_DEF_MINOR   0
#define TDS_DEF_PORT   4000
#define TDS_DEF_SERVER   "SYBASE"
#define TDS_DESCRIBE_RESULT   4051
#define TDS_DONE_TOKEN   253
#define TDS_DONEINPROC_TOKEN   255
#define TDS_DONEPROC_TOKEN   254
#define TDS_DONT_RETURN   42
#define TDS_DYNAMIC2_TOKEN   163
#define TDS_EED_TOKEN   229
#define TDS_ENV_CHARSET   3
#define TDS_ENV_COLLATION   7
#define TDS_ENV_DATABASE   1
#define TDS_ENV_LANG   2
#define TDS_ENV_PACKSIZE   4
#define TDS_ENVCHANGE_TOKEN   227
#define TDS_ERROR   3
#define TDS_ERROR_TOKEN   170
#define TDS_FAIL   0
#define TDS_INFO_TOKEN   171
#define TDS_IS_MSSQL(x)   ((x->product_version & 0x80000000u)!=0)
#define TDS_IS_SYBASE(x)   (!(x->product_version & 0x80000000u))
#define TDS_LANGUAGE_TOKEN   33
#define TDS_LOGINACK_TOKEN   173
#define TDS_LOGOUT_TOKEN   113
#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_MS_VER(maj, min, x)   (0x80000000u|((maj)<<24)|((min)<<16)|(x))
#define TDS_MSG_RESULT   4044
#define TDS_NO_MORE_RESULTS   2
#define TDS_NO_MORE_ROWS   -2
#define TDS_NULLTERM   -9
#define TDS_ORDERBY2_TOKEN   34
#define TDS_ORDERBY_TOKEN   169
#define TDS_PARAM_RESULT   4042
#define TDS_PARAM_TOKEN   172
#define TDS_PROCID_TOKEN   124
#define TDS_REG_ROW   -1
#define TDS_RESULT_TOKEN   238
#define TDS_RETURNSTATUS_TOKEN   121
#define TDS_ROW_RESULT   4040
#define TDS_ROW_TOKEN   209
#define TDS_ROWFMT2_TOKEN   97
#define TDS_ROWFMT_RESULT   4049
#define TDS_SF_ACCENT_SENSITIVE   (TDS_USMALLINT) 0x020
#define TDS_SF_BIN   (TDS_USMALLINT) 0x100
#define TDS_SF_CASE_INSENSITIVE   (TDS_USMALLINT) 0x010
#define TDS_SF_KATATYPE_INSENSITIVE   (TDS_USMALLINT) 0x040
#define TDS_SF_WIDTH_INSENSITIVE   (TDS_USMALLINT) 0x080
#define TDS_STATUS_RESULT   4043
#define TDS_STR_APPENDMODE   "dump file append"
#define TDS_STR_BLKSZ   "initial block size"
#define TDS_STR_CHARSET   "charset"
#define TDS_STR_CLCHARSET   "client charset"
#define TDS_STR_CONNTMOUT   "connect timeout"
#define TDS_STR_DATEFMT   "date format"
#define TDS_STR_DEBUGLVL   "debug level"
#define TDS_STR_DOMAIN   "nt domain"
#define TDS_STR_DUMPFILE   "dump file"
#define TDS_STR_EMUL_LE   "emulate little endian"
#define TDS_STR_HOST   "host"
#define TDS_STR_HOSTNAME   "hostname"
#define TDS_STR_LANGUAGE   "language"
#define TDS_STR_PORT   "port"
#define TDS_STR_SWAPDT   "swap broken dates"
#define TDS_STR_SWAPMNY   "swap broken money"
#define TDS_STR_TEXTSZ   "text size"
#define TDS_STR_TIMEOUT   "timeout"
#define TDS_STR_TRYDOM   "try domain login"
#define TDS_STR_TRYSVR   "try server login"
#define TDS_STR_VERSION   "tds version"
#define TDS_STR_XDOMAUTH   "cross domain login"
#define TDS_SUCCEED   1
#define TDS_SYB_VER(maj, min, x)   (((maj)<<24)|((min)<<16)|(x)<<8)
#define TDS_TABNAME_TOKEN   164
#define TDS_VECTOR_SIZE(x)   (sizeof(x)/sizeof(x[0]))
#define TDS_ZERO_FREE(x)   {free((x)); (x) = NULL;}
#define XSYBBINARY   173
#define XSYBCHAR   175
#define XSYBNCHAR   239
#define XSYBNVARCHAR   231
#define XSYBVARBINARY   165
#define XSYBVARCHAR   167

Typedefs

typedef char TDS_CHAR
typedef struct tdsdatetime TDS_DATETIME
typedef struct tdsdatetime4 TDS_DATETIME4
typedef tds_sysdep_real64_type TDS_FLOAT
typedef tds_sysdep_int32_type TDS_INT
typedef tds_sysdep_int64_type TDS_INT8
typedef union tdsmoney TDS_MONEY
typedef struct tdsmoney4 TDS_MONEY4
typedef struct tdsnumeric TDS_NUMERIC
typedef struct tdsoldmoney TDS_OLD_MONEY
typedef tds_sysdep_real32_type TDS_REAL
typedef tds_sysdep_int16_type TDS_SMALLINT
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 struct tdsunique TDS_UNIQUE
typedef unsigned
tds_sysdep_int16_type 
TDS_USMALLINT
typedef struct tdsvarbinary TDS_VARBINARY
typedef struct tdsvarchar TDS_VARCHAR
typedef struct tds_answer TDSANSWER
typedef struct tds_blob_info TDSBLOBINFO
typedef struct tds_column_info TDSCOLINFO
typedef struct tds_result_info TDSCOMPUTEINFO
typedef void(* TDSCONFPARSE )(const char *option, const char *value, void *param)
typedef struct tds_connect_info TDSCONNECTINFO
typedef struct tds_context TDSCONTEXT
typedef struct tdsdaterec TDSDATEREC
typedef struct tds_dynamic TDSDYNAMIC
typedef struct tds_env_info TDSENVINFO
typedef struct tds_locale TDSLOCALE
typedef struct tds_login TDSLOGIN
typedef struct tds_msg_info TDSMSGINFO
typedef TDSRESULTINFO TDSPARAMINFO
typedef struct tds_result_info TDSRESULTINFO
typedef struct tds_socket TDSSOCKET

Enumerations

enum  {
  TDS_QUERYING, TDS_PENDING, TDS_COMPLETED, TDS_CANCELED,
  TDS_DEAD
}
enum  tds_end { TDS_DONE_MORE_RESULTS = 1, TDS_DONE_ERROR = 2, TDS_DONE_COUNT = 16, TDS_DONE_CANCELLED = 32 }

Functions

char * tds7_ascii2unicode (TDSSOCKET *tds, const char *in_string, char *out_string, int maxlen)
unsigned char * tds7_crypt_pass (const unsigned char *clear_pass, int len, unsigned char *crypt_pass)
int tds7_send_auth (TDSSOCKET *tds, const unsigned char *challenge)
char * tds7_unicode2ascii (TDSSOCKET *tds, const char *in_string, char *out_string, int len)
void tds_add_row_column_size (TDSRESULTINFO *info, TDSCOLINFO *curcol)
TDSCOMPUTEINFO ** tds_alloc_compute_results (TDS_INT *num_comp_results, TDSCOMPUTEINFO **ci, int num_cols, int by_cols)
unsigned char * tds_alloc_compute_row (TDSCOMPUTEINFO *res_info)
TDSCONNECTINFO * tds_alloc_connect (TDSLOCALE *locale)
TDSCONTEXT * tds_alloc_context (void)
TDSDYNAMIC * tds_alloc_dynamic (TDSSOCKET *tds, const char *id)
char * tds_alloc_get_string (TDSSOCKET *tds, int len)
TDSLOCALE * tds_alloc_locale (void)
TDSLOGIN * tds_alloc_login (void)
TDSPARAMINFOtds_alloc_param_result (TDSPARAMINFO *old_param)
 Adds a output parameter to TDSPARAMINFO.
unsigned char * tds_alloc_param_row (TDSPARAMINFO *info, TDSCOLINFO *curparam)
TDSRESULTINFOtds_alloc_results (int num_cols)
unsigned char * tds_alloc_row (TDSRESULTINFO *res_info)
TDSSOCKET * tds_alloc_socket (TDSCONTEXT *context, int bufsize)
void tds_answer_challenge (const char *passwd, const unsigned char *challenge, TDSANSWER *answer)
int tds_client_msg (TDSCONTEXT *tds_ctx, TDSSOCKET *tds, int msgnum, int level, int state, int line, const char *message)
int tds_close_socket (TDSSOCKET *tds)
void tds_clr_null (unsigned char *current_row, int column)
void tds_config_verstr (const char *tdsver, TDSCONNECTINFO *connect_info)
int tds_connect (TDSSOCKET *tds, TDSCONNECTINFO *connect_info)
int tds_count_placeholders (const char *query)
void * tds_ctx_get_parent (TDSCONTEXT *ctx)
void tds_ctx_set_parent (TDSCONTEXT *ctx, void *the_parent)
TDS_INT tds_datecrack (TDS_INT datetype, const void *di, TDSDATEREC *dr)
void tds_fix_connect (TDSCONNECTINFO *connect_info)
int tds_flush_packet (TDSSOCKET *tds)
void tds_free_all_results (TDSSOCKET *tds)
void tds_free_compute_result (TDSCOMPUTEINFO *comp_info)
void tds_free_compute_results (TDSCOMPUTEINFO **comp_info, TDS_INT num_comp)
void tds_free_connect (TDSCONNECTINFO *connect_info)
void tds_free_context (TDSCONTEXT *locale)
void tds_free_dynamic (TDSSOCKET *tds)
 Frees all dynamic statements for a given connection.
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 (TDSMSGINFO *msg_info)
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_socket (TDSSOCKET *tds)
unsigned char tds_get_byte (TDSSOCKET *tds)
int tds_get_dynid (TDSSOCKET *tds, char **id)
char * tds_get_homedir (void)
TDS_INT tds_get_int (TDSSOCKET *tds)
TDSLOCALE * tds_get_locale (void)
void * tds_get_n (TDSSOCKET *tds, void *dest, int n)
int tds_get_null (unsigned char *current_row, int column)
void * tds_get_parent (TDSSOCKET *tds)
int tds_get_size_by_type (int servertype)
TDS_SMALLINT tds_get_smallint (TDSSOCKET *tds)
char * tds_get_string (TDSSOCKET *tds, char *dest, int n)
int tds_get_token_size (int marker)
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 (int s, unsigned char mac[6])
struct servent * tds_getservbyname_r (const char *name, const char *proto, struct servent *result, char *buffer, int buflen)
void tds_iconv_close (TDSSOCKET *tds)
void tds_iconv_open (TDSSOCKET *tds, char *charset)
int tds_init_write_buf (TDSSOCKET *tds)
TDSDYNAMIC * tds_lookup_dynamic (TDSSOCKET *tds, char *id)
void tds_lookup_host (const char *servername, const char *portname, char *ip, char *port)
char * tds_money_to_string (const TDS_MONEY *money, char *s)
const char * tds_next_placeholders (const char *start)
char * tds_numeric_to_string (const TDS_NUMERIC *numeric, char *s)
unsigned char tds_peek (TDSSOCKET *tds)
int tds_process_cancel (TDSSOCKET *tds)
int tds_process_default_tokens (TDSSOCKET *tds, int marker)
TDS_INT tds_process_end (TDSSOCKET *tds, int marker, int *flags)
int tds_process_login_tokens (TDSSOCKET *tds)
int tds_process_result_tokens (TDSSOCKET *tds, TDS_INT *result_type)
int tds_process_row_tokens (TDSSOCKET *tds, TDS_INT *rowtype, TDS_INT *computeid)
int tds_process_simple_query (TDSSOCKET *tds, TDS_INT *result_type)
const char * tds_prtype (int token)
int tds_put_buf (TDSSOCKET *tds, const unsigned char *buf, int dsize, int ssize)
int tds_put_bulk_data (TDSSOCKET *tds, const unsigned char *buf, TDS_INT bufsize)
int tds_put_byte (TDSSOCKET *tds, unsigned char c)
int tds_put_int (TDSSOCKET *tds, TDS_INT i)
int tds_put_n (TDSSOCKET *tds, const void *buf, int n)
int tds_put_smallint (TDSSOCKET *tds, TDS_SMALLINT si)
int tds_put_string (TDSSOCKET *tds, const char *buf, int len)
int tds_put_tinyint (TDSSOCKET *tds, TDS_TINYINT ti)
int tds_quote_id (TDSSOCKET *tds, char *buffer, const char *id)
int tds_read_conf_file (TDSCONNECTINFO *connect_info, const char *server)
int tds_read_conf_section (FILE *in, const char *section, TDSCONFPARSE tds_conf_parse, void *parse_param)
TDSCONNECTINFO * tds_read_config_info (TDSSOCKET *tds, TDSLOGIN *login, TDSLOCALE *locale)
int tds_read_packet (TDSSOCKET *tds)
TDSSOCKET * tds_realloc_socket (int bufsize)
int tds_send_cancel (TDSSOCKET *tds)
void tds_set_app (TDSLOGIN *tds_login, const char *application)
void tds_set_bulk (TDSLOGIN *tds_login, TDS_TINYINT enabled)
void tds_set_capabilities (TDSLOGIN *tds_login, unsigned char *capabilities, int size)
void tds_set_charset (TDSLOGIN *tds_login, const char *charset)
void tds_set_column_type (TDSCOLINFO *curcol, int type)
void tds_set_host (TDSLOGIN *tds_login, const char *hostname)
int tds_set_interfaces_file_loc (char *interfloc)
void tds_set_language (TDSLOGIN *tds_login, const char *language)
void tds_set_library (TDSLOGIN *tds_login, const char *library)
void tds_set_longquery_handler (TDSLOGIN *tds_login, void(*longquery_func)(long), long longquery_param)
void tds_set_null (unsigned char *current_row, int column)
void tds_set_packet (TDSLOGIN *tds_login, int packet_size)
void tds_set_parent (TDSSOCKET *tds, void *the_parent)
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)
void tds_set_timeouts (TDSLOGIN *tds_login, int connect_timeout, int query_timeout, int longquery_timeout)
void tds_set_user (TDSLOGIN *tds_login, const char *username)
void tds_set_version (TDSLOGIN *tds_login, short major_ver, short minor_ver)
int tds_submit_execute (TDSSOCKET *tds, TDSDYNAMIC *dyn)
int tds_submit_prepare (TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out)
int tds_submit_query (TDSSOCKET *tds, const char *query)
int tds_submit_queryf (TDSSOCKET *tds, const char *queryf,...)
int tds_submit_rpc (TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params)
int tds_submit_unprepare (TDSSOCKET *tds, TDSDYNAMIC *dyn)
int tds_swap_bytes (unsigned char *buf, int bytes)
void tds_swap_datatype (int coltype, unsigned char *buf)
char * tds_timestamp_str (char *str, int maxlen)
void tds_unget_byte (TDSSOCKET *tds)
int tds_version (TDSSOCKET *tds_socket, char *pversion_string)
int tds_vstrbuild (char *buffer, int buflen, int *resultlen, char *text, int textlen, const char *formats, int formatlen, va_list ap)
int tdsdump_append (void)
void tdsdump_close (void)
void tdsdump_dump_buf (const void *buf, int length)
void tdsdump_log (int dbg_lvl, const char *fmt,...)
void tdsdump_off (void)
void tdsdump_on (void)
int tdsdump_open (const char *filename)

Variables

static void * no_unused_tds_h_warn []
static char rcsid_tds_h []
const int tds_numeric_bytes_per_prec []


Generated by  Doxygen 1.6.0   Back to index