A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/group__dblib__core.html below:

NCBI C++ ToolKit: Primary functions

Core functions needed by most db-lib programs. More...

#define  DBCMDROW(x)   dbcmdrow((x))   Sybase macro mapping to the Microsoft (lower-case) function. More...
  #define  DBCOUNT(x)   dbcount((x))   Sybase macro mapping to the Microsoft (lower-case) function. More...
  #define  DBCURCMD(x)   dbcurcmd((x))   Sybase macro mapping to the Microsoft (lower-case) function. More...
  #define  DBCURROW(x)   dbcurrow((x))   Sybase macro mapping to the Microsoft (lower-case) function. More...
  #define  DBDEAD(x)   dbdead((x))   Sybase macro mapping to the Microsoft (lower-case) function. More...
  #define  DBFIRSTROW(x)   dbfirstrow((x))   Sybase macro mapping to the Microsoft (lower-case) function. More...
  #define  DBIORDESC(x)   dbiordesc((x))   Sybase macro, maps to the internal (lower-case) function. More...
  #define  DBIOWDESC(x)   dbiowdesc((x))   Sybase macro, maps to the internal (lower-case) function. More...
  #define  DBISAVAIL(x)   dbisavail((x))   Sybase macro mapping to the Microsoft (lower-case) function. More...
  #define  DBLASTROW(x)   dblastrow((x))   Sybase macro mapping to the Microsoft (lower-case) function. More...
  #define  DBMORECMDS(x)   dbmorecmds((x))   Sybase macro mapping to the Microsoft (lower-case) function. More...
  #define  DBROWS(x)   dbrows((x))   Sybase macro mapping to the Microsoft (lower-case) function. More...
  #define  DBROWTYPE(x)   dbrowtype((x))   Sybase macro mapping to the Microsoft (lower-case) function. More...
  #define  DBTDS(a)   dbtds(a)   Sybase macro, maps to the internal (lower-case) function. More...
  #define  DBSETLCHARSET(x, y)   dbsetlname((x), (y), DBSETCHARSET)   Set the client character set in the login packet. More...
  #define  DBSETLNATLANG(x, y)   dbsetlname((x), (y), DBSETNATLANG)   Set the language the server should use for messages. More...
  #define  dbsetlnatlang(x, y)   dbsetlname((x), (y), DBSETNATLANG)   Set the language the server should use for messages. More...
  #define  DBSETLPACKET(x, y)   dbsetllong((x), (y), DBSETPACKET)   Set the packet size in the login packet for new connections. More...
  #define  dbsetlpacket(x, y)   dbsetllong((x), (y), DBSETPACKET)   Set the packet size in the login packet for new connections. More...
  #define  DBSETLENCRYPT(x, y)   dbsetlbool((x), (y), DBSETENCRYPT)   Enable (or not) network password encryption for Sybase servers version 10.0 or above. More...
  #define  dbinit   dbinit_ver100   Initialize db-lib. More...
  #define  dblogin   dblogin_ver100   Allocate a LOGINREC structure. More...
  #define  dbexit   dbexit_ver100   Close server connections and free all related structures. More...
  #define  dbgetmaxprocs   dbgetmaxprocs_ver100   get maximum simultaneous connections db-lib will open to the server. More...
  #define  dbgettime   dbgettime_ver100   Get maximum seconds db-lib waits for a server response to query. More...
  #define  dbversion   dbversion_ver100   See which version of db-lib is in use. More...
  static RETCODE  _dbresults (DBPROCESS *dbproc)   RETCODE  dbinit (void)   Initialize db-lib. More...
  LOGINRECdblogin (void)   Allocate a LOGINREC structure. More...
  void  dbloginfree (LOGINREC *login)   free the LOGINREC More...
  RETCODE  dbsetlversion (LOGINREC *login, BYTE version)   Set TDS version for future connections. More...
  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...
  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...
  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...
  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...
  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...
  DBTYPEINFOdbcoltypeinfo (DBPROCESS *dbproc, int column)   Get precision and scale information for a regular result column. 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...
  BYTEdbdata (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...
  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...
  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...
  BYTEdbadata (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...
  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...
  BYTEdbbylist (DBPROCESS *dbproc, int computeid, int *size)   Get bylist for a compute row. More...
  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...
  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...
  BYTEdbgetuserdata (DBPROCESS *dbproc)   Get address of user-allocated data from a DBPROCESS. More...
  RETCODE  dbsetversion (DBINT version)   Specify a db-lib version level. 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...
  RETCODE  dbmorecmds (DBPROCESS *dbproc)   See if more commands are to be processed. 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...
  DBBINARYdbtxtimestamp (DBPROCESS *dbproc, int column)   Get text timestamp for a column in the current row. More...
  DBBINARYdbtxptr (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...
  const char *  dbversion ()   See which version of db-lib is in use. 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...
  RETCODE  dbstrbuild (DBPROCESS *dbproc, char *charbuf, int bufsize, char *text, char *formats,...)   Build a printable string from text containing placeholders for variables. More...
  const char *  dbacolname (DBPROCESS *dbproc, int computeid, int column)   Return name of a computed result column. More...
 

Core functions needed by most db-lib programs.

◆ DBCMDROW

Sybase macro mapping to the Microsoft (lower-case) function.

See also
dbcmdrow()

Definition at line 733 of file sybdb.h.

◆ DBCOUNT

Sybase macro mapping to the Microsoft (lower-case) function.

See also
dbcount()

Definition at line 748 of file sybdb.h.

Referenced by main().

◆ DBCURCMD

Sybase macro mapping to the Microsoft (lower-case) function.

See also
dbcurcmd()

Definition at line 751 of file sybdb.h.

◆ DBCURROW

Sybase macro mapping to the Microsoft (lower-case) function.

See also
dbcurrow()

Definition at line 754 of file sybdb.h.

◆ DBDEAD ◆ dbexit ◆ DBFIRSTROW

Sybase macro mapping to the Microsoft (lower-case) function.

See also
dbfirstrow()

Definition at line 768 of file sybdb.h.

◆ dbgetmaxprocs ◆ dbgettime ◆ dbinit

Initialize db-lib.

Return values
SUCCEED normal. FAIL cannot allocate an array of TDS_MAX_CONN TDSSOCKET pointers.

Definition at line 107 of file rename_ftds_dblib.h.

◆ DBIORDESC

Sybase macro, maps to the internal (lower-case) function.

See also
dbiordesc()

Definition at line 784 of file sybdb.h.

◆ DBIOWDESC

Sybase macro, maps to the internal (lower-case) function.

See also
dbiowdesc()

Definition at line 787 of file sybdb.h.

◆ DBISAVAIL

Sybase macro mapping to the Microsoft (lower-case) function.

See also
dbisavail()

Definition at line 790 of file sybdb.h.

◆ DBLASTROW ◆ dblogin

Allocate a LOGINREC structure.

Return values
NULL the LOGINREC cannot be allocated. LOGINREC* to valid memory, otherwise.

Definition at line 115 of file rename_ftds_dblib.h.

◆ DBMORECMDS

Sybase macro mapping to the Microsoft (lower-case) function.

See also
dbmorecmds()

Definition at line 820 of file sybdb.h.

◆ DBROWS

Sybase macro mapping to the Microsoft (lower-case) function.

See also
dbrows()

Definition at line 881 of file sybdb.h.

Referenced by main(), and test().

◆ DBROWTYPE

Sybase macro mapping to the Microsoft (lower-case) function.

See also
dbrowtype()

Definition at line 884 of file sybdb.h.

◆ DBSETLCHARSET

Set the client character set in the login packet.

Definition at line 1281 of file sybdb.h.

Referenced by main().

◆ DBSETLENCRYPT

Enable (or not) network password encryption for Sybase servers version 10.0 or above.

See also
dbsetlencrypt()

Definition at line 1286 of file sybdb.h.

◆ DBSETLNATLANG ◆ dbsetlnatlang ◆ DBSETLPACKET ◆ dbsetlpacket ◆ DBTDS ◆ dbversion

See which version of db-lib is in use.

Returns
null-terminated ASCII string representing the version of db-lib.
See also

Definition at line 205 of file rename_ftds_dblib.h.

◆ _dbresults()

Definition at line 1716 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_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.

Referenced by dbresults().

◆ dbacolname()

Return name of a computed result column.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. computeid identifies which one of potientially many compute rows is meant. The first compute clause has computeid == 1. column Nth in the result set, starting with 1.
Returns
pointer to ASCII null-terminated string, the name of the column.
Return values
NULL column is not in range.
See also
dbcollen(), dbcoltype(), dbdata(), dbdatlen(), dbnumcols().

Definition at line 1898 of file dblib.c.

References column, tds_column::column_name, dbacolptr(), dbproc, NULL, TDS_DBG_FUNC, tds_dstr_cstr(), and tdsdump_log.

◆ dbadata()

Get address of compute column data.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. computeid of COMPUTE clause to which we're referring. column Nth column in computeid, starting from 1.
Returns
pointer to columns's data buffer.
Return values
NULL no such computeid or column.
See also
dbadlen(), dbaltbind(), dbaltlen(), dbalttype(), dbgetrow(), dbnextrow(), dbnumalts().

Definition at line 4325 of file dblib.c.

References CHECK_PARAMETER, column, tds_column::column_data, dbacolptr(), dbproc, is_blob_col, NULL, SYBENULL, TDS_DBG_FUNC, and tdsdump_log.

Referenced by dbprrow().

◆ dbadlen()

Get size of data in a compute column.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. computeid of COMPUTE clause to which we're referring. column Nth column in computeid, starting from 1.
Returns
size of the data, in bytes.
Return values
-1 no such column or computeid. 0 data are NULL.
See also
dbadata(), dbaltlen(), dbalttype(), dbgetrow(), dbnextrow(), dbnumalts().

Definition at line 4209 of file dblib.c.

References CHECK_PARAMETER, column, tds_column::column_cur_size, tds_column::column_type, dbacolptr(), dbproc, len, SYBENULL, TDS_DBG_FUNC, and tdsdump_log.

◆ dbaltbind()

Bind a compute column to a program variable.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. computeid of COMPUTE clause to which we're referring. column Nth column in computeid, starting from 1. vartype datatype of the host variable that will receive the data varlen size of host variable pointed to varaddr varaddr address of host variable
Return values
SUCCEED everything worked. FAIL no such computeid or column, or no such conversion possible, or target buffer too small.
See also
dbadata(), dbaltbind_ps(), dbanullbind(), dbbind(), dbbind_ps(), dbconvert(), dbconvert_ps(), dbnullbind(), dbsetnull(), dbsetversion(), dbwillconvert().

Definition at line 4278 of file dblib.c.

References tds_dblib_dbprocess::avail_flag, CHECK_PARAMETER, column, tds_column::column_bindlen, tds_column::column_bindtype, tds_column::column_size, tds_column::column_type, tds_column::column_varaddr, dbacolptr(), dblib_bound_type(), dbperror(), dbproc, dbwillconvert(), FAIL, FALSE, NULL, SUCCEED, SYBEAAMT, SYBEABNV, SYBEBTYP, SYBENULL, TDS_DBG_FUNC, tds_get_conversion_type, TDS_INVALID_TYPE, and tdsdump_log.

Referenced by main().

◆ dbaltcolid()

Get column ID of a compute column.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. computeid of COMPUTE clause to which we're referring. column Nth column in computeid, starting from 1.
Returns
Nth column in the base result set, on which column was computed.
See also
dbadata(), dbadlen(), dbaltlen(), dbgetrow(), dbnextrow(), dbnumalts(), dbprtype().

Definition at line 4182 of file dblib.c.

References CHECK_PARAMETER, column, tds_column::column_operand, dbacolptr(), dbproc, SYBENULL, TDS_DBG_FUNC, and tdsdump_log.

Referenced by dbprrow(), and main().

◆ dbaltlen()

Get size of data in compute column.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. computeid of COMPUTE clause to which we're referring. column Nth column in computeid, starting from 1.
See also
dbadata(), dbadlen(), dbalttype(), dbgetrow(), dbnextrow(), dbnumalts().

Definition at line 7060 of file dblib.c.

References column, tds_column::column_size, dbacolptr(), dbproc, TDS_DBG_FUNC, and tdsdump_log.

Referenced by dbcolinfo().

◆ dbaltop()

Get aggregation operator for a compute column.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. computeid of COMPUTE clause to which we're referring. column Nth column in computeid, starting from 1.
Returns
token value for the type of the compute column's aggregation operator.
Return values
-1 no such computeid or column.
See also
dbadata(), dbadlen(), dbaltlen(), dbnextrow(), dbnumalts(), dbprtype().

Definition at line 4355 of file dblib.c.

References CHECK_PARAMETER, column, tds_column::column_operator, dbacolptr(), dbproc, NULL, SYBENULL, TDS_DBG_FUNC, and tdsdump_log.

Referenced by dbprrow(), and main().

◆ dbalttype()

Get datatype for a compute column.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. computeid of COMPUTE clause to which we're referring. column Nth column in computeid, starting from 1.
Returns
SYB* dataype token.
Return values
-1 no such column or computeid.
See also
dbadata(), dbadlen(), dbaltlen(), dbnextrow(), dbnumalts(), dbprtype().

Definition at line 4240 of file dblib.c.

References CHECK_PARAMETER, column, tds_column::column_size, tds_column::column_type, dbacolptr(), dbproc, SYBBINARY, SYBCHAR, SYBENULL, SYBVARBINARY, SYBVARCHAR, TDS_DBG_FUNC, tds_get_conversion_type, and tdsdump_log.

Referenced by dbcolinfo(), dbprrow(), and main().

◆ dbaltutype()

Get user-defined datatype of a compute column.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. computeid of COMPUTE clause to which we're referring. column Nth column in computeid, starting from 1.
Returns
user-defined datatype of compute column, else -1.
See also
dbalttype(), dbcolutype().

Definition at line 7036 of file dblib.c.

References CHECK_PARAMETER, column, tds_column::column_usertype, dbacolptr(), dbproc, SYBENULL, TDS_DBG_FUNC, and tdsdump_log.

Referenced by dbcolinfo().

◆ dbanullbind()

Tie a null-indicator to a compute result column.

When a row is fetched, the indicator variable tells the state of the column's data.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. computeid identifies which one of potientially many compute rows is meant. The first compute clause has computeid == 1. column Nth column in the result set, starting with 1. indicator address of host variable.
Return values
SUCCEED variable accepted. FAIL indicator is NULL or column is out of range.
See also
dbadata(), dbadlen(), dbaltbind(), dbnextrow(), dbnullbind().

When a row is fetched, the indicator variable tells the state of the column's data.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. computeid identifies which one of potientially many compute rows is meant. The first compute clause has computeid == 1. column Nth column in the result set, starting with 1. indicator address of host variable.
Return values
SUCCEED variable accepted. FAIL indicator is NULL or column is out of range.
See also
dbadata(), dbadlen(), dbaltbind(), dbnextrow(), dbnullbind().

Definition at line 2787 of file dblib.c.

References column, tds_column::column_nullbind, dbacolptr(), dbproc, FAIL, SUCCEED, TDS_DBG_FUNC, and tdsdump_log.

◆ dbanydatecrack()

Break any kind of date or time value into useful pieces.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. di output: structure to contain the exploded parts of datetime. type input: type of date/time value returned by dbcoltype(). data input: date/time value to be converted.
Return values

This is an extension to dbdatecrack(), see it for more information.

See also
dbdatecrack(), dbconvert(), dbdata(), dbdatechar(), dbdatename(), dbdatepart(), tdsdbopen().

Definition at line 5777 of file dblib.c.

References data, dblib_datecrack(), dbproc, and TRUE.

Referenced by main().

◆ dbbind()

Tie a host variable to a resultset column.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. column Nth column, starting at 1. vartype datatype of the host variable that will receive the data varlen size of host variable pointed to varaddr varaddr address of host variable
Return values
SUCCEED everything worked. FAIL no such column or no such conversion possible, or target buffer too small.
See also

Definition at line 2645 of file dblib.c.

References tds_dblib_dbprocess::avail_flag, CHARBIND, CHECK_CONN, CHECK_PARAMETER, column, tds_column::column_bindlen, tds_column::column_bindtype, tds_column::column_size, tds_column::column_type, tds_column::column_varaddr, tds_result_info::columns, dblib_bound_type(), dbperror(), dbproc, dbwillconvert(), FAIL, FALSE, NTBSTRINGBIND, NULL, tds_socket::res_info, results, STRINGBIND, SUCCEED, SYBEABMT, SYBEABNC, SYBEABNV, SYBEBTYP, TDS_DBG_FUNC, tds_get_conversion_type, TDS_INVALID_TYPE, tds_dblib_dbprocess::tds_socket, tdsdump_log, VARYBINBIND, and VARYCHARBIND.

Referenced by char_test(), dbpivot(), main(), select_rows(), test(), test0(), and test_row().

◆ dbbylist()

Get bylist for a compute row.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. computeid of COMPUTE clause to which we're referring. size output: size of bylist buffer whose address is returned, possibly zero.
Returns
address of bylist for computeid.
Return values
See also
dbadata(), dbadlen(), dbaltlen(), dbalttype(), dbcolname(), dbgetrow(), dbnextrow().

Definition at line 4908 of file dblib.c.

References CHECK_PARAMETER, tds_socket::comp_info, dbperror(), dbproc, free(), i, info, malloc(), n, NULL, tds_socket::num_comp_info, ncbi::grid::netcache::search::fields::size, SYBEMEM, SYBENULL, tds, TDS_DBG_FUNC, tds_dblib_dbprocess::tds_socket, and tdsdump_log.

◆ dbcancel()

Cancel the current command batch.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server.
Return values
See also
dbcanquery(), dbnextrow(), dbresults(), dbsetinterrupt(), dbsqlexec(), dbsqlok(), dbsqlsend().
Parameters
dbproc contains all information needed by db-lib to manage communications with the server.
Return values
See also
dbcanquery(), dbnextrow(), dbresults(), dbsetinterrupt(), dbsqlexec(), dbsqlok(), dbsqlsend().

Definition at line 3279 of file dblib.c.

References CHECK_CONN, dbproc, FAIL, SUCCEED, tds, TDS_DBG_FUNC, tds_process_cancel, tds_send_cancel, tds_dblib_dbprocess::tds_socket, and tdsdump_log.

Referenced by cancel_msg_handler(), char_test(), drop_table(), main(), test(), and test0().

◆ dbcanquery()

Cancel the query currently being retrieved, discarding all pending rows.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server.
See also

Definition at line 5941 of file dblib.c.

References _DB_RES_NEXT_RESULT, CHECK_CONN, dbproc, tds_dblib_dbprocess::dbresults_state, FAIL, IS_TDSDEAD, NULL, SUCCEED, TDS_DBG_FUNC, TDS_FAILED, tds_process_tokens, TDS_RETURN_DONE, tds_dblib_dbprocess::tds_socket, TDS_STOPAT_ROWFMT, and tdsdump_log.

Referenced by dbuse(), and main().

◆ dbchange()

See if a command caused the current database to change.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server.
Returns
name of new database, if changed, as a null-terminated ASCII string, else NULL.
See also
dbname(), dbresults(), dbsqlexec(), dbsqlsend(), dbuse().

Definition at line 6909 of file dblib.c.

References CHECK_PARAMETER, tds_dblib_dbprocess::dbcurdb, dbproc, tds_dblib_dbprocess::envchange_rcv, NULL, SYBENULL, TDS_DBG_FUNC, TDS_ENV_DATABASE, and tdsdump_log.

◆ dbclose()

Close a connection to the server and free associated resources.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server.
See also
dbexit(), dbopen().

Definition at line 1492 of file dblib.c.

References _dbprdate(), tds_dblib_dbprocess::bcpinfo, NULLREP::bindval, buffer_free(), CHECK_PARAMETER, dbfreebuf(), dblib_del_connection(), dblib_mutex, dblib_release_tds_ctx(), DBNUMOPTIONS, tds_dblib_dbprocess::dboptcmd, tds_dblib_dbprocess::dbopts, dbproc, dbstring_free(), default_null_representations, BCP_HOSTFILEINFO::errorfile, free(), tds_dblib_dbprocess::ftos, g_dblib_ctx, BCP_HOSTFILEINFO::host_colcount, BCP_HOSTFILEINFO::host_columns, BCP_HOSTFILEINFO::hostfile, tds_dblib_dbprocess::hostfileinfo, i, MAXBINDTYPES, NULL, tds_dblib_dbprocess::nullreps, dboption::param, tds_dblib_dbprocess::row_buf, SYBENULL, tds, tds_close_socket, TDS_DBG_FUNC, tds_free_bcpinfo, tds_free_socket, tds_mutex_lock, tds_mutex_unlock, tds_dblib_dbprocess::tds_socket, tdsdump_log, and BCP_HOSTCOLINFO::terminator.

Referenced by dbexit(), main(), tdsdbopen(), and test().

◆ dbclrbuf()

Clear n rows from the row buffer.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. n number of rows to remove, >= 0.
See also
dbgetrow(), dbnextrow(), dbsetopt().

Definition at line 2855 of file dblib.c.

References buf, buffer_count(), buffer_delete_rows(), CHECK_PARAMETER, count, DBBUFFER, tds_dblib_dbprocess::dbopts, dbproc, dboption::factive, n, tds_dblib_dbprocess::row_buf, SYBENULL, TDS_DBG_FUNC, and tdsdump_log.

Referenced by main().

◆ dbclropt()

Reset an option.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. option to be turned off. param clearing some options requires a parameter, believe it or not.
Return values
SUCCEED option and parameter seem sane. FAIL no such option.
See also
dbisopt(), dbsetopt().

Definition at line 6008 of file dblib.c.

References asprintf, buffer_set_capacity(), CHECK_CONN, CHECK_NULP, cmd, DBARITHABORT, DBARITHIGNORE, DBBUFFER, DBCHAINXACTS, DBFIPSFLAG, DBISOLATION, dblib_mutex, DBNOCOUNT, DBNOEXEC, DBNUMOPTIONS, tds_dblib_dbprocess::dboptcmd, tds_dblib_dbprocess::dbopts, DBPARSEONLY, dbproc, DBQUOTEDIDENT, DBSETTIME, DBSHOWPLAN, DBSTORPROCID, dbstring_concat(), dboption::factive, FAIL, free(), g_dblib_ctx, option, tds_socket::query_timeout, dblib_context::query_timeout, SUCCEED, TDS_DBG_FUNC, tds_mutex_lock, tds_mutex_unlock, tds_dblib_dbprocess::tds_socket, tdsdump_log, and dboption::text.

Referenced by test().

◆ dbcmd()

Append SQL to the command buffer.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. cmdstring SQL to append to the command buffer.
Return values
SUCCEED success. FAIL insufficient memory.
See also
dbfcmd(), dbfreebuf(), dbgetchar(), dbopen(), dbstrcpy(), dbstrlen().

Definition at line 1377 of file dblib.c.

References tds_dblib_dbprocess::avail_flag, CHECK_CONN, CHECK_NULP, tds_dblib_dbprocess::command_state, tds_dblib_dbprocess::dbbuf, tds_dblib_dbprocess::dbbufsz, DBCMDPEND, DBCMDSENT, dbfreebuf(), dbperror(), dbproc, FAIL, FALSE, int, tds_dblib_dbprocess::noautofree, SUCCEED, SYBEMEM, TDS_DBG_FUNC, TDS_RESIZE, and tdsdump_log.

Referenced by char_test(), check_state(), dbfcmd(), dbuse(), main(), query(), sql_cmd(), test(), and test_row().

◆ dbcollen()

Get size of a regular result column.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. column Nth in the result set, starting from 1.
Returns
size of the column (not of data in any particular row). On error, -1.
See also
dbcolname(), dbcoltype(), dbdata(), dbdatlen(), dbnumcols().

Definition at line 3109 of file dblib.c.

References column, tds_column::column_size, dbcolptr(), dbproc, TDS_DBG_FUNC, and tdsdump_log.

Referenced by colwidth(), dbcolinfo(), dbpivot(), and main().

◆ dbcolname()

Return name of a regular result column.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. column Nth in the result set, starting with 1.
Returns
pointer to ASCII null-terminated string, the name of the column.
Return values
NULL column is not in range.
See also
dbcollen(), dbcoltype(), dbdata(), dbdatlen(), dbnumcols().
Parameters
dbproc contains all information needed by db-lib to manage communications with the server. column Nth in the result set, starting with 1.
Returns
pointer to ASCII null-terminated string, the name of the column.
Return values
NULL column is not in range.
See also
dbcollen(), dbcoltype(), dbdata(), dbdatlen(), dbnumcols().

Definition at line 1884 of file dblib.c.

References column, tds_column::column_name, dbcolptr(), dbproc, NULL, TDS_DBG_FUNC, tds_dstr_buf(), and tdsdump_log.

Referenced by dbcolinfo(), dbpivot(), main(), select_rows(), start_query(), and test().

◆ dbcolsource()

Get base database column name for a result set column.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. column Nth in the result set, starting from 1.
Returns
pointer to ASCII null-terminated string, the name of the column. On error, NULL.
See also
dbcolbrowse(), dbqual(), dbtabbrowse(), dbtabcount(), dbtabname(), dbtabsource(), dbtsnewlen(), dbtsnewval(), dbtsput().

Definition at line 3084 of file dblib.c.

References column, tds_column::column_name, dbcolptr(), dbproc, NULL, tds_column::table_column_name, TDS_DBG_FUNC, tds_dstr_buf(), tds_dstr_isempty(), and tdsdump_log.

◆ dbcoltype()

Get the datatype of a regular result set column.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. column Nth in the result set, starting from 1.
Returns
SYB* datetype token value, or zero if column out of range
See also
dbcollen(), dbcolname(), dbdata(), dbdatlen(), dbnumcols(), dbprtype(), dbvarylen().

Definition at line 2902 of file dblib.c.

References column, tds_column::column_size, tds_column::column_type, dbcolptr(), dbproc, SYBBINARY, SYBCHAR, SYBVARBINARY, SYBVARCHAR, TDS_DBG_FUNC, tds_get_conversion_type, and tdsdump_log.

Referenced by colwidth(), dbcolinfo(), dbpivot(), main(), and test().

◆ dbcoltypeinfo()

Get precision and scale information for a regular result column.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. column Nth in the result set, starting from 1.
Returns
Pointer to a DBTYPEINFO structure . NULL column is out of range.
See also
dbcollen(), dbcolname(), dbcoltype(), dbdata(), dbdatlen(), dbnumcols(), dbprtype(), dbvarylen().

Definition at line 2956 of file dblib.c.

References column, tds_column::column_prec, tds_column::column_scale, dbcolptr(), dbproc, NULL, dbtypeinfo::precision, dbtypeinfo::scale, TDS_DBG_FUNC, tdsdump_log, and tds_dblib_dbprocess::typeinfo.

Referenced by dbcolinfo().

◆ dbcolutype() ◆ dbconvert()

cf.

dbconvert_ps(), above

Sybase: Convert numeric types.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. srctype datatype of the data to convert. src buffer to convert srclen length of src desttype target datatype dest output buffer destlen size of dest typeinfo address of a DBTYPEINFO structure that governs the precision & scale of the output, may be NULL.
See also
dbaltbind(), dbaltbind_ps(), dbbind(), dbbind_ps(), dbconvert_ps(), dberrhandle(), dbsetnull(), dbsetversion(), dbwillconvert().

Definition at line 2604 of file dblib.c.

References dbconvert_ps(), DBPERROR_RETURN, dbproc, is_numeric_type, is_tds_type_valid(), tds_dblib_dbprocess::msdblib, NULL, DBNUMERIC::precision, dbtypeinfo::precision, DBNUMERIC::scale, dbtypeinfo::scale, SYBEUDTY, TDS_DBG_FUNC, and tdsdump_log.

Referenced by dbprrow(), dbspr1row(), dbwritetext(), main(), and test().

◆ dbconvert_ps()

Convert one datatype to another.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. srctype datatype of the data to convert. src buffer to convert srclen length of src desttype target datatype dest output buffer destlen size of dest
Returns
On success, the count of output bytes in dest, else -1. On failure, it will call any user-supplied error handler.

Conversion functions are handled in the TDS layer.

The main reason for this is that ct-lib and ODBC (and presumably DBI) need to be able to do conversions between datatypes. This is possible because the format of complex data (dates, money, numeric, decimal) is defined by its representation on the wire; thus what we call DBMONEY is exactly its format on the wire. CLIs that need a different representation (ODBC?) need to convert from this format anyway, so the code would already be in place.

Each datatype is also defined by its Server-type so all CLIs should be able to map native types to server types as well.

tds_convert() copies from src to dest and returns the output data length, period. All padding and termination is the responsibility of the API library and is done post-conversion. The peculiar rule in dbconvert() is that a destlen of -1 and a desttype of SYBCHAR means the output buffer should be null-terminated.

See also
dbaltbind(), dbaltbind_ps(), dbbind(), dbbind_ps(), dbconvert_ps(), dberrhandle(), dbsetnull(), dbsetversion(), dbwillconvert().
Parameters
dbproc contains all information needed by db-lib to manage communications with the server. srctype datatype of the data to convert. src buffer to convert srclen length of src desttype target datatype dest output buffer destlen size of dest
Returns
On success, the count of output bytes in dest, else -1. On failure, it will call any user-supplied error handler.

Conversion functions are handled in the TDS layer.

The main reason for this is that ct-lib and ODBC (and presumably DBI) need to be able to do conversions between datatypes. This is possible because the format of complex data (dates, money, numeric, decimal) is defined by its representation on the wire; thus what we call DBMONEY is exactly its format on the wire. CLIs that need a different representation (ODBC?) need to convert from this format anyway, so the code would already be in place.

Each datatype is also defined by its Server-type so all CLIs should be able to map native types to server types as well.

tds_convert() copies from src to dest and returns the output data length, period. All padding and termination is the responsibility of the API library and is done post-conversion. The peculiar rule in dbconvert() is that a destlen of -1 and a desttype of SYBCHAR means the output buffer should be null-terminated.

See also
dbaltbind(), dbaltbind_ps(), dbbind(), dbbind_ps(), dbconvert_ps(), dberrhandle(), dbsetnull(), dbsetversion(), dbwillconvert().

Definition at line 2303 of file dblib.c.

References _dblib_convert_err, assert, BINARYBIND, conv_result::c, CHARBIND, CHECK_PARAMETER, dbbindtype(), dbgetnull(), dbperror(), DBPERROR_RETURN, dbproc, free(), g_dblib_ctx, i, conv_result::ib, int, is_numeric_type, is_similar_type, is_tds_type_valid(), len, conv_result::n, NTBSTRINGBIND, NULL, tdsnumeric::precision, DBNUMERIC::precision, dbtypeinfo::precision, tdsnumeric::scale, DBNUMERIC::scale, dbtypeinfo::scale, ncbi::grid::netcache::search::fields::size, SYB5BIGDATETIME, SYB5BIGTIME, SYBBINARY, SYBBIT, SYBBITN, SYBCHAR, SYBDATE, SYBDATETIME, SYBDATETIME4, SYBDECIMAL, SYBEACNV, SYBECOFL, SYBEUDTY, 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_prdatatype(), tdsdump_log, and conv_result::ti.

Referenced by dbconvert(), and test().

◆ dbcount()

Get count of rows processed.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server.
Returns
See also
DBCOUNT(), dbnextrow(), dbresults().

Definition at line 2835 of file dblib.c.

References CHECK_PARAMETER, dbproc, tds_socket::rows_affected, SYBENULL, TDS_DBG_FUNC, TDS_NO_COUNT, tds_dblib_dbprocess::tds_socket, and tdsdump_log.

Referenced by check_state(), main(), and test().

◆ dbdata()

Get address of data in a regular result column.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. column Nth in the result set, starting from 1.
Returns
pointer the data, or NULL if data are NULL, or if column is out of range.
See also
dbbind(), dbcollen(), dbcolname(), dbcoltype(), dbdatlen(), dbnumcols().

Definition at line 3237 of file dblib.c.

References _dbcoldata(), column, dbcolptr(), dbproc, TDS_DBG_FUNC, and tdsdump_log.

Referenced by check_state(), dbprrow(), dbspr1row(), main(), and test0().

◆ dbdatecrack()

Break a DBDATETIME value into useful pieces.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. di output: structure to contain the exploded parts of datetime. datetime input: DBDATETIME to be converted.
Return values

If DBPROCESS is NULL, dbdatecrack() uses the compiled in default value of MSDBLIB as of when libsybdb was compiled, irrespective of its value when the application is compiled. This can lead to incorrect results because Sybase and Microsoft use different ranges – [0,11] vs. [1,12] – for the month.

See also
dbconvert(), dbdata(), dbdatechar(), dbdatename(), dbdatepart(), tdsdbopen().

Definition at line 5756 of file dblib.c.

References dblib_datecrack(), dbproc, FALSE, and SYBDATETIME.

Referenced by main().

◆ dbdatlen()

Get size of current row's data in a regular result column.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. column Nth in the result set, starting from 1.
Returns
size of the data, in bytes.
See also
dbcollen(), dbcolname(), dbcoltype(), dbdata(), dbnumcols().

Definition at line 3209 of file dblib.c.

References column, tds_column::column_cur_size, tds_column::column_type, dbcolptr(), dbproc, len, TDS_DBG_FUNC, and tdsdump_log.

Referenced by dbprrow(), dbspr1row(), main(), and test0().

◆ dberrhandle() ◆ dbexit()

Close server connections and free all related structures.

See also
dbclose(), dbinit(), dbopen().
See also
dbclose(), dbinit(), dbopen().

Definition at line 1559 of file dblib.c.

References dblib_context::connection_list, dblib_context::connection_list_size, count, dbclose(), dblib_mutex, dblib_release_tds_ctx(), dbproc, g_dblib_ctx, i, NULL, dblib_context::ref_count, tds, tds_close_socket, TDS_DBG_FUNC, tds_free_socket, tds_get_parent, tds_mutex_lock, tds_mutex_unlock, tds_dblib_dbprocess::tds_socket, TDS_ZERO_FREE, and tdsdump_log.

Referenced by doexit(), main(), and test().

◆ dbfcmd()

printf-like way to form SQL to send to the server.

Forms a command string and writes to the command buffer with dbcmd().

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. fmt man vasprintf for details.
Return values
SUCCEED success. FAIL insufficient memory, or dbcmd() failed.
See also
dbcmd(), dbfreebuf(), dbgetchar(), dbopen(), dbstrcpy(), dbstrlen().

Definition at line 1338 of file dblib.c.

References CHECK_CONN, CHECK_NULP, dbcmd(), dbperror(), dbproc, FAIL, free(), len, SYBEMEM, TDS_DBG_FUNC, tdsdump_log, and vasprintf.

Referenced by test(), and test0().

◆ dbfirstrow()

See if a server response has arrived.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. milliseconds how long to wait for the server before returning: ready_dbproc output: DBPROCESS for which a response arrived, of NULL. return_reason output:
Return values
SUCCEED everything worked. FAIL a server connection died.
See also
DBIORDESC(), DBRBUF(), dbresults(), dbreghandle(), dbsqlok().
Parameters
dbproc contains all information needed by db-lib to manage communications with the server. milliseconds how long to wait for the server before returning: ready_dbproc output: DBPROCESS for which a response arrived, of NULL. return_reason output:
Return values
SUCCEED everything worked. FAIL a server connection died.
See also
DBIORDESC(), DBRBUF(), dbresults(), dbreghandle(), dbsqlok().

Definition at line 7115 of file dblib.c.

References buffer_idx2row(), CHECK_CONN, dbproc, tds_dblib_dbprocess::row_buf, DBPROC_ROWBUF::tail, TDS_DBG_FUNC, and tdsdump_log.

◆ dbfreebuf()

Erase the command buffer, in case DBNOAUTOFREE was set with dbsetopt().

Parameters
dbproc contains all information needed by db-lib to manage communications with the server.
See also
dbcmd(), dbfcmd(), dbgetchar(), dbsqlexec(), dbsqlsend(), dbsetopt(), dbstrcpy(), dbstrlen().

Definition at line 5973 of file dblib.c.

References CHECK_PARAMETER, tds_dblib_dbprocess::dbbuf, tds_dblib_dbprocess::dbbufsz, dbproc, SYBENULL, TDS_DBG_FUNC, TDS_ZERO_FREE, and tdsdump_log.

Referenced by dbclose(), and dbcmd().

◆ dbgetchar()

Get address of a position in the command buffer.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. pos offset within the command buffer, starting at 0.
See also
dbcmd(), dbfcmd(), dbfreebuf(), dbstrcpy(), dbstrlen(),

Definition at line 6225 of file dblib.c.

References CHECK_PARAMETER, tds_dblib_dbprocess::dbbuf, tds_dblib_dbprocess::dbbufsz, dbproc, NULL, SYBENULL, TDS_DBG_FUNC, and tdsdump_log.

Referenced by main().

◆ dbgetmaxprocs() int dbgetmaxprocs ( void  ) ◆ dbgetpacket()

Get TDS packet size for the connection.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server.
Returns
TDS packet size, in bytes.
See also
DBSETLPACKET()

Definition at line 3970 of file dblib.c.

References tds_env::block_size, CHECK_PARAMETER, tds_socket::conn, dbproc, tds_connection::env, SYBENULL, tds, TDS_DBG_FUNC, TDS_DEF_BLKSZ, tds_dblib_dbprocess::tds_socket, and tdsdump_log.

◆ dbgetrow()

Read a row from the row buffer.

When row buffering is enabled (DBBUFFER option is on), the client can use dbgetrow() to re-read a row previously fetched with dbnextrow(). The effect is to move the row pointer – analogous to fseek() – back to row. Calls to dbnextrow() read from row + 1 until the buffer is exhausted, at which point it resumes its normal behavior, except that as each row is fetched from the server, it is added to the row buffer (in addition to being returned to the client). When the buffer is filled, dbnextrow() returns FAIL until the buffer is at least partially emptied with dbclrbuf().

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. row Nth row to read, starting with 1.
Return values
REG_ROW returned row is a regular row.
Returns
computeid when returned row is a compute row.
Return values
NO_MORE_ROWS no such row in the row buffer. Current row is unchanged. FAIL unsuccessful; row buffer may be full.
See also
dbaltbind(), dbbind(), dbclrbuf(), DBCURROW(), DBFIRSTROW(), DBLASTROW(), dbnextrow(), dbsetrow().

Definition at line 1932 of file dblib.c.

References buffer_row2idx(), buffer_transfer_bound_data(), CHECK_CONN, DBPROC_ROWBUF::current, dbproc, FAIL, NO_MORE_ROWS, REG_ROW, result, row, tds_dblib_dbprocess::row_buf, TDS_DBG_FUNC, TDS_ROW_RESULT, and tdsdump_log.

Referenced by main().

◆ dbgettime() ◆ dbgetuserdata() ◆ dbinit()

Initialize db-lib.

Return values
SUCCEED normal. FAIL cannot allocate an array of TDS_MAX_CONN TDSSOCKET pointers.

Definition at line 674 of file dblib.c.

References _dblib_err_handler, dblib_context::connection_list, dblib_context::connection_list_size, dblib_context::connection_list_size_represented, dblib_get_tds_ctx(), dblib_mutex, default_err_handler(), FAIL, g_dblib_ctx, dblib_context::login_timeout, NULL, dblib_context::query_timeout, dblib_context::ref_count, SUCCEED, TDS_DBG_FUNC, TDS_MAX_CONN, tds_mutex_lock, tds_mutex_unlock, tds_new0, and tdsdump_log.

Referenced by main(), and test().

◆ dbiscount() ◆ dbisopt()

Get value of an option.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. option the option param a parameter to option.
See also
dbclropt(), dbsetopt().

Definition at line 6076 of file dblib.c.

References CHECK_PARAMETER, DBNUMOPTIONS, tds_dblib_dbprocess::dbopts, dbproc, dboption::factive, FALSE, option, SYBENULL, TDS_DBG_FUNC, and tdsdump_log.

Referenced by dbsettime(), main(), and test().

◆ dblogin()

Allocate a LOGINREC structure.

Return values
NULL the LOGINREC cannot be allocated. LOGINREC* to valid memory, otherwise.

Definition at line 719 of file dblib.c.

References dbperror(), free(), NULL, SYBEMEM, tds_alloc_login, TDS_DBG_FUNC, tds_dblib_loginrec::tds_login, tds_new, tds_set_library, and tdsdump_log.

Referenced by main(), and test().

◆ dbloginfree() ◆ dbmorecmds()

See if more commands are to be processed.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server.
See also
DBMORECMDS(). DBCMDROW(), dbresults(), DBROWS(), DBROWTYPE().

Definition at line 6150 of file dblib.c.

References assert, CHECK_CONN, dbproc, FAIL, tds_result_info::more_results, NULL, tds_socket::res_info, SUCCEED, TDS_DBG_FUNC, tds_dblib_dbprocess::tds_socket, and tdsdump_log.

Referenced by main().

◆ dbmoretext()

Send chunk of a text/image value to the server.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. size count of bytes to send. text textpointer, obtained from dbtxptr.
Return values
See also
dbtxptr(), dbtxtimestamp(), dbwritetext().
Parameters
dbproc contains all information needed by db-lib to manage communications with the server. size count of bytes to send. text textpointer, obtained from dbtxptr.
Return values
See also
dbtxptr(), dbtxtimestamp(), dbwritetext().

Definition at line 6654 of file dblib.c.

References assert, CHECK_CONN, CHECK_NULP, dbproc, FAIL, ncbi::grid::netcache::search::fields::size, SUCCEED, TDS_DBG_FUNC, TDS_FAILED, tds_dblib_dbprocess::tds_socket, tds_writetext_continue, tds_writetext_end, tdsdump_log, text(), tds_dblib_dbprocess::text_sent, and tds_dblib_dbprocess::text_size.

Referenced by test().

◆ dbmsghandle() ◆ dbname()

Get name of current database.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server.
Returns
current database name, as null-terminated ASCII string.
See also
dbchange(), dbuse().

Definition at line 6929 of file dblib.c.

References CHECK_PARAMETER, tds_dblib_dbprocess::dbcurdb, dbproc, NULL, SYBENULL, TDS_DBG_FUNC, and tdsdump_log.

Referenced by CWriteDB_Column::AddByteOrder(), CCreateProteinId::apply(), CCreateLocusTagGene::apply(), BlastFilteringOptionsFromString(), BOOST_AUTO_TEST_CASE(), CAlignFormatUtil::BuildUserUrl(), CAutoRegistrar::CAutoRegistrar(), CBlastKmer::CBlastKmer(), TestUtil::CBlastOM::CBlastOM(), CBuildDatabase::CBuildDatabase(), check_dbname(), CEntrezSearchForm::ConstructQuery(), CPepXML::ConvertFromOMSSA(), CSrcTableColumnBaseFactory::Create(), CCreateProteinId::create_protein_ids(), CBlastDb_DataLoaderCF::CreateAndRegister(), CRmtBlastDb_DataLoaderCF::CreateAndRegister(), CBuildDatabase::CreateDirectories(), CSQLITE_Connection::CreateInMemoryDatabase(), SGeneCdsmRnaFeats::CrossLinkTriple(), CSeqDB::CSeqDB(), CSeqDBGiIndex::CSeqDBGiIndex(), CSeqDBIdxFile::CSeqDBIdxFile(), CSeqDBIsam::CSeqDBIsam(), CSeqDbSeqInfoSrc::CSeqDbSeqInfoSrc(), CTaxonomy4BlastSQLite::CTaxonomy4BlastSQLite(), CWriteDB::CWriteDB(), CWriteDB_Column::CWriteDB_Column(), CWriteDB_Isam::CWriteDB_Isam(), CWriteDB_Volume::CWriteDB_Volume(), CAliasTest::DoTest(), FindBlastDbPath(), CSeqDBAliasSets::FindBlastDBPath(), CVDBAliasUtil::FindVDBPaths(), CSeqDBImpl::FindVolumePaths(), CSeqDB::FindVolumePaths(), CFlatSubmitterSeqidQVal::Format(), fta_create_wgs_dbtag(), CBlastServices::GetDatabaseInfo(), CBlastServices::GetDatabaseInfoLegacy(), CSeqDB::GetDate(), CSeqDBLMDB::GetDBTaxIds(), CSeqDB::GetDiskUsage(), CBlastDbDataLoader::GetLoaderNameFromArgs(), CSeqDBLMDB::GetOid(), CSeqDBLMDB::GetOids(), CSeqDBLMDB::GetOidsForTaxIds(), CSeqDBIsam::IndexExists(), CBlastServices::IsValidBlastDb(), CProfileData::Load(), CAlnMrgApp::LoadBlastDb(), MakeStrDbtag(), CIgBlastTabularInfo::PrintHeader(), CBlastTabularInfo::PrintHeader(), CBlastDbDataLoader::RegisterInObjectManager(), CRemoteBlastDbDataLoader::RegisterInObjectManager(), CMultiApplication::Run(), COcbdDemoApp::Run(), CCtlLibDemoAPp::RunSample(), s_checkDbSeqSrcFunctions(), s_ComputeNumSequencesAndDbLength(), SGeneCdsmRnaFeats::s_CreateDBXref(), s_DoesBlastDbExist(), s_FillDbInfoLocally(), s_ImportDatabase(), s_ParseRepeatOptions(), s_ParseWindowMaskerOptions(), s_PrintAliasFileCreationLog(), s_RetrieveSequenceLength(), s_SeqDB_DBExists(), s_SeqDB_FindBlastDBPath(), s_SeqDB_TryPaths(), s_SeqDBInit(), s_TestReadPDBAsn1(), SDataLoaderConfig::SDataLoaderConfig(), SeqDB_CombineAndQuote(), SeqDB_FindBlastDBPath(), SeqDB_SplitQuoted(), SeqDbBlastSeqSrcInit(), set_dbname(), CApplyStructCommentTreeItemData::SetData(), CSearchDatabase::SetDatabaseName(), CSeqDBDemo_Threaded::SetDbName(), CMultiAlignerOptions::SetRpsDb(), CSequenceIStreamBlastDB::ShowSupportedFilters(), CId1FetchApp::WriteHistoryTable(), CMakeBlastDBApp::x_BuildDatabase(), CSeqDBAliasSets::x_FindBlastDBPath(), CBlastTracebackSearch::x_Init(), SDataLoaderConfig::x_Init(), TestUtil::CBlastOM::x_InitBlastDatabaseDataLoader(), CBlastScopeSource::x_InitBlastDatabaseDataLoader(), CSeqDBIsam::x_MakeFilenames(), CBlastTabularInfo::x_PrintQueryAndDbNames(), CBlastFormat::x_PrintTabularReport(), CBlastKmer::x_SearchMultipleQueries(), BlastdbCopyApplication::x_ShouldCopyPIGs(), and BlastdbCopyApplication::x_ShouldParseSeqIds().

◆ dbnullbind()

Tie a null-indicator to a regular result column.

When a row is fetched, the indicator variable tells the state of the column's data.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. column Nth column in the result set, starting with 1. indicator address of host variable.
Return values
SUCCEED variable accepted. FAIL indicator is NULL or column is out of range.
See also
dbanullbind(), dbbind(), dbdata(), dbdatlen(), dbnextrow().

Definition at line 2751 of file dblib.c.

References column, tds_column::column_nullbind, dbcolptr(), dbproc, FAIL, SUCCEED, TDS_DBG_FUNC, and tdsdump_log.

Referenced by dbpivot(), and test0().

◆ dbnumalts()

Get count of columns in a compute row.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. computeid of COMPUTE clause to which we're referring.
Returns
number of columns, else -1 if no such computeid.
See also
dbadata(), dbadlen(), dbaltlen(), dbalttype(), dbgetrow(), dbnextrow(), dbnumcols().

Definition at line 4849 of file dblib.c.

References CHECK_PARAMETER, tds_socket::comp_info, dbproc, i, info, tds_socket::num_comp_info, SYBENULL, tds, TDS_DBG_FUNC, tds_dblib_dbprocess::tds_socket, and tdsdump_log.

Referenced by dbprrow(), and main().

◆ dbnumcols()

Return number of regular columns in a result set.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server.
See also
dbcollen(), dbcolname(), dbnumalts().

Definition at line 1860 of file dblib.c.

References CHECK_PARAMETER, dbproc, tds_result_info::num_cols, tds_socket::res_info, SYBENULL, TDS_DBG_FUNC, tds_dblib_dbprocess::tds_socket, and tdsdump_log.

Referenced by check_state(), main(), select_rows(), start_query(), test(), and test_file().

◆ dbnumcompute() ◆ dbprcollen()

Get size of a result column needed to print column.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. column Nth in the result set, starting from 1.
Returns
size of the column in characters (not of data in any particular row). On error, -1.
See also
dbcolname(), dbcoltype(), dbdata(), dbdatlen(), dbnumcols().

Definition at line 3132 of file dblib.c.

References _get_printable_size(), column, dbcolptr(), dbproc, TDS_DBG_FUNC, and tdsdump_log.

◆ dbprhead()

Print result set headings to stdout.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server.
See also

Definition at line 3854 of file dblib.c.

References _get_printable_size(), CHECK_PARAMETER, tds_column::column_name, tds_result_info::columns, tds_dblib_dbprocess::dbopts, DBPRCOLSEP, DBPRLINESEP, dbproc, DBPRPAD, dbstring_getchar(), i, len, NULL, tds_result_info::num_cols, dboption::param, tds_socket::res_info, SYBENULL, tds, TDS_DBG_FUNC, tds_dstr_cstr(), tds_dstr_len(), tds_dblib_dbprocess::tds_socket, and tdsdump_log.

Referenced by init(), and main().

◆ dbprrow()

Print a result set to stdout.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server.
See also
dbbind(), dbnextrow(), dbprhead(), dbresults(), dbspr1row(), dbsprhead(), dbsprline().

Definition at line 3425 of file dblib.c.

References _get_printable_size(), tds_result_info::by_cols, CHECK_CONN, tds_column::column_cur_size, tds_column::column_name, tds_column::column_size, tds_column::column_type, tds_result_info::columns, tds_socket::comp_info, tds_result_info::computeid, dbadata(), dbaltcolid(), dbaltop(), dbalttype(), dbconvert(), dbdata(), dbdatlen(), dblib_bound_type(), dbnextrow(), dbnumalts(), tds_dblib_dbprocess::dbopts, dbperror(), DBPRCOLSEP, DBPRLINESEP, dbproc, DBPRPAD, dbprtype(), dbstring_getchar(), FAIL, free(), i, int, is_datetime_type, len, NO_MORE_ROWS, NULL, tds_result_info::num_cols, tds_socket::num_comp_info, dboption::param, REG_ROW, tds_socket::res_info, pivot_t::status, STD_DATETIME_FMT, STRINGBIND, SUCCEED, SYBEMEM, tds, tds_datecrack, TDS_DBG_FUNC, tds_dstr_len(), tds_get_conversion_type, tds_new0, tds_dblib_dbprocess::tds_socket, tds_strftime, and tdsdump_log.

Referenced by init(), and main().

◆ dbprtype() ◆ dbreadtext()

Fetch part of a text or image value from the server.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. buf output: buffer into which text will be placed. bufsize size of buf, in bytes.
Returns
See also
dbmoretext(), dbnextrow(), dbwritetext().

Definition at line 6585 of file dblib.c.

References buf, buffer_save_row(), bufsize, CHECK_NULP, CHECK_PARAMETER, tds_column::column_cur_size, tds_column::column_data, tds_column::column_textpos, tds_result_info::columns, dbproc, mask, NO_MORE_ROWS, NULL, tds_socket::res_info, SYBENULL, tds, TDS_COMPUTE_RESULT, TDS_DBG_FUNC, TDS_NO_MORE_RESULTS, tds_process_tokens, TDS_RETURN_COMPUTE, TDS_RETURN_ROW, TDS_ROW_RESULT, tds_dblib_dbprocess::tds_socket, TDS_STOPAT_DONE, TDS_STOPAT_ROWFMT, TDS_SUCCESS, and tdsdump_log.

Referenced by test().

◆ dbrecftos() void dbrecftos ( const char  filename[] )

Record to a file all SQL commands sent to the server.

Parameters
filename name of file to write to.
See also
dbopen(), TDSDUMP environment variable().

Definition at line 6689 of file dblib.c.

References dblib_mutex, dbperror(), f, free(), g_dblib_ctx, NULL, dblib_context::recftos_filename, dblib_context::recftos_filenum, strdup, SYBEMEM, SYBENULP, TDS_DBG_FUNC, tds_mutex_lock, tds_mutex_unlock, and tdsdump_log.

Referenced by read_login_info().

◆ dbresults()

Set up query results.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server.
Return values
SUCCEED Some results are available. FAIL query was not processed successfully by the server NO_MORE_RESULTS query produced no results.

The meaning of results is very specific and not very intuitive. Results are created by either

If none of the above are present, dbresults() returns NO_MORE_RESULTS.

SUCCEED does not imply that DBROWS() will return TRUE or even that dbnumcols() will return nonzero. A general algorithm for reading results will call dbresults() until it return NO_MORE_RESULTS (or FAIL). An application should check for all the above kinds of results within the dbresults() loop.

See also
dbsqlexec(), dbsqlok(), dbrpcsend(), dbcancel(), DBROWS(), dbnextrow(), dbnumcols(), dbhasretstat(), dbretstatus(), dbnumrets()

Definition at line 1706 of file dblib.c.

References _dbresults(), buf, dbproc, prdbretcode(), TDS_DBG_FUNC, and tdsdump_log.

Referenced by char_test(), create_tables(), dbuse(), dbwritetext(), do_test(), drop_table(), init(), init_proc(), insert_row(), main(), query(), select_rows(), start_query(), test(), test0(), test_file(), and test_row().

◆ dbsafestr()

safely quotes character values in SQL text.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. src input string. srclen length of src in bytes, or -1 to indicate it's null-terminated. dest output: client-provided output buffer. destlen size of dest in bytes, or -1 to indicate it's "big enough" and the data should be null-terminated. quotetype
Return values
SUCCEED everything worked. FAIL no such quotetype, or insufficient room in dest.
See also
dbcmd(), dbfcmd().

Definition at line 6302 of file dblib.c.

References CHECK_NULP, DBBOTH, DBDOUBLE, dbproc, DBSINGLE, FAIL, FALSE, i, int, SUCCEED, TDS_DBG_FUNC, tdsdump_log, and TRUE.

Referenced by main().

◆ dbservcharset() ◆ dbsetifile() void dbsetifile ( char *  filename ) ◆ dbsetinterrupt()

Set interrupt handler for db-lib to use while blocked against a read from the server.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. chkintr hndlintr
See also
dbcancel(), dbgetuserdata(), dbsetuserdata(), dbsetbusy(), dbsetidle().

Definition at line 4539 of file dblib.c.

References CHECK_PARAMETER, tds_dblib_dbprocess::chkintr, chkintr(), dbproc, tds_dblib_dbprocess::hndlintr, hndlintr(), SYBENULL, TDS_DBG_FUNC, and tdsdump_log.

◆ dbsetlogintime() ◆ dbsetlversion()

Set TDS version for future connections.

Definition at line 945 of file dblib.c.

References assert, dbperror(), DBVER42, DBVER60, DBVERSION_100, DBVERSION_71, DBVERSION_72, DBVERSION_73, DBVERSION_74, FAIL, login, NULL, SUCCEED, SYBEASNL, TDS_DBG_FUNC, tds_set_version, tds_login::tds_version, tdsdump_log, and dtl::version.

◆ dbsetmaxprocs()

Set maximum simultaneous connections db-lib will open to the server.

Parameters
maxprocs Limit for process.
Return values
See also
dbgetmaxprocs(), dbopen()

Definition at line 3994 of file dblib.c.

References assert, dblib_context::connection_list, dblib_context::connection_list_size, dblib_context::connection_list_size_represented, dblib_mutex, dbperror(), FAIL, g_dblib_ctx, i, NULL, SUCCEED, SYBEMEM, TDS_DBG_FUNC, tds_mutex_lock, tds_mutex_unlock, tds_new0, and tdsdump_log.

Referenced by test().

◆ dbsetnull()

Define substitution values to be used when binding null values.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. bindtype type of binding to which the substitute value will apply. bindlen size of the substitute value you are supplying, in bytes. Ignored except for CHARBIND and BINARYBIND. bindval pointer to a buffer containing the substitute value.
Return values
SUCCEED query was processed without errors. FAIL query was not processed
See also
dbaltbind(), dbbind(), dbconvert(), dbnullbind().

Definition at line 1964 of file dblib.c.

References BIGDATETIMEBIND, BIGINTBIND, BIGTIMEBIND, BINARYBIND, NULLREP::bindval, CHARBIND, CHECK_CONN, CHECK_PARAMETER, DATEBIND, DATETIMEBIND, dbperror(), dbproc, DECIMALBIND, default_null_representations, FAIL, FLT8BIND, free(), int, INTBIND, NULLREP::len, len, MONEYBIND, NTBSTRINGBIND, NULL, tds_dblib_dbprocess::nullreps, NUMERICBIND, REALBIND, SMALLBIND, SMALLDATETIMEBIND, SMALLMONEYBIND, SRCDECIMALBIND, SRCNUMERICBIND, STRINGBIND, SUCCEED, SYBEBBL, SYBEBTYP, SYBEMEM, SYBENBVP, TDS_DBG_FUNC, TDS_DBG_NETWORK, tds_new, tdsdump_dump_buf, tdsdump_log, TIMEBIND, TINYBIND, VARYBINBIND, and VARYCHARBIND.

Referenced by char_test(), and main().

◆ dbsetopt()

Set db-lib or server option.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. option option to set. char_param value to set option to, if it wants a null-teminated ASCII string. int_param value to set option to, if it wants an integer value.
Return values
SUCCEED everything worked. FAIL no such option, or insufficient memory, or unimplemented.
See also
dbclropt(), dbisopt().
Parameters
dbproc contains all information needed by db-lib to manage communications with the server. option option to set. char_param value to set option to, if it wants a null-teminated ASCII string. int_param value to set option to, if it wants an integer value.
Return values
SUCCEED everything worked. FAIL no such option, or insufficient memory, or unimplemented.
See also
dbclropt(), dbisopt().

Definition at line 4383 of file dblib.c.

References asprintf, buffer_set_capacity(), CHECK_CONN, CHECK_NULP, cmd, DBARITHABORT, DBARITHIGNORE, DBAUTH, DBBUFFER, DBCHAINXACTS, DBDATEFIRST, DBDATEFORMAT, DBFIPSFLAG, DBISOLATION, DBNATLANG, DBNOAUTOFREE, DBNOCOUNT, DBNOEXEC, DBNUMOPTIONS, DBOFFSET, tds_dblib_dbprocess::dboptcmd, tds_dblib_dbprocess::dbopts, DBPARSEONLY, dbperror(), DBPRCOLSEP, DBPRLINELEN, DBPRLINESEP, dbproc, DBPRPAD, DBQUOTEDIDENT, DBROWCOUNT, DBSETTIME, DBSHOWPLAN, DBSTAT, DBSTORPROCID, dbstring_assign(), dbstring_concat(), DBTEXTLIMIT, DBTEXTSIZE, dboption::factive, FAIL, free(), i, NULL, option, dboption::param, tds_socket::query_timeout, SUCCEED, SYBEUNOP, TDS_DBG_FUNC, tds_dblib_dbprocess::tds_socket, tdsdump_log, and dboption::text.

Referenced by main(), and test().

◆ dbsetrow()

Make a buffered row "current" without fetching it into bound variables.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server.
Return values
MORE_ROWS row found NO_MORE_ROWS row not found FAIL dbproc is dead or not enabled
See also
dbaltbind(), dbbind(), dbcanquery(), dbclrbuf(), dbgetrow(), dbnextrow(), dbprrow().

Definition at line 2047 of file dblib.c.

References buffer_row2idx(), CHECK_CONN, DBPROC_ROWBUF::current, dbproc, FAIL, NO_MORE_ROWS, REG_ROW, row, tds_dblib_dbprocess::row_buf, TDS_DBG_FUNC, and tdsdump_log.

◆ dbsettime()

Set maximum seconds db-lib waits for a server response to query.

Parameters
seconds New limit for application.
Return values
See also
dberrhandle(), DBGETTIME(), dbsetlogintime(), dbsqlexec(), dbsqlok(), dbsqlsend().

Definition at line 4090 of file dblib.c.

References dblib_context::connection_list, dbisopt(), dblib_mutex, dbproc, DBSETTIME, g_dblib_ctx, i, dblib_context::query_timeout, SUCCEED, tds, TDS_DBG_FUNC, tds_get_parent, TDS_MAX_CONN, tds_mutex_lock, tds_mutex_unlock, and tdsdump_log.

Referenced by test(), and timeout_err_handler().

◆ dbsetuserdata() ◆ dbsetversion()

Specify a db-lib version level.

Parameters
version Any DBVERSION_* constant.
Return values
SUCCEED if version was valid, FAIL otherwise.
See also
Parameters
version anything, really.
Return values
See also

Definition at line 5885 of file dblib.c.

References dbperror(), DBVERSION_100, DBVERSION_42, DBVERSION_46, DBVERSION_70, DBVERSION_71, DBVERSION_72, DBVERSION_73, DBVERSION_74, FAIL, g_dblib_version, g_dbsetversion_called, NULL, SUCCEED, SYBEIVERS, TDS_DBG_FUNC, tdsdump_log, and dtl::version.

Referenced by main().

◆ dbspid() ◆ dbspr1row()

Print a regular result row to a buffer.

Fills a buffer with one data row, represented as a null-terminated ASCII string. Helpful for debugging.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. buffer output: Address of a buffer to hold ASCII null-terminated string. buf_len size of buffer, in bytes.
Return values
SUCCEED on success. FAIL trouble encountered.
See also
dbclropt(), dbisopt(), dbprhead(), dbprrow(), dbspr1rowlen(), dbsprhead(), dbsprline().

Definition at line 3342 of file dblib.c.

References _get_printable_size(), buffer, CHECK_CONN, CHECK_NULP, tds_column::column_cur_size, tds_column::column_name, tds_column::column_size, tds_column::column_type, tds_result_info::columns, dbconvert(), dbdata(), dbdatlen(), dblib_bound_type(), tds_dblib_dbprocess::dbopts, DBPRCOLSEP, dbproc, DBPRPAD, dbstring_getchar(), FAIL, i, int, is_datetime_type, len, tds_result_info::num_cols, dboption::param, tds_socket::res_info, STD_DATETIME_FMT, STRINGBIND, SUCCEED, tds, tds_datecrack, TDS_DBG_FUNC, tds_dstr_len(), tds_get_conversion_type, tds_dblib_dbprocess::tds_socket, tds_strftime, and tdsdump_log.

◆ dbspr1rowlen()

Determine size buffer required to hold the results returned by dbsprhead(), dbsprline(), and dbspr1row().

Parameters
dbproc contains all information needed by db-lib to manage communications with the server.
Returns
size of buffer requirement, in bytes.
See also
dbprhead(), dbprrow(), dbspr1row(), dbsprhead(), dbsprline().

Definition at line 3304 of file dblib.c.

References _get_printable_size(), CHECK_PARAMETER, tds_column::column_name, tds_result_info::columns, tds_dblib_dbprocess::dbopts, DBPRCOLSEP, dbproc, dbstring_length(), int, len, tds_result_info::num_cols, dboption::param, tds_socket::res_info, SYBEDDNE, SYBENULL, tds, TDS_DBG_FUNC, tds_dstr_len(), tds_dblib_dbprocess::tds_socket, and tdsdump_log.

◆ dbsprhead()

Print result set headings to a buffer.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. buffer output buffer buf_len size of buffer
Return values
SUCCEED buffer filled. FAIL insufficient spaace in buffer, usually.
See also
dbprhead(), dbprrow(), dbsetopt(), dbspr1row(), dbspr1rowlen(), dbsprline().
Parameters
dbproc contains all information needed by db-lib to manage communications with the server. buffer output buffer buf_len size of buffer
Return values
SUCCEED buffer filled. FAIL insufficient space in buffer, usually.
See also
dbprhead(), dbprrow(), dbsetopt(), dbspr1row(), dbspr1rowlen(), dbsprline().

Definition at line 3789 of file dblib.c.

References _get_printable_size(), buffer, CHECK_CONN, CHECK_NULP, tds_column::column_name, tds_result_info::columns, tds_dblib_dbprocess::dbopts, DBPRCOLSEP, dbproc, DBPRPAD, dbstring_getchar(), FAIL, i, int, tds_result_info::num_cols, dboption::param, tds_socket::res_info, SUCCEED, tds, TDS_DBG_FUNC, tds_dstr_cstr(), tds_dstr_len(), tds_dblib_dbprocess::tds_socket, and tdsdump_log.

◆ dbsprline()

Get formatted string for underlining dbsprhead() column names.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. buffer output buffer buf_len size of buffer line_char character to use to represent underlining.
Return values
SUCCEED buffer filled. FAIL insufficient space in buffer, usually.
See also
dbprhead(), dbprrow(), dbspr1row(), dbspr1rowlen(), dbsprhead().

Definition at line 3731 of file dblib.c.

References _get_printable_size(), buffer, CHECK_CONN, CHECK_NULP, tds_column::column_name, tds_result_info::columns, tds_dblib_dbprocess::dbopts, DBPRCOLSEP, dbproc, dbstring_getchar(), FAIL, i, len, tds_result_info::num_cols, dboption::param, tds_socket::res_info, SUCCEED, tds, TDS_DBG_FUNC, tds_dstr_len(), tds_dblib_dbprocess::tds_socket, and tdsdump_log.

◆ dbsqlexec()

send the SQL command to the server and wait for an answer.

Please be patient. This function waits for the server to respond. dbsqlexec is equivalent to dbsqlsend() followed by dbsqlok().

Parameters
dbproc contains all information needed by db-lib to manage communications with the server.
Return values
See also
dbcmd(), dbfcmd(), dbnextrow(), dbresults(), dbretstatus(), dbsettime(), dbsqlok(), dbsqlsend()

Definition at line 1423 of file dblib.c.

References CHECK_CONN, dbproc, dbsqlok(), dbsqlsend(), FAIL, SUCCEED, TDS_DBG_FUNC, and tdsdump_log.

Referenced by char_test(), check_state(), create_tables(), dbuse(), do_test(), drop_table(), init(), init_proc(), insert_row(), main(), query(), select_rows(), start_query(), test(), test0(), test_file(), and test_row().

◆ dbsqlok()

Wait for results of a query from the server.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server.
Return values
SUCCEED everything worked, fetch results with dbnextresults(). FAIL SQL syntax error, typically.
See also
dbcmd(), dbfcmd(), DBIORDESC(), DBIOWDESC(), dbmoretext(), dbnextrow(), dbpoll(), DBRBUF(), dbresults(), dbretstatus(), dbrpcsend(), dbsettime(), dbsqlexec(), dbsqlsend(), dbwritetext().

Definition at line 4722 of file dblib.c.

References _DB_RES_NEXT_RESULT, _DB_RES_NO_MORE_RESULTS, _DB_RES_RESULTSET_EMPTY, _DB_RES_SUCCEED, assert, buffer_alloc(), buffer_free(), CHECK_CONN, dbproc, tds_dblib_dbprocess::dbresults_state, FAIL, prdbresults_state(), prdbretcode(), tds_dblib_dbprocess::row_buf, SUCCEED, tds, TDS_COMPUTE_RESULT, TDS_COMPUTEFMT_RESULT, TDS_DBG_FUNC, TDS_DONE_ERROR, TDS_DONE_MORE_RESULTS, TDS_DONE_RESULT, TDS_DONEINPROC_RESULT, TDS_DONEPROC_RESULT, TDS_FAILED, tds_flush_packet, TDS_NO_MORE_RESULTS, tds_process_tokens, TDS_ROW_RESULT, TDS_ROWFMT_RESULT, tds_dblib_dbprocess::tds_socket, TDS_SUCCESS, TDS_TOKEN_RESULTS, tdsdump_log, and tds_dblib_dbprocess::text_sent.

Referenced by dbsqlexec(), dbwritetext(), main(), and test().

◆ dbsqlsend()

Transmit the command buffer to the server.

Non-blocking, does not wait for a response.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server.
Return values
SUCCEED SQL sent. FAIL protocol problem, unless dbsqlsend() when it's not supposed to be (in which case a db-lib error message will be emitted).
See also
dbcmd(), dbfcmd(), DBIORDESC(), DBIOWDESC(), dbnextrow(), dbpoll(), dbresults(), dbsettime(), dbsqlexec(), dbsqlok().

Definition at line 6965 of file dblib.c.

References _DB_RES_INIT, _dbprdate(), tds_dblib_dbprocess::avail_flag, CHECK_CONN, tds_dblib_dbprocess::command_state, tds_dblib_dbprocess::dbbuf, DBCMDSENT, tds_dblib_dbprocess::dboptcmd, dbperror(), dbproc, tds_dblib_dbprocess::dbresults_state, dbstring_free(), dbstring_get(), tds_dblib_dbprocess::envchange_rcv, FAIL, FALSE, free(), tds_dblib_dbprocess::ftos, tds_dblib_dbprocess::more_results, NULL, tds_socket::state, SUCCEED, SYBEASEC, SYBERPND, tds, TDS_DBG_FUNC, TDS_FAILED, TDS_NO_MORE_RESULTS, TDS_PENDING, tds_process_tokens, tds_dblib_dbprocess::tds_socket, tds_submit_query, TDS_SUCCESS, TDS_TOKEN_RESULTS, TDS_TOKEN_TRAILING, tdsdump_log, and TRUE.

Referenced by dbsqlexec(), and test().

◆ dbstrbuild() RETCODE dbstrbuild ( DBPROCESSdbproc, char *  charbuf, int  bufsize, char *  text, char *  formats,   ...  )

Build a printable string from text containing placeholders for variables.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. charbuf output: buffer that will contain the ASCII null-terminated string built by dbstrbuild(). bufsize size of charbuf, in bytes. text null-terminated ASCII string, with placeholders for variables. A Placeholder is a three-byte string, made up of: formats null-terminated ASCII sprintf-style string. Has one format specifier for each placeholder in text.
See also
dbconvert(), dbdatename(), dbdatepart().

Definition at line 7223 of file dblib.c.

References bufsize, CHECK_NULP, dbproc, FAIL, SUCCEED, TDS_DBG_FUNC, TDS_NULLTERM, TDS_SUCCEED, tds_vstrbuild, tdsdump_log, and text().

◆ dbstrcpy()

Get a copy of a chunk of the command buffer.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. start position in the command buffer to start copying from, starting from 0. If start is past the end of the command buffer, dbstrcpy() inserts a null terminator at dest[0]. numbytes number of bytes to copy. dest output: the buffer to write to. Make sure it's big enough.
Return values
SUCCEED the inputs were valid and dest was affected. FAIL start < 0 or numbytes < -1.
See also
dbcmd(), dbfcmd(), dbfreebuf(), dbgetchar(), dbstrlen().

Definition at line 6258 of file dblib.c.

References CHECK_CONN, CHECK_NULP, tds_dblib_dbprocess::dbbuf, tds_dblib_dbprocess::dbbufsz, dbperror(), dbproc, FAIL, SUCCEED, SYBEBNUM, SYBENSIP, TDS_DBG_FUNC, and tdsdump_log.

◆ dbstrlen()

Get size of the command buffer, in bytes.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server.
See also
dbcmd(), dbfcmd(), dbfreebuf(), dbgetchar(), dbstrcpy().

Definition at line 6206 of file dblib.c.

References CHECK_PARAMETER, tds_dblib_dbprocess::dbbufsz, dbproc, SYBENULL, TDS_DBG_FUNC, and tdsdump_log.

◆ dbtablecolinfo()

describe table column attributes with a single call (Freetds-only API function modelled on dbcolinfo)

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. column Nth in the result set, starting from 1. pdbcol address of structure to be populated by this function.
Returns
SUCCEED or FAIL.
See also
dbcolinfo().

Definition at line 6380 of file dblib.c.

References DBCOL::ActualName, CHECK_CONN, CHECK_NULP, column, tds_column::column_identity, tds_column::column_name, tds_column::column_nullable, tds_column::column_prec, tds_column::column_scale, tds_column::column_size, tds_column::column_type, tds_column::column_usertype, tds_column::column_writeable, dbcolptr(), DBPERROR_RETURN, dbproc, FAIL, FALSE, DBCOL::Identity, is_nullable_type, DBCOL::MaxLength, DBCOL::Name, DBCOL::Null, tds_column::on_server, DBCOL::Precision, DBCOL::Scale, DBCOL2::ServerMaxLength, DBCOL2::ServerType, DBCOL2::ServerTypeDeclaration, DBCOL::SizeOfStruct, strlcpy, SUCCEED, SYBECOLSIZE, TDS_DBG_FUNC, tds_dstr_cstr(), TDS_FAILED, tds_get_column_declaration, tds_get_conversion_type, tds_dblib_dbprocess::tds_socket, tdsdump_log, TRUE, DBCOL::Type, DBCOL::Updatable, DBCOL::UserType, and DBCOL::VarLength.

Referenced by main().

◆ dbtxptr()

Get text pointer for a column in the current row.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. column number of the column in the SELECT statement, starting at 1.
Returns
text pointer for column, may be NULL.
See also
dbtxtimestamp(), dbwritetext().

Definition at line 6472 of file dblib.c.

References column, tds_column::column_data, dbcolptr(), dbproc, if(), is_blob_col, NULL, TDS_DBG_FUNC, tdsdump_log, tds_blob::textptr, and tds_blob::valid_ptr.

Referenced by test().

◆ dbtxtimestamp()

Get text timestamp for a column in the current row.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. column number of the column in the SELECT statement, starting at 1.
Returns
timestamp for column, may be NULL.
See also
dbtxptr(), dbwritetext().

Definition at line 6442 of file dblib.c.

References column, tds_column::column_data, dbcolptr(), dbproc, if(), is_blob_col, NULL, TDS_DBG_FUNC, tdsdump_log, tds_blob::timestamp, and tds_blob::valid_ptr.

Referenced by test().

◆ dbuse()

Change current database.

Analagous to the unix command cd, dbuse() makes name the default database. Waits for an answer from the server.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. name database to use.
Return values
SUCCEED query was processed without errors. FAIL query was not processed
See also
dbchange(), dbname().

Definition at line 1449 of file dblib.c.

References CHECK_CONN, CHECK_NULP, dbcanquery(), dbcmd(), dbperror(), dbproc, dbresults(), dbsqlexec(), FAIL, free(), NULL, query, strcat, SUCCEED, SYBEMEM, TDS_DBG_FUNC, tds_new, tds_quote_id, tds_dblib_dbprocess::tds_socket, and tdsdump_log.

Referenced by main(), and test().

◆ dbvarylen()

Determine whether a column can vary in size.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. column Nth in the result set, starting from 1.
Return values
TRUE datatype of column can vary in size, or is nullable. FALSE datatype of column is fixed and is not nullable.
See also
dbcollen(), dbcolname(), dbcoltype(), dbdata(), dbdatlen(), dbnumcols(), dbprtype().

Definition at line 3158 of file dblib.c.

References column, tds_column::column_nullable, tds_column::column_type, dbcolptr(), dbproc, FALSE, SYBBITN, SYBDATETIMN, SYBDECIMAL, SYBFLTN, SYBIMAGE, SYBINTN, SYBMONEYN, SYBNTEXT, SYBNUMERIC, SYBNVARCHAR, SYBTEXT, SYBVARBINARY, SYBVARCHAR, TDS_DBG_FUNC, tdsdump_log, and TRUE.

Referenced by dbcolinfo(), init_hostfile_columns(), and main().

◆ dbversion() const char* dbversion ( ) ◆ dbwillconvert()

Test whether or not a datatype can be converted to another datatype.

Parameters
srctype type converting from desttype type converting to
Return values
TRUE convertible, or should be. FAIL not convertible.
See also
dbaltbind(), dbbind(), dbconvert(), dbconvert_ps(), src/dblib/unittests/convert().c().

Definition at line 2885 of file dblib.c.

References FALSE, TDS_DBG_FUNC, tds_prdatatype(), tds_willconvert, tdsdump_log, and TRUE.

Referenced by colwidth(), dbaltbind(), and dbbind().

◆ dbwritetext()

Send text or image data to the server.

Parameters
dbproc contains all information needed by db-lib to manage communications with the server. objname table name textptr text pointer to be modified, obtained from dbtxptr(). textptrlen Ignored. Supposed to be DBTXPLEN. timestamp text timestamp to be modified, obtained from dbtxtimestamp() or dbtxtsnewval(), may be NULL. log TRUE if the operation is to be recorded in the transaction log. size overall size of the data (in total, not just for this call), in bytes. A guideline, must not overstate the case. text the chunk of data to write.
Return values
SUCCEED everything worked. FAIL not sent, possibly because timestamp is invalid or was changed in the database since it was fetched.
See also
dbmoretext(), dbtxptr(), dbtxtimestamp(), dbwritetext(), dbtxtsput().

Definition at line 6509 of file dblib.c.

References _DB_RES_INIT, CHECK_CONN, CHECK_NULP, CHECK_PARAMETER, tds_dblib_dbprocess::command_state, DBCMDSENT, dbconvert(), dbperror(), dbproc, dbresults(), tds_dblib_dbprocess::dbresults_state, dbsqlok(), DBTXPLEN, FAIL, IS_TDSDEAD, log, NULL, ncbi::grid::netcache::search::fields::size, tds_socket::state, SUCCEED, SYBBINARY, SYBCHAR, SYBERPND, SYBEZTXT, TDS_DBG_FUNC, TDS_FAILED, TDS_NO_MORE_RESULTS, TDS_PENDING, tds_process_tokens, tds_dblib_dbprocess::tds_socket, TDS_TOKEN_TRAILING, tds_writetext_continue, tds_writetext_end, tds_writetext_start, tdsdump_log, text(), tds_dblib_dbprocess::text_sent, tds_dblib_dbprocess::text_size, and TRUE.

Referenced by test().


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4