|
FreeTDS API
|
Core functions needed by most db-lib programs. More...
Macros | |
| #define | MAX(a, b) ( (a) > (b) ? (a) : (b) ) |
Functions | |
| const char * | dbacolname (DBPROCESS *dbproc, int computeid, int column) |
| Return name of a computed result column. | |
| BYTE * | dbadata (DBPROCESS *dbproc, int computeid, int column) |
| Get address of compute column data. | |
| DBINT | dbadlen (DBPROCESS *dbproc, int computeid, int column) |
| Get size of data in a compute column. | |
| RETCODE | dbaltbind (DBPROCESS *dbproc, int computeid, int column, int vartype, DBINT varlen, BYTE *varaddr) |
| Bind a compute column to a program variable. | |
| int | dbaltcolid (DBPROCESS *dbproc, int computeid, int column) |
| Get column ID of a compute column. | |
| DBINT | dbaltlen (DBPROCESS *dbproc, int computeid, int column) |
| Get size of data in compute column. | |
| int | dbaltop (DBPROCESS *dbproc, int computeid, int column) |
| Get aggregation operator for a compute column. | |
| int | dbalttype (DBPROCESS *dbproc, int computeid, int column) |
| Get datatype for a compute column. | |
| DBINT | dbaltutype (DBPROCESS *dbproc, int computeid, int column) |
| Get user-defined datatype of a compute column. | |
| RETCODE | dbanullbind (DBPROCESS *dbproc, int computeid, int column, DBINT *indicator) |
| Tie a null-indicator to a compute result column. | |
| RETCODE | dbanydatecrack (DBPROCESS *dbproc, DBDATEREC2 *di, int type, const void *data) |
| Break any kind of date or time value into useful pieces. | |
| RETCODE | dbbind (DBPROCESS *dbproc, int column, int vartype, DBINT varlen, BYTE *varaddr) |
| Tie a host variable to a resultset column. | |
| BYTE * | dbbylist (DBPROCESS *dbproc, int computeid, int *size) |
Get bylist for a compute row. | |
| RETCODE | dbcancel (DBPROCESS *dbproc) |
| Cancel the current command batch. | |
| RETCODE | dbcanquery (DBPROCESS *dbproc) |
| Cancel the query currently being retrieved, discarding all pending rows. | |
| char * | dbchange (DBPROCESS *dbproc) |
| See if a command caused the current database to change. | |
| void | dbclose (DBPROCESS *dbproc) |
| Close a connection to the server and free associated resources. | |
| void | dbclrbuf (DBPROCESS *dbproc, DBINT n) |
| Clear n rows from the row buffer. | |
| RETCODE | dbclropt (DBPROCESS *dbproc, int option, const char param[]) |
| Reset an option. | |
| RETCODE | dbcmd (DBPROCESS *dbproc, const char cmdstring[]) |
Append SQL to the command buffer. | |
| DBINT | dbcollen (DBPROCESS *dbproc, int column) |
| Get size of a regular result column. | |
| char * | dbcolname (DBPROCESS *dbproc, int column) |
| Return name of a regular result column. | |
| char * | dbcolsource (DBPROCESS *dbproc, int column) |
| Get base database column name for a result set column. | |
| int | dbcoltype (DBPROCESS *dbproc, int column) |
| Get the datatype of a regular result set column. | |
| DBTYPEINFO * | dbcoltypeinfo (DBPROCESS *dbproc, int column) |
| Get precision and scale information for a regular result column. | |
| int | dbcolutype (DBPROCESS *dbproc, int column) |
| Get user-defined datatype of a regular result column. | |
| DBINT | dbconvert (DBPROCESS *dbproc, int srctype, const BYTE *src, DBINT srclen, int desttype, BYTE *dest, DBINT destlen) |
| cf. | |
| 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. | |
| DBINT | dbcount (DBPROCESS *dbproc) |
| Get count of rows processed. | |
| BYTE * | dbdata (DBPROCESS *dbproc, int column) |
| Get address of data in a regular result column. | |
| RETCODE | dbdatecrack (DBPROCESS *dbproc, DBDATEREC *di, DBDATETIME *datetime) |
| Break a DBDATETIME value into useful pieces. | |
| DBINT | dbdatlen (DBPROCESS *dbproc, int column) |
| Get size of current row's data in a regular result column. | |
| EHANDLEFUNC | dberrhandle (EHANDLEFUNC handler) |
| Set an error handler, for messages from db-lib. | |
| void | dbexit (void) |
| Close server connections and free all related structures. | |
| RETCODE | dbfcmd (DBPROCESS *dbproc, const char *fmt,...) |
printf-like way to form SQL to send to the server. | |
| void | dbfreebuf (DBPROCESS *dbproc) |
Erase the command buffer, in case DBNOAUTOFREE was set with dbsetopt(). | |
| char * | dbgetchar (DBPROCESS *dbproc, int pos) |
| Get address of a position in the command buffer. | |
| int | dbgetmaxprocs (void) |
| get maximum simultaneous connections db-lib will open to the server. | |
| int | dbgetpacket (DBPROCESS *dbproc) |
| Get TDS packet size for the connection. | |
| RETCODE | dbgetrow (DBPROCESS *dbproc, DBINT row) |
| Read a row from the row buffer. | |
| int | dbgettime (void) |
| Get maximum seconds db-lib waits for a server response to query. | |
| BYTE * | dbgetuserdata (DBPROCESS *dbproc) |
Get address of user-allocated data from a DBPROCESS. | |
| RETCODE | dbinit (void) |
| Initialize db-lib. | |
| BOOL | dbiscount (DBPROCESS *dbproc) |
| Indicates whether or not the count returned by dbcount is real (Microsoft-compatibility feature). | |
| DBBOOL | dbisopt (DBPROCESS *dbproc, int option, const char param[]) |
| Get value of an option. | |
| LOGINREC * | dblogin (void) |
Allocate a LOGINREC structure. | |
| void | dbloginfree (LOGINREC *login) |
free the LOGINREC | |
| RETCODE | dbmorecmds (DBPROCESS *dbproc) |
| See if more commands are to be processed. | |
| RETCODE | dbmoretext (DBPROCESS *dbproc, DBINT size, const BYTE text[]) |
| Send chunk of a text/image value to the server. | |
| MHANDLEFUNC | dbmsghandle (MHANDLEFUNC handler) |
| Set a message handler, for messages from the server. | |
| char * | dbname (DBPROCESS *dbproc) |
| Get name of current database. | |
| RETCODE | dbnullbind (DBPROCESS *dbproc, int column, DBINT *indicator) |
| Tie a null-indicator to a regular result column. | |
| int | dbnumalts (DBPROCESS *dbproc, int computeid) |
| Get count of columns in a compute row. | |
| int | dbnumcols (DBPROCESS *dbproc) |
| Return number of regular columns in a result set. | |
| int | dbnumcompute (DBPROCESS *dbproc) |
Get count of COMPUTE clauses for a result set. | |
| DBINT | dbprcollen (DBPROCESS *dbproc, int column) |
| Get size of a result column needed to print column. | |
| void | dbprhead (DBPROCESS *dbproc) |
| Print result set headings to stdout. | |
| RETCODE | dbprrow (DBPROCESS *dbproc) |
| Print a result set to stdout. | |
| const char * | dbprtype (int token) |
| Print a token value's name to a buffer. | |
| STATUS | dbreadtext (DBPROCESS *dbproc, void *buf, DBINT bufsize) |
| Fetch part of a text or image value from the server. | |
| void | dbrecftos (const char filename[]) |
| Record to a file all SQL commands sent to the server. | |
| RETCODE | dbresults (DBPROCESS *dbproc) |
| Set up query results. | |
| RETCODE | dbsafestr (DBPROCESS *dbproc, const char *src, DBINT srclen, char *dest, DBINT destlen, int quotetype) |
| safely quotes character values in SQL text. | |
| char * | dbservcharset (DBPROCESS *dbproc) |
Get syscharset name of the server character set. | |
| void | dbsetifile (char *filename) |
set name and location of the interfaces file FreeTDS should use to look up a servername. | |
| 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. | |
| RETCODE | dbsetlogintime (int seconds) |
| Set maximum seconds db-lib waits for a server response to a login attempt. | |
| RETCODE | dbsetlversion (LOGINREC *login, BYTE version) |
| Set TDS version for future connections. | |
| RETCODE | dbsetmaxprocs (int maxprocs) |
| Set maximum simultaneous connections db-lib will open to the server. | |
| RETCODE | dbsetnull (DBPROCESS *dbproc, int bindtype, int bindlen, BYTE *bindval) |
| Define substitution values to be used when binding null values. | |
| RETCODE | dbsetopt (DBPROCESS *dbproc, int option, const char *char_param, int int_param) |
| Set db-lib or server option. | |
| STATUS | dbsetrow (DBPROCESS *dbproc, DBINT row) |
| Make a buffered row "current" without fetching it into bound variables. | |
| RETCODE | dbsettime (int seconds) |
| Set maximum seconds db-lib waits for a server response to query. | |
| void | dbsetuserdata (DBPROCESS *dbproc, BYTE *ptr) |
Associate client-allocated (and defined) data with a DBPROCESS. | |
| RETCODE | dbsetversion (DBINT version) |
| Specify a db-lib version level. | |
| int | dbspid (DBPROCESS *dbproc) |
Get server process ID for a DBPROCESS. | |
| RETCODE | dbspr1row (DBPROCESS *dbproc, char *buffer, DBINT buf_len) |
| Print a regular result row to a buffer. | |
| DBINT | dbspr1rowlen (DBPROCESS *dbproc) |
| Determine size buffer required to hold the results returned by dbsprhead(), dbsprline(), and dbspr1row(). | |
| RETCODE | dbsprhead (DBPROCESS *dbproc, char *buffer, DBINT buf_len) |
| Print result set headings to a buffer. | |
| RETCODE | dbsprline (DBPROCESS *dbproc, char *buffer, DBINT buf_len, DBCHAR line_char) |
| Get formatted string for underlining dbsprhead() column names. | |
| RETCODE | dbsqlexec (DBPROCESS *dbproc) |
| send the SQL command to the server and wait for an answer. | |
| RETCODE | dbsqlok (DBPROCESS *dbproc) |
| Wait for results of a query from the server. | |
| RETCODE | dbsqlsend (DBPROCESS *dbproc) |
| Transmit the command buffer to the server. | |
| RETCODE | dbstrbuild (DBPROCESS *dbproc, char *charbuf, int bufsize, char *text, char *formats,...) |
| Build a printable string from text containing placeholders for variables. | |
| RETCODE | dbstrcpy (DBPROCESS *dbproc, int start, int numbytes, char *dest) |
| Get a copy of a chunk of the command buffer. | |
| int | dbstrlen (DBPROCESS *dbproc) |
| Get size of the command buffer, in bytes. | |
| RETCODE | dbtablecolinfo (DBPROCESS *dbproc, DBINT column, DBCOL *pdbcol) |
| describe table column attributes with a single call (Freetds-only API function modelled on dbcolinfo) | |
| DBBINARY * | dbtxptr (DBPROCESS *dbproc, int column) |
| Get text pointer for a column in the current row. | |
| DBBINARY * | dbtxtimestamp (DBPROCESS *dbproc, int column) |
| Get text timestamp for a column in the current row. | |
| RETCODE | dbuse (DBPROCESS *dbproc, const char *name) |
| Change current database. | |
| DBINT | dbvarylen (DBPROCESS *dbproc, int column) |
| Determine whether a column can vary in size. | |
| const char * | dbversion (void) |
| See which version of db-lib is in use. | |
| DBBOOL | dbwillconvert (int srctype, int desttype) |
| Test whether or not a datatype can be converted to another datatype. | |
| 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. | |
Core functions needed by most db-lib programs.
| #define MAX | ( | a, | |
| b | |||
| ) | ( (a) > (b) ? (a) : (b) ) |
| const char * dbacolname | ( | DBPROCESS * | dbproc, |
| int | computeid, | ||
| int | column | ||
| ) |
Return name of a computed result column.
| 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. |
| NULL | column is not in range. |
| BYTE * dbadata | ( | DBPROCESS * | dbproc, |
| int | computeid, | ||
| int | column | ||
| ) |
Get address of compute column data.
| 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. |
| NULL | no such computeid or column. |
| DBINT dbadlen | ( | DBPROCESS * | dbproc, |
| int | computeid, | ||
| int | column | ||
| ) |
Get size of data in a compute column.
| 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. |
| -1 | no such column or computeid. |
| 0 | data are NULL. |
| RETCODE dbaltbind | ( | DBPROCESS * | dbproc, |
| int | computeid, | ||
| int | column, | ||
| int | vartype, | ||
| DBINT | varlen, | ||
| BYTE * | varaddr | ||
| ) |
Bind a compute column to a program variable.
| 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 |
| SUCCEED | everything worked. |
| FAIL | no such computeid or column, or no such conversion possible, or target buffer too small. |
| int dbaltcolid | ( | DBPROCESS * | dbproc, |
| int | computeid, | ||
| int | column | ||
| ) |
Get column ID of a compute column.
| 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. |
| DBINT dbaltlen | ( | DBPROCESS * | dbproc, |
| int | computeid, | ||
| int | column | ||
| ) |
Get size of data in compute column.
| 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. |
| int dbaltop | ( | DBPROCESS * | dbproc, |
| int | computeid, | ||
| int | column | ||
| ) |
Get aggregation operator for a compute column.
| 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. |
| -1 | no such computeid or column. |
| int dbalttype | ( | DBPROCESS * | dbproc, |
| int | computeid, | ||
| int | column | ||
| ) |
Get datatype for a compute column.
| 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. |
SYB* dataype token. | -1 | no such column or computeid. |
| DBINT dbaltutype | ( | DBPROCESS * | dbproc, |
| int | computeid, | ||
| int | column | ||
| ) |
Get user-defined datatype of a compute column.
| 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. |
| RETCODE dbanullbind | ( | DBPROCESS * | dbproc, |
| int | computeid, | ||
| int | column, | ||
| DBINT * | indicator | ||
| ) |
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.
| 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. |
| SUCCEED | variable accepted. |
| FAIL | indicator is NULL or column is out of range. |
dbnextrow(). Possible values are:| RETCODE dbanydatecrack | ( | DBPROCESS * | dbproc, |
| DBDATEREC2 * | di, | ||
| int | type, | ||
| const void * | data | ||
| ) |
Break any kind of date or time value into useful pieces.
| 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. |
| SUCCEED | always. |
--with-msdblib was configured.This is an extension to dbdatecrack(), see it for more information.
| RETCODE dbbind | ( | DBPROCESS * | dbproc, |
| int | column, | ||
| int | vartype, | ||
| DBINT | varlen, | ||
| BYTE * | varaddr | ||
| ) |
Tie a host variable to a resultset column.
| 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 |
| SUCCEED | everything worked. |
| FAIL | no such column or no such conversion possible, or target buffer too small. |
| BYTE * dbbylist | ( | DBPROCESS * | dbproc, |
| int | computeid, | ||
| int * | size | ||
| ) |
Get bylist for a compute row.
| 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. |
bylist for computeid. | NULL | no such computeid. |
| RETCODE dbcancel | ( | DBPROCESS * | dbproc | ) |
Cancel the current command batch.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| SUCCEED | always. |
| RETCODE dbcanquery | ( | DBPROCESS * | dbproc | ) |
Cancel the query currently being retrieved, discarding all pending rows.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| char * dbchange | ( | DBPROCESS * | dbproc | ) |
See if a command caused the current database to change.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
NULL.| void dbclose | ( | DBPROCESS * | dbproc | ) |
Close a connection to the server and free associated resources.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| void dbclrbuf | ( | DBPROCESS * | dbproc, |
| DBINT | n | ||
| ) |
Clear n rows from the row buffer.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| n | number of rows to remove, >= 0. |
| RETCODE dbclropt | ( | DBPROCESS * | dbproc, |
| int | option, | ||
| const char | param[] | ||
| ) |
Reset an option.
| 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. |
| SUCCEED | option and parameter seem sane. |
| FAIL | no such option. |
| RETCODE dbcmd | ( | DBPROCESS * | dbproc, |
| const char | cmdstring[] | ||
| ) |
Append SQL to the command buffer.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| cmdstring | SQL to append to the command buffer. |
| SUCCEED | success. |
| FAIL | insufficient memory. |
DBCMDPEND unless the command state is DBCMDSENT, in which case it frees the command buffer. This latter may or may not be the Right Thing to do. | DBINT dbcollen | ( | DBPROCESS * | dbproc, |
| int | column | ||
| ) |
Get size of a regular result column.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| column | Nth in the result set, starting from 1. |
| char * dbcolname | ( | DBPROCESS * | dbproc, |
| int | column | ||
| ) |
Return name of a regular result column.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| column | Nth in the result set, starting with 1. |
| NULL | column is not in range. |
| char * dbcolsource | ( | DBPROCESS * | dbproc, |
| int | column | ||
| ) |
Get base database column name for a result set column.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| column | Nth in the result set, starting from 1. |
| int dbcoltype | ( | DBPROCESS * | dbproc, |
| int | column | ||
| ) |
Get the datatype of a regular result set column.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| column | Nth in the result set, starting from 1. |
SYB* datetype token value, or zero if column out of range | DBTYPEINFO * dbcoltypeinfo | ( | DBPROCESS * | dbproc, |
| int | column | ||
| ) |
Get precision and scale information for a regular result column.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| column | Nth in the result set, starting from 1. |
| int dbcolutype | ( | DBPROCESS * | dbproc, |
| int | column | ||
| ) |
Get user-defined datatype of a regular result column.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| column | Nth in the result set, starting from 1. |
SYB* datetype token value, or -1 if column out of range | DBINT dbconvert | ( | DBPROCESS * | dbproc, |
| int | srctype, | ||
| const BYTE * | src, | ||
| DBINT | srclen, | ||
| int | desttype, | ||
| BYTE * | dest, | ||
| DBINT | destlen | ||
| ) |
cf.
dbconvert_ps(), above
Sybase: Convert numeric types.
| 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. |
| 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.
| 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 |
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.
What happens if client does not reset values?
Microsoft and Sybase define this function differently.
| DBINT dbcount | ( | DBPROCESS * | dbproc | ) |
Get count of rows processed.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| BYTE * dbdata | ( | DBPROCESS * | dbproc, |
| int | column | ||
| ) |
Get address of data in a regular result column.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| column | Nth in the result set, starting from 1. |
| RETCODE dbdatecrack | ( | DBPROCESS * | dbproc, |
| DBDATEREC * | di, | ||
| DBDATETIME * | datetime | ||
| ) |
Break a DBDATETIME value into useful pieces.
| 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. |
| SUCCEED | always. |
--with-msdblib was configured.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.
| DBINT dbdatlen | ( | DBPROCESS * | dbproc, |
| int | column | ||
| ) |
Get size of current row's data in a regular result column.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| column | Nth in the result set, starting from 1. |
| EHANDLEFUNC dberrhandle | ( | EHANDLEFUNC | handler | ) |
Set an error handler, for messages from db-lib.
| handler | pointer to callback function that will handle errors. Pass NULL to restore the default handler. |
| void dbexit | ( | void | ) |
| RETCODE dbfcmd | ( | DBPROCESS * | dbproc, |
| const char * | fmt, | ||
| ... | |||
| ) |
printf-like way to form SQL to send to the server.
Forms a command string and writes to the command buffer with dbcmd().
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| fmt | man vasprintf for details. |
| SUCCEED | success. |
| FAIL | insufficient memory, or dbcmd() failed. |
| void dbfreebuf | ( | DBPROCESS * | dbproc | ) |
Erase the command buffer, in case DBNOAUTOFREE was set with dbsetopt().
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| char * dbgetchar | ( | DBPROCESS * | dbproc, |
| int | pos | ||
| ) |
Get address of a position in the command buffer.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| pos | offset within the command buffer, starting at 0. |
| int dbgetmaxprocs | ( | void | ) |
get maximum simultaneous connections db-lib will open to the server.
| int dbgetpacket | ( | DBPROCESS * | dbproc | ) |
Get TDS packet size for the connection.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| RETCODE dbgetrow | ( | DBPROCESS * | dbproc, |
| DBINT | row | ||
| ) |
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().
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| row | Nth row to read, starting with 1. |
| REG_ROW | returned row is a regular row. |
| NO_MORE_ROWS | no such row in the row buffer. Current row is unchanged. |
| FAIL | unsuccessful; row buffer may be full. |
| int dbgettime | ( | void | ) |
Get maximum seconds db-lib waits for a server response to query.
| query | timeout limit, in seconds |
| BYTE * dbgetuserdata | ( | DBPROCESS * | dbproc | ) |
Get address of user-allocated data from a DBPROCESS.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
db-lib associated with dbproc when the client called dbsetuserdata(). | undefined | (probably NULL) dbsetuserdata() was not previously called. |
| RETCODE dbinit | ( | void | ) |
Initialize db-lib.
locales.conf (if any) to determine the default date format. | SUCCEED | normal. |
| FAIL | cannot allocate an array of TDS_MAX_CONN TDSSOCKET pointers. |
| BOOL dbiscount | ( | DBPROCESS * | dbproc | ) |
Indicates whether or not the count returned by dbcount is real (Microsoft-compatibility feature).
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| DBBOOL dbisopt | ( | DBPROCESS * | dbproc, |
| int | option, | ||
| const char | param[] | ||
| ) |
Get value of an option.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| option | the option |
| param | a parameter to option. |
| LOGINREC * dblogin | ( | void | ) |
Allocate a LOGINREC structure.
LOGINREC structure is passed to dbopen() to create a connection to the database. Does not communicate to the server; interacts strictly with library. | NULL | the LOGINREC cannot be allocated. |
| LOGINREC* | to valid memory, otherwise. |
| RETCODE dbmorecmds | ( | DBPROCESS * | dbproc | ) |
See if more commands are to be processed.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| RETCODE dbmoretext | ( | DBPROCESS * | dbproc, |
| DBINT | size, | ||
| const BYTE | text[] | ||
| ) |
Send chunk of a text/image value to the server.
| 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. |
| SUCCEED | always. |
FAIL if appropriate. | MHANDLEFUNC dbmsghandle | ( | MHANDLEFUNC | handler | ) |
Set a message handler, for messages from the server.
| handler | address of the function that will process the messages. |
| char * dbname | ( | DBPROCESS * | dbproc | ) |
Get name of current database.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| RETCODE dbnullbind | ( | DBPROCESS * | dbproc, |
| int | column, | ||
| DBINT * | indicator | ||
| ) |
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.
| 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. |
| SUCCEED | variable accepted. |
| FAIL | indicator is NULL or column is out of range. |
dbnextrow(). Possible values are:| int dbnumalts | ( | DBPROCESS * | dbproc, |
| int | computeid | ||
| ) |
Get count of columns in a compute row.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| computeid | of COMPUTE clause to which we're referring. |
| int dbnumcols | ( | DBPROCESS * | dbproc | ) |
Return number of regular columns in a result set.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| int dbnumcompute | ( | DBPROCESS * | dbproc | ) |
Get count of COMPUTE clauses for a result set.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| DBINT dbprcollen | ( | DBPROCESS * | dbproc, |
| int | column | ||
| ) |
Get size of a result column needed to print column.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| column | Nth in the result set, starting from 1. |
| void dbprhead | ( | DBPROCESS * | dbproc | ) |
Print result set headings to stdout.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| RETCODE dbprrow | ( | DBPROCESS * | dbproc | ) |
Print a result set to stdout.
| dbproc | contains all information needed by db-lib to manage communications with the server. |
| lecolinfobproc | contains all information needed by db-lib to manage c"> | ||||||||
| dbnumcols().
Here is the call graph for this function:
Here is the call graph for this function:
Here is the call graph for this function:
Here is the call graph for this function:
<Þ> CS_LONG;
|
| dbproc, so the c"ga6ba2a7f18cb76d24776e45fd71141494" name="ga6ba2a7f18cb76d24776e45fd71141494">
aph for this function:
| TDSSOCKET *tds) | DB class="params"> |
Here is the caller graph for this function:
.*)roc<08tml">DBPROCESS * dbproc);
| | | |||
interfaces file FreeTDS shueBPROCESS *