NCBI C++ ToolKit
|
Main implementation file for db-lib
.
More...
#include <config.h>
#include <stdarg.h>
#include <freetds/time.h>
#include <assert.h>
#include <stdio.h>
#include <freetds/tds.h>
#include <freetds/thread.h>
#include <freetds/convert.h>
#include <freetds/utils/string.h>
#include <freetds/data.h>
#include <freetds/replacements.h>
#include <sybfront.h>
#include <sybdb.h>
#include <syberror.h>
#include <dblib.h>
#include "buffering.h"
Go to the source code of this file.
Go to the SVN repository for this file.
Classes | |
struct | dblib_context |
struct | _dblib_error_message |
Typedefs | |
typedef struct dblib_context | DBLIBCONTEXT |
typedef struct _dblib_error_message | DBLIB_ERROR_MESSAGE |
Functions | |
static RETCODE | _dbresults (DBPROCESS *dbproc) |
static BYTE * | _dbcoldata (TDSCOLUMN *colinfo) |
static int | _get_printable_size (TDSCOLUMN *colinfo) |
static char * | _dbprdate (char *timestr) |
static int | _dbnullable (DBPROCESS *dbproc, int column) |
static const char * | tds_prdatatype (int datatype_token) |
Returns type in string. More... | |
static int | default_err_handler (DBPROCESS *dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr) |
void | copy_data_to_host_var (DBPROCESS *, TDS_SERVER_TYPE, const BYTE *, int, BYTE *, DBINT, int, DBINT *) |
RETCODE | dbgetnull (DBPROCESS *dbproc, int bindtype, int varlen, BYTE *varaddr) |
static int | dblib_add_connection (DBLIBCONTEXT *ctx, TDSSOCKET *tds) |
static void | dblib_del_connection (DBLIBCONTEXT *ctx, TDSSOCKET *tds) |
static TDSCONTEXT * | dblib_get_tds_ctx (void) |
static void | dblib_release_tds_ctx (int count) |
static void | db_env_chg (TDSSOCKET *tds, int type, char *oldval, char *newval) |
static TDSCOLUMN * | dbcolptr (DBPROCESS *dbproc, int column) |
static TDSCOLUMN * | dbacolptr (DBPROCESS *dbproc, int computeid, int column, int is_bind) |
static int | dbbindtype (int datatype) |
RETCODE | dbinit (void) |
Initialize db-lib. More... | |
LOGINREC * | dblogin (void) |
Allocate a LOGINREC structure. More... | |
void | dbloginfree (LOGINREC *login) |
free the LOGINREC More... | |
RETCODE | dbsetlname (LOGINREC *login, const char *value, int which) |
RETCODE | dbsetllong (LOGINREC *login, long value, int which) |
RETCODE | dbsetlbool (LOGINREC *login, int value, int which) |
RETCODE | dbsetlversion (LOGINREC *login, BYTE version) |
Set TDS version for future connections. More... | |
static void | dbstring_free (DBSTRING **dbstrp) |
static RETCODE | dbstring_concat (DBSTRING **dbstrp, const char *p) |
static RETCODE | dbstring_assign (DBSTRING **dbstrp, const char *p) |
static DBINT | dbstring_length (DBSTRING *dbstr) |
static int | dbstring_getchar (DBSTRING *dbstr, ssize_t i) |
static char * | dbstring_get (DBSTRING *dbstr) |
static DBOPTION * | init_dboptions (void) |
DBPROCESS * | tdsdbopen (LOGINREC *login, const char *server, int msdblib) |
RETCODE | dbfcmd (DBPROCESS *dbproc, const char *fmt,...) |
printf-like way to form SQL to send to the server. More... | |
RETCODE | dbcmd (DBPROCESS *dbproc, const char cmdstring[]) |
Append SQL to the command buffer. More... | |
RETCODE | dbsqlexec (DBPROCESS *dbproc) |
send the SQL command to the server and wait for an answer. More... | |
RETCODE | dbuse (DBPROCESS *dbproc, const char *name) |
Change current database. More... | |
void | dbclose (DBPROCESS *dbproc) |
Close a connection to the server and free associated resources. More... | |
void | dbexit () |
Close server connections and free all related structures. More... | |
static const char * | prdbresults_state (int retcode) |
static const char * | prdbretcode (RETCODE retcode) |
static const char * | prretcode (int retcode) |
static const char * | prresult_type (int result_type) |
RETCODE | dbresults (DBPROCESS *dbproc) |
Set up query results. More... | |
int | dbnumcols (DBPROCESS *dbproc) |
Return number of regular columns in a result set. More... | |
char * | dbcolname (DBPROCESS *dbproc, int column) |
Return name of a regular result column. More... | |
const char * | dbacolname (DBPROCESS *dbproc, int computeid, int column) |
Return name of a computed result column. More... | |
RETCODE | dbgetrow (DBPROCESS *dbproc, DBINT row) |
Read a row from the row buffer. More... | |
RETCODE | dbsetnull (DBPROCESS *dbproc, int bindtype, int bindlen, BYTE *bindval) |
Define substitution values to be used when binding null values. More... | |
STATUS | dbsetrow (DBPROCESS *dbproc, DBINT row) |
Make a buffered row "current" without fetching it into bound variables. More... | |
STATUS | dbnextrow (DBPROCESS *dbproc) |
static TDS_SERVER_TYPE | dblib_bound_type (int bindtype) |
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. More... | |
DBINT | dbconvert (DBPROCESS *dbproc, int srctype, const BYTE *src, DBINT srclen, int desttype, BYTE *dest, DBINT destlen) |
cf. More... | |
RETCODE | dbbind (DBPROCESS *dbproc, int column, int vartype, DBINT varlen, BYTE *varaddr) |
Tie a host variable to a resultset column. More... | |
void | dbsetifile (char *filename) |
set name and location of the interfaces file FreeTDS should use to look up a servername. More... | |
RETCODE | dbnullbind (DBPROCESS *dbproc, int column, DBINT *indicator) |
Tie a null-indicator to a regular result column. More... | |
RETCODE | dbanullbind (DBPROCESS *dbproc, int computeid, int column, DBINT *indicator) |
Tie a null-indicator to a compute result column. More... | |
BOOL | dbiscount (DBPROCESS *dbproc) |
Indicates whether or not the count returned by dbcount is real (Microsoft-compatibility feature). More... | |
DBINT | dbcount (DBPROCESS *dbproc) |
Get count of rows processed. More... | |
void | dbclrbuf (DBPROCESS *dbproc, DBINT n) |
Clear n rows from the row buffer. More... | |
DBBOOL | dbwillconvert (int srctype, int desttype) |
Test whether or not a datatype can be converted to another datatype. More... | |
static int | dblib_coltype (TDSCOLUMN *colinfo) |
int | dbcoltype (DBPROCESS *dbproc, int column) |
Get the datatype of a regular result set column. More... | |
int | dbcolutype (DBPROCESS *dbproc, int column) |
Get user-defined datatype of a regular result column. More... | |
DBTYPEINFO * | dbcoltypeinfo (DBPROCESS *dbproc, int column) |
Get precision and scale information for a regular result column. More... | |
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). More... | |
char * | dbcolsource (DBPROCESS *dbproc, int column) |
Get base database column name for a result set column. More... | |
DBINT | dbcollen (DBPROCESS *dbproc, int column) |
Get size of a regular result column. More... | |
DBINT | dbprcollen (DBPROCESS *dbproc, int column) |
Get size of a result column needed to print column. More... | |
DBINT | dbvarylen (DBPROCESS *dbproc, int column) |
Determine whether a column can vary in size. More... | |
DBINT | dbdatlen (DBPROCESS *dbproc, int column) |
Get size of current row's data in a regular result column. More... | |
BYTE * | dbdata (DBPROCESS *dbproc, int column) |
Get address of data in a regular result column. More... | |
RETCODE | dbcancel (DBPROCESS *dbproc) |
Cancel the current command batch. More... | |
DBINT | dbspr1rowlen (DBPROCESS *dbproc) |
Determine size buffer required to hold the results returned by dbsprhead(), dbsprline(), and dbspr1row(). More... | |
RETCODE | dbspr1row (DBPROCESS *dbproc, char *buffer, DBINT buf_len) |
Print a regular result row to a buffer. More... | |
RETCODE | dbprrow (DBPROCESS *dbproc) |
Print a result set to stdout. More... | |
RETCODE | dbsprline (DBPROCESS *dbproc, char *buffer, DBINT buf_len, DBCHAR line_char) |
Get formatted string for underlining dbsprhead() column names. More... | |
RETCODE | dbsprhead (DBPROCESS *dbproc, char *buffer, DBINT buf_len) |
Print result set headings to a buffer. More... | |
void | dbprhead (DBPROCESS *dbproc) |
Print result set headings to stdout. More... | |
RETCODE | dbrows (DBPROCESS *dbproc) |
int | dbgetpacket (DBPROCESS *dbproc) |
Get TDS packet size for the connection. More... | |
RETCODE | dbsetmaxprocs (int maxprocs) |
Set maximum simultaneous connections db-lib will open to the server. More... | |
int | dbgetmaxprocs (void) |
get maximum simultaneous connections db-lib will open to the server. More... | |
RETCODE | dbsettime (int seconds) |
Set maximum seconds db-lib waits for a server response to query. More... | |
int | dbgettime (void) |
Get maximum seconds db-lib waits for a server response to query. More... | |
RETCODE | dbsetlogintime (int seconds) |
Set maximum seconds db-lib waits for a server response to a login attempt. More... | |
RETCODE | dbcmdrow (DBPROCESS *dbproc) |
int | dbaltcolid (DBPROCESS *dbproc, int computeid, int column) |
Get column ID of a compute column. More... | |
DBINT | dbadlen (DBPROCESS *dbproc, int computeid, int column) |
Get size of data in a compute column. More... | |
int | dbalttype (DBPROCESS *dbproc, int computeid, int column) |
Get datatype for a compute column. More... | |
RETCODE | dbaltbind (DBPROCESS *dbproc, int computeid, int column, int vartype, DBINT varlen, BYTE *varaddr) |
Bind a compute column to a program variable. More... | |
BYTE * | dbadata (DBPROCESS *dbproc, int computeid, int column) |
Get address of compute column data. More... | |
int | dbaltop (DBPROCESS *dbproc, int computeid, int column) |
Get aggregation operator for a compute column. More... | |
RETCODE | dbsetopt (DBPROCESS *dbproc, int option, const char *char_param, int int_param) |
Set db-lib or server option. More... | |
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. More... | |
DBBOOL | dbhasretstat (DBPROCESS *dbproc) |
Determine if query generated a return status number. More... | |
DBINT | dbretstatus (DBPROCESS *dbproc) |
Fetch status value returned by query or remote procedure call. More... | |
int | dbnumrets (DBPROCESS *dbproc) |
Get count of output parameters filled by a stored procedure. More... | |
char * | dbretname (DBPROCESS *dbproc, int retnum) |
Get name of an output parameter filled by a stored procedure. More... | |
BYTE * | dbretdata (DBPROCESS *dbproc, int retnum) |
Get value of an output parameter filled by a stored procedure. More... | |
int | dbretlen (DBPROCESS *dbproc, int retnum) |
Get size of an output parameter filled by a stored procedure. More... | |
RETCODE | dbsqlok (DBPROCESS *dbproc) |
Wait for results of a query from the server. More... | |
int | dbnumalts (DBPROCESS *dbproc, int computeid) |
Get count of columns in a compute row. More... | |
int | dbnumcompute (DBPROCESS *dbproc) |
Get count of COMPUTE clauses for a result set. More... | |
BYTE * | dbbylist (DBPROCESS *dbproc, int computeid, int *size) |
Get bylist for a compute row. More... | |
DBBOOL | dbdead (DBPROCESS *dbproc) |
EHANDLEFUNC | dberrhandle (EHANDLEFUNC handler) |
Set an error handler, for messages from db-lib. More... | |
MHANDLEFUNC | dbmsghandle (MHANDLEFUNC handler) |
Set a message handler, for messages from the server. More... | |
int | dbmnycmp (DBPROCESS *dbproc, DBMONEY *m1, DBMONEY *m2) |
Compare two DBMONEY values. More... | |
RETCODE | dbmnyzero (DBPROCESS *dbproc, DBMONEY *dest) |
Set a DBMONEY value to zero. More... | |
RETCODE | dbmnymaxpos (DBPROCESS *dbproc, DBMONEY *amount) |
Get maximum positive DBMONEY value supported. More... | |
RETCODE | dbmnymaxneg (DBPROCESS *dbproc, DBMONEY *amount) |
Get maximum negative DBMONEY value supported. More... | |
RETCODE | dbmnyinc (DBPROCESS *dbproc, DBMONEY *amount) |
Add $0.0001 to a DBMONEY value. More... | |
RETCODE | dbmnydec (DBPROCESS *dbproc, DBMONEY *amount) |
Subtract $0.0001 from a DBMONEY value. More... | |
RETCODE | dbmnyminus (DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest) |
Negate a DBMONEY value. More... | |
RETCODE | dbmny4minus (DBPROCESS *dbproc, DBMONEY4 *src, DBMONEY4 *dest) |
Negate a DBMONEY4 value. More... | |
RETCODE | dbmny4zero (DBPROCESS *dbproc, DBMONEY4 *dest) |
Zero a DBMONEY4 value. More... | |
RETCODE | dbmny4add (DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *sum) |
Add two DBMONEY4 values. More... | |
RETCODE | dbmny4sub (DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *diff) |
Subtract two DBMONEY4 values. More... | |
int | dbmny4cmp (DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2) |
Compare two DBMONEY4 values. More... | |
RETCODE | dbmny4copy (DBPROCESS *dbproc, DBMONEY4 *src, DBMONEY4 *dest) |
Copy a DBMONEY4 value. More... | |
int | dbdatecmp (DBPROCESS *dbproc, DBDATETIME *d1, DBDATETIME *d2) |
Compare DBDATETIME values, similar to strcmp(3). More... | |
static RETCODE | dblib_datecrack (DBPROCESS *dbproc, BOOL nano_precision, DBDATEREC *output, int type, const void *data) |
RETCODE | dbdatecrack (DBPROCESS *dbproc, DBDATEREC *di, DBDATETIME *datetime) |
Break a DBDATETIME value into useful pieces. More... | |
RETCODE | dbanydatecrack (DBPROCESS *dbproc, DBDATEREC2 *di, int type, const void *data) |
Break any kind of date or time value into useful pieces. More... | |
int | dbspid (DBPROCESS *dbproc) |
Get server process ID for a DBPROCESS . More... | |
void | dbsetuserdata (DBPROCESS *dbproc, BYTE *ptr) |
Associate client-allocated (and defined) data with a DBPROCESS . More... | |
BYTE * | dbgetuserdata (DBPROCESS *dbproc) |
Get address of user-allocated data from a DBPROCESS . More... | |
RETCODE | dbsetversion (DBINT version) |
Specify a db-lib version level. More... | |
RETCODE | dbmnycopy (DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest) |
Copy a DBMONEY value. More... | |
RETCODE | dbcanquery (DBPROCESS *dbproc) |
Cancel the query currently being retrieved, discarding all pending rows. More... | |
void | dbfreebuf (DBPROCESS *dbproc) |
Erase the command buffer, in case DBNOAUTOFREE was set with dbsetopt(). More... | |
RETCODE | dbclropt (DBPROCESS *dbproc, int option, const char param[]) |
Reset an option. More... | |
DBBOOL | dbisopt (DBPROCESS *dbproc, int option, const char param[]) |
Get value of an option. More... | |
DBINT | dbcurrow (DBPROCESS *dbproc) |
STATUS | dbrowtype (DBPROCESS *dbproc) |
int | dbcurcmd (DBPROCESS *dbproc) |
RETCODE | dbmorecmds (DBPROCESS *dbproc) |
See if more commands are to be processed. More... | |
int | dbrettype (DBPROCESS *dbproc, int retnum) |
Get datatype of a stored procedure's return parameter. More... | |
int | dbstrlen (DBPROCESS *dbproc) |
Get size of the command buffer, in bytes. More... | |
char * | dbgetchar (DBPROCESS *dbproc, int pos) |
Get address of a position in the command buffer. More... | |
RETCODE | dbstrcpy (DBPROCESS *dbproc, int start, int numbytes, char *dest) |
Get a copy of a chunk of the command buffer. More... | |
RETCODE | dbsafestr (DBPROCESS *dbproc, const char *src, DBINT srclen, char *dest, DBINT destlen, int quotetype) |
safely quotes character values in SQL text. More... | |
const char * | dbprtype (int token) |
Print a token value's name to a buffer. More... | |
RETCODE | dbtablecolinfo (DBPROCESS *dbproc, DBINT column, DBCOL *pdbcol) |
describe table column attributes with a single call (Freetds-only API function modelled on dbcolinfo) More... | |
DBBINARY * | dbtxtimestamp (DBPROCESS *dbproc, int column) |
Get text timestamp for a column in the current row. More... | |
DBBINARY * | dbtxptr (DBPROCESS *dbproc, int column) |
Get text pointer for a column in the current row. More... | |
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. More... | |
STATUS | dbreadtext (DBPROCESS *dbproc, void *buf, DBINT bufsize) |
Fetch part of a text or image value from the server. More... | |
RETCODE | dbmoretext (DBPROCESS *dbproc, DBINT size, const BYTE text[]) |
Send chunk of a text/image value to the server. More... | |
void | dbrecftos (const char filename[]) |
Record to a file all SQL commands sent to the server. More... | |
int | dbtds (DBPROCESS *dbproc) |
const char * | dbversion () |
See which version of db-lib is in use. More... | |
const char * | dbmonthname (DBPROCESS *dbproc, char *language, int monthnum, DBBOOL shortform) |
Get name of a month, in some human language. More... | |
char * | dbchange (DBPROCESS *dbproc) |
See if a command caused the current database to change. More... | |
char * | dbname (DBPROCESS *dbproc) |
Get name of current database. More... | |
char * | dbservcharset (DBPROCESS *dbproc) |
Get syscharset name of the server character set. More... | |
RETCODE | dbsqlsend (DBPROCESS *dbproc) |
Transmit the command buffer to the server. More... | |
DBINT | dbaltutype (DBPROCESS *dbproc, int computeid, int column) |
Get user-defined datatype of a compute column. More... | |
DBINT | dbaltlen (DBPROCESS *dbproc, int computeid, int column) |
Get size of data in compute column. More... | |
DBINT | dbfirstrow (DBPROCESS *dbproc) |
See if a server response has arrived. More... | |
DBINT | dblastrow (DBPROCESS *dbproc) |
int | dbiordesc (DBPROCESS *dbproc) |
int | dbiowdesc (DBPROCESS *dbproc) |
DBBOOL | dbisavail (DBPROCESS *dbproc) |
void | dbsetavail (DBPROCESS *dbproc) |
RETCODE | dbstrbuild (DBPROCESS *dbproc, char *charbuf, int bufsize, char *text, char *formats,...) |
Build a printable string from text containing placeholders for variables. More... | |
void | copy_data_to_host_var (DBPROCESS *dbproc, TDS_SERVER_TYPE srctype, const BYTE *src, DBINT srclen, BYTE *dest, DBINT destlen, int bindtype, DBINT *indicator) |
int | dbperror (DBPROCESS *dbproc, DBINT msgno, long errnum,...) |
Main implementation file for db-lib
.
Definition in file dblib.c.
typedef struct _dblib_error_message DBLIB_ERROR_MESSAGE |
typedef struct dblib_context DBLIBCONTEXT |
Definition at line 3379 of file dblib.c.
References tds_column::column_cur_size, tds_column::column_data, ctll::empty(), is_blob_col, and NULL.
Definition at line 7382 of file dblib.c.
References assert, column, tds_column::column_nullable, tds_result_info::columns, dbproc, FALSE, tds_result_info::num_cols, tds_socket::res_info, tds_dblib_dbprocess::tds_socket, and TRUE.
Referenced by dbcolinfo().
|
static |
Definition at line 1703 of file dblib.c.
References _DB_RES_INIT, _DB_RES_NEXT_RESULT, _DB_RES_NO_MORE_RESULTS, _DB_RES_RESULTSET_EMPTY, _DB_RES_RESULTSET_ROWS, _DB_RES_SUCCEED, assert, buffer_alloc(), buffer_free(), CHECK_CONN, dbperror(), dbproc, tds_dblib_dbprocess::dbresults_state, FAIL, NO_MORE_RESULTS, prdbresults_state(), prresult_type(), prretcode(), tds_dblib_dbprocess::row_buf, SUCCEED, SYBERPND, tds, TDS_COMPUTE_RESULT, TDS_COMPUTEFMT_RESULT, TDS_DBG_FUNC, TDS_DESCRIBE_RESULT, TDS_DONE_ERROR, TDS_DONE_RESULT, TDS_DONEINPROC_RESULT, TDS_DONEPROC_RESULT, TDS_FAILED, tds_free_all_results, TDS_MSG_RESULT, TDS_NO_MORE_RESULTS, TDS_PARAM_RESULT, tds_process_tokens, TDS_ROW_RESULT, TDS_ROWFMT_RESULT, tds_dblib_dbprocess::tds_socket, TDS_STATUS_RESULT, TDS_SUCCESS, TDS_TOKEN_RESULTS, and tdsdump_log.
Definition at line 3796 of file dblib.c.
References tds_column::column_prec, tds_column::column_size, tds_column::column_type, SYB5BIGDATETIME, SYB5BIGTIME, SYBBINARY, SYBBIT, SYBCHAR, SYBDATE, SYBDATETIME, SYBDATETIME4, SYBDECIMAL, SYBFLT8, SYBIMAGE, SYBINT1, SYBINT2, SYBINT4, SYBINT8, SYBLONGBINARY, SYBLONGCHAR, SYBMONEY, SYBMONEY4, SYBMSDATE, SYBMSDATETIME2, SYBMSDATETIMEOFFSET, SYBMSTIME, SYBNTEXT, SYBNUMERIC, SYBNVARCHAR, SYBREAL, SYBSINT1, SYBTEXT, SYBTIME, SYBUINT1, SYBUINT2, SYBUINT4, SYBUINT8, SYBUNIQUE, SYBUNITEXT, SYBVARBINARY, SYBVARCHAR, SYBVOID, and tds_get_conversion_type.
void copy_data_to_host_var | ( | DBPROCESS * | , |
TDS_SERVER_TYPE | , | ||
const BYTE * | , | ||
int | , | ||
BYTE * | , | ||
DBINT | , | ||
int | , | ||
DBINT * | |||
) |
void copy_data_to_host_var | ( | DBPROCESS * | dbproc, |
TDS_SERVER_TYPE | srctype, | ||
const BYTE * | src, | ||
DBINT | srclen, | ||
BYTE * | dest, | ||
DBINT | destlen, | ||
int | bindtype, | ||
DBINT * | indicator | ||
) |
Definition at line 7467 of file dblib.c.
References _dblib_convert_err, DBVARYBIN::array, assert, conv_result::c, CHARBIND, CHECK_NULP, dblib_bound_type(), dbperror(), dbproc, free(), g_dblib_ctx, conv_result::ib, is_numeric_type, is_similar_type, DBVARYBIN::len, len, tds_dblib_dbprocess::msdblib, conv_result::n, NTBSTRINGBIND, NULL, tdsnumeric::precision, DBNUMERIC::precision, tdsnumeric::scale, DBNUMERIC::scale, SRCDECIMALBIND, SRCNUMERICBIND, str(), STRINGBIND, SYB5BIGDATETIME, SYB5BIGTIME, SYBBINARY, SYBBIT, SYBBITN, SYBCHAR, SYBDATE, SYBDATETIME, SYBDATETIME4, SYBDECIMAL, SYBECOFL, SYBFLT8, SYBIMAGE, SYBINT1, SYBINT2, SYBINT4, SYBINT8, SYBMONEY, SYBMONEY4, SYBMSDATE, SYBMSDATETIME2, SYBMSDATETIMEOFFSET, SYBMSTIME, SYBNUMERIC, SYBREAL, SYBTEXT, SYBTIME, SYBUNIQUE, SYBVARBINARY, SYBVARCHAR, tds_convert, dblib_context::tds_ctx, TDS_DBG_FUNC, TDS_DBG_INFO1, tds_get_size_by_type, TDS_INVALID_TYPE, tds_prdatatype(), TDS_ZERO_FREE, tdsdump_log, conv_result::ti, VARYBINBIND, and VARYCHARBIND.
Definition at line 292 of file dblib.c.
References assert, tds_dblib_dbprocess::dbcurdb, dbproc, tds_dblib_dbprocess::envchange_rcv, NULL, tds_dblib_dbprocess::servcharset, strlcpy, tds, TDS_DBG_FUNC, TDS_ENV_CHARSET, TDS_ENV_DATABASE, tds_get_parent, and tdsdump_log.
Referenced by tdsdbopen().
Definition at line 352 of file dblib.c.
References column, tds_socket::comp_info, dbperror(), dbproc, i, info, IS_TDSDEAD, NULL, tds_socket::num_comp_info, SYBEABNC, SYBEBNCR, SYBECNOR, SYBEDDNE, SYBENULL, tds, and tds_dblib_dbprocess::tds_socket.
Referenced by dbacolname().
Definition at line 466 of file dblib.c.
References assert, BIGDATETIMEBIND, BIGINTBIND, BIGTIMEBIND, BINARYBIND, BITBIND, DATEBIND, DATETIME2BIND, DATETIMEBIND, DECIMALBIND, FLT8BIND, INTBIND, MONEYBIND, NTBSTRINGBIND, NUMERICBIND, REALBIND, SMALLBIND, SMALLDATETIMEBIND, SMALLMONEYBIND, SYB5BIGDATETIME, SYB5BIGTIME, SYBBINARY, SYBBIT, SYBCHAR, SYBDATE, SYBDATETIME, SYBDATETIME4, SYBDECIMAL, SYBFLT8, SYBIMAGE, SYBINT1, SYBINT2, SYBINT4, SYBINT8, SYBLONGCHAR, SYBMONEY, SYBMONEY4, SYBMSDATE, SYBMSDATETIME2, SYBMSDATETIMEOFFSET, SYBMSTIME, SYBNUMERIC, SYBREAL, SYBTEXT, SYBTIME, SYBVARBINARY, SYBVARCHAR, TIMEBIND, and TINYBIND.
Definition at line 4303 of file dblib.c.
References CHECK_CONN, dbproc, FAIL, tds_socket::res_info, SUCCEED, tds, TDS_DBG_FUNC, tds_dblib_dbprocess::tds_socket, and tdsdump_log.
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).
dbproc | contains all information needed by db-lib to manage communications with the server. |
type | must be CI_REGULAR or CI_ALTERNATE (CI_CURSOR is defined by the vendor, but is not yet implemented). |
column | Nth in the result set, starting from 1. |
computeid | (ignored) |
pdbcol | address of structure to be populated by this function. |
Definition at line 3054 of file dblib.c.
References _dbnullable(), DBCOL::ActualName, CHECK_NULP, CI_ALTERNATE, CI_REGULAR, column, tds_column::column_identity, tds_column::column_name, tds_column::column_nullable, tds_column::column_prec, tds_column::column_scale, tds_column::column_type, tds_column::column_writeable, tds_socket::comp_info, dbaltlen(), dbalttype(), dbaltutype(), dbcollen(), dbcolname(), dbcolptr(), dbcoltype(), dbcoltypeinfo(), dbcolutype(), dbproc, dbvarylen(), FAIL, FALSE, i, DBCOL::Identity, info, is_nullable_type, DBCOL::MaxLength, DBCOL::Name, DBCOL::Null, tds_socket::num_comp_info, dbtypeinfo::precision, DBCOL::Precision, dbtypeinfo::scale, DBCOL::Scale, strlcpy, SUCCEED, tds_column::table_name, DBCOL::TableName, TDS_DBG_FUNC, tds_dstr_cstr(), tds_dblib_dbprocess::tds_socket, tdsdump_log, TRUE, DBCOL::Type, DBCOL::Updatable, DBCOL::UserType, and DBCOL::VarLength.
Definition at line 331 of file dblib.c.
References column, tds_result_info::columns, dbperror(), dbproc, IS_TDSDEAD, NULL, tds_result_info::num_cols, tds_socket::res_info, SYBECNOR, SYBEDDNE, SYBENULL, and tds_dblib_dbprocess::tds_socket.
Referenced by dbcolinfo().
Definition at line 6263 of file dblib.c.
References CHECK_PARAMETER, dbproc, SYBENULL, TDS_DBG_FUNC, and tdsdump_log.
Definition at line 6229 of file dblib.c.
References CHECK_PARAMETER, dbproc, SYBENULL, TDS_DBG_FUNC, and tdsdump_log.
Definition at line 5101 of file dblib.c.
References dbproc, FALSE, IS_TDSDEAD, NULL, TDS_DBG_FUNC, tds_dblib_dbprocess::tds_socket, tdsdump_log, and TRUE.
Definition at line 529 of file dblib.c.
References assert, BIGDATETIMEBIND, BIGINTBIND, BIGTIMEBIND, BINARYBIND, NULLREP::bindval, BITBIND, CHARBIND, CHECK_PARAMETER, DATEBIND, DATETIME2BIND, DATETIMEBIND, dbperror(), dbproc, DECIMALBIND, default_null_representations, FAIL, FLT8BIND, if(), int, INTBIND, NULLREP::len, MAXBINDTYPES, MONEYBIND, NTBSTRINGBIND, NULL, tds_dblib_dbprocess::nullreps, NUMERICBIND, REALBIND, SMALLBIND, SMALLDATETIMEBIND, SMALLMONEYBIND, SRCDECIMALBIND, SRCNUMERICBIND, STRINGBIND, SUCCEED, SYBEBTYP, SYBENULL, TDS_DBG_FUNC, tdsdump_log, TIMEBIND, TINYBIND, VARYBINBIND, and VARYCHARBIND.
Definition at line 7281 of file dblib.c.
References CHECK_PARAMETER, dbproc, SYBENULL, TDS_DBG_FUNC, tds_get_s, tds_dblib_dbprocess::tds_socket, and tdsdump_log.
Definition at line 7297 of file dblib.c.
References CHECK_PARAMETER, dbproc, SYBENULL, TDS_DBG_FUNC, tds_get_s, tds_dblib_dbprocess::tds_socket, and tdsdump_log.
Definition at line 7306 of file dblib.c.
References tds_dblib_dbprocess::avail_flag, CHECK_PARAMETER, dbproc, FALSE, SYBENULL, TDS_DBG_FUNC, and tdsdump_log.
Definition at line 7257 of file dblib.c.
References assert, buffer_idx2row(), DBPROC_ROWBUF::capacity, CHECK_PARAMETER, dbproc, DBPROC_ROWBUF::head, tds_dblib_dbprocess::row_buf, SYBENULL, DBPROC_ROWBUF::tail, TDS_DBG_FUNC, and tdsdump_log.
|
static |
Definition at line 212 of file dblib.c.
References ctx, dbperror(), i, tds, TDS_DBG_FUNC, tds_get_parent, and tdsdump_log.
Referenced by tdsdbopen().
|
static |
Definition at line 2183 of file dblib.c.
References BIGDATETIMEBIND, BIGINTBIND, BIGTIMEBIND, BINARYBIND, BITBIND, CHARBIND, DATEBIND, DATETIME2BIND, DATETIMEBIND, DECIMALBIND, FLT8BIND, INTBIND, MONEYBIND, NTBSTRINGBIND, NUMERICBIND, REALBIND, SMALLBIND, SMALLDATETIMEBIND, SMALLMONEYBIND, SRCDECIMALBIND, SRCNUMERICBIND, STRINGBIND, SYB5BIGDATETIME, SYB5BIGTIME, SYBBINARY, SYBBIT, SYBCHAR, SYBDATE, SYBDATETIME, SYBDATETIME4, SYBFLT8, SYBINT1, SYBINT2, SYBINT4, SYBINT8, SYBMONEY, SYBMONEY4, SYBMSDATETIMEOFFSET, SYBNUMERIC, SYBREAL, SYBTIME, SYBVARBINARY, SYBVARCHAR, TDS_INVALID_TYPE, TIMEBIND, TINYBIND, VARYBINBIND, and VARYCHARBIND.
Referenced by copy_data_to_host_var().
Definition at line 2889 of file dblib.c.
References tds_column::column_size, tds_column::column_type, SYB5BIGDATETIME, SYB5BIGTIME, SYB5INT8, SYBBINARY, SYBBIT, SYBBITN, SYBCHAR, SYBDATE, SYBDATEN, SYBDATETIME, SYBDATETIME4, SYBDATETIMN, SYBDECIMAL, SYBFLT8, SYBFLTN, SYBIMAGE, SYBINT1, SYBINT2, SYBINT4, SYBINT8, SYBINTERVAL, SYBINTN, SYBLONGBINARY, SYBLONGCHAR, SYBMONEY, SYBMONEY4, SYBMONEYN, SYBMSDATE, SYBMSDATETIME2, SYBMSDATETIMEOFFSET, SYBMSTABLE, SYBMSTIME, SYBMSUDT, SYBMSXML, SYBNTEXT, SYBNUMERIC, SYBNVARCHAR, SYBREAL, SYBSINT1, SYBTEXT, SYBTIME, SYBTIMEN, SYBUINT1, SYBUINT2, SYBUINT4, SYBUINT8, SYBUINTN, SYBUNIQUE, SYBUNITEXT, SYBVARBINARY, SYBVARCHAR, SYBVARIANT, SYBVOID, SYBXML, tds_get_conversion_type, XSYBBINARY, XSYBNCHAR, XSYBNVARCHAR, XSYBVARBINARY, and XSYBVARCHAR.
|
static |
Definition at line 5836 of file dblib.c.
References CHECK_NULP, CHECK_PARAMETER, data, tds_sybase_dbdaterec::datedmonth, tds_sybase_dbdaterec::datedweek, tds_sybase_dbdaterec::datedyear, tds_sybase_dbdaterec::datehour, tds_sybase_dbdaterec::dateminute, tds_sybase_dbdaterec::datemonth, tds_sybase_dbdaterec::datemsecond, tds_sybase_dbdaterec::datesecond, tds_sybase_dbdaterec::datetzone, tds_sybase_dbdaterec::dateyear, dblib_msdblib, dbproc, dr, FAIL, tds_dblib_dbprocess::msdblib, output, tds_sybase_dbdaterec::quarter, SUCCEED, SYBENDTP, tds_datecrack, TDS_DBG_FUNC, TDS_FAILED, and tdsdump_log.
|
static |
Definition at line 231 of file dblib.c.
References ctx, i, NULL, tds, TDS_DBG_FUNC, and tdsdump_log.
|
static |
Definition at line 249 of file dblib.c.
References _dblib_check_and_handle_interrupt, _dblib_handle_err_message, _dblib_handle_info_message, tds_locale::datetime_fmt, dblib_mutex, tds_context::err_handler, g_dblib_ctx, tds_context::int_handler, tds_context::locale, tds_context::msg_handler, NULL, strdup, tds_alloc_context, dblib_context::tds_ctx, dblib_context::tds_ctx_ref_count, TDS_DBG_FUNC, tds_mutex_lock, tds_mutex_unlock, and tdsdump_log.
Referenced by tdsdbopen().
Definition at line 276 of file dblib.c.
References dblib_mutex, g_dblib_ctx, NULL, dblib_context::tds_ctx, dblib_context::tds_ctx_ref_count, TDS_DBG_FUNC, tds_free_context, tds_mutex_lock, tds_mutex_unlock, and tdsdump_log.
Definition at line 2074 of file dblib.c.
References _DB_RES_NEXT_RESULT, _DB_RES_RESULTSET_ROWS, assert, BUF_FULL, buffer_add_row(), buffer_current_index(), buffer_is_full(), buffer_save_row(), buffer_transfer_bound_data(), CHECK_CONN, tds_result_info::computeid, tds_socket::current_results, dbnextrow_pivoted, dbproc, tds_dblib_dbprocess::dbresults_state, dbrows_pivoted, FAIL, mask, NO_MORE_ROWS, NULL, prdbresults_state(), prdbretcode(), REG_ROW, tds_socket::res_info, result, tds_dblib_dbprocess::row_buf, tds_dblib_dbprocess::row_type, tds_socket::rows_affected, tds, TDS_COMPUTE_RESULT, TDS_DBG_FUNC, TDS_DONEINPROC_RESULT, TDS_NO_COUNT, TDS_NO_MORE_RESULTS, tds_process_tokens, TDS_RETURN_COMPUTE, TDS_RETURN_DONE, TDS_RETURN_ROW, TDS_ROW_RESULT, TDS_ROWFMT_RESULT, tds_dblib_dbprocess::tds_socket, TDS_STOPAT_ROWFMT, TDS_SUCCESS, TDS_TOKEN_TRAILING, and tdsdump_log.
Definition at line 8180 of file dblib.c.
References _dblib_err_handler, asprintf, assert, buffer, dblib_error_messages, dbproc, EXCONSISTENCY, exit(), EXIT_FAILURE, free(), i, int, INT_CANCEL, INT_CONTINUE, INT_EXIT, INT_TIMEOUT, len, tds_socket::login, tds_dblib_dbprocess::msdblib, _dblib_error_message::msgtext, tds_dblib_dbprocess::ntimeouts, NULL, result_len, tds_login::server_name, _dblib_error_message::severity, strerror(), SYBEMEM, SYBETIME, TDS_DBG_FUNC, TDS_DBG_SEVERE, tds_dstr_cstr(), tds_dstr_isempty(), TDS_FAILED, tds_new0, TDS_NULLTERM, tds_dblib_dbprocess::tds_socket, TDS_VECTOR_SIZE, tds_vstrbuild, and tdsdump_log.
Definition at line 4077 of file dblib.c.
References CHECK_CONN, dbproc, FAIL, tds_socket::res_info, tds_result_info::rows_exist, SUCCEED, tds, TDS_DBG_FUNC, tds_dblib_dbprocess::tds_socket, and tdsdump_log.
Definition at line 6246 of file dblib.c.
References CHECK_PARAMETER, dbproc, NO_MORE_ROWS, tds_dblib_dbprocess::row_type, SYBENULL, TDS_DBG_FUNC, and tdsdump_log.
void dbsetavail | ( | DBPROCESS * | dbproc | ) |
Definition at line 7325 of file dblib.c.
References tds_dblib_dbprocess::avail_flag, CHECK_PARAMETER, dbproc, SYBENULL, TDS_DBG_FUNC, tdsdump_log, and TRUE.
Definition at line 896 of file dblib.c.
References dbperror(), DBSETBCP, DBSETDELEGATION, DBSETENCRYPT, DBSETLABELED, DBSETMUTUALAUTH, DBSETNETWORKAUTH, DBSETNTLMV2, DBSETREADONLY, DBSETUTF16, FAIL, tds_login::gssapi_use_delegation, login, tds_login::mutual_authentication, NULL, tds_login::readonly_intent, SUCCEED, SYBEASNL, TDS_DBG_FUNC, tds_set_bulk, tdsdump_log, tds_login::use_ntlmv2, tds_login::use_ntlmv2_specified, tds_login::use_utf16, and rapidjson::value.
Definition at line 825 of file dblib.c.
References tds_login::block_size, dbperror(), DBSETPACKET, FAIL, login, NULL, SUCCEED, SYBEASNL, SYBEBADPK, TDS_DBG_FUNC, tds_set_packet, tdsdump_log, and rapidjson::value.
Definition at line 759 of file dblib.c.
References tds_login::database, dbperror(), DBSETAPP, DBSETCHARSET, DBSETDBNAME, DBSETHOST, DBSETNATLANG, DBSETPWD, DBSETSERVERPRINCIPAL, DBSETUSER, FAIL, login, NULL, tds_login::server_spn, SUCCEED, SYBEASNL, SYBEASUL, SYBENTLL, TDS_DBG_FUNC, tds_dstr_copy(), TDS_MAX_LOGIN_STR_SZ, tds_set_app, tds_set_client_charset, tds_set_host, tds_set_language, tds_set_passwd, tds_set_user, tdsdump_log, and rapidjson::value.
Definition at line 1033 of file dblib.c.
References dbstring_concat(), and dbstring_free().
Referenced by init_dboptions().
Definition at line 1008 of file dblib.c.
References dbperror(), FAIL, NULL, SUCCEED, SYBEMEM, tds_new, and TDS_ZERO_FREE.
Referenced by dbstring_assign().
Definition at line 989 of file dblib.c.
References free(), next(), NULL, dbstring::strnext, and dbstring::strtext.
Referenced by dbstring_assign().
Definition at line 1074 of file dblib.c.
References dbperror(), dbstring_length(), len, next(), NULL, SYBEMEM, and tds_new.
Definition at line 1056 of file dblib.c.
References i, NULL, dbstring::strnext, dbstring::strtext, and dbstring::strtotlen.
Definition at line 6851 of file dblib.c.
References CHECK_PARAMETER, tds_socket::conn, dbproc, DBTDS_4_2, DBTDS_4_6, DBTDS_5_0, DBTDS_7_0, DBTDS_7_1, DBTDS_7_2, DBTDS_7_3, DBTDS_7_4, DBTDS_UNKNOWN, SYBENULL, TDS_DBG_FUNC, tds_dblib_dbprocess::tds_socket, tds_connection::tds_version, and tdsdump_log.
|
static |
Definition at line 5135 of file dblib.c.
References DBDEAD, dbproc, INT_CANCEL, INT_EXIT, tds_dblib_dbprocess::msdblib, SYBETIME, TDS_DBG_FUNC, and tdsdump_log.
Definition at line 1140 of file dblib.c.
References DBCLIENTCURSORS, DBNUMOPTIONS, dbperror(), DBPRCOLSEP, DBPRLINELEN, DBPRLINESEP, DBPRPAD, DBSETTIME, dbstring_assign(), dboption::factive, FALSE, i, NULL, opttext, dboption::param, SYBEMEM, tds_new0, and dboption::text.
Referenced by tdsdbopen().
Definition at line 1596 of file dblib.c.
References _DB_RES_INIT, _DB_RES_NEXT_RESULT, _DB_RES_NO_MORE_RESULTS, _DB_RES_RESULTSET_EMPTY, _DB_RES_RESULTSET_ROWS, and _DB_RES_SUCCEED.
Referenced by _dbresults(), and dbnextrow().
Definition at line 1611 of file dblib.c.
References BUF_FULL, FAIL, NO_MORE_RESULTS, NO_MORE_ROWS, REG_ROW, and SUCCEED.
Referenced by dbnextrow().
Definition at line 1639 of file dblib.c.
References TDS_CMD_DONE, TDS_CMD_FAIL, TDS_CMD_SUCCEED, TDS_COMPUTE_RESULT, TDS_COMPUTEFMT_RESULT, TDS_DESCRIBE_RESULT, TDS_DONE_RESULT, TDS_DONEINPROC_RESULT, TDS_DONEPROC_RESULT, TDS_MSG_RESULT, TDS_OTHERS_RESULT, TDS_PARAM_RESULT, TDS_ROW_RESULT, TDS_ROWFMT_RESULT, and TDS_STATUS_RESULT.
Referenced by _dbresults().
Definition at line 1626 of file dblib.c.
References TDS_CANCELLED, TDS_FAIL, TDS_NO_MORE_RESULTS, and TDS_SUCCESS.
Referenced by _dbresults().
Returns type in string.
Used for debugging purpose
Definition at line 7400 of file dblib.c.
References SYB5BIGDATETIME, SYB5BIGTIME, SYB5INT8, SYBBINARY, SYBBIT, SYBBITN, SYBCHAR, SYBDATE, SYBDATEN, SYBDATETIME, SYBDATETIME4, SYBDATETIMN, SYBDECIMAL, SYBFLT8, SYBFLTN, SYBIMAGE, SYBINT1, SYBINT2, SYBINT4, SYBINT8, SYBINTERVAL, SYBINTN, SYBLONGBINARY, SYBMONEY, SYBMONEY4, SYBMONEYN, SYBMSDATE, SYBMSDATETIME2, SYBMSDATETIMEOFFSET, SYBMSTABLE, SYBMSTIME, SYBMSUDT, SYBMSXML, SYBNTEXT, SYBNUMERIC, SYBNVARCHAR, SYBREAL, SYBSINT1, SYBTEXT, SYBTIME, SYBTIMEN, SYBUINT1, SYBUINT2, SYBUINT4, SYBUINT8, SYBUINTN, SYBUNIQUE, SYBUNITEXT, SYBVARBINARY, SYBVARCHAR, SYBVARIANT, SYBVOID, SYBXML, XSYBBINARY, XSYBCHAR, XSYBNCHAR, XSYBNVARCHAR, XSYBVARBINARY, and XSYBVARCHAR.
Referenced by copy_data_to_host_var().
Definition at line 1179 of file dblib.c.
References _dbprdate(), asprintf, tds_dblib_dbprocess::avail_flag, buffer_set_capacity(), tds_dblib_dbprocess::chkintr, tds_dblib_dbprocess::command_state, tds_login::connect_timeout, db_env_chg(), tds_dblib_dbprocess::dbbuf, tds_dblib_dbprocess::dbbufsz, dbclose(), DBCMDNONE, tds_dblib_dbprocess::dbcurdb, dblib_add_connection(), dblib_get_tds_ctx(), dblib_mutex, tds_dblib_dbprocess::dboptcmd, tds_dblib_dbprocess::dbopts, dbperror(), dbproc, default_null_representations, tds_socket::env_chg_func, tds_dblib_dbprocess::envchange_rcv, free(), tds_dblib_dbprocess::ftos, g_dblib_ctx, tds_dblib_dbprocess::hndlintr, init_dboptions(), len, tds_context::locale, login, dblib_context::login_timeout, tds_dblib_dbprocess::msdblib, msdblib, NULL, tds_dblib_dbprocess::nullreps, tds_login::option_flag2, tds_login::password, tds_login::query_timeout, dblib_context::query_timeout, dblib_context::recftos_filename, dblib_context::recftos_filenum, tds_dblib_dbprocess::servcharset, tds_login::server_name, SYBEMEM, tds_alloc_socket, tds_connect_and_login, dblib_context::tds_ctx, TDS_DBG_ERROR, TDS_DBG_FUNC, tds_dstr_cstr(), tds_dstr_empty, TDS_FAILED, tds_fix_login, tds_free_login, tds_mutex_lock, tds_mutex_unlock, tds_new0, TDS_ODBC_ON, tds_read_config_info, tds_set_parent, tds_set_server, tds_dblib_dbprocess::tds_socket, tdsdump_log, tdsdump_open, TRUE, and tds_login::user_name.
EHANDLEFUNC _dblib_err_handler = default_err_handler |
MHANDLEFUNC _dblib_msg_handler = NULL |
|
static |
Definition at line 7800 of file dblib.c.
Referenced by dbperror().
|
static |
Definition at line 193 of file dblib.c.
Referenced by dbclose(), dbclropt(), dbexit(), dbgetmaxprocs(), dbinit(), dblib_get_tds_ctx(), dblib_release_tds_ctx(), dbrecftos(), dbsetlogintime(), dbsetmaxprocs(), dbsettime(), and tdsdbopen().
|
static |
Definition at line 429 of file dblib.c.
Referenced by dbgetnull(), and tdsdbopen().
|
static |
Definition at line 192 of file dblib.c.
Referenced by copy_data_to_host_var(), dblib_get_tds_ctx(), dblib_release_tds_ctx(), and tdsdbopen().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 1100 of file dblib.c.
Referenced by init_dboptions().