3 #ifdef ENABLE_ODBC_WIDE 
    4 static SQLRETURN _SQLGetDiagRec(SQLSMALLINT handleType,
 
    8     SQLINTEGER * pfNativeError,
 
    9     ODBC_CHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg, 
int wide);
 
   11 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDiagRecW(
 
   12     SQLSMALLINT handleType,
 
   14     SQLSMALLINT numRecord,
 
   16     SQLINTEGER * pfNativeError,
 
   17     SQLWCHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg)
 
   19     TDSDUMP_LOG_FAST(TDS_DBG_FUNC, 
"SQLGetDiagRecW(%d, %p, %d, %p, %p, %p, %d, %p)\n",
 
   25             szErrorMsg, (
int) cbErrorMsgMax, pcbErrorMsg);
 
   26     return _SQLGetDiagRec(handleType,
 
   29         (ODBC_CHAR*) szSqlStat,
 
   31         (ODBC_CHAR*) szErrorMsg, cbErrorMsgMax, pcbErrorMsg, 1);
 
   35 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDiagRec(
 
   36     SQLSMALLINT handleType,
 
   38     SQLSMALLINT numRecord,
 
   40     SQLINTEGER * pfNativeError,
 
   41     SQLCHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg)
 
   43     TDSDUMP_LOG_FAST(TDS_DBG_FUNC, 
"SQLGetDiagRec(%d, %p, %d, %p, %p, %p, %d, %p)\n",
 
   49             szErrorMsg, (
int) cbErrorMsgMax, pcbErrorMsg);
 
   50 #ifdef ENABLE_ODBC_WIDE 
   51     return _SQLGetDiagRec(handleType,
 
   54         (ODBC_CHAR*) szSqlStat,
 
   56         (ODBC_CHAR*) szErrorMsg, cbErrorMsgMax, pcbErrorMsg, 0);
 
   58     return _SQLGetDiagRec(handleType,
 
   63         szErrorMsg, cbErrorMsgMax, pcbErrorMsg);
 
   67 #ifdef ENABLE_ODBC_WIDE 
   68 static SQLRETURN _SQLError(SQLHENV henv,
 
   71     ODBC_CHAR * szSqlStat,
 
   72     SQLINTEGER * pfNativeError,
 
   73     ODBC_CHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg, 
int wide);
 
   75 SQLRETURN ODBC_PUBLIC ODBC_API SQLErrorW(
 
   80     SQLINTEGER * pfNativeError,
 
   81     SQLWCHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg)
 
   83     TDSDUMP_LOG_FAST(TDS_DBG_FUNC, 
"SQLErrorW(%p, %p, %p, %p, %p, %p, %d, %p)\n",
 
   89             szErrorMsg, (
int) cbErrorMsgMax, pcbErrorMsg);
 
   90     return _SQLError(henv,
 
   93         (ODBC_CHAR*) szSqlStat,
 
   95         (ODBC_CHAR*) szErrorMsg, cbErrorMsgMax, pcbErrorMsg, 1);
 
   99 SQLRETURN ODBC_PUBLIC ODBC_API SQLError(
 
  104     SQLINTEGER * pfNativeError,
 
  105     SQLCHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg)
 
  107     TDSDUMP_LOG_FAST(TDS_DBG_FUNC, 
"SQLError(%p, %p, %p, %p, %p, %p, %d, %p)\n",
 
  113             szErrorMsg, (
int) cbErrorMsgMax, pcbErrorMsg);
 
  114 #ifdef ENABLE_ODBC_WIDE 
  115     return _SQLError(henv,
 
  118         (ODBC_CHAR*) szSqlStat,
 
  120         (ODBC_CHAR*) szErrorMsg, cbErrorMsgMax, pcbErrorMsg, 0);
 
  122     return _SQLError(henv,
 
  127         szErrorMsg, cbErrorMsgMax, pcbErrorMsg);
 
  131 #ifdef ENABLE_ODBC_WIDE 
  132 static SQLRETURN _SQLGetDiagField(SQLSMALLINT handleType,
 
  134     SQLSMALLINT numRecord,
 
  135     SQLSMALLINT diagIdentifier,
 
  137     SQLSMALLINT cbBuffer,
 
  138     SQLSMALLINT * pcbBuffer, 
int wide);
 
  140 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDiagFieldW(
 
  141     SQLSMALLINT handleType,
 
  143     SQLSMALLINT numRecord,
 
  144     SQLSMALLINT diagIdentifier,
 
  146     SQLSMALLINT cbBuffer,
 
  147     SQLSMALLINT * pcbBuffer)
 
  149     TDSDUMP_LOG_FAST(TDS_DBG_FUNC, 
"SQLGetDiagFieldW(%d, %p, %d, %d, %p, %d, %p)\n",
 
  153             (
int) diagIdentifier,
 
  157     return _SQLGetDiagField(handleType,
 
  167 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDiagField(
 
  168     SQLSMALLINT handleType,
 
  170     SQLSMALLINT numRecord,
 
  171     SQLSMALLINT diagIdentifier,
 
  173     SQLSMALLINT cbBuffer,
 
  174     SQLSMALLINT * pcbBuffer)
 
  176     TDSDUMP_LOG_FAST(TDS_DBG_FUNC, 
"SQLGetDiagField(%d, %p, %d, %d, %p, %d, %p)\n",
 
  180             (
int) diagIdentifier,
 
  184 #ifdef ENABLE_ODBC_WIDE 
  185     return _SQLGetDiagField(handleType,
 
  193     return _SQLGetDiagField(handleType,
 
  203 #define tdsdump_log TDSDUMP_LOG_FAST 
  
Primary include file for db-lib applications.
Store variant informations.
Definition: tds.h:605
Definition: connectparams.c:518
TDS_INT month
month number (0-11)
Definition: tds.h:163
TDS_INT second
0-59
Definition: tds.h:169
struct addrinfo * ip_addrs
ip(s) of server
Definition: tds.h:547
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
DSTR server_name
server name (in freetds.conf)
Definition: tds.h:519
void tds_dstr_free(DSTR *s)
free string
Definition: tdsstring.c:62
void tds_set_param_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
Set type of column initializing all dependency.
Definition: data.c:249
TDSRET tds_submit_rpc(TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params, TDSHEADERS *head)
Calls a RPC from server.
Definition: query.c:1929
Information about blobs (e.g.
Definition: tds.h:594
TDS_INT year
year
Definition: tds.h:161
TDS_TINYINT column_prec
precision for decimal/numeric
Definition: tds.h:704
#define tds_dstr_empty(s)
Make a string empty.
Definition: string.h:91
Hold information for any results.
Definition: tds.h:770
this structure is not directed connected to a TDS protocol but keeps any DATE/TIME information.
Definition: tds.h:147
Information for a server connection.
Definition: tds.h:1164
TDSPARAMINFO * tds_alloc_param_result(TDSPARAMINFO *old_param)
Adds a output parameter to TDSPARAMINFO.
Definition: mem.c:284
RETCODE dbrpcsend(DBPROCESS *dbproc)
Execute the procedure and free associated memory.
Definition: rpc.c:281
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
DSTR db_filename
database filename to attach (MSSQL)
Definition: tds.h:530
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:590
int dbperror(DBPROCESS *dbproc, DBINT msgno, long errnum,...)
Call client-installed error handler.
Definition: dblib.c:8131
DSTR * tds_dstr_copyn(DSTR *s, const char *src, size_t length)
Set string to a given buffer of characters.
Definition: tdsstring.c:77
int port
port of database service
Definition: tds.h:520
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:2968
static int tds_dstr_isempty(const DSTR *s)
test if string is empty
Definition: string.h:60
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:756
void tdsdump_log(const char *file, unsigned int level_line, const char *fmt,...)
Write a message to the debug log.
Definition: log.c:354
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:630
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:1878
TDS_INT column_size
maximun size of data.
Definition: tds.h:695
TDS_SERVER_TYPE tds_get_null_type(TDS_SERVER_TYPE srctype)
Get same type but nullable.
Definition: convert.c:2913
static const char * tds_dstr_cstr(const DSTR *s)
Returns a C version (NUL terminated string) of dstr.
Definition: string.h:78
TDS_INT minute
0-59
Definition: tds.h:168
TDS_TINYINT column_scale
scale for decimal/numeric
Definition: tds.h:705
TDS_INT decimicrosecond
0-9999999
Definition: tds.h:170
TDS_INT day
day of month (1-31)
Definition: tds.h:164
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
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
TDS_INT column_cur_size
size written in variable (ie: char, text, binary).
Definition: tds.h:737
Structure to hold a string.
Definition: string.h:36
TDSICONV * char_conv
refers to previously allocated iconv information
Definition: tds.h:713
TDS_SMALLINT offset
time offset
Definition: tds.h:150
Used by tds_datecrack.
Definition: tds.h:160
RETCODE dbrpcinit(DBPROCESS *dbproc, const char rpcname[], DBSMALLINT options)
Initialize a remote procedure call.
Definition: rpc.c:72
int tds_get_size_by_type(TDS_SERVER_TYPE servertype)
Return the number of bytes needed by specified type.
Definition: tds_types.h:9
bool tds_read_conf_file(TDSLOGIN *login, const char *server)
Read configuration info for given server return 0 on error.
Definition: config.c:346
DSTR password
password of account login
Definition: tds.h:536
TDSRET tds_datecrack(TDS_INT datetype, const void *di, TDSDATEREC *dr)
Convert from db date format to a structured date format.
Definition: convert.c:3122
Metadata about columns in regular and compute rows.
Definition: tds.h:690
TDS_INT hour
0-23
Definition: tds.h:167
DSTR user_name
account for login
Definition: tds.h:535
#define DSTR_INITIALIZER
Initializer, used to initialize string like in the following example.
Definition: string.h:49
TDS_SERVER_TYPE column_type
This type can be different from wire type because conversion (e.g.
Definition: tds.h:697
void * tds_alloc_param_data(TDSCOLUMN *curparam)
Allocate data for a parameter.
Definition: mem.c:364
DSTR * tds_dstr_copy(DSTR *s, const char *src)
copy a string from another
Definition: tdsstring.c:122
Definition: bsqlodbc.c:100