error_export.h
#undef tdsdump_log
#ifdef ENABLE_ODBC_WIDE
static SQLRETURN _SQLGetDiagRec(SQLSMALLINT handleType,
SQLHANDLE handle,
SQLSMALLINT numRecord,
ODBC_CHAR * szSqlStat,
SQLINTEGER * pfNativeError,
ODBC_CHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg, int wide);
SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDiagRecW(
SQLSMALLINT handleType,
SQLHANDLE handle,
SQLSMALLINT numRecord,
SQLWCHAR * szSqlStat,
SQLINTEGER * pfNativeError,
SQLWCHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg)
{
TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDiagRecW(%d, %p, %d, %p, %p, %p, %d, %p)\n",
(int) handleType,
handle,
(int) numRecord,
szSqlStat,
pfNativeError,
szErrorMsg, (int) cbErrorMsgMax, pcbErrorMsg);
return _SQLGetDiagRec(handleType,
handle,
numRecord,
(ODBC_CHAR*) szSqlStat,
pfNativeError,
(ODBC_CHAR*) szErrorMsg, cbErrorMsgMax, pcbErrorMsg, 1);
}
#endif
SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDiagRec(
SQLSMALLINT handleType,
SQLHANDLE handle,
SQLSMALLINT numRecord,
SQLCHAR * szSqlStat,
SQLINTEGER * pfNativeError,
SQLCHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg)
{
TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDiagRec(%d, %p, %d, %p, %p, %p, %d, %p)\n",
(int) handleType,
handle,
(int) numRecord,
szSqlStat,
pfNativeError,
szErrorMsg, (int) cbErrorMsgMax, pcbErrorMsg);
#ifdef ENABLE_ODBC_WIDE
return _SQLGetDiagRec(handleType,
handle,
numRecord,
(ODBC_CHAR*) szSqlStat,
pfNativeError,
(ODBC_CHAR*) szErrorMsg, cbErrorMsgMax, pcbErrorMsg, 0);
#else
return _SQLGetDiagRec(handleType,
handle,
numRecord,
szSqlStat,
pfNativeError,
szErrorMsg, cbErrorMsgMax, pcbErrorMsg);
#endif
}
#ifdef ENABLE_ODBC_WIDE
static SQLRETURN _SQLError(SQLHENV henv,
SQLHDBC hdbc,
SQLHSTMT hstmt,
ODBC_CHAR * szSqlStat,
SQLINTEGER * pfNativeError,
ODBC_CHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg, int wide);
SQLRETURN ODBC_PUBLIC ODBC_API SQLErrorW(
SQLHENV henv,
SQLHDBC hdbc,
SQLHSTMT hstmt,
SQLWCHAR * szSqlStat,
SQLINTEGER * pfNativeError,
SQLWCHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg)
{
TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLErrorW(%p, %p, %p, %p, %p, %p, %d, %p)\n",
henv,
hdbc,
hstmt,
szSqlStat,
pfNativeError,
szErrorMsg, (int) cbErrorMsgMax, pcbErrorMsg);
return _SQLError(henv,
hdbc,
hstmt,
(ODBC_CHAR*) szSqlStat,
pfNativeError,
(ODBC_CHAR*) szErrorMsg, cbErrorMsgMax, pcbErrorMsg, 1);
}
#endif
SQLRETURN ODBC_PUBLIC ODBC_API SQLError(
SQLHENV henv,
SQLHDBC hdbc,
SQLHSTMT hstmt,
SQLCHAR * szSqlStat,
SQLINTEGER * pfNativeError,
SQLCHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg)
{
TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLError(%p, %p, %p, %p, %p, %p, %d, %p)\n",
henv,
hdbc,
hstmt,
szSqlStat,
pfNativeError,
szErrorMsg, (int) cbErrorMsgMax, pcbErrorMsg);
#ifdef ENABLE_ODBC_WIDE
return _SQLError(henv,
hdbc,
hstmt,
(ODBC_CHAR*) szSqlStat,
pfNativeError,
(ODBC_CHAR*) szErrorMsg, cbErrorMsgMax, pcbErrorMsg, 0);
#else
return _SQLError(henv,
hdbc,
hstmt,
szSqlStat,
pfNativeError,
szErrorMsg, cbErrorMsgMax, pcbErrorMsg);
#endif
}
#ifdef ENABLE_ODBC_WIDE
static SQLRETURN _SQLGetDiagField(SQLSMALLINT handleType,
SQLHANDLE handle,
SQLSMALLINT numRecord,
SQLSMALLINT diagIdentifier,
SQLPOINTER buffer,
SQLSMALLINT cbBuffer,
SQLSMALLINT * pcbBuffer, int wide);
SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDiagFieldW(
SQLSMALLINT handleType,
SQLHANDLE handle,
SQLSMALLINT numRecord,
SQLSMALLINT diagIdentifier,
SQLPOINTER buffer,
SQLSMALLINT cbBuffer,
SQLSMALLINT * pcbBuffer)
{
TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDiagFieldW(%d, %p, %d, %d, %p, %d, %p)\n",
(int) handleType,
handle,
(int) numRecord,
(int) diagIdentifier,
buffer,
(int) cbBuffer,
pcbBuffer);
return _SQLGetDiagField(handleType,
handle,
numRecord,
diagIdentifier,
buffer,
cbBuffer,
pcbBuffer, 1);
}
#endif
SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDiagField(
SQLSMALLINT handleType,
SQLHANDLE handle,
SQLSMALLINT numRecord,
SQLSMALLINT diagIdentifier,
SQLPOINTER buffer,
SQLSMALLINT cbBuffer,
SQLSMALLINT * pcbBuffer)
{
TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDiagField(%d, %p, %d, %d, %p, %d, %p)\n",
(int) handleType,
handle,
(int) numRecord,
(int) diagIdentifier,
buffer,
(int) cbBuffer,
pcbBuffer);
#ifdef ENABLE_ODBC_WIDE
return _SQLGetDiagField(handleType,
handle,
numRecord,
diagIdentifier,
buffer,
cbBuffer,
pcbBuffer, 0);
#else
return _SQLGetDiagField(handleType,
handle,
numRecord,
diagIdentifier,
buffer,
cbBuffer,
pcbBuffer);
#endif
}
#define tdsdump_log TDSDUMP_LOG_FAST
tds_numeric_bytes_per_prec
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:41
dbrpcsend
RETCODE dbrpcsend(DBPROCESS *dbproc)
Execute the procedure and free associated memory.
Definition: rpc.c:281
_hdbc
Definition: odbc.h:275
tdsdaterec
Used by tds_datecrack.
Definition: tds.h:159
tds_dstr_empty
#define tds_dstr_empty(s)
Make a string empty.
Definition: string.h:91
_drecord
Definition: odbc.h:163
tds_set_param_type
void tds_set_param_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
Set type of column initializing all dependency.
Definition: data.c:246
tds_dstr_cstr
static const char * tds_dstr_cstr(const DSTR *s)
Returns a C version (NUL terminated string) of dstr.
Definition: string.h:78
tds_login::password
DSTR password
password of account login
Definition: tds.h:535
tdsdaterec::decimicrosecond
TDS_INT decimicrosecond
0-9999999
Definition: tds.h:169
tds_strftime
size_t tds_strftime(char *buf, size_t maxsize, const char *format, const TDSDATEREC *dr, int prec)
format a date string according to an "extended" strftime(3) formatting definition.
Definition: convert.c:2992
odbc_c_to_server_type
TDS_SERVER_TYPE odbc_c_to_server_type(int c_type)
Pass this an SQL_C_* type and get a SYB* type which most closely corresponds to the SQL_C_* type.
Definition: odbc_util.c:601
tds.h
Main include file for libtds.
tdsdaterec::day
TDS_INT day
day of month (1-31)
Definition: tds.h:163
tds_read_conf_section
bool tds_read_conf_section(FILE *in, const char *section, TDSCONFPARSE tds_conf_parse, void *param)
Read a section of configuration file (INI style file)
Definition: config.c:503
_hdesc
Definition: odbc.h:204
tds_dstr_isempty
static int tds_dstr_isempty(const DSTR *s)
test if string is empty
Definition: string.h:60
DBNUMERIC
Definition: sybdb.h:275
tds_get_conversion_type
TDS_SERVER_TYPE tds_get_conversion_type(TDS_SERVER_TYPE srctype, int colsize)
Return type suitable for conversions (convert all nullable types to fixed type)
Definition: tds_types.h:125
LOGINREC
Definition: bsqlodbc.c:100
tds_convert
TDS_INT tds_convert(const TDSCONTEXT *tds_ctx, int srctype, const void *src, TDS_UINT srclen, int desttype, CONV_RESULT *cr)
tds_convert convert a type to another.
Definition: convert.c:1891
tds_column::column_prec
TDS_TINYINT column_prec
precision for decimal/numeric
Definition: tds.h:703
conv_result
Definition: convert.h:34
_sql_error
Definition: odbc.h:94
tds_iconv_get_info
TDSICONV * tds_iconv_get_info(TDSCONNECTION *conn, int canonic_client, int canonic_server)
Get a iconv info structure, allocate and initialize if needed.
Definition: iconv.c:764
dbrpcinit
RETCODE dbrpcinit(DBPROCESS *dbproc, const char rpcname[], DBSMALLINT options)
Initialize a remote procedure call.
Definition: rpc.c:72
DBREMOTE_PROC
Definition: dblib.h:101
tds_dstr_copyn
DSTR * tds_dstr_copyn(DSTR *s, const char *src, size_t length)
Set string to a given buffer of characters.
Definition: tdsstring.c:77
tds_variant
Store variant informations.
Definition: tds.h:604
tds_get_null_type
TDS_SERVER_TYPE tds_get_null_type(TDS_SERVER_TYPE srctype)
Get same type but nullable.
Definition: convert.c:2926
s_v3to2map
Definition: error.c:168
tagSS_TIME2_STRUCT
Definition: odbcss.h:132
tds_login::db_filename
DSTR db_filename
database filename to attach (MSSQL)
Definition: tds.h:529
tds_column
Metadata about columns in regular and compute rows.
Definition: tds.h:689
tdsiconvinfo
Definition: iconv.h:92
_hstmt
Definition: odbc.h:381
tdsunique
Definition: proto.h:62
tds_read_conf_file
bool tds_read_conf_file(TDSLOGIN *login, const char *server)
Read configuration info for given server return 0 on error.
Definition: config.c:346
tds_datecrack
TDSRET tds_datecrack(TDS_INT datetype, const void *di, TDSDATEREC *dr)
Convert from db date format to a structured date format.
Definition: convert.c:3172
tds_blob
Information about blobs (e.g.
Definition: tds.h:593
_hchk
Definition: odbc.h:230
tds_dstr
Structure to hold a string.
Definition: string.h:36
tds_result_info
Hold information for any results.
Definition: tds.h:769
tdsdaterec::hour
TDS_INT hour
0-23
Definition: tds.h:166
tds_alloc_param_result
TDSPARAMINFO * tds_alloc_param_result(TDSPARAMINFO *old_param)
Adds a output parameter to TDSPARAMINFO.
Definition: mem.c:284
tds_login::ip_addrs
struct addrinfo * ip_addrs
ip(s) of server
Definition: tds.h:546
tdsdaterec::month
TDS_INT month
month number (0-11)
Definition: tds.h:162
tdsdaterec::second
TDS_INT second
0-59
Definition: tds.h:168
tds_alloc_param_data
void * tds_alloc_param_data(TDSCOLUMN *curparam)
Allocate data for a parameter.
Definition: mem.c:364
tds_get_size_by_type
int tds_get_size_by_type(TDS_SERVER_TYPE servertype)
Return the number of bytes needed by specified type.
Definition: tds_types.h:9
tds_login::server_name
DSTR server_name
server name (in freetds.conf)
Definition: tds.h:518
tds_column::column_size
TDS_INT column_size
maximun size of data.
Definition: tds.h:694
tds_column::column_cur_size
TDS_INT column_cur_size
size written in variable (ie: char, text, binary).
Definition: tds.h:736
tds_column::char_conv
TDSICONV * char_conv
refers to previously allocated iconv information
Definition: tds.h:712
sybdb.h
Primary include file for db-lib applications.
TDS_PARSED_PARAM
Definition: odbc.h:532
tds_dstr_free
void tds_dstr_free(DSTR *s)
free string
Definition: tdsstring.c:62
tdsdaterec::year
TDS_INT year
year
Definition: tds.h:160
ProfileParam
Definition: connectparams.c:523
tds_dstr_copy
DSTR * tds_dstr_copy(DSTR *s, const char *src)
copy a string from another
Definition: tdsstring.c:122
tds_login::port
int port
port of database service
Definition: tds.h:519
tds_column::column_scale
TDS_TINYINT column_scale
scale for decimal/numeric
Definition: tds.h:704
tds_login::user_name
DSTR user_name
account for login
Definition: tds.h:534
tds_iconv
size_t tds_iconv(TDSSOCKET *tds, TDSICONV *conv, TDS_ICONV_DIRECTION io, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
Wrapper around iconv(3).
Definition: iconv.c:598
TDS_DATETIMEALL::offset
TDS_SMALLINT offset
time offset
Definition: tds.h:149
_sql_errors
Definition: odbc.h:106
TDS_DATETIMEALL
this structure is not directed connected to a TDS protocol but keeps any DATE/TIME information.
Definition: tds.h:146
DBREMOTE_PROC_PARAM
Definition: dblib.h:89
dbrpcparam
RETCODE dbrpcparam(DBPROCESS *dbproc, const char paramname[], BYTE status, int db_type, DBINT maxlen, DBINT datalen, BYTE *value)
Add a parameter to a remote procedure call.
Definition: rpc.c:155
tds_socket
Information for a server connection.
Definition: tds.h:1163
tds_dblib_dbprocess
Definition: dblib.h:123
DSTR_INITIALIZER
#define DSTR_INITIALIZER
Initializer, used to initialize string like in the following example.
Definition: string.h:49
tdsdaterec::minute
TDS_INT minute
0-59
Definition: tds.h:167
tds_submit_rpc
TDSRET tds_submit_rpc(TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params, TDSHEADERS *head)
Calls a RPC from server.
Definition: query.c:1929
tagSS_TIMESTAMPOFFSET_STRUCT
Definition: odbcss.h:139
_henv
Definition: odbc.h:237
tds_column::column_type
TDS_SERVER_TYPE column_type
This type can be different from wire type because conversion (e.g.
Definition: tds.h:696
tds_context
Definition: tds.h:1029
tdsnumeric
Definition: proto.h:26
tds_login
Definition: tds.h:517
s_SqlMsgMap
Definition: error.c:48
dbperror
int dbperror(DBPROCESS *dbproc, DBINT msgno, long errnum,...)
Call client-installed error handler.
Definition: dblib.c:8148
tdsdump_log
void tdsdump_log(const char *file, unsigned int level_line, const char *fmt,...)
Write a message to the debug log.
Definition: log.c:396