#include <freetds/tds.h>
#include <freetds/thread.h>
#include <freetds/data.h>
#include <isql.h>
#include <isqlext.h>
#include <wchar.h>
#include <freetds/pushvis.h>
#include <freetds/popvis.h>
Go to the source code of this file.
Go to the SVN repository for this file.
#define TDS_DONT_DEFINE_DEFAULT_FUNCTIONS #define SQLULEN SQLUINTEGER #define SQLLEN SQLINTEGER #define SQLSETPOSIROW SQLUSMALLINT #define SQLROWOFFSET SQLLEN #define SQLROWSETSIZE SQLULEN #define ODBC_API SQL_API #define ODBC_PUBLIC #define ODBC_MAX(a, b) ( (a) > (b) ? (a) : (b) ) #define ODBC_MIN(a, b) ( (a) < (b) ? (a) : (b) ) #define ODBC_CLAMP(x, a, b) ( (x) < (a) ? (a) : (x) > (b) ? (b) : (x) ) #define ODBC_RETURN(handle, rc) #define ODBC_RETURN_(handle) #define ODBC_EXIT(handle, rc) #define ODBC_EXIT_(handle) #define DESC_IRD 1 #define DESC_IPD 2 #define DESC_ARD 3 #define DESC_APD 4 #define TDS_MAX_APP_DESC 100 #define IS_HENV(x) (((TDS_CHK *)x)->htype == SQL_HANDLE_ENV) #define IS_HDBC(x) (((TDS_CHK *)x)->htype == SQL_HANDLE_DBC) #define IS_HSTMT(x) (((TDS_CHK *)x)->htype == SQL_HANDLE_STMT) #define IS_HDESC(x) (((TDS_CHK *)x)->htype == SQL_HANDLE_DESC) #define ODBC_PARAM_LIST #define ODBC_PARAM(p) ODBC_PARAM_##p, #define CHECK_ENV_EXTRA(env) #define CHECK_DBC_EXTRA(dbc) #define CHECK_STMT_EXTRA(stmt) #define CHECK_DESC_EXTRA(desc) #define _wide #define _wide0 #define _WIDE #define ODBC_CHAR SQLCHAR #define odbc_dstr_copy_oct odbc_dstr_copy #define odbc_set_string(dbc, buf, buf_len, out_len, s, s_len) odbc_set_string_flag(dbc, buf, buf_len, out_len, s, s_len, (sizeof(*(out_len)) == sizeof(SQLSMALLINT)?0:0x10)) #define odbc_set_string_oct(dbc, buf, buf_len, out_len, s, s_len) odbc_set_string_flag(dbc, buf, buf_len, out_len, s, s_len, (sizeof(*(out_len)) == sizeof(SQLSMALLINT)?0x20:0x30)) #define odbc_set_dstr_oct(dbc, buf, buf_len, out_len, s) odbc_set_string_oct(dbc, buf, buf_len, out_len, tds_dstr_cstr(s), tds_dstr_len(s)) #define odbc_set_dstr(dbc, buf, buf_len, out_len, s) odbc_set_string(dbc, buf, buf_len, out_len, tds_dstr_cstr(s), tds_dstr_len(s)) #define sqlwcslen(s) wcslen(s) #define SQLWSTR_BUFS(n) do {} while(0) #define SQLWSTR(s) ((const wchar_t*)(s)) #define SQLWSTR_FREE() do {} while(0) enum TDS_ODBC_ROW_STATUS {Definition at line 611 of file odbc.h.
◆ CHECK_DESC_EXTRA #define CHECK_DESC_EXTRA ( desc )Definition at line 613 of file odbc.h.
◆ CHECK_ENV_EXTRA #define CHECK_ENV_EXTRA ( env )Definition at line 610 of file odbc.h.
◆ CHECK_STMT_EXTRA #define CHECK_STMT_EXTRA ( stmt )Definition at line 612 of file odbc.h.
◆ DESC_APD ◆ DESC_ARD ◆ DESC_IPD ◆ DESC_IRD ◆ IS_HDBC ◆ IS_HDESC ◆ IS_HENV ◆ IS_HSTMT ◆ ODBC_API ◆ ODBC_CHAR ◆ ODBC_CLAMP #define ODBC_CLAMP ( x, a, b ) ( (x) < (a) ? (a) : (x) > (b) ? (b) : (x) )Definition at line 93 of file odbc.h.
◆ odbc_dstr_copy_oct ◆ ODBC_EXIT #define ODBC_EXIT ( handle, rc ) Value: do{
SQLRETURN_odbc_rc = handle->errs.lastrc = (rc); \
odbc_check_struct_extra(handle); \
tds_mutex_unlock(&handle->mtx); \
return _odbc_rc; } while(0)
Definition at line 130 of file odbc.h.
◆ ODBC_EXIT_ #define ODBC_EXIT_ ( handle ) Value: do{
SQLRETURN_odbc_rc = handle->errs.lastrc; \
odbc_check_struct_extra(handle); \
tds_mutex_unlock(&handle->mtx); \
return _odbc_rc; } while(0)
Definition at line 135 of file odbc.h.
◆ ODBC_MAX #define ODBC_MAX ( a, b ) ( (a) > (b) ? (a) : (b) )Definition at line 91 of file odbc.h.
◆ ODBC_MIN #define ODBC_MIN ( a, b ) ( (a) < (b) ? (a) : (b) )Definition at line 92 of file odbc.h.
◆ ODBC_PARAM #define ODBC_PARAM ( p ) ODBC_PARAM_##p,Definition at line 532 of file odbc.h.
◆ ODBC_PARAM_LIST Value:ODBC_PARAM(Server) \
ODBC_PARAM(DSN) \
ODBC_PARAM(UID) \
ODBC_PARAM(Address) \
ODBC_PARAM(Port) \
ODBC_PARAM(TDS_Version) \
ODBC_PARAM(Language) \
ODBC_PARAM(Database) \
ODBC_PARAM(TextSize) \
ODBC_PARAM(PacketSize) \
ODBC_PARAM(ClientCharset) \
ODBC_PARAM(DumpFile) \
ODBC_PARAM(DumpFileAppend) \
ODBC_PARAM(DebugFlags) \
ODBC_PARAM(Encryption) \
ODBC_PARAM(Trusted_Connection) \
ODBC_PARAM(APP) \
ODBC_PARAM(WSID) \
ODBC_PARAM(UseNTLMv2) \
ODBC_PARAM(MARS_Connection) \
ODBC_PARAM(REALM) \
ODBC_PARAM(ServerSPN) \
ODBC_PARAM(AttachDbFilename) \
ODBC_PARAM(ApplicationIntent) \
ODBC_PARAM(Timeout)
Definition at line 503 of file odbc.h.
◆ ODBC_PUBLIC ◆ ODBC_RETURN #define ODBC_RETURN ( handle, rc ) Value:return handle->errs.lastrc = (rc); } while(0)
static void odbc_check_struct_extra(void *p)
Definition at line 123 of file odbc.h.
◆ ODBC_RETURN_ #define ODBC_RETURN_ ( handle ) Value:return handle->errs.lastrc; } while(0)
Definition at line 126 of file odbc.h.
◆ odbc_set_dstr ◆ odbc_set_dstr_oct ◆ odbc_set_string #define odbc_set_string ( dbc, buf, buf_len, out_len, s, s_len ) odbc_set_string_flag(dbc, buf, buf_len, out_len, s, s_len, (sizeof(*(out_len)) == sizeof(SQLSMALLINT)?0:0x10))Definition at line 675 of file odbc.h.
◆ odbc_set_string_oct #define odbc_set_string_oct ( dbc, buf, buf_len, out_len, s, s_len ) odbc_set_string_flag(dbc, buf, buf_len, out_len, s, s_len, (sizeof(*(out_len)) == sizeof(SQLSMALLINT)?0x20:0x30))Definition at line 677 of file odbc.h.
◆ SQLLEN ◆ SQLROWOFFSET ◆ SQLROWSETSIZE ◆ SQLSETPOSIROW ◆ SQLULEN ◆ sqlwcslen #define sqlwcslen ( s ) wcslen(s)Definition at line 740 of file odbc.h.
◆ SQLWSTR #define SQLWSTR ( s ) ((const wchar_t*)(s))Definition at line 743 of file odbc.h.
◆ SQLWSTR_BUFS #define SQLWSTR_BUFS ( n ) do {} while(0)Definition at line 742 of file odbc.h.
◆ SQLWSTR_FREE #define SQLWSTR_FREE ( ) do {} while(0)Definition at line 744 of file odbc.h.
◆ TDS_DONT_DEFINE_DEFAULT_FUNCTIONS #define TDS_DONT_DEFINE_DEFAULT_FUNCTIONSDefinition at line 24 of file odbc.h.
◆ TDS_MAX_APP_DESC #define TDS_MAX_APP_DESC 100Definition at line 282 of file odbc.h.
◆ TDS_CHK ◆ TDS_DBC ◆ TDS_DESC ◆ TDS_ENV ◆ TDS_ERRSDefinition at line 1 of file odbc.h.
◆ TDS_STMT ◆ anonymous enum Enumerator ODBC_PARAM_Servername ODBC_PARAM_Server ODBC_PARAM_DSN ODBC_PARAM_UID ODBC_PARAM_PWD ODBC_PARAM_Address ODBC_PARAM_Port ODBC_PARAM_TDS_Version ODBC_PARAM_Language ODBC_PARAM_Database ODBC_PARAM_TextSize ODBC_PARAM_PacketSize ODBC_PARAM_ClientCharset ODBC_PARAM_DumpFile ODBC_PARAM_DumpFileAppend ODBC_PARAM_DebugFlags ODBC_PARAM_Encryption ODBC_PARAM_Trusted_Connection ODBC_PARAM_APP ODBC_PARAM_WSID ODBC_PARAM_UseNTLMv2 ODBC_PARAM_MARS_Connection ODBC_PARAM_REALM ODBC_PARAM_ServerSPN ODBC_PARAM_AttachDbFilename ODBC_PARAM_ApplicationIntent ODBC_PARAM_Timeout ODBC_PARAM_SIZEDefinition at line 533 of file odbc.h.
◆ TDS_ODBC_ROW_STATUS Enumerator NOT_IN_ROW IN_NORMAL_ROW IN_COMPUTE_ROW AFTER_COMPUTE_ROW PRE_NORMAL_ROW NOT_IN_ROW IN_NORMAL_ROW IN_COMPUTE_ROW AFTER_COMPUTE_ROW PRE_NORMAL_ROWDefinition at line 374 of file odbc.h.
◆ TDS_ODBC_SPECIAL_ROWS Enumerator ODBC_SPECIAL_NONE ODBC_SPECIAL_GETTYPEINFO ODBC_SPECIAL_COLUMNS ODBC_SPECIAL_PROCEDURECOLUMNS ODBC_SPECIAL_SPECIALCOLUMNS ODBC_SPECIAL_NONE ODBC_SPECIAL_GETTYPEINFO ODBC_SPECIAL_COLUMNS ODBC_SPECIAL_PROCEDURECOLUMNS ODBC_SPECIAL_SPECIALCOLUMNSDefinition at line 383 of file odbc.h.
◆ _SQLRowCount() ◆ continue_parse_prepared_query() ◆ convert_datetime2server()Definition at line 40 of file sql2tds.c.
References TDS_DATETIMEALL::date, tagDATE_STRUCT::day, tagTIMESTAMP_STRUCT::day, tagTIMESTAMP_STRUCT::fraction, gettimeofday(), TDS_DATETIMEALL::has_date, TDS_DATETIMEALL::has_time, tagTIME_STRUCT::hour, tagTIMESTAMP_STRUCT::hour, i, tagTIME_STRUCT::minute, tagTIMESTAMP_STRUCT::minute, tagDATE_STRUCT::month, tagTIMESTAMP_STRUCT::month, NULL, tagTIME_STRUCT::second, tagTIMESTAMP_STRUCT::second, SQL_C_DATE, SQL_C_TIME, SQL_C_TIMESTAMP, SQL_C_TYPE_DATE, SQL_C_TYPE_TIME, SQL_C_TYPE_TIMESTAMP, TDS_CONVERT_FAIL, tds_localtime_r, TDS_DATETIMEALL::time, tagDATE_STRUCT::year, and tagTIMESTAMP_STRUCT::year.
Referenced by odbc_sql2tds().
◆ desc_alloc()Definition at line 41 of file descriptor.c.
References CHECK_DESC_EXTRA, DESC_APD, DESC_ARD, DESC_IPD, DESC_IRD, free(), _hdesc::header, _hdesc::htype, _hdesc::mtx, NULL, _hdesc::parent, _hdesc::records, SQL_BIND_BY_COLUMN, _dheader::sql_desc_alloc_type, _dheader::sql_desc_array_size, _dheader::sql_desc_bind_type, _dheader::sql_desc_count, SQL_HANDLE_DESC, tds_mutex_init, tds_new0, and _hdesc::type.
◆ desc_alloc_records()Definition at line 85 of file descriptor.c.
References count, DESC_APD, DESC_ARD, desc_free_record(), DESC_IPD, DESC_IRD, _hdesc::header, i, _hdesc::records, SQL_C_DEFAULT, _drecord::sql_desc_concise_type, _dheader::sql_desc_count, _drecord::sql_desc_parameter_type, SQL_DESC_STRINGS, _drecord::sql_desc_type, SQL_ERROR, SQL_PARAM_INPUT, SQL_SUCCESS, TDS_RESIZE, and _hdesc::type.
Referenced by desc_copy().
◆ desc_copy()Definition at line 149 of file descriptor.c.
References desc_alloc_records(), desc_free_records(), _hdesc::errs, _hdesc::header, i, NULL, odbc_errs_reset(), _hdesc::records, _dheader::sql_desc_alloc_type, _dheader::sql_desc_count, SQL_DESC_STRINGS, SQL_ERROR, SQL_SUCCESS, and tmp.
◆ desc_free() ◆ desc_free_records() ◆ desc_get_dbc() ◆ native_sql() ◆ odbc_bcp_batch()Commit a set of rows to the table.
Definition at line 278 of file bcp.c.
References dbc, NULL, ODBCBCP_ERROR_DBINT, tds_bcp_done, tds_bcp_start, TDS_DBG_FUNC, TDS_FAILED, and tdsdump_log.
◆ odbc_bcp_bind()Bind a program host variable to a database column.
Definition at line 345 of file bcp.c.
References tds_column::bcp_prefix_len, tds_column::bcp_term_len, tds_column::bcp_terminator, tds_column::column_bindlen, tds_column::column_bindtype, tds_column::column_type, tds_column::column_varaddr, dbc, is_fixed_type, is_tds_type_valid(), NULL, ODBCBCP_ERROR_RETURN, SQL_VARLEN_DATA, SYBBINARY, SYBCHAR, SYBIMAGE, SYBTEXT, TDS_DBG_FUNC, tds_new, TDS_ZERO_FREE, tdsdump_log, and terminator.
◆ odbc_bcp_colptr() void odbc_bcp_colptr ( TDS_DBC * dbc, const void * colptr, int table_column ) ◆ odbc_bcp_control() void odbc_bcp_control ( TDS_DBC * dbc, int field, void * value )Set BCP options for data transfer.
Definition at line 170 of file bcp.c.
References BCPHINTS, BCPKEEPIDENTITY, dbc, NULL, ODBCBCP_ERROR_RETURN, strdup, TDS_DBG_FUNC, tdsdump_log, and rapidjson::value.
◆ odbc_bcp_done()Conclude the transfer of data from program variables.
Definition at line 305 of file bcp.c.
References dbc, odbc_bcp_free_storage(), ODBCBCP_ERROR_DBINT, tds_bcp_done, TDS_DBG_FUNC, TDS_FAILED, and tdsdump_log.
◆ odbc_bcp_free_storage() void odbc_bcp_free_storage ( TDS_DBC * dbc ) ◆ odbc_bcp_init() ◆ odbc_bcp_sendrow() void odbc_bcp_sendrow ( TDS_DBC * dbc )Write data in host variables to the table.
Definition at line 236 of file bcp.c.
References _bcp_get_col_data(), dbc, NULL, ODBCBCP_ERROR_RETURN, tds, tds_bcp_send_record, tds_bcp_start_copy_in, TDS_DBG_FUNC, TDS_FAILED, and tdsdump_log.
◆ odbc_check_struct_extra() static void odbc_check_struct_extra ( void * p ) inlinestaticDefinition at line 120 of file odbc.h.
◆ odbc_dstr_copy() ◆ odbc_errs_add()add an error to list
Definition at line 382 of file error.c.
References assert, _sql_errors::errs, _sql_errors::lastrc, _sql_error::msg, msg(), n, _sql_error::native, _sql_errors::num_errors, odbc_get_msg(), odbc_get_v2state(), _sql_error::server, SQL_ERROR, SQL_SUCCESS_WITH_INFO, _sql_error::state2, _sql_error::state3, util::strcmp(), strdup, strlcpy, TDS_DBG_FUNC, TDS_RESIZE, and tdsdump_log.
◆ odbc_errs_add_rdbms()Add an error to list.
This functions is for error that came from server
Definition at line 419 of file error.c.
References _sql_errors::errs, _sql_error::linenum, _sql_error::msg, msg(), _sql_error::msgstate, n, _sql_error::native, _sql_errors::num_errors, odbc_get_msg(), _sql_error::row, row, _sql_error::server, sqlstate2to3(), _sql_error::state2, _sql_error::state3, strdup, strlcpy, and TDS_RESIZE.
◆ odbc_errs_reset()reset errors
Definition at line 343 of file error.c.
References assert, _sql_errors::errs, free(), i, _sql_errors::lastrc, _sql_error::msg, _sql_errors::num_errors, _sql_errors::ranked, _sql_error::server, SQL_SUCCESS, and TDS_ZERO_FREE.
Referenced by odbc_errs_pop().
◆ odbc_get_dsn_info()Read connection information from given DSN.
Definition at line 147 of file connectparams.c.
References tds_login::database, FILENAME_MAX, tds_login::ip_addrs, login, tds_login::mars, myGetPrivateProfileString(), NULL, odbc_errs_add(), parse_server(), tds_login::password, tds_login::server_name, tds_config_boolean, tds_dstr_copy(), tds_dstr_empty, tds_dstr_isempty(), TDS_FAILED, tds_lookup_host_set, tds_parse_conf_section, tds_read_conf_file, TDS_STR_APPENDMODE, TDS_STR_BLKSZ, TDS_STR_CLCHARSET, TDS_STR_DBFILENAME, TDS_STR_DEBUGFLAGS, TDS_STR_DUMPFILE, TDS_STR_ENCRYPTION, TDS_STR_LANGUAGE, TDS_STR_PORT, TDS_STR_REALM, TDS_STR_SPN, TDS_STR_TEXTSZ, TDS_STR_TIMEOUT, TDS_STR_USENTLMV2, TDS_STR_VERSION, tmp, and tds_login::user_name.
Referenced by odbc_parse_connect_string().
◆ odbc_get_param_len() ◆ odbc_get_string_size() ◆ odbc_get_wide_canonic() ◆ odbc_parse_connect_string()Parses a connection string for SQLDriverConnect().
Parses a connection string for SQLDriverConnect().
Parses a connection string for SQLDriverConnect().
Definition at line 275 of file connectparams.c.
References tds_login::app_name, CHK_PARAM, tds_login::client_host_name, tds_login::database, tds_login::db_filename, DSTR_INITIALIZER, int, TDS_PARSED_PARAM::len, login, tds_login::mars, NULL, odbc_dstr_swap(), odbc_errs_add(), odbc_get_dsn_info(), ODBC_PARAM_ClientCharset, ODBC_PARAM_PWD, ODBC_PARAM_SIZE, ODBC_PARAM_Trusted_Connection, ODBC_PARAM_UID, option, TDS_PARSED_PARAM::p, parse_server(), parse_value(), tds_login::password, PWD, tds_login::server_name, strcasecmp, tds_config_boolean, TDS_DBG_ERROR, TDS_DBG_INFO1, tds_dstr_buf(), tds_dstr_copyn(), tds_dstr_cstr(), tds_dstr_empty, tds_dstr_free(), tds_parse_conf_section, tds_read_conf_file, TDS_STR_APPENDMODE, TDS_STR_BLKSZ, TDS_STR_CLCHARSET, TDS_STR_DEBUGFLAGS, TDS_STR_DUMPFILE, TDS_STR_ENCRYPTION, TDS_STR_LANGUAGE, TDS_STR_PORT, TDS_STR_READONLY_INTENT, TDS_STR_REALM, TDS_STR_SPN, TDS_STR_TEXTSZ, TDS_STR_TIMEOUT, TDS_STR_USENTLMV2, TDS_STR_VERSION, tdsdump_log, tds_login::user_name, and rapidjson::value.
◆ odbc_set_sql_type_info()Definition at line 390 of file odbc_data.c.
References tds_column::column_prec, tds_column::column_scale, tds_column::column_size, tds_column::funcs, tds_column::on_server, SQL_DATETIME, _drecord::sql_desc_concise_type, _drecord::sql_desc_datetime_interval_code, _drecord::sql_desc_length, _drecord::sql_desc_num_prec_radix, _drecord::sql_desc_octet_length, _drecord::sql_desc_precision, _drecord::sql_desc_scale, _drecord::sql_desc_type, _drecord::sql_desc_unsigned, SQL_FALSE, and SQL_TYPE_TIMESTAMP.
◆ odbc_set_stmt_query() ◆ odbc_skip_rpc_name() ◆ odbc_sql2tds() ◆ odbc_tds2sql_col() ◆ odbc_tds2sql_int4() ◆ parse_const_param()Definition at line 183 of file native.c.
References isdigit(), isxdigit(), NULL, strncasecmp, SYBFLT8, SYBINT4, SYBINT8, SYBVARBINARY, SYBVARCHAR, tds_skip_quoted, tds_strtoll, and val.
Referenced by prepare_call().
◆ parse_prepared_query() int parse_prepared_query ( struct _hstmt * stmt, bool compute_row )Definition at line 199 of file prepare_query.c.
References int, NULL, odbc_errs_add(), odbc_sql2tds(), prepared_rpc(), SQL_ERROR, SQL_NEED_DATA, SQL_SUCCESS, stmt, tds_alloc_param_result, TDS_DBG_FUNC, and tdsdump_log.
◆ prepare_call()Definition at line 242 of file native.c.
References buf, IS_TDS72_PLUS, memmove, odbc_errs_add(), odbc_skip_rpc_name(), parse_const_param(), SQL_ERROR, SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, stmt, strncasecmp, tds_dstr_buf(), tds_dstr_isempty(), tds_dstr_setlen(), TDS_ISSPACE, to_native(), and type.
◆ start_parse_prepared_query() int start_parse_prepared_query ( struct _hstmt * stmt, bool compute_row ) ◆ tvp_alloc()Definition at line 226 of file descriptor.c.
References SQLTVP::apd, desc_alloc(), DESC_APD, DESC_IPD, _hdesc::focus, SQLTVP::ipd, NULL, SQL_DESC_ALLOC_AUTO, stmt, tds_dstr_init(), tds_new0, tvp_free(), and SQLTVP::type_name.
Referenced by _SQLBindParameter().
◆ tvp_free() void tvp_free ( SQLTVP * tvp )RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4