34 #include "tds_sysdep_public.h" 35 #ifdef _FREETDS_LIBRARY_SOURCE 36 #include "tds_sysdep_private.h" 54 const char *freetds_version;
55 const char *sysconfdir;
56 const char *last_update;
96 typedef char TDS_CHAR;
97 typedef unsigned char TDS_UCHAR;
98 typedef unsigned char TDS_TINYINT;
99 typedef tds_sysdep_int16_type TDS_SMALLINT;
100 typedef unsigned tds_sysdep_int16_type TDS_USMALLINT;
101 typedef tds_sysdep_int32_type TDS_INT;
102 typedef unsigned tds_sysdep_int32_type TDS_UINT;
103 typedef tds_sysdep_real32_type TDS_REAL;
104 typedef tds_sysdep_real64_type TDS_FLOAT;
105 typedef tds_sysdep_int64_type TDS_INT8;
106 typedef unsigned tds_sysdep_int64_type TDS_UINT8;
107 typedef tds_sysdep_intptr_type TDS_INTPTR;
111 unsigned char precision;
113 unsigned char array[33];
142 TDS_USMALLINT minutes;
186 #define TDS_SUCCEED 1 188 #define TDS_NO_MORE_RESULTS 2 189 #define TDS_CANCELLED 3 191 #define TDS_INT_CONTINUE 1 192 #define TDS_INT_CANCEL 2 193 #define TDS_INT_TIMEOUT 3 196 #define TDS_NO_COUNT -1 198 #define TDS_ROW_RESULT 4040 199 #define TDS_PARAM_RESULT 4042 200 #define TDS_STATUS_RESULT 4043 201 #define TDS_MSG_RESULT 4044 202 #define TDS_COMPUTE_RESULT 4045 203 #define TDS_CMD_DONE 4046 204 #define TDS_CMD_SUCCEED 4047 205 #define TDS_CMD_FAIL 4048 206 #define TDS_ROWFMT_RESULT 4049 207 #define TDS_COMPUTEFMT_RESULT 4050 208 #define TDS_DESCRIBE_RESULT 4051 209 #define TDS_DONE_RESULT 4052 210 #define TDS_DONEPROC_RESULT 4053 211 #define TDS_DONEINPROC_RESULT 4054 212 #define TDS_OTHERS_RESULT 4055 214 enum tds_token_results
216 TDS_TOKEN_RES_OTHERS,
217 TDS_TOKEN_RES_ROWFMT,
218 TDS_TOKEN_RES_COMPUTEFMT,
219 TDS_TOKEN_RES_PARAMFMT,
222 TDS_TOKEN_RES_COMPUTE,
227 #define TDS_TOKEN_FLAG(flag) TDS_RETURN_##flag = (1 << (TDS_TOKEN_RES_##flag*2)), TDS_STOPAT_##flag = (2 << (TDS_TOKEN_RES_##flag*2)) 232 TDS_TOKEN_FLAG(OTHERS),
233 TDS_TOKEN_FLAG(ROWFMT),
234 TDS_TOKEN_FLAG(COMPUTEFMT),
235 TDS_TOKEN_FLAG(PARAMFMT),
236 TDS_TOKEN_FLAG(DONE),
238 TDS_TOKEN_FLAG(COMPUTE),
239 TDS_TOKEN_FLAG(PROC),
241 TDS_TOKEN_RESULTS = TDS_RETURN_ROWFMT|TDS_RETURN_COMPUTEFMT|TDS_RETURN_DONE|TDS_STOPAT_ROW|TDS_STOPAT_COMPUTE|TDS_RETURN_PROC,
242 TDS_TOKEN_TRAILING = TDS_STOPAT_ROWFMT|TDS_STOPAT_COMPUTEFMT|TDS_STOPAT_ROW|TDS_STOPAT_COMPUTE|TDS_STOPAT_MSG|TDS_STOPAT_OTHERS
257 , TDS_DONE_EVENT = 0x40
261 , TDS_DONE_NO_TRAN = 0
262 , TDS_DONE_TRAN_SUCCEED = 1
263 , TDS_DONE_TRAN_PROGRESS= 2
264 , TDS_DONE_STMT_ABORT = 3
265 , TDS_DONE_TRAN_ABORT = 4
275 typedef enum { TDSEICONVIU = 2400,
276 TDSEICONVAVAIL = 2401,
279 TDSEICONV2BIG = 2404,
308 #define TDS_DONT_RETURN 42 310 #define TDS5_PARAMFMT2_TOKEN 32 311 #define TDS_LANGUAGE_TOKEN 33 312 #define TDS_ORDERBY2_TOKEN 34 313 #define TDS_ROWFMT2_TOKEN 97 314 #define TDS_LOGOUT_TOKEN 113 315 #define TDS_RETURNSTATUS_TOKEN 121 316 #define TDS_PROCID_TOKEN 124 317 #define TDS7_RESULT_TOKEN 129 318 #define TDS7_COMPUTE_RESULT_TOKEN 136 319 #define TDS_COLNAME_TOKEN 160 320 #define TDS_COLFMT_TOKEN 161 321 #define TDS_DYNAMIC2_TOKEN 163 322 #define TDS_TABNAME_TOKEN 164 323 #define TDS_COLINFO_TOKEN 165 324 #define TDS_OPTIONCMD_TOKEN 166 325 #define TDS_COMPUTE_NAMES_TOKEN 167 326 #define TDS_COMPUTE_RESULT_TOKEN 168 327 #define TDS_ORDERBY_TOKEN 169 328 #define TDS_ERROR_TOKEN 170 329 #define TDS_INFO_TOKEN 171 330 #define TDS_PARAM_TOKEN 172 331 #define TDS_LOGINACK_TOKEN 173 332 #define TDS_CONTROL_TOKEN 174 333 #define TDS_ROW_TOKEN 209 334 #define TDS_CMP_ROW_TOKEN 211 335 #define TDS5_PARAMS_TOKEN 215 336 #define TDS_CAPABILITY_TOKEN 226 337 #define TDS_ENVCHANGE_TOKEN 227 338 #define TDS_EED_TOKEN 229 339 #define TDS_DBRPC_TOKEN 230 340 #define TDS5_DYNAMIC_TOKEN 231 341 #define TDS5_PARAMFMT_TOKEN 236 342 #define TDS_AUTH_TOKEN 237 343 #define TDS_RESULT_TOKEN 238 344 #define TDS_DONE_TOKEN 253 345 #define TDS_DONEPROC_TOKEN 254 346 #define TDS_DONEINPROC_TOKEN 255 349 #define TDS_CURCLOSE_TOKEN 128 350 #define TDS_CURDELETE_TOKEN 129 351 #define TDS_CURFETCH_TOKEN 130 352 #define TDS_CURINFO_TOKEN 131 353 #define TDS_CUROPEN_TOKEN 132 354 #define TDS_CURDECLARE_TOKEN 134 357 TDS_CUR_ISTAT_UNUSED = 0x00,
358 TDS_CUR_ISTAT_DECLARED = 0x01,
359 TDS_CUR_ISTAT_OPEN = 0x02,
360 TDS_CUR_ISTAT_CLOSED = 0x04,
361 TDS_CUR_ISTAT_RDONLY = 0x08,
362 TDS_CUR_ISTAT_UPDATABLE = 0x10,
363 TDS_CUR_ISTAT_ROWCNT = 0x20,
364 TDS_CUR_ISTAT_DEALLOC = 0x40
373 #define IS_DECLARE 100 374 #define IS_CURROW 200 379 #define PROCESS_ROWS 0 380 #define PROCESS_RESULTS 1 381 #define CANCEL_PROCESS 2 382 #define GOTO_1ST_ROW 3 386 #define TDS_ENV_DATABASE 1 387 #define TDS_ENV_LANG 2 388 #define TDS_ENV_CHARSET 3 389 #define TDS_ENV_PACKSIZE 4 390 #define TDS_ENV_LCID 5 391 #define TDS_ENV_SQLCOLLATION 7 392 #define TDS_ENV_BEGINTRANS 8 393 #define TDS_ENV_COMMITTRANS 9 394 #define TDS_ENV_ROLLBACKTRANS 10 397 #define TDS_NULLTERM -9 401 #define TDS_SP_CURSOR 1 402 #define TDS_SP_CURSOROPEN 2 403 #define TDS_SP_CURSORPREPARE 3 404 #define TDS_SP_CURSOREXECUTE 4 405 #define TDS_SP_CURSORPREPEXEC 5 406 #define TDS_SP_CURSORUNPREPARE 6 407 #define TDS_SP_CURSORFETCH 7 408 #define TDS_SP_CURSOROPTION 8 409 #define TDS_SP_CURSORCLOSE 9 410 #define TDS_SP_EXECUTESQL 10 411 #define TDS_SP_PREPARE 11 412 #define TDS_SP_EXECUTE 12 413 #define TDS_SP_PREPEXEC 13 414 #define TDS_SP_PREPEXECRPC 14 415 #define TDS_SP_UNPREPARE 15 424 #define SYBCHAR SYBCHAR 426 #define SYBVARCHAR SYBVARCHAR 428 #define SYBINTN SYBINTN 430 #define SYBINT1 SYBINT1 432 #define SYBINT2 SYBINT2 434 #define SYBINT4 SYBINT4 436 #define SYBFLT8 SYBFLT8 438 #define SYBDATETIME SYBDATETIME 440 #define SYBBIT SYBBIT 442 #define SYBTEXT SYBTEXT 444 #define SYBNTEXT SYBNTEXT 446 #define SYBIMAGE SYBIMAGE 448 #define SYBMONEY4 SYBMONEY4 450 #define SYBMONEY SYBMONEY 452 #define SYBDATETIME4 SYBDATETIME4 454 #define SYBREAL SYBREAL 456 #define SYBBINARY SYBBINARY 458 #define SYBVOID SYBVOID 460 #define SYBVARBINARY SYBVARBINARY 462 #define SYBBITN SYBBITN 464 #define SYBNUMERIC SYBNUMERIC 466 #define SYBDECIMAL SYBDECIMAL 468 #define SYBFLTN SYBFLTN 470 #define SYBMONEYN SYBMONEYN 472 #define SYBDATETIMN SYBDATETIMN 478 #define SYBNVARCHAR SYBNVARCHAR 480 #define SYBINT8 SYBINT8 482 #define XSYBCHAR XSYBCHAR 484 #define XSYBVARCHAR XSYBVARCHAR 486 #define XSYBNVARCHAR XSYBNVARCHAR 488 #define XSYBNCHAR XSYBNCHAR 490 #define XSYBVARBINARY XSYBVARBINARY 492 #define XSYBBINARY XSYBBINARY 494 #define SYBUNIQUE SYBUNIQUE 496 #define SYBVARIANT SYBVARIANT 502 #define SYBLONGBINARY SYBLONGBINARY 504 #define SYBUINT1 SYBUINT1 506 #define SYBUINT2 SYBUINT2 508 #define SYBUINT4 SYBUINT4 510 #define SYBUINT8 SYBUINT8 512 #define SYBBLOB SYBBLOB 514 #define SYBBOUNDARY SYBBOUNDARY 516 #define SYBDATE SYBDATE 518 #define SYBDATEN SYBDATEN 520 #define SYB5INT8 SYB5INT8 522 #define SYBINTERVAL SYBINTERVAL 524 #define SYBLONGCHAR SYBLONGCHAR 525 SYBSENSITIVITY = 103,
526 #define SYBSENSITIVITY SYBSENSITIVITY 528 #define SYBSINT1 SYBSINT1 530 #define SYBTIME SYBTIME 532 #define SYBTIMEN SYBTIMEN 534 #define SYBUINTN SYBUINTN 536 #define SYBUNITEXT SYBUNITEXT 538 #define SYBXML SYBXML 545 USER_UNICHAR_TYPE = 34,
546 USER_UNIVARCHAR_TYPE = 35
549 #define SYBAOPCNT 0x4b 550 #define SYBAOPCNTU 0x4c 551 #define SYBAOPSUM 0x4d 552 #define SYBAOPSUMU 0x4e 553 #define SYBAOPAVG 0x4f 554 #define SYBAOPAVGU 0x50 555 #define SYBAOPMIN 0x51 556 #define SYBAOPMAX 0x52 559 #define SYBAOPCNT_BIG 0x09 560 #define SYBAOPSTDEV 0x30 561 #define SYBAOPSTDEVP 0x31 562 #define SYBAOPVAR 0x32 563 #define SYBAOPVARP 0x33 564 #define SYBAOPCHECKSUM_AGG 0x72 573 , TDS_OPT_DEFAULT = 2
580 TDS_OPT_DATEFIRST = 1
581 , TDS_OPT_TEXTSIZE = 2
582 , TDS_OPT_STAT_TIME = 3
583 , TDS_OPT_STAT_IO = 4
584 , TDS_OPT_ROWCOUNT = 5
585 , TDS_OPT_NATLANG = 6
586 , TDS_OPT_DATEFORMAT = 7
587 , TDS_OPT_ISOLATION = 8
589 , TDS_OPT_CHARSET = 10
590 , TDS_OPT_SHOWPLAN = 13
591 , TDS_OPT_NOEXEC = 14
592 , TDS_OPT_ARITHIGNOREON = 15
593 , TDS_OPT_ARITHABORTON = 17
594 , TDS_OPT_PARSEONLY = 18
595 , TDS_OPT_GETDATA = 20
596 , TDS_OPT_NOCOUNT = 21
597 , TDS_OPT_FORCEPLAN = 23
598 , TDS_OPT_FORMATONLY = 24
599 , TDS_OPT_CHAINXACTS = 25
600 , TDS_OPT_CURCLOSEONXACT = 26
601 , TDS_OPT_FIPSFLAG = 27
602 , TDS_OPT_RESTREES = 28
603 , TDS_OPT_IDENTITYON = 29
604 , TDS_OPT_CURREAD = 30
605 , TDS_OPT_CURWRITE = 31
606 , TDS_OPT_IDENTITYOFF = 32
607 , TDS_OPT_AUTHOFF = 33
608 , TDS_OPT_ANSINULL = 34
609 , TDS_OPT_QUOTED_IDENT = 35
610 , TDS_OPT_ARITHIGNOREOFF = 36
611 , TDS_OPT_ARITHABORTOFF = 37
612 , TDS_OPT_TRUNCABORT = 38
623 TDS_OPT_ARITHOVERFLOW = 0x01,
624 TDS_OPT_NUMERICTRUNC = 0x02
627 enum TDS_OPT_DATEFIRST_CHOICE
629 TDS_OPT_MONDAY = 1, TDS_OPT_TUESDAY = 2, TDS_OPT_WEDNESDAY = 3, TDS_OPT_THURSDAY = 4, TDS_OPT_FRIDAY = 5, TDS_OPT_SATURDAY =
630 6, TDS_OPT_SUNDAY = 7
633 enum TDS_OPT_DATEFORMAT_CHOICE
635 TDS_OPT_FMTMDY = 1, TDS_OPT_FMTDMY = 2, TDS_OPT_FMTYMD = 3, TDS_OPT_FMTYDM = 4, TDS_OPT_FMTMYD = 5, TDS_OPT_FMTDYM = 6
637 enum TDS_OPT_ISOLATION_CHOICE
639 TDS_OPT_LEVEL1 = 1, TDS_OPT_LEVEL3 = 3
642 typedef enum tds_packet_type
656 typedef enum tds_encryption_level {
657 TDS_ENCRYPTION_OFF, TDS_ENCRYPTION_REQUEST, TDS_ENCRYPTION_REQUIRE
658 } TDS_ENCRYPTION_LEVEL;
660 #define TDS_ZERO_FREE(x) do {free((x)); (x) = NULL;} while(0) 661 #define TDS_VECTOR_SIZE(x) (sizeof(x)/sizeof(x[0])) 668 #define TDS_BYTE_SWAP16(value) \ 669 (((((unsigned short)value)<<8) & 0xFF00) | \ 670 ((((unsigned short)value)>>8) & 0x00FF)) 672 #define TDS_BYTE_SWAP32(value) \ 673 (((((unsigned long)value)<<24) & 0xFF000000) | \ 674 ((((unsigned long)value)<< 8) & 0x00FF0000) | \ 675 ((((unsigned long)value)>> 8) & 0x0000FF00) | \ 676 ((((unsigned long)value)>>24) & 0x000000FF)) 678 #define is_end_token(x) (x==TDS_DONE_TOKEN || \ 679 x==TDS_DONEPROC_TOKEN || \ 680 x==TDS_DONEINPROC_TOKEN) 682 #define is_hard_end_token(x) (x==TDS_DONE_TOKEN || \ 683 x==TDS_DONEPROC_TOKEN) 685 #define is_msg_token(x) (x==TDS_INFO_TOKEN || \ 686 x==TDS_ERROR_TOKEN || \ 689 #define is_result_token(x) (x==TDS_RESULT_TOKEN || \ 690 x==TDS_ROWFMT2_TOKEN || \ 691 x==TDS7_RESULT_TOKEN || \ 692 x==TDS_COLFMT_TOKEN || \ 693 x==TDS_COLNAME_TOKEN || \ 694 x==TDS_RETURNSTATUS_TOKEN) 697 #define is_fixed_type(x) (x==SYBINT1 || \ 710 #define is_nullable_type(x) ( \ 723 #define is_variable_type(x) ( \ 730 (x)==SYBVARBINARY || \ 731 (x)==SYBLONGBINARY || \ 733 (x)==XSYBVARCHAR || \ 734 (x)==XSYBNVARCHAR || \ 737 #define is_blob_type(x) (x==SYBTEXT || x==SYBIMAGE || x==SYBNTEXT) 740 #define is_numeric_type(x) (x==SYBNUMERIC || x==SYBDECIMAL) 741 #define is_unicode_type(x) (x==XSYBNVARCHAR || x==XSYBNCHAR || x==SYBNTEXT) 742 #define is_collate_type(x) (x==XSYBVARCHAR || x==XSYBCHAR || x==SYBTEXT || x==XSYBNVARCHAR || x==XSYBNCHAR || x==SYBNTEXT) 743 #define is_ascii_type(x) ( x==XSYBCHAR || x==XSYBVARCHAR || x==SYBTEXT || x==SYBCHAR || x==SYBVARCHAR) 744 #define is_binary_type(x) (x==SYBLONGBINARY) 745 #define is_char_type(x) (is_unicode_type(x) || is_ascii_type(x)) 746 #define is_similar_type(x, y) ((is_char_type(x) && is_char_type(y)) || ((is_unicode_type(x) && is_unicode_type(y)))) 749 #define TDS_MAX_CAPABILITY 22 750 #define MAXPRECISION 80 751 #define TDS_MAX_CONN 4096 752 #define TDS_MAX_DYNID_LEN 30 755 #define TDS_DEF_SERVER "SYBASE" 756 #define TDS_DEF_BLKSZ 512 757 #define TDS_DEF_CHARSET "iso_1" 758 #define TDS_DEF_LANG "us_english" 760 #define TDS_DEF_MAJOR 4 761 #define TDS_DEF_MINOR 2 762 #define TDS_DEF_PORT 1433 764 #define TDS_DEF_MAJOR 4 765 #define TDS_DEF_MINOR 6 766 #define TDS_DEF_PORT 4000 768 #define TDS_DEF_MAJOR 7 769 #define TDS_DEF_MINOR 0 770 #define TDS_DEF_PORT 1433 772 #define TDS_DEF_MAJOR 8 773 #define TDS_DEF_MINOR 0 774 #define TDS_DEF_PORT 1433 776 #define TDS_DEF_MAJOR 5 777 #define TDS_DEF_MINOR 0 778 #define TDS_DEF_PORT 4000 782 #define TDS_STR_VERSION "tds version" 783 #define TDS_STR_BLKSZ "initial block size" 784 #define TDS_STR_SWAPDT "swap broken dates" 785 #define TDS_STR_SWAPMNY "swap broken money" 786 #define TDS_STR_DUMPFILE "dump file" 787 #define TDS_STR_DEBUGLVL "debug level" 788 #define TDS_STR_DEBUGFLAGS "debug flags" 789 #define TDS_STR_TIMEOUT "timeout" 790 #define TDS_STR_QUERY_TIMEOUT "query timeout" 791 #define TDS_STR_CONNTIMEOUT "connect timeout" 792 #define TDS_STR_HOSTNAME "hostname" 793 #define TDS_STR_HOST "host" 794 #define TDS_STR_PORT "port" 795 #define TDS_STR_TEXTSZ "text size" 797 #define TDS_STR_EMUL_LE "emulate little endian" 798 #define TDS_STR_CHARSET "charset" 799 #define TDS_STR_CLCHARSET "client charset" 800 #define TDS_STR_LANGUAGE "language" 801 #define TDS_STR_APPENDMODE "dump file append" 802 #define TDS_STR_DATEFMT "date format" 803 #define TDS_STR_INSTANCE "instance" 804 #define TDS_STR_ENCRYPTION "encryption" 806 #define TDS_STR_ENCRYPTION_OFF "off" 807 #define TDS_STR_ENCRYPTION_REQUEST "request" 808 #define TDS_STR_ENCRYPTION_REQUIRE "require" 818 #define TDS_ALIGN_SIZE sizeof(tds_align_struct) 820 #define TDS_MAX_LOGIN_STR_SZ 30 826 TDS_TINYINT major_version;
827 TDS_TINYINT minor_version;
831 TDS_INT connect_timeout;
832 DSTR client_host_name;
838 TDS_TINYINT bulk_copy;
839 TDS_TINYINT suppress_language;
840 TDS_TINYINT encryption_level;
842 TDS_INT query_timeout;
843 unsigned char capabilities[TDS_MAX_CAPABILITY];
852 TDS_TINYINT major_version;
853 TDS_TINYINT minor_version;
857 TDS_INT connect_timeout;
858 DSTR client_host_name;
859 DSTR server_host_name;
864 TDS_TINYINT bulk_copy;
865 TDS_TINYINT suppress_language;
866 TDS_TINYINT encryption_level;
868 TDS_INT query_timeout;
869 unsigned char capabilities[TDS_MAX_CAPABILITY];
880 int emul_little_endian;
886 char *server_charset;
887 char *client_charset;
898 TDS_CHAR textptr[16];
899 TDS_CHAR timestamp[8];
907 TDS_USMALLINT locale_id;
909 TDS_UCHAR charset_id;
913 #define TDS_SF_BIN (TDS_USMALLINT) 0x100 914 #define TDS_SF_WIDTH_INSENSITIVE (TDS_USMALLINT) 0x080 915 #define TDS_SF_KATATYPE_INSENSITIVE (TDS_USMALLINT) 0x040 916 #define TDS_SF_ACCENT_SENSITIVE (TDS_USMALLINT) 0x020 917 #define TDS_SF_CASE_INSENSITIVE (TDS_USMALLINT) 0x010 920 #define TDS_UT_TIMESTAMP 80 930 unsigned char min_bytes_per_char;
931 unsigned char max_bytes_per_char;
943 { TDS_SYSNAME_SIZE = 512 };
955 TDS_INT column_usertype;
956 TDS_INT column_flags;
966 TDS_SMALLINT table_namelen;
975 TDS_CHAR table_name[TDS_SYSNAME_SIZE];
976 TDS_CHAR column_name[TDS_SYSNAME_SIZE];
977 char * table_column_name;
979 unsigned char *column_data;
980 void (*column_data_free)(
struct tds_column *column);
981 unsigned int column_nullable:1;
982 unsigned int column_writeable:1;
983 unsigned int column_identity:1;
984 unsigned int column_key:1;
985 unsigned int column_hidden:1;
986 unsigned int column_output:1;
987 unsigned int column_timestamp:1;
988 TDS_UCHAR column_collation[5];
991 TDS_TINYINT column_operator;
992 TDS_SMALLINT column_operand;
1000 TDS_SMALLINT column_bindtype;
1001 TDS_SMALLINT column_bindfmt;
1002 TDS_UINT column_bindlen;
1003 TDS_SMALLINT *column_nullbind;
1004 TDS_CHAR *column_varaddr;
1005 TDS_INT *column_lenbind;
1006 TDS_INT column_textpos;
1007 TDS_INT column_text_sqlgetdatapos;
1008 TDS_CHAR column_text_sqlputdatainfo;
1020 TDS_INT bcp_term_len;
1021 TDS_CHAR *bcp_terminator;
1029 TDS_SMALLINT num_cols;
1033 unsigned char *current_row;
1036 TDS_SMALLINT rows_exist;
1040 TDS_TINYINT more_results;
1041 TDS_SMALLINT computeid;
1042 TDS_SMALLINT *bycolumns;
1043 TDS_SMALLINT by_cols;
1056 #define TDS_DBG_FUNC __FILE__, ((__LINE__ << 4) | 7) 1057 #define TDS_DBG_INFO2 __FILE__, ((__LINE__ << 4) | 6) 1058 #define TDS_DBG_INFO1 __FILE__, ((__LINE__ << 4) | 5) 1059 #define TDS_DBG_NETWORK __FILE__, ((__LINE__ << 4) | 4) 1060 #define TDS_DBG_WARN __FILE__, ((__LINE__ << 4) | 3) 1061 #define TDS_DBG_ERROR __FILE__, ((__LINE__ << 4) | 2) 1062 #define TDS_DBG_SEVERE __FILE__, ((__LINE__ << 4) | 1) 1064 #define TDS_DBGFLAG_FUNC 0x80 1065 #define TDS_DBGFLAG_INFO2 0x40 1066 #define TDS_DBGFLAG_INFO1 0x20 1067 #define TDS_DBGFLAG_NETWORK 0x10 1068 #define TDS_DBGFLAG_WARN 0x08 1069 #define TDS_DBGFLAG_ERROR 0x04 1070 #define TDS_DBGFLAG_SEVERE 0x02 1071 #define TDS_DBGFLAG_ALLLVL 0xfff 1072 #define TDS_DBGFLAG_PID 0x1000 1073 #define TDS_DBGFLAG_TIME 0x2000 1074 #define TDS_DBGFLAG_SOURCE 0x4000 1075 #define TDS_DBGFLAG_THREAD 0x8000 1089 , TDS_DBG_error = (1 << 4)
1106 TDS_CHAR *proc_name;
1107 TDS_CHAR *sql_state;
1109 TDS_INT line_number;
1112 TDS_TINYINT priv_msg_type;
1113 TDS_TINYINT severity;
1121 TDS_INT colnamelength;
1126 TDS_CURSOR_STATE_UNACTIONED = 0
1127 , TDS_CURSOR_STATE_REQUESTED = 1
1128 , TDS_CURSOR_STATE_SENT = 2
1129 , TDS_CURSOR_STATE_ACTIONED = 3
1134 TDS_CURSOR_STATE declare;
1135 TDS_CURSOR_STATE cursor_row;
1136 TDS_CURSOR_STATE open;
1137 TDS_CURSOR_STATE fetch;
1138 TDS_CURSOR_STATE close;
1139 TDS_CURSOR_STATE dealloc;
1142 typedef enum _tds_cursor_operation
1144 TDS_CURSOR_POSITION = 0,
1145 TDS_CURSOR_UPDATE = 1,
1146 TDS_CURSOR_DELETE = 2,
1147 TDS_CURSOR_INSERT = 4
1148 } TDS_CURSOR_OPERATION;
1150 typedef enum _tds_cursor_fetch
1152 TDS_CURSOR_FETCH_NEXT = 1,
1153 TDS_CURSOR_FETCH_PREV,
1154 TDS_CURSOR_FETCH_FIRST,
1155 TDS_CURSOR_FETCH_LAST,
1156 TDS_CURSOR_FETCH_ABSOLUTE,
1157 TDS_CURSOR_FETCH_RELATIVE
1180 TDS_SMALLINT srv_status;
1232 TDS_MULTIPLE_EXECUTE,
1234 } TDS_MULTIPLE_TYPE;
1238 TDS_MULTIPLE_TYPE type;
1252 int (*int_handler) (
void *);
1255 enum TDS_ICONV_ENTRY
1258 , client2server_chardata
1259 , iso2server_metadata
1260 , initial_char_conv_count
1281 TDS_SMALLINT major_version;
1282 TDS_SMALLINT minor_version;
1286 unsigned char capabilities[TDS_MAX_CAPABILITY];
1287 unsigned char broken_dates;
1288 unsigned char option_flag2;
1318 TDS_INT num_comp_info;
1331 TDS_INT query_timeout;
1338 int emul_little_endian;
1341 int char_conv_count;
1348 TDS_UCHAR collation[5];
1349 TDS_UCHAR tds9_transaction[8];
1350 void (*env_chg_func) (
TDSSOCKET * tds,
int type,
char *oldval,
char *newval);
1351 int internal_sp_called;
1354 void *tls_credentials;
1359 int tds_init_write_buf(
TDSSOCKET * tds);
1363 void tds_free_all_results(
TDSSOCKET * tds);
1365 void tds_free_param_results(
TDSPARAMINFO * param_info);
1370 void tds_free_bcp_column_data(
BCPCOLDATA * coldata);
1372 int tds_put_n(
TDSSOCKET * tds,
const void *buf,
int n);
1374 int tds_put_int(
TDSSOCKET * tds, TDS_INT i);
1375 int tds_put_int8(
TDSSOCKET * tds, TDS_INT8 i);
1376 int tds_put_smallint(
TDSSOCKET * tds, TDS_SMALLINT si);
1378 #define tds_put_tinyint(tds, ti) tds_put_byte(tds,ti) 1379 int tds_put_byte(
TDSSOCKET * tds,
unsigned char c);
1382 TDSCONTEXT *tds_alloc_context(
void * parent);
1388 typedef void (*TDSCONFPARSE) (
const char *option,
const char *value,
void *param);
1389 int tds_read_conf_section(FILE * in,
const char *section, TDSCONFPARSE tds_conf_parse,
void *parse_param);
1400 BCPCOLDATA * tds_alloc_bcp_column_data(
int column_size);
1401 unsigned char *
tds7_crypt_pass(
const unsigned char *clear_pass,
int len,
unsigned char *crypt_pass);
1403 const char *tds_prtype(
int token);
1408 void tds_iconv_open(
TDSSOCKET * tds,
const char *charset);
1410 void tds_srv_charset_changed(
TDSSOCKET * tds,
const char *charset);
1411 void tds7_srv_charset_changed(
TDSSOCKET * tds,
int sql_collate,
int lcid);
1418 struct hostent *tds_gethostbyname_r(
const char *servername,
struct hostent *result,
char *buffer,
int buflen,
int *h_errnop);
1419 struct hostent *tds_gethostbyaddr_r(
const char *addr,
int len,
int type,
struct hostent *result,
char *buffer,
int buflen,
1421 struct servent *tds_getservbyname_r(
const char *name,
const char *proto,
struct servent *result,
char *buffer,
int buflen);
1423 const char *tds_inet_ntoa_r(
struct in_addr iaddr,
char *ip,
size_t len);
1432 char *tds_alloc_client_sqlstate(
int msgno);
1433 char *tds_alloc_lookup_sqlstate(
TDSSOCKET * tds,
int msgno);
1436 void tds_free_login(
TDSLOGIN * login);
1440 void tds_free_locale(
TDSLOCALE * locale);
1441 TDSCURSOR * tds_alloc_cursor(
TDSSOCKET * tds,
const char *name, TDS_INT namelen,
const char *query, TDS_INT querylen);
1442 void tds_free_row(
TDSRESULTINFO * res_info,
unsigned char *row);
1457 void tds_set_version(
TDSLOGIN *
tds_login, TDS_TINYINT major_ver, TDS_TINYINT minor_ver);
1458 void tds_set_capabilities(
TDSLOGIN *
tds_login,
unsigned char *capabilities,
int size);
1464 int tds_submit_queryf(
TDSSOCKET * tds,
const char *queryf, ...);
1482 int tds_cursor_fetch(
TDSSOCKET * tds,
TDSCURSOR * cursor, TDS_CURSOR_FETCH fetch_type, TDS_INT i_row);
1495 void tds_swap_datatype(
int coltype,
unsigned char *buf);
1501 TDS_INT * tds_argsize);
1512 extern const char tds_hex_digits[];
1516 int tds_put_buf(
TDSSOCKET * tds,
const unsigned char *buf,
int dsize,
int ssize);
1519 unsigned char tds_get_byte(
TDSSOCKET * tds);
1521 unsigned char tds_peek(
TDSSOCKET * tds);
1534 void tds_set_parent(
TDSSOCKET * tds,
void *the_parent);
1536 int tds_swap_bytes(
unsigned char *buf,
int bytes);
1542 void tdsdump_dump_buf(
const char* file,
unsigned int level_line,
const char *msg,
const void *buf,
int length);
1543 void tdsdump_log(
const char* file,
unsigned int level_line,
const char *fmt, ...)
1544 #if defined(__GNUC__) && __GNUC__ >= 2 1545 __attribute__ ((__format__ (__printf__, 3, 4)))
1548 extern int tds_debug_flags;
1549 unsigned int tds_gettime_ms(
void);
1552 int tds_open_socket(
TDSSOCKET * tds,
const char *ip_addr,
unsigned int port,
int timeout);
1555 int tds_write_packet(
TDSSOCKET * tds,
unsigned char final);
1563 int tds_vstrbuild(
char *buffer,
int buflen,
int *resultlen,
char *text,
int textlen,
const char *formats,
int formatlen,
1567 char *tds_money_to_string(
const TDS_MONEY * money,
char *s);
1568 TDS_INT tds_numeric_to_string(
const TDS_NUMERIC * numeric,
char *s);
1569 TDS_INT tds_numeric_change_prec_scale(
TDS_NUMERIC * numeric,
unsigned char new_prec,
unsigned char new_scale);
1572 void tds_getmac(
int s,
unsigned char mac[6]);
1577 #define IS_TDS42(x) (x->major_version==4 && x->minor_version==2) 1578 #define IS_TDS46(x) (x->major_version==4 && x->minor_version==6) 1579 #define IS_TDS50(x) (x->major_version==5 && x->minor_version==0) 1580 #define IS_TDS70(x) (x->major_version==7 && x->minor_version==0) 1581 #define IS_TDS80(x) (x->major_version==8 && x->minor_version==0) 1582 #define IS_TDS90(x) (x->major_version==9 && x->minor_version==0) 1584 #define IS_TDS7_PLUS(x) ((x)->major_version>=7) 1585 #define IS_TDS8_PLUS(x) ((x)->major_version>=8) 1587 #define IS_TDSDEAD(x) (((x) == NULL) || TDS_IS_SOCKET_INVALID((x)->s)) 1590 #define TDS_IS_SYBASE(x) (!(x->product_version & 0x80000000u)) 1592 #define TDS_IS_MSSQL(x) ((x->product_version & 0x80000000u)!=0) 1597 #define TDS_MS_VER(maj,min,x) (0x80000000u|((maj)<<24)|((min)<<16)|(x)) 1601 #define TDS_SYB_VER(maj,min,x) (((maj)<<24)|((min)<<16)|(x)<<8) TDS_TINYINT column_scale
scale for decimal/numeric
Definition: tds.h:963
TDS_DBG_LOG_STATE
An attempt at better logging.
Definition: tds.h:1082
void tdsdump_log(const char *file, unsigned int level_line, const char *fmt,...)
This function write a message to the debug log.
Definition: log.c:371
int tds_submit_unprepare(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Send a unprepare request for a prepared query.
Definition: query.c:1757
TDS_TINYINT column_varint_size
size of length when reading from wire (0, 1, 2 or 4)
Definition: tds.h:960
TDS_STATE tds_set_state(TDSSOCKET *tds, TDS_STATE state)
Set state of TDS connection, with logging and checking.
Definition: util.c:90
struct tds_column TDSCOLUMN
Metadata about columns in regular and compute rows.
Hold information for a server connection.
Definition: tds.h:1276
int tds_submit_execdirect(TDSSOCKET *tds, const char *query, TDSPARAMINFO *params)
Submit a prepared query with parameters.
Definition: query.c:1141
char * cursor_name
name of the cursor
Definition: tds.h:1168
int tds_iconv_alloc(TDSSOCKET *tds)
Allocate iconv stuff.
Definition: iconv.c:277
TDSDYNAMIC * dyns
list of dynamic allocate for this connection
Definition: tds.h:1336
int tds_version(TDSSOCKET *tds_socket, char *pversion_string)
Returns the version of the TDS protocol in effect for the link as a decimal integer.
Definition: util.c:192
const char * tds_next_placeholder(const char *start)
Get position of next placeholder.
Definition: query.c:463
TDS_UINT product_version
version of product (Sybase/MS and full version)
Definition: tds.h:1284
int tdsdump_open(const char *filename)
This creates and truncates a human readable dump file for the TDS traffic.
Definition: log.c:122
cilent is waiting for data
Definition: tds.h:1051
DSTR password
password of account login
Definition: tds.h:862
int tds7_get_instance_port(const char *ip_addr, const char *instance)
Get port of given instance.
Definition: net.c:819
TDS_SYS_SOCKET s
tcp socket, INVALID_SOCKET if not connected
Definition: tds.h:1280
TDS_INT minute
0-59
Definition: tds.h:173
struct _tds_compiletime_settings TDS_COMPILETIME_SETTINGS
A structure to hold all the compile-time settings.
int tds_get_dynid(TDSSOCKET *tds, char **id)
Get an id for dynamic query based on TDS information.
Definition: query.c:1721
TDSPARAMINFO * tds_alloc_param_result(TDSPARAMINFO *old_param)
Adds a output parameter to TDSPARAMINFO.
Definition: mem.c:182
TDSCURSOR * cur_cursor
cursor in use
Definition: tds.h:1321
struct tds_env TDSENV
Current environment as reported by the server.
void tds_set_server(TDSLOGIN *tds_login, const char *server)
Set the servername in a TDSLOGIN structure.
Definition: login.c:123
TDSRESULTINFO * current_results
info about current query.
Definition: tds.h:1316
Log calls to (and in) libtds.
Definition: tds.h:1093
int tds_read_conf_file(TDSCONNECTION *connection, const char *server)
Read configuration info for given server return 0 on error.
Definition: config.c:294
void tdsdump_dump_buf(const char *file, unsigned int level_line, const char *msg, const void *buf, int length)
Dump the contents of data into the log file in a human readable format.
Definition: log.c:274
client is reading data
Definition: tds.h:1052
unsigned in_pos
current position in in_buf
Definition: tds.h:1297
TDS_SMALLINT column_namelen
length of column name
Definition: tds.h:965
int tds_flush_packet(TDSSOCKET *tds)
Flush packet to server.
Definition: write.c:292
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)
Definition: config.c:388
error occurred
Definition: tds.h:252
_TDS_STATE
values for tds->state
Definition: tds.h:1047
struct tds_dynamic TDSDYNAMIC
Holds information for a dynamic (also called prepared) query.
struct _tds_cursor TDSCURSOR
Holds informations about a cursor.
TDS 8.0 collation informations.
Definition: tds.h:905
TDSICONV * tds_iconv_from_collate(TDSSOCKET *tds, int sql_collate, int lcid)
Get iconv information from a LCID (to support different column encoding under MSSQL2K) ...
Definition: iconv.c:1437
unsigned char out_flag
output buffer type
Definition: tds.h:1307
Definition: tdsiconv.h:132
Log asynchronous function starts or completes.
Definition: tds.h:1087
const TDS_COMPILETIME_SETTINGS * tds_get_compiletime_settings(void)
Return a structure capturing the compile-time settings provided to the configure script.
Definition: config.c:1079
int tds_get_char_data(TDSSOCKET *tds, char *dest, size_t wire_size, TDSCOLUMN *curcol)
Fetch character data the wire.
Definition: read.c:229
TDSCONNECTION * connection
config for login stuff.
Definition: tds.h:1345
int tds_submit_execute(TDSSOCKET *tds, TDSDYNAMIC *dyn)
tds_submit_execute() sends a previously prepared dynamic statement to the server. ...
Definition: query.c:1623
TDS_INT month
month number (0-11)
Definition: tds.h:168
no data expected
Definition: tds.h:1049
int tdserror(const TDSCONTEXT *tds_ctx, TDSSOCKET *tds, int msgno, int errnum)
Call the client library's error handler (for library-generated errors only)
Definition: util.c:322
final result set, command completed successfully.
Definition: tds.h:250
void tds_unget_byte(TDSSOCKET *tds)
Unget will always work as long as you don't call it twice in a row.
Definition: read.c:90
Hold information for any results.
Definition: tds.h:1026
int tds_get_size_by_type(int servertype)
Return the number of bytes needed by specified type.
Definition: read.c:322
unsigned char * in_buf
input buffer
Definition: tds.h:1291
TDSCONNECTION * tds_alloc_connection(TDSLOCALE *locale)
Allocate space for configure structure and initialize with default values.
Definition: mem.c:722
TDSPARAMINFO * res_info
query results
Definition: tds.h:1211
enum _TDS_STATE TDS_STATE
values for tds->state
void tds_free_dynamic(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Frees dynamic statement and remove from TDS.
Definition: mem.c:144
TDSPARAMINFO * params
query parameters.
Definition: tds.h:1219
Holds information for a dynamic (also called prepared) query.
Definition: tds.h:1199
int tds_cursor_dealloc(TDSSOCKET *tds, TDSCURSOR *cursor)
Send a deallocation request to server libTDS care for all deallocation stuff (memory and server curso...
Definition: query.c:2674
Log client- and server-generated messages.
Definition: tds.h:1088
struct tds_blob TDSBLOB
Information about blobs (e.g.
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 determi...
Definition: token.c:2802
void tdsdump_close(void)
Close the TDS dump log file.
Definition: log.c:215
struct _tds_encoding TDS_ENCODING
Information relevant to libiconv.
count field in packet is valid
Definition: tds.h:255
TDS_TINYINT has_status
true is ret_status is valid
Definition: tds.h:1323
int tds_quote_id(TDSSOCKET *tds, char *buffer, const char *id, int idlen)
Quote an id.
Definition: query.c:1990
char * query
saved query, we need to know original query if prepare is impossible
Definition: tds.h:1227
all above except login packets
Definition: tds.h:1095
const int tds_numeric_bytes_per_prec[]
The following little table is indexed by precision and will tell us the number of bytes required to s...
Definition: numeric.c:60
char * tds_timestamp_str(char *str, int maxlen)
Definition: threadsafe.c:90
int tds_process_login_tokens(TDSSOCKET *tds)
tds_process_login_tokens() is called after sending the login packet to the server.
Definition: token.c:300
TDS_INT column_size
maximun size of data.
Definition: tds.h:958
void * tds_alloc_param_data(TDSCOLUMN *curparam)
Allocate data for a parameter.
Definition: mem.c:267
Log calls to client libraries.
Definition: tds.h:1086
A structure to hold all the compile-time settings.
Definition: tds.h:52
volatile unsigned char in_cancel
indicate we are waiting a cancel reply so discard tokens till acknowledge
Definition: tds.h:1327
int tds_submit_rpc(TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params)
tds_submit_rpc() call a RPC from server.
Definition: query.c:1833
TDS_INT type
row fetched from this cursor
Definition: tds.h:1182
TDS_INT num_id
numeric id for mssql7+
Definition: tds.h:1210
void tds_lookup_host(const char *servername, char *ip)
Given a servername lookup the hostname.
Definition: config.c:733
struct tds_result_info TDSRESULTINFO
Hold information for any results.
struct tdsdaterec TDSDATEREC
information on data, used by tds_datecrack
int tds_process_tokens(TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsigned flag)
process all streams.
Definition: token.c:473
TDSLOCALE * tds_get_locale(void)
Get locale information.
Definition: locale.c:54
void tds_fix_connection(TDSCONNECTION *connection)
Fix configuration after reading it.
Definition: config.c:237
TDS_INT day
day of month (1-31)
Definition: tds.h:169
more results follow
Definition: tds.h:251
void tds_set_column_type(TDSSOCKET *tds, TDSCOLUMN *curcol, int type)
Set type of column initializing all dependency.
Definition: data.c:51
DSTR server_name
server name (in freetds.conf)
Definition: tds.h:850
Information about blobs (e.g.
Definition: tds.h:895
TDSDYNAMIC * tds_lookup_dynamic(TDSSOCKET *tds, char *id)
Find a dynamic given string id.
Definition: token.c:2604
int tds_submit_query(TDSSOCKET *tds, const char *query)
tds_submit_query() sends a language string to the database server for processing. ...
Definition: query.c:188
SQL server server error.
Definition: tds.h:258
TDS_INT year
year
Definition: tds.h:167
DSTR server_charset
charset of server
Definition: tds.h:856
int tds_connect(TDSSOCKET *tds, TDSCONNECTION *connection)
Do a connection to socket.
Definition: login.c:312
acknowledging an attention command (usually a cancel)
Definition: tds.h:256
information on data, used by tds_datecrack
Definition: tds.h:165
void tds_free_param_result(TDSPARAMINFO *param_info)
Delete latest parameter.
Definition: mem.c:222
tds_end
Flags returned in TDS_DONE token.
Definition: tds.h:248
int port
port of database service
Definition: tds.h:851
TDS_INT tds_datecrack(TDS_INT datetype, const void *di, TDSDATEREC *dr)
Convert from db date format to a structured date format.
Definition: convert.c:2944
TDS_INT bcp_prefix_len
The length, in bytes, of any length prefix this column may have.
Definition: tds.h:1019
void tds_set_param_type(TDSSOCKET *tds, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
Set type of column initializing all dependency.
Definition: data.c:72
TDS_CURSOR_STATUS status
cursor parameter
Definition: tds.h:1179
DSTR ip_addr
ip of server
Definition: tds.h:872
int tds_alloc_row(TDSRESULTINFO *res_info)
Allocate space for row store return NULL on out of memory.
Definition: mem.c:416
TDSDYNAMIC * cur_dyn
dynamic structure in use
Definition: tds.h:1335
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...
Definition: read.c:290
DSTR user_name
account for login
Definition: tds.h:861
TDS_TINYINT cursor_name_len
length of cursor name > 0 and <= 30
Definition: tds.h:1167
unsigned out_pos
current position in out_buf
Definition: tds.h:1299
Information relevant to libiconv.
Definition: tds.h:927
TDS_INT column_cur_size
size written in variable (ie: char, text, binary).
Definition: tds.h:996
TDSDYNAMIC * tds_alloc_dynamic(TDSSOCKET *tds, const char *id)
Allocate a dynamic statement.
Definition: mem.c:94
unsigned in_len
input buffer length
Definition: tds.h:1301
int tds_put_string(TDSSOCKET *tds, const char *buf, int len)
Output a string to wire automatic translate string to unicode if needed.
Definition: write.c:100
TDS_INT ret_status
return status from store procedure
Definition: tds.h:1324
int emulated
this dynamic query cannot be prepared so libTDS have to construct a simple query. ...
Definition: tds.h:1225
const TDSICONV * char_conv
refers to previously allocated iconv information
Definition: tds.h:973
unsigned int in_buf_max
allocated input buffer
Definition: tds.h:1295
TDS_INT cursor_id
cursor id returned by the server after cursor declare
Definition: tds.h:1169
TDS_USMALLINT query_len
SQL query length.
Definition: tds.h:1172
Holds informations about a cursor.
Definition: tds.h:1163
replaces TDSDUMPCONFIG
Definition: tds.h:1094
int 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.
Definition: query.c:997
TDS_TINYINT hasargs
cursor parameters exists ?
Definition: tds.h:1171
unsigned char * tds7_crypt_pass(const unsigned char *clear_pass, int len, unsigned char *crypt_pass)
tds7_crypt_pass() – 'encrypt' TDS 7.0 style passwords.
Definition: login.c:883
TDS_TINYINT column_prec
precision for decimal/numeric
Definition: tds.h:962
unsigned char in_flag
input buffer type
Definition: tds.h:1305
Metadata about columns in regular and compute rows.
Definition: tds.h:948
TDSCONNECTION * tds_read_config_info(TDSSOCKET *tds, TDSLOGIN *login, TDSLOCALE *locale)
tds_read_config_info() will fill the tds connection structure based on configuration information gath...
Definition: config.c:144
int tds_read_packet(TDSSOCKET *tds)
Read in one 'packet' from the server.
Definition: net.c:552
const char * tds_skip_quoted(const char *s)
Skip quoting string (like 'sfsf', "dflkdj" or [dfkjd])
Definition: query.c:443
Log hex dump of packets to/from the server.
Definition: tds.h:1092
TDS_SMALLINT column_type
This type can be different from wire type because conversion (e.g.
Definition: tds.h:950
void tds_free_input_params(TDSDYNAMIC *dyn)
Frees all allocated input parameters of a dynamic statement.
Definition: mem.c:126
for diagnosing login problems; otherwise the username/password information is suppressed.
Definition: tds.h:1084
char * tds_get_homedir(void)
Get user home directory.
Definition: threadsafe.c:513
TDS_INT cursor_rows
< number of updatable columns
Definition: tds.h:1177
TDS_TINYINT options
read only|updatable
Definition: tds.h:1170
unsigned char last_packet
true if current input buffer is the last one
Definition: tds.h:1309
int tds_get_conversion_type(int srctype, int colsize)
Return type suitable for conversions (convert all nullable types to fixed type)
Definition: convert.c:152
TDS_INT tds_get_int(TDSSOCKET *tds)
Get an int32 from the server.
Definition: read.c:127
void tdsdump_on(void)
Turn logging back on.
Definition: log.c:105
void tdsdump_off(void)
Temporarily turn off logging.
Definition: log.c:93
client is sending request
Definition: tds.h:1050
int tds_process_simple_query(TDSSOCKET *tds)
Process results for simple query as "SET TEXTSIZE" or "USE dbname" If the statement returns results...
Definition: token.c:794
TDS_INT ref_count
reference counter so client can retain safely a pointer
Definition: tds.h:1166
TDS_INT weekday
day of week (0-6, 0 = sunday)
Definition: tds.h:171
TDS_OPTION_CMD
options that can be sent with a TDS_OPTIONCMD token
Definition: tds.h:570
TDS_INT dayofyear
day of year (1-366)
Definition: tds.h:170
TDSCURSOR * cursors
linked list of cursors allocated for this connection
Definition: tds.h:1322
struct _tds_cursor * next
next in linked list, keep first
Definition: tds.h:1165
TDS_INT hour
0-23
Definition: tds.h:172
unsigned char * out_buf
output buffer
Definition: tds.h:1293
int tds_send_cancel(TDSSOCKET *tds)
tds_send_cancel() sends an empty packet (8 byte header only) tds_process_cancel should be called dire...
Definition: query.c:1930
void tds_config_verstr(const char *tdsver, TDSCONNECTION *connection)
Set TDS version from given string.
Definition: config.c:668
int tds_quote_string(TDSSOCKET *tds, char *buffer, const char *str, int len)
Quote a string.
Definition: query.c:2031
TDS_INT second
0-59
Definition: tds.h:174
Current environment as reported by the server.
Definition: tds.h:1188
TDS_INT8 rows_affected
rows updated/deleted/inserted/selected, TDS_NO_COUNT if not valid
Definition: tds.h:1329
results are from a stored procedure
Definition: tds.h:254
no connection
Definition: tds.h:1053
char * query
SQL query.
Definition: tds.h:1173
int 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.
Definition: query.c:279
TDS_SMALLINT tds_get_smallint(TDSSOCKET *tds)
Get an int16 from the server.
Definition: read.c:110
TDSAUTHENTICATION * tds_ntlm_get_auth(TDSSOCKET *tds)
Build a NTLMSPP packet to send to server.
Definition: challenge.c:366
transaction in progress
Definition: tds.h:253
struct tds_dynamic * next
next in linked list, keep first
Definition: tds.h:1201
int tds_get_string(TDSSOCKET *tds, int string_len, char *dest, size_t dest_size)
Fetch a string from the wire.
Definition: read.c:186
TDS_INT millisecond
0-999
Definition: tds.h:175
int tds_process_cancel(TDSSOCKET *tds)
Definition: token.c:2571
int tds_set_interfaces_file_loc(const char *interfloc)
Set the full name of interface file.
Definition: config.c:708
int tds_count_placeholders(const char *query)
Count the number of placeholders in query.
Definition: query.c:498