FreeTDS API
error_export.h
1 #undef tdsdump_log
2 
3 #ifdef ENABLE_ODBC_WIDE
4 static SQLRETURN _SQLGetDiagRec(SQLSMALLINT handleType,
5  SQLHANDLE handle,
6  SQLSMALLINT numRecord,
7  ODBC_CHAR * szSqlStat,
8  SQLINTEGER * pfNativeError,
9  ODBC_CHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg, int wide);
10 
11 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDiagRecW(
12  SQLSMALLINT handleType,
13  SQLHANDLE handle,
14  SQLSMALLINT numRecord,
15  SQLWCHAR * szSqlStat,
16  SQLINTEGER * pfNativeError,
17  SQLWCHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg)
18 {
19  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDiagRecW(%d, %p, %d, %p, %p, %p, %d, %p)\n",
20  (int) handleType,
21  handle,
22  (int) numRecord,
23  szSqlStat,
24  pfNativeError,
25  szErrorMsg, (int) cbErrorMsgMax, pcbErrorMsg);
26  return _SQLGetDiagRec(handleType,
27  handle,
28  numRecord,
29  (ODBC_CHAR*) szSqlStat,
30  pfNativeError,
31  (ODBC_CHAR*) szErrorMsg, cbErrorMsgMax, pcbErrorMsg, 1);
32 }
33 #endif
34 
35 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDiagRec(
36  SQLSMALLINT handleType,
37  SQLHANDLE handle,
38  SQLSMALLINT numRecord,
39  SQLCHAR * szSqlStat,
40  SQLINTEGER * pfNativeError,
41  SQLCHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg)
42 {
43  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDiagRec(%d, %p, %d, %p, %p, %p, %d, %p)\n",
44  (int) handleType,
45  handle,
46  (int) numRecord,
47  szSqlStat,
48  pfNativeError,
49  szErrorMsg, (int) cbErrorMsgMax, pcbErrorMsg);
50 #ifdef ENABLE_ODBC_WIDE
51  return _SQLGetDiagRec(handleType,
52  handle,
53  numRecord,
54  (ODBC_CHAR*) szSqlStat,
55  pfNativeError,
56  (ODBC_CHAR*) szErrorMsg, cbErrorMsgMax, pcbErrorMsg, 0);
57 #else
58  return _SQLGetDiagRec(handleType,
59  handle,
60  numRecord,
61  szSqlStat,
62  pfNativeError,
63  szErrorMsg, cbErrorMsgMax, pcbErrorMsg);
64 #endif
65 }
66 
67 #ifdef ENABLE_ODBC_WIDE
68 static SQLRETURN _SQLError(SQLHENV henv,
69  SQLHDBC hdbc,
70  SQLHSTMT hstmt,
71  ODBC_CHAR * szSqlStat,
72  SQLINTEGER * pfNativeError,
73  ODBC_CHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg, int wide);
74 
75 SQLRETURN ODBC_PUBLIC ODBC_API SQLErrorW(
76  SQLHENV henv,
77  SQLHDBC hdbc,
78  SQLHSTMT hstmt,
79  SQLWCHAR * szSqlStat,
80  SQLINTEGER * pfNativeError,
81  SQLWCHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg)
82 {
83  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLErrorW(%p, %p, %p, %p, %p, %p, %d, %p)\n",
84  henv,
85  hdbc,
86  hstmt,
87  szSqlStat,
88  pfNativeError,
89  szErrorMsg, (int) cbErrorMsgMax, pcbErrorMsg);
90  return _SQLError(henv,
91  hdbc,
92  hstmt,
93  (ODBC_CHAR*) szSqlStat,
94  pfNativeError,
95  (ODBC_CHAR*) szErrorMsg, cbErrorMsgMax, pcbErrorMsg, 1);
96 }
97 #endif
98 
99 SQLRETURN ODBC_PUBLIC ODBC_API SQLError(
100  SQLHENV henv,
101  SQLHDBC hdbc,
102  SQLHSTMT hstmt,
103  SQLCHAR * szSqlStat,
104  SQLINTEGER * pfNativeError,
105  SQLCHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg)
106 {
107  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLError(%p, %p, %p, %p, %p, %p, %d, %p)\n",
108  henv,
109  hdbc,
110  hstmt,
111  szSqlStat,
112  pfNativeError,
113  szErrorMsg, (int) cbErrorMsgMax, pcbErrorMsg);
114 #ifdef ENABLE_ODBC_WIDE
115  return _SQLError(henv,
116  hdbc,
117  hstmt,
118  (ODBC_CHAR*) szSqlStat,
119  pfNativeError,
120  (ODBC_CHAR*) szErrorMsg, cbErrorMsgMax, pcbErrorMsg, 0);
121 #else
122  return _SQLError(henv,
123  hdbc,
124  hstmt,
125  szSqlStat,
126  pfNativeError,
127  szErrorMsg, cbErrorMsgMax, pcbErrorMsg);
128 #endif
129 }
130 
131 #ifdef ENABLE_ODBC_WIDE
132 static SQLRETURN _SQLGetDiagField(SQLSMALLINT handleType,
133  SQLHANDLE handle,
134  SQLSMALLINT numRecord,
135  SQLSMALLINT diagIdentifier,
136  SQLPOINTER buffer,
137  SQLSMALLINT cbBuffer,
138  SQLSMALLINT * pcbBuffer, int wide);
139 
140 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDiagFieldW(
141  SQLSMALLINT handleType,
142  SQLHANDLE handle,
143  SQLSMALLINT numRecord,
144  SQLSMALLINT diagIdentifier,
145  SQLPOINTER buffer,
146  SQLSMALLINT cbBuffer,
147  SQLSMALLINT * pcbBuffer)
148 {
149  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDiagFieldW(%d, %p, %d, %d, %p, %d, %p)\n",
150  (int) handleType,
151  handle,
152  (int) numRecord,
153  (int) diagIdentifier,
154  buffer,
155  (int) cbBuffer,
156  pcbBuffer);
157  return _SQLGetDiagField(handleType,
158  handle,
159  numRecord,
160  diagIdentifier,
161  buffer,
162  cbBuffer,
163  pcbBuffer, 1);
164 }
165 #endif
166 
167 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDiagField(
168  SQLSMALLINT handleType,
169  SQLHANDLE handle,
170  SQLSMALLINT numRecord,
171  SQLSMALLINT diagIdentifier,
172  SQLPOINTER buffer,
173  SQLSMALLINT cbBuffer,
174  SQLSMALLINT * pcbBuffer)
175 {
176  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDiagField(%d, %p, %d, %d, %p, %d, %p)\n",
177  (int) handleType,
178  handle,
179  (int) numRecord,
180  (int) diagIdentifier,
181  buffer,
182  (int) cbBuffer,
183  pcbBuffer);
184 #ifdef ENABLE_ODBC_WIDE
185  return _SQLGetDiagField(handleType,
186  handle,
187  numRecord,
188  diagIdentifier,
189  buffer,
190  cbBuffer,
191  pcbBuffer, 0);
192 #else
193  return _SQLGetDiagField(handleType,
194  handle,
195  numRecord,
196  diagIdentifier,
197  buffer,
198  cbBuffer,
199  pcbBuffer);
200 #endif
201 }
202 
203 #define tdsdump_log TDSDUMP_LOG_FAST
tds_convert
TDS_INT tds_convert(const TDSCONTEXT *tds_ctx, int srctype, const TDS_CHAR *src, TDS_UINT srclen, int desttype, CONV_RESULT *cr)
tds_convert convert a type to another.
Definition: convert.c:1878
dbopen
DBPROCESS * dbopen(LOGINREC *login, const char *server)
Normally not used.
Definition: dbopen.c:36
dbmsghandle
MHANDLEFUNC dbmsghandle(MHANDLEFUNC handler)
Set a message handler, for messages from the server.
Definition: dblib.c:5121
tds_login::user_name
DSTR user_name
account for login
Definition: tds.h:529
tds.h
dbsqlexec
RETCODE dbsqlexec(DBPROCESS *dbproc)
send the SQL command to the server and wait for an answer.
Definition: dblib.c:1401
dbconvert_ps
DBINT dbconvert_ps(DBPROCESS *dbproc, int db_srctype, const BYTE *src, DBINT srclen, int db_desttype, BYTE *dest, DBINT destlen, DBTYPEINFO *typeinfo)
Convert one datatype to another.
Definition: dblib.c:2281
tds_writetext_start
TDSRET tds_writetext_start(TDSSOCKET *tds, const char *objname, const char *textptr, const char *timestamp, int with_log, TDS_UINT size)
Start writing writetext request.
Definition: bulk.c:1112
tds_login::ip_addrs
struct addrinfo * ip_addrs
ip(s) of server
Definition: tds.h:541
dbretname
char * dbretname(DBPROCESS *dbproc, int retnum)
Get name of an output parameter filled by a stored procedure.
Definition: dblib.c:4705
tds_read_config_info
TDSLOGIN * 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:138
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:504
dbcmdrow
RETCODE dbcmdrow(DBPROCESS *dbproc)
See if the current command can return rows.
Definition: dblib.c:4241
dbmnycmp
int dbmnycmp(DBPROCESS *dbproc, DBMONEY *m1, DBMONEY *m2)
Compare two DBMONEY values.
Definition: dblib.c:5247
agg_t
Definition: dbpivot.c:538
dbbylist
BYTE * dbbylist(DBPROCESS *dbproc, int computeid, int *size)
Get bylist for a compute row.
Definition: dblib.c:4980
dbfcmd
RETCODE dbfcmd(DBPROCESS *dbproc, const char *fmt,...)
printf-like way to form SQL to send to the server.
Definition: dblib.c:1316
tdsdaterec
Used by tds_datecrack.
Definition: tds.h:157
dbstrbuild
RETCODE dbstrbuild(DBPROCESS *dbproc, char *charbuf, int bufsize, char *text, char *formats,...)
Build a printable string from text containing placeholders for variables.
Definition: dblib.c:7282
tds_dblib_dbprocess
Definition: dblib.h:120
dblib_context::login_timeout
int login_timeout
not used unless positive
Definition: dblib.c:187
tds_socket::ret_status
TDS_INT ret_status
return status from store procedure
Definition: tds.h:1203
tdsdbopen
DBPROCESS * tdsdbopen(LOGINREC *login, const char *server, int msdblib)
Form a connection with the server.
Definition: dblib.c:1166
tdsdaterec::decimicrosecond
TDS_INT decimicrosecond
0-9999999
Definition: tds.h:168
tagSS_TIME2_STRUCT
Definition: odbcss.h:132
dbcurcmd
int dbcurcmd(DBPROCESS *dbproc)
Get number of the row just returned.
Definition: dblib.c:6201
DBMONEY4
Definition: sybdb.h:289
tdsdaterec::timezone
TDS_INT timezone
-840 - 840 minutes from UTC
Definition: tds.h:169
dbaltbind
RETCODE dbaltbind(DBPROCESS *dbproc, int computeid, int column, int vartype, DBINT varlen, BYTE *varaddr)
Bind a compute column to a program variable.
Definition: dblib.c:4350
tds_column::column_size
TDS_INT column_size
maximun size of data.
Definition: tds.h:696
dbrpcsend
RETCODE dbrpcsend(DBPROCESS *dbproc)
Execute the procedure and free associated memory.
Definition: rpc.c:281
dbgetnull
RETCODE dbgetnull(DBPROCESS *dbproc, int bindtype, int varlen, BYTE *varaddr)
Definition: dblib.c:534
dbcoltypeinfo
DBTYPEINFO * dbcoltypeinfo(DBPROCESS *dbproc, int column)
Get precision and scale information for a regular result column.
Definition: dblib.c:2997
tds_writetext_end
TDSRET tds_writetext_end(TDSSOCKET *tds)
Finish sending writetext data.
Definition: bulk.c:1167
DBVERSION_UNKNOWN
#define DBVERSION_UNKNOWN
DBVERSION_xxx are used with dbsetversion()
Definition: sybdb.h:70
tds_fix_login
void tds_fix_login(TDSLOGIN *login)
Fix configuration after reading it.
Definition: config.c:286
dbversion
const char * dbversion()
See which version of db-lib is in use.
Definition: dblib.c:6822
dbprrow
RETCODE dbprrow(DBPROCESS *dbproc)
Print a result set to stdout.
Definition: dblib.c:3521
dbcmd
RETCODE dbcmd(DBPROCESS *dbproc, const char cmdstring[])
Append SQL to the command buffer.
Definition: dblib.c:1355
DBLIBCONTEXT
struct dblib_context DBLIBCONTEXT
_drecord
Definition: odbc.h:162
TDS_DONE_ERROR
@ TDS_DONE_ERROR
error occurred
Definition: tds.h:252
sybdb.h
Primary include file for db-lib applications.
dbclose
void dbclose(DBPROCESS *dbproc)
Close a connection to the server and free associated resources.
Definition: dblib.c:1467
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:354
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:3124
dblib_context::tds_ctx
TDSCONTEXT * tds_ctx
libTDS context
Definition: dblib.c:177
_sql_error
Definition: odbc.h:93
tds_login::db_filename
DSTR db_filename
database filename to attach (MSSQL)
Definition: tds.h:524
dbacolname
const char * dbacolname(DBPROCESS *dbproc, int computeid, int column)
Return name of a computed result column.
Definition: dblib.c:1879
dbbind
RETCODE dbbind(DBPROCESS *dbproc, int column, int vartype, DBINT varlen, BYTE *varaddr)
Tie a host variable to a resultset column.
Definition: dblib.c:2615
tds_variant
Store variant informations.
Definition: tds.h:598
dbsetversion
RETCODE dbsetversion(DBINT version)
Specify a db-lib version level.
Definition: dblib.c:5957
dbsqlsend
RETCODE dbsqlsend(DBPROCESS *dbproc)
Transmit the command buffer to the server. Non-blocking, does not wait for a response.
Definition: dblib.c:7025
dberrhandle
EHANDLEFUNC dberrhandle(EHANDLEFUNC handler)
Set an error handler, for messages from db-lib.
Definition: dblib.c:5102
dbaltutype
DBINT dbaltutype(DBPROCESS *dbproc, int computeid, int column)
Get user-defined datatype of a compute column.
Definition: dblib.c:7096
tds_dstr_len
static size_t tds_dstr_len(const DSTR *s)
Returns the length of the string in bytes.
Definition: string.h:85
dbmny4cmp
int dbmny4cmp(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2)
Compare two DBMONEY4 values.
Definition: dblib.c:5693
dbsqlok
RETCODE dbsqlok(DBPROCESS *dbproc)
Wait for results of a query from the server.
Definition: dblib.c:4795
tds_alloc_param_result
TDSPARAMINFO * tds_alloc_param_result(TDSPARAMINFO *old_param)
Adds a output parameter to TDSPARAMINFO.
Definition: mem.c:284
dbclropt
RETCODE dbclropt(DBPROCESS *dbproc, int option, const char param[])
Reset an option.
Definition: dblib.c:6076
tds_alloc_row
TDSRET tds_alloc_row(TDSRESULTINFO *res_info)
Allocate space for row store return NULL on out of memory.
Definition: mem.c:524
tds_set_server
bool tds_set_server(TDSLOGIN *tds_login, const char *server) TDS_WUR
Set the servername in a TDSLOGIN structure.
Definition: login.c:125
dbnullbind
RETCODE dbnullbind(DBPROCESS *dbproc, int column, DBINT *indicator)
Tie a null-indicator to a regular result column.
Definition: dblib.c:2721
dbgetpacket
int dbgetpacket(DBPROCESS *dbproc)
Get TDS packet size for the connection.
Definition: dblib.c:4056
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:2021
tds_socket::cur_cursor
TDSCURSOR * cur_cursor
cursor in use
Definition: tds.h:1199
dbmnymaxneg
RETCODE dbmnymaxneg(DBPROCESS *dbproc, DBMONEY *amount)
Get maximum negative DBMONEY value supported.
Definition: dblib.c:5347
dbsetlogintime
RETCODE dbsetlogintime(int seconds)
Set maximum seconds db-lib waits for a server response to a login attempt.
Definition: dblib.c:4220
dblastrow
DBINT dblastrow(DBPROCESS *dbproc)
Get number of the last row in the row buffer.
Definition: dblib.c:7189
_dbcoldata
static BYTE * _dbcoldata(TDSCOLUMN *colinfo)
Return data from a column.
Definition: dblib.c:3349
dbcoltype
int dbcoltype(DBPROCESS *dbproc, int column)
Get the datatype of a regular result set column.
Definition: dblib.c:2951
dbmny4copy
RETCODE dbmny4copy(DBPROCESS *dbproc, DBMONEY4 *src, DBMONEY4 *dest)
Copy a DBMONEY4 value.
Definition: dblib.c:5721
ProfileParam
Definition: connectparams.c:517
tds_flush_packet
TDSRET tds_flush_packet(TDSSOCKET *tds)
Flush packet to server.
Definition: write.c:285
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
DBMONEY
Definition: sybdb.h:283
dbdatlen
DBINT dbdatlen(DBPROCESS *dbproc, int column)
Get size of current row's data in a regular result column.
Definition: dblib.c:3305
dbrettype
int dbrettype(DBPROCESS *dbproc, int retnum)
Get datatype of a stored procedure's return parameter.
Definition: dblib.c:6247
tds_column::column_scale
TDS_TINYINT column_scale
scale for decimal/numeric
Definition: tds.h:706
tds_dblib_dbprocess::msdblib
int msdblib
boolean use ms behaviour
Definition: dblib.h:152
DBVARYCHAR
Definition: sybdb.h:262
TDS_PENDING
@ TDS_PENDING
cilent is waiting for data
Definition: tds.h:794
dbtablecolinfo
RETCODE dbtablecolinfo(DBPROCESS *dbproc, DBINT column, DBCOL *pdbcol)
describe table column attributes with a single call (Freetds-only API function modelled on dbcolinfo)
Definition: dblib.c:6446
dbspr1rowlen
DBINT dbspr1rowlen(DBPROCESS *dbproc)
Determine size buffer required to hold the results returned by dbsprhead(), dbsprline(),...
Definition: dblib.c:3400
dbadlen
DBINT dbadlen(DBPROCESS *dbproc, int computeid, int column)
Get size of data in a compute column.
Definition: dblib.c:4291
tdsiconvinfo
Definition: iconv.h:91
dbcollen
DBINT dbcollen(DBPROCESS *dbproc, int column)
Get size of a regular result column.
Definition: dblib.c:3150
dbmny4sub
RETCODE dbmny4sub(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *diff)
Subtract two DBMONEY4 values.
Definition: dblib.c:5605
dbvarylen
DBINT dbvarylen(DBPROCESS *dbproc, int column)
Determine whether a column can vary in size.
Definition: dblib.c:3199
dbinit
RETCODE dbinit(void)
Initialize db-lib.
Definition: dblib.c:665
dbmnydec
RETCODE dbmnydec(DBPROCESS *dbproc, DBMONEY *amount)
Subtract $0.0001 from a DBMONEY value.
Definition: dblib.c:5472
tds_dstr_free
void tds_dstr_free(DSTR *s)
free string
Definition: tdsstring.c:62
pivot_t
Definition: dbpivot.c:765
dbaltop
int dbaltop(DBPROCESS *dbproc, int computeid, int column)
Get aggregation operator for a compute column.
Definition: dblib.c:4425
conv_result
Definition: convert.h:33
dbadata
BYTE * dbadata(DBPROCESS *dbproc, int computeid, int column)
Get address of compute column data.
Definition: dblib.c:4396
tds_dstr_isempty
static int tds_dstr_isempty(const DSTR *s)
test if string is empty
Definition: string.h:60
tds_column::char_conv
TDSICONV * char_conv
refers to previously allocated iconv information
Definition: tds.h:714
dbmny4minus
RETCODE dbmny4minus(DBPROCESS *dbproc, DBMONEY4 *src, DBMONEY4 *dest)
Negate a DBMONEY4 value.
Definition: dblib.c:5527
dbwritetext
RETCODE dbwritetext(DBPROCESS *dbproc, char *objname, DBBINARY *textptr, DBTINYINT textptrlen, DBBINARY *timestamp, DBBOOL log, DBINT size, BYTE *text)
Send text or image data to the server.
Definition: dblib.c:6576
tdsdaterec::dayofyear
TDS_INT dayofyear
day of year (1-366)
Definition: tds.h:163
tds_dstr_buf
static char * tds_dstr_buf(DSTR *s)
Returns a buffer to edit the string.
Definition: string.h:71
tds_message
Definition: tds.h:876
dbretstatus
DBINT dbretstatus(DBPROCESS *dbproc)
Fetch status value returned by query or remote procedure call.
Definition: dblib.c:4655
dbnumalts
int dbnumalts(DBPROCESS *dbproc, int computeid)
Get count of columns in a compute row.
Definition: dblib.c:4921
tdsunique
Definition: proto.h:61
tds_set_column_type
void tds_set_column_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
Set type of column initializing all dependency.
Definition: data.c:227
s_v3to2map
Definition: error.c:167
tds_willconvert
unsigned char tds_willconvert(int srctype, int desttype)
Test if a conversion is possible.
Definition: convert.c:3058
tds_dstr
Structure to hold a string.
Definition: string.h:36
tds_column
Metadata about columns in regular and compute rows.
Definition: tds.h:690
tds_set_interfaces_file_loc
TDSRET tds_set_interfaces_file_loc(const char *interf)
Set the full name of interface file.
Definition: config.c:948
tds_get_column_declaration
TDSRET tds_get_column_declaration(TDSSOCKET *tds, TDSCOLUMN *curcol, char *out)
Return declaration for column (like "varchar(20)").
Definition: query.c:737
dbmoretext
RETCODE dbmoretext(DBPROCESS *dbproc, DBINT size, const BYTE text[])
Send chunk of a text/image value to the server.
Definition: dblib.c:6714
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:551
dbmorecmds
RETCODE dbmorecmds(DBPROCESS *dbproc)
See if more commands are to be processed.
Definition: dblib.c:6218
name_t
Definition: dbpivot.c:1264
DBNUMERIC
Definition: sybdb.h:274
tdsdaterec::second
TDS_INT second
0-59
Definition: tds.h:167
dbmny4zero
RETCODE dbmny4zero(DBPROCESS *dbproc, DBMONEY4 *dest)
Zero a DBMONEY4 value.
Definition: dblib.c:5551
tdsdaterec::day
TDS_INT day
day of month (1-31)
Definition: tds.h:162
tdsdaterec::weekday
TDS_INT weekday
day of week (0-6, 0 = sunday)
Definition: tds.h:164
dbmonthname
const char * dbmonthname(DBPROCESS *dbproc, char *language, int monthnum, DBBOOL shortform)
Get name of a month, in some human language.
Definition: dblib.c:6940
tds_connection::env
TDSENV env
environment is shared between all sessions
Definition: tds.h:1080
tds_dstr_empty
#define tds_dstr_empty(s)
Make a string empty.
Definition: string.h:91
dbcolutype
int dbcolutype(DBPROCESS *dbproc, int column)
Get user-defined datatype of a regular result column.
Definition: dblib.c:2974
dbrecftos
void dbrecftos(const char filename[])
Record to a file all SQL commands sent to the server.
Definition: dblib.c:6749
tds_login::server_name
DSTR server_name
server name (in freetds.conf)
Definition: tds.h:513
tds_env::block_size
int block_size
packet size (512-65535)
Definition: tds.h:966
tdsdatetime
Definition: proto.h:49
dbresults
RETCODE dbresults(DBPROCESS *dbproc)
Set up query results.
Definition: dblib.c:1675
dbaltlen
DBINT dbaltlen(DBPROCESS *dbproc, int computeid, int column)
Get size of data in compute column.
Definition: dblib.c:7119
dbnumrets
int dbnumrets(DBPROCESS *dbproc)
Get count of output parameters filled by a stored procedure.
Definition: dblib.c:4673
dbprtype
const char * dbprtype(int token)
Print a token value's name to a buffer.
Definition: dblib.c:6429
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
_hstmt
Definition: odbc.h:380
dbchange
char * dbchange(DBPROCESS *dbproc)
See if a command caused the current database to change.
Definition: dblib.c:6969
dbnumcompute
int dbnumcompute(DBPROCESS *dbproc)
Get count of COMPUTE clauses for a result set.
Definition: dblib.c:4954
metadata_t
Definition: dbpivot.c:707
dbtxtimestamp
DBBINARY * dbtxtimestamp(DBPROCESS *dbproc, int column)
Get text timestamp for a column in the current row.
Definition: dblib.c:6509
dbsetuserdata
void dbsetuserdata(DBPROCESS *dbproc, BYTE *ptr)
Associate client-allocated (and defined) data with a DBPROCESS.
Definition: dblib.c:5921
TDS_DATETIMEALL::offset
TDS_SMALLINT offset
time offset
Definition: tds.h:148
dbanydatecrack
RETCODE dbanydatecrack(DBPROCESS *dbproc, DBDATEREC2 *di, int type, const void *data)
Break any kind of date or time value into useful pieces.
Definition: dblib.c:5849
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:2970
tagSS_TIMESTAMPOFFSET_STRUCT
Definition: odbcss.h:139
tds_result_info
Hold information for any results.
Definition: tds.h:769
dbmny4add
RETCODE dbmny4add(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *sum)
Add two DBMONEY4 values.
Definition: dblib.c:5574
dbsetavail
void dbsetavail(DBPROCESS *dbproc)
Mark a DBPROCESS as "available".
Definition: dblib.c:7257
dbcolinfo
RETCODE dbcolinfo(DBPROCESS *dbproc, CI_TYPE type, DBINT column, DBINT computeid, DBCOL *pdbcol)
Get a bunch of column attributes with a single call (Microsoft-compatibility feature).
Definition: dblib.c:3026
dbconvert
DBINT dbconvert(DBPROCESS *dbproc, int srctype, const BYTE *src, DBINT srclen, int desttype, BYTE *dest, DBINT destlen)
cf. dbconvert_ps(), above
Definition: dblib.c:2574
tdsdatetime4
Definition: proto.h:55
dbspr1row
RETCODE dbspr1row(DBPROCESS *dbproc, char *buffer, DBINT buf_len)
Print a regular result row to a buffer.
Definition: dblib.c:3438
dbexit
void dbexit()
Close server connections and free all related structures.
Definition: dblib.c:1534
tds_dstr_copy
DSTR * tds_dstr_copy(DSTR *s, const char *src)
copy a string from another
Definition: tdsstring.c:122
tds_send_cancel
TDSRET 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:2123
dbtds
int dbtds(DBPROCESS *dbproc)
Get the TDS version in use for dbproc.
Definition: dblib.c:6783
DBLIB_ERROR_MESSAGE
struct _dblib_error_message DBLIB_ERROR_MESSAGE
dbrows
RETCODE dbrows(DBPROCESS *dbproc)
Indicate whether a query returned rows.
Definition: dblib.c:4015
_hchk
Definition: odbc.h:229
dbcolptr
static TDSCOLUMN * dbcolptr(DBPROCESS *dbproc, int column)
Sanity checks for column-oriented functions.
Definition: dblib.c:336
dbsprline
RETCODE dbsprline(DBPROCESS *dbproc, char *buffer, DBINT buf_len, DBCHAR line_char)
Get formatted string for underlining dbsprhead() column names.
Definition: dblib.c:3818
dbmnycopy
RETCODE dbmnycopy(DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest)
Copy a DBMONEY value.
Definition: dblib.c:5991
dbhasretstat
DBBOOL dbhasretstat(DBPROCESS *dbproc)
Determine if query generated a return status number.
Definition: dblib.c:4631
DBCOL2
Definition: sybdb.h:373
dbiowdesc
int dbiowdesc(DBPROCESS *dbproc)
Get file descriptor of the socket used by a DBPROCESS to write data coming to the server....
Definition: dblib.c:7229
dbwillconvert
DBBOOL dbwillconvert(int srctype, int desttype)
Test whether or not a datatype can be converted to another datatype.
Definition: dblib.c:2855
tdsmoney4
Definition: proto.h:44
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:249
dbgetrow
RETCODE dbgetrow(DBPROCESS *dbproc, DBINT row)
Read a row from the row buffer.
Definition: dblib.c:1911
dbsetrow
STATUS dbsetrow(DBPROCESS *dbproc, DBINT row)
Make a buffered row "current" without fetching it into bound variables.
Definition: dblib.c:2026
tds_column::column_prec
TDS_TINYINT column_prec
precision for decimal/numeric
Definition: tds.h:705
dbfreebuf
void dbfreebuf(DBPROCESS *dbproc)
Erase the command buffer, in case DBNOAUTOFREE was set with dbsetopt().
Definition: dblib.c:6041
DBTDS_UNKNOWN
#define DBTDS_UNKNOWN
DBTDS_xxx are returned by DBTDS() The integer values of the constants are poorly chosen.
Definition: sybdb.h:88
dbmnymaxpos
RETCODE dbmnymaxpos(DBPROCESS *dbproc, DBMONEY *amount)
Get maximum positive DBMONEY value supported.
Definition: dblib.c:5326
dbsetlbool
RETCODE dbsetlbool(LOGINREC *login, int value, int which)
Set a boolean value in a LOGINREC structure.
Definition: dblib.c:898
dbsetlname
RETCODE dbsetlname(LOGINREC *login, const char *value, int which)
Set the value of a string in a LOGINREC structure.
Definition: dblib.c:764
dbspid
int dbspid(DBPROCESS *dbproc)
Get server process ID for a DBPROCESS.
Definition: dblib.c:5901
TDS_DONE_MORE_RESULTS
@ TDS_DONE_MORE_RESULTS
more results follow
Definition: tds.h:251
dbname
char * dbname(DBPROCESS *dbproc)
Get name of current database.
Definition: dblib.c:6989
dbgetuserdata
BYTE * dbgetuserdata(DBPROCESS *dbproc)
Get address of user-allocated data from a DBPROCESS.
Definition: dblib.c:5939
dbmnyinc
RETCODE dbmnyinc(DBPROCESS *dbproc, DBMONEY *amount)
Add $0.0001 to a DBMONEY value.
Definition: dblib.c:5444
tds_column::column_type
TDS_SERVER_TYPE column_type
This type can be different from wire type because conversion (e.g.
Definition: tds.h:698
is_datetime_type
#define is_datetime_type(x)
return true if type is a datetime (but not date or time)
Definition: tds.h:390
tds_socket::rows_affected
TDS_INT8 rows_affected
rows updated/deleted/inserted/selected, TDS_NO_COUNT if not valid
Definition: tds.h:1209
_null_representation
Definition: dblib.h:114
tdsoldmoney
Definition: proto.h:32
TDS_DATETIMEALL
this structure is not directed connected to a TDS protocol but keeps any DATE/TIME information.
Definition: tds.h:144
dbrpcinit
RETCODE dbrpcinit(DBPROCESS *dbproc, const char rpcname[], DBSMALLINT options)
Initialize a remote procedure call.
Definition: rpc.c:72
dbsetmaxprocs
RETCODE dbsetmaxprocs(int maxprocs)
Set maximum simultaneous connections db-lib will open to the server.
Definition: dblib.c:4080
DSTR_INITIALIZER
#define DSTR_INITIALIZER
Initializer, used to initialize string like in the following example.
Definition: string.h:49
DBDATETIME4
Definition: sybdb.h:300
dbgetmaxprocs
int dbgetmaxprocs(void)
get maximum simultaneous connections db-lib will open to the server.
Definition: dblib.c:4152
tdsdaterec::quarter
TDS_INT quarter
quarter (0-3)
Definition: tds.h:160
default_err_handler
static int default_err_handler(DBPROCESS *dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr)
default error handler for db-lib (handles library-generated errors)
Definition: dblib.c:5073
dbsetlversion
RETCODE dbsetlversion(LOGINREC *login, BYTE version)
Set TDS version for future connections.
Definition: dblib.c:937
tdsdaterec::month
TDS_INT month
month number (0-11)
Definition: tds.h:161
tds_socket::has_status
bool has_status
true is ret_status is valid
Definition: tds.h:1201
dbmnyminus
RETCODE dbmnyminus(DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest)
Negate a DBMONEY value.
Definition: dblib.c:5500
_DBREMOTE_PROC
Definition: dblib.h:98
dbcolname
char * dbcolname(DBPROCESS *dbproc, int column)
Return name of a regular result column.
Definition: dblib.c:1853
_dblib_error_message
Definition: dblib.c:7719
dbalttype
int dbalttype(DBPROCESS *dbproc, int computeid, int column)
Get datatype for a compute column.
Definition: dblib.c:4321
TDS_PARSED_PARAM
Definition: odbc.h:531
dbsetopt
RETCODE dbsetopt(DBPROCESS *dbproc, int option, const char *char_param, int int_param)
Set db-lib or server option.
Definition: dblib.c:4452
dbretdata
BYTE * dbretdata(DBPROCESS *dbproc, int retnum)
Get value of an output parameter filled by a stored procedure.
Definition: dblib.c:4734
tds_get_null_type
TDS_SERVER_TYPE tds_get_null_type(TDS_SERVER_TYPE srctype)
Get same type but nullable.
Definition: convert.c:2915
dbmnyzero
RETCODE dbmnyzero(DBPROCESS *dbproc, DBMONEY *dest)
Set a DBMONEY value to zero.
Definition: dblib.c:5305
tds_blob
Information about blobs (e.g.
Definition: tds.h:587
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:347
dbprhead
void dbprhead(DBPROCESS *dbproc)
Print result set headings to stdout.
Definition: dblib.c:3940
tds_sybase_dbdaterec2
Definition: sybdb.h:505
dbgetchar
char * dbgetchar(DBPROCESS *dbproc, int pos)
Get address of a position in the command buffer.
Definition: dblib.c:6291
dbsetllong
RETCODE dbsetllong(LOGINREC *login, long value, int which)
Set an integer value in a LOGINREC structure.
Definition: dblib.c:827
dbrowtype
STATUS dbrowtype(DBPROCESS *dbproc)
Get returned row's type.
Definition: dblib.c:6184
dbperror
int dbperror(DBPROCESS *dbproc, DBINT msgno, long errnum,...)
Call client-installed error handler.
Definition: dblib.c:8109
tds_prdatatype
static const char * tds_prdatatype(int datatype_token)
Returns type in string.
Definition: dblib.c:7332
tds_socket::current_results
TDSRESULTINFO * current_results
Current query information.
Definition: tds.h:1194
dboption
Definition: dblib.h:107
dbiordesc
int dbiordesc(DBPROCESS *dbproc)
Get file descriptor of the socket used by a DBPROCESS to read data coming from the server....
Definition: dblib.c:7213
dbcount
DBINT dbcount(DBPROCESS *dbproc)
Get count of rows processed.
Definition: dblib.c:2805
col_t
Definition: dbpivot.c:75
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
tdsnumeric
Definition: proto.h:25
dbservcharset
char * dbservcharset(DBPROCESS *dbproc)
Get syscharset name of the server character set.
Definition: dblib.c:7005
dbiscount
BOOL dbiscount(DBPROCESS *dbproc)
Indicates whether or not the count returned by dbcount is real (Microsoft-compatibility feature).
Definition: dblib.c:2785
dbnumcols
int dbnumcols(DBPROCESS *dbproc)
Return number of regular columns in a result set.
Definition: dblib.c:1829
dbcolsource
char * dbcolsource(DBPROCESS *dbproc, int column)
Get base database column name for a result set column.
Definition: dblib.c:3125
dbclrbuf
void dbclrbuf(DBPROCESS *dbproc, DBINT n)
Clear n rows from the row buffer.
Definition: dblib.c:2825
dbsafestr
RETCODE dbsafestr(DBPROCESS *dbproc, const char *src, DBINT srclen, char *dest, DBINT destlen, int quotetype)
safely quotes character values in SQL text.
Definition: dblib.c:6368
tds_login::port
int port
port of database service
Definition: tds.h:514
tdsdaterec::hour
TDS_INT hour
0-23
Definition: tds.h:165
tds_dblib_dbprocess::nullreps
NULLREP nullreps[MAXBINDTYPES]
default null values
Definition: dblib.h:157
dbfirstrow
DBINT dbfirstrow(DBPROCESS *dbproc)
See if a server response has arrived.
Definition: dblib.c:7174
dbuse
RETCODE dbuse(DBPROCESS *dbproc, const char *name)
Change current database.
Definition: dblib.c:1427
dbsprhead
RETCODE dbsprhead(DBPROCESS *dbproc, char *buffer, DBINT buf_len)
Print result set headings to a buffer.
Definition: dblib.c:3876
tds_sybase_dbdaterec
Definition: sybdb.h:473
dbaltcolid
int dbaltcolid(DBPROCESS *dbproc, int computeid, int column)
Get column ID of a compute column.
Definition: dblib.c:4265
dbstrlen
int dbstrlen(DBPROCESS *dbproc)
Get size of the command buffer, in bytes.
Definition: dblib.c:6272
tds_login::password
DSTR password
password of account login
Definition: tds.h:530
_DBREMOTE_PROC_PARAM
Definition: dblib.h:86
_dbresults
static RETCODE _dbresults(DBPROCESS *dbproc)
Definition: dblib.c:1684
dblib_context
Definition: dblib.c:171
DBCOL
Definition: sybdb.h:354
tds_socket
Information for a server connection.
Definition: tds.h:1141
tdsdaterec::year
TDS_INT year
year
Definition: tds.h:159
dbcancel
RETCODE dbcancel(DBPROCESS *dbproc)
Cancel the current command batch.
Definition: dblib.c:3375
tag_DBPROC_ROWBUF
Definition: dblib.h:49
_sql_errors
Definition: odbc.h:105
dbisopt
DBBOOL dbisopt(DBPROCESS *dbproc, int option, const char param[])
Get value of an option.
Definition: dblib.c:6144
_hdbc
Definition: odbc.h:274
dbcurrow
DBINT dbcurrow(DBPROCESS *dbproc)
Get number of the row currently being read.
Definition: dblib.c:6167
dbreadtext
STATUS dbreadtext(DBPROCESS *dbproc, void *buf, DBINT bufsize)
Fetch part of a text or image value from the server.
Definition: dblib.c:6645
dbcanquery
RETCODE dbcanquery(DBPROCESS *dbproc)
Cancel the query currently being retrieved, discarding all pending rows.
Definition: dblib.c:6012
dblib_context::tds_ctx_ref_count
int tds_ctx_ref_count
libTDS context reference counter
Definition: dblib.c:179
dbsetinterrupt
void dbsetinterrupt(DBPROCESS *dbproc, DB_DBCHKINTR_FUNC chkintr, DB_DBHNDLINTR_FUNC hndlintr)
Set interrupt handler for db-lib to use while blocked against a read from the server.
Definition: dblib.c:4612
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:617
dbstrcpy
RETCODE dbstrcpy(DBPROCESS *dbproc, int start, int numbytes, char *dest)
Get a copy of a chunk of the command buffer.
Definition: dblib.c:6324
dbgettime
int dbgettime(void)
Get maximum seconds db-lib waits for a server response to query.
Definition: dblib.c:4204
dbloginfree
void dbloginfree(LOGINREC *login)
free the LOGINREC
Definition: dblib.c:742
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_close_socket
void tds_close_socket(TDSSOCKET *tds)
Close current socket.
Definition: net.c:548
tds_socket::login
TDSLOGIN * login
config for login stuff.
Definition: tds.h:1214
dblogin
LOGINREC * dblogin(void)
Allocate a LOGINREC structure.
Definition: dblib.c:710
tds_prtype
const char * tds_prtype(int type)
Returns string representation of the given type.
Definition: token.c:3052
_dblib_check_and_handle_interrupt
int _dblib_check_and_handle_interrupt(void *vdbproc)
check interrupts for libtds.
Definition: dbutil.c:192
dblib_context::ref_count
int ref_count
reference count, time dbinit called
Definition: dblib.c:174
dbdead
DBBOOL dbdead(DBPROCESS *dbproc)
Check if dbproc is an ex-parrot.
Definition: dblib.c:5039
tdsdump_open
int tdsdump_open(const char *filename)
Create and truncate a human readable dump file for the TDS traffic.
Definition: log.c:112
dblib_context::query_timeout
int query_timeout
not used unless positive
Definition: dblib.c:188
dbtxptr
DBBINARY * dbtxptr(DBPROCESS *dbproc, int column)
Get text pointer for a column in the current row.
Definition: dblib.c:6539
dbtypeinfo
Definition: sybdb.h:335
tds_alloc_param_data
void * tds_alloc_param_data(TDSCOLUMN *curparam)
Allocate data for a parameter.
Definition: mem.c:364
dbdatecmp
int dbdatecmp(DBPROCESS *dbproc, DBDATETIME *d1, DBDATETIME *d2)
Compare DBDATETIME values, similar to strcmp(3).
Definition: dblib.c:5746
tds_process_cancel
TDSRET tds_process_cancel(TDSSOCKET *tds)
Definition: token.c:2550
LOGINREC
Definition: bsqlodbc.c:99
DBDATETIME
Definition: sybdb.h:294
tds_context
Definition: tds.h:1029
dbsettime
RETCODE dbsettime(int seconds)
Set maximum seconds db-lib waits for a server response to query.
Definition: dblib.c:4173
_henv
Definition: odbc.h:236
tds_quote_id
size_t tds_quote_id(TDSSOCKET *tds, char *buffer, const char *id, int idlen)
Quote an id.
Definition: query.c:2266
s_SqlMsgMap
Definition: error.c:47
tdsdaterec::minute
TDS_INT minute
0-59
Definition: tds.h:166
tds_login
Definition: tds.h:511
dbsetifile
void dbsetifile(char *filename)
set name and location of the interfaces file FreeTDS should use to look up a servername.
Definition: dblib.c:2692
KEY_T
Definition: bsqldb.c:79
tdsdump_dump_buf
void tdsdump_dump_buf(const char *file, unsigned int level_line, const char *msg, const void *buf, size_t length)
Dump the contents of data into the log file in a human readable format.
Definition: log.c:256
tds_writetext_continue
TDSRET tds_writetext_continue(TDSSOCKET *tds, const TDS_UCHAR *text, TDS_UINT size)
Send some data in the writetext request started by tds_writetext_start.
Definition: bulk.c:1150
dbdata
BYTE * dbdata(DBPROCESS *dbproc, int column)
Get address of data in a regular result column.
Definition: dblib.c:3333
_hdesc
Definition: odbc.h:203
dbpivot
RETCODE dbpivot(DBPROCESS *dbproc, int nkeys, int *keys, int ncols, int *cols, DBPIVOT_FUNC func, int val)
Pivot the rows, creating a new resultset.
Definition: dbpivot.c:908
dbsetnull
RETCODE dbsetnull(DBPROCESS *dbproc, int bindtype, int bindlen, BYTE *bindval)
Define substitution values to be used when binding null values.
Definition: dblib.c:1943
DBVARYBIN
Definition: sybdb.h:268
dbretlen
int dbretlen(DBPROCESS *dbproc, int retnum)
Get size of an output parameter filled by a stored procedure.
Definition: dblib.c:4760
dbdatecrack
RETCODE dbdatecrack(DBPROCESS *dbproc, DBDATEREC *di, DBDATETIME *datetime)
Break a DBDATETIME value into useful pieces.
Definition: dblib.c:5828
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
dbstring
Definition: sybdb.h:341
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
dbanullbind
RETCODE dbanullbind(DBPROCESS *dbproc, int computeid, int column, DBINT *indicator)
Tie a null-indicator to a compute result column.
Definition: dblib.c:2757
dbprcollen
DBINT dbprcollen(DBPROCESS *dbproc, int column)
Get size of a result column needed to print column.
Definition: dblib.c:3173
tds_submit_query
TDSRET tds_submit_query(TDSSOCKET *tds, const char *query)
Sends a language string to the database server for processing.
Definition: query.c:207
tds_column::column_cur_size
TDS_INT column_cur_size
size written in variable (ie: char, text, binary).
Definition: tds.h:737
tds_process_tokens
TDSRET tds_process_tokens(TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsigned flag)
process all streams.
Definition: token.c:529
tds_column::column_varint_size
TDS_TINYINT column_varint_size
size of length when reading from wire (0, 1, 2 or 4)
Definition: tds.h:703