FreeTDS API
|
Allocate or free resources. More...
Macros | |
#define | REQ(i, n) |(((TDS_REQ_ ## n / 8) == i)?(1<<(TDS_REQ_ ## n & 7)):0) |
#define | REQB(i) 0 SUPPORTED_REQ_CAP(i) |
#define | RES(i, n) |(((TDS_RES_ ## n / 8) == i)?(1<<(TDS_RES_ ## n & 7)):0) |
#define | RESB(i) 0 SUPPORTED_RES_CAP(i) |
#define | SQLS_ENTRY(number, state) case number: p = state; break |
#define | SUPPORTED_REQ_CAP(i) |
#define | SUPPORTED_RES_CAP(i) RES(i,CON_NOOOB) RES(i,PROTO_NOTEXT) RES(i,PROTO_NOBULK) RES(i,NOTDSDEBUG) |
Functions | |
BCPCOLDATA * | tds_alloc_bcp_column_data (unsigned int column_size) |
TDSBCPINFO * | tds_alloc_bcpinfo (void) |
char * | tds_alloc_client_sqlstate (int msgno) |
static TDSCOLUMN * | tds_alloc_column (void) |
static TDSCOMPUTEINFO * | tds_alloc_compute_result (TDS_USMALLINT num_cols, TDS_USMALLINT by_cols) |
Allocate memory for storing compute info return NULL on out of memory. | |
TDSCOMPUTEINFO ** | tds_alloc_compute_results (TDSSOCKET *tds, TDS_USMALLINT num_cols, TDS_USMALLINT by_cols) |
TDSRET | tds_alloc_compute_row (TDSCOMPUTEINFO *res_info) |
TDSCONTEXT * | tds_alloc_context (void *parent) |
TDSCURSOR * | tds_alloc_cursor (TDSSOCKET *tds, const char *name, TDS_INT namelen, const char *query, TDS_INT querylen) |
TDSDYNAMIC * | tds_alloc_dynamic (TDSCONNECTION *conn, const char *id) |
Allocate a dynamic statement. | |
TDSLOCALE * | tds_alloc_locale (void) |
TDSLOGIN * | tds_alloc_login (bool use_environment) |
char * | tds_alloc_lookup_sqlstate (TDSSOCKET *tds, int msgno) |
TDSPACKET * | tds_alloc_packet (void *buf, unsigned len) |
void * | tds_alloc_param_data (TDSCOLUMN *curparam) |
Allocate data for a parameter. | |
TDSPARAMINFO * | tds_alloc_param_result (TDSPARAMINFO *old_param) |
Adds a output parameter to TDSPARAMINFO. | |
TDSRESULTINFO * | tds_alloc_results (TDS_USMALLINT num_cols) |
TDSRET | tds_alloc_row (TDSRESULTINFO *res_info) |
Allocate space for row store return NULL on out of memory. | |
TDSSOCKET * | tds_alloc_socket (TDSCONTEXT *context, unsigned int bufsize) |
TDS_COMPILE_CHECK (tds_cap_len, sizeof(defaultcaps)==TDS_MAX_CAPABILITY) | |
TDS_COMPILE_CHECK (tds_values_len, sizeof(defaultcaps.types[0].values)==14) | |
static void | tds_connection_remove_socket (TDSCONNECTION *conn, TDSSOCKET *tds TDS_UNUSED) |
void | tds_cursor_deallocated (TDSCONNECTION *conn, TDSCURSOR *cursor) |
void | tds_deinit_bcpinfo (TDSBCPINFO *bcpinfo) |
static void | tds_deinit_connection (TDSCONNECTION *conn) |
void | tds_deinit_tvp (TDS_TVP *table) |
void | tds_detach_results (TDSRESULTINFO *info) |
Detach result info from it current socket. | |
void | tds_dynamic_deallocated (TDSCONNECTION *conn, TDSDYNAMIC *dyn) |
void | tds_free_all_results (TDSSOCKET *tds) |
void | tds_free_bcp_column_data (BCPCOLDATA *coldata) |
void | tds_free_bcpinfo (TDSBCPINFO *bcpinfo) |
static void | tds_free_column (TDSCOLUMN *col) |
static void | tds_free_compute_result (TDSCOMPUTEINFO *comp_info) |
static void | tds_free_compute_results (TDSSOCKET *tds) |
void | tds_free_context (TDSCONTEXT *context) |
static void | tds_free_env (TDSCONNECTION *conn) |
void | tds_free_input_params (TDSDYNAMIC *dyn) |
Frees all allocated input parameters of a dynamic statement. | |
void | tds_free_locale (TDSLOCALE *locale) |
void | tds_free_login (TDSLOGIN *login) |
void | tds_free_msg (TDSMESSAGE *message) |
void | tds_free_packets (TDSPACKET *packet) |
void | tds_free_param_result (TDSPARAMINFO *param_info) |
Delete latest parameter. | |
void | tds_free_param_results (TDSPARAMINFO *param_info) |
void | tds_free_results (TDSRESULTINFO *res_info) |
void | tds_free_row (TDSRESULTINFO *res_info, unsigned char *row) |
void | tds_free_socket (TDSSOCKET *tds) |
static void | tds_free_tvp_row (TDS_TVP_ROW *row) |
static char * | tds_get_dynid (TDSCONNECTION *conn, char *id) |
Get an id for dynamic query based on TDS information. | |
static TDSCONNECTION * | tds_init_connection (TDSCONNECTION *conn, TDSCONTEXT *context, unsigned int bufsize) |
TDSLOGIN * | tds_init_login (TDSLOGIN *login, TDSLOCALE *locale) |
Initialize login structure with locale information and other stuff for connection. | |
static TDSSOCKET * | tds_init_socket (TDSSOCKET *tds_socket, unsigned int bufsize) |
static void | tds_param_free (TDSCOLUMN *col) |
void * | tds_realloc (void **pp, size_t new_size) |
Reallocate a pointer and update it if success. | |
TDSPACKET * | tds_realloc_packet (TDSPACKET *packet, unsigned len) |
TDSSOCKET * | tds_realloc_socket (TDSSOCKET *tds, size_t bufsize) |
void | tds_release_cursor (TDSCURSOR **pcursor) |
void | tds_release_dynamic (TDSDYNAMIC **pdyn) |
Frees dynamic statement. | |
static void | tds_row_free (TDSRESULTINFO *res_info, unsigned char *row) |
void | tds_set_current_results (TDSSOCKET *tds, TDSRESULTINFO *info) |
static bool | winsock_initialized (void) |
Variables | |
static const TDS_CAPABILITIES | defaultcaps |
static volatile unsigned int | inc_num = 1 |
const TDSCOLUMNFUNCS | tds_invalid_funcs |
Allocate or free resources.
Allocation can fail only on out of memory. In such case they return NULL and leave the state as before call. Mainly function names are in the form tds_alloc_XX or tds_free_XXX. tds_alloc_XXX functions allocate structures and return pointer to allocated data while tds_free_XXX take structure pointers and free them. Some functions require additional parameters to initialize structure correctly. The main exception are structures that use reference counting. These structures have tds_alloc_XXX functions but instead of tds_free_XXX use tds_release_XXX.
#define SUPPORTED_REQ_CAP | ( | i | ) |
TDSDYNAMIC * tds_alloc_dynamic | ( | TDSCONNECTION * | conn, |
const char * | id | ||
) |
Allocate a dynamic statement.
conn | the connection within which to allocate the statement. |
id | a character label identifying the statement. |
tds_alloc_dynamic is used to implement placeholder code under TDS 5.0
void * tds_alloc_param_data | ( | TDSCOLUMN * | curparam | ) |
Allocate data for a parameter.
curparam | parameter to retrieve size information |
TDSPARAMINFO * tds_alloc_param_result | ( | TDSPARAMINFO * | old_param | ) |
Adds a output parameter to TDSPARAMINFO.
old_param | a pointer to the TDSPARAMINFO structure containing the current set of output parameter, or NULL if none exists. |
tds_alloc_param_result() works a bit differently than the other alloc result functions. Output parameters come in individually with no total number given in advance, so we simply call this func every time with get a TDS_PARAM_TOKEN and let it realloc the columns struct one bigger. tds_free_all_results() usually cleans up after us.
void tds_free_input_params | ( | TDSDYNAMIC * | dyn | ) |
Frees all allocated input parameters of a dynamic statement.
dyn | the dynamic statement whose input parameter are to be freed |
tds_free_input_params frees all parameters for the give dynamic statement
|
static |
Get an id for dynamic query based on TDS information.
conn | state information for the connection and the TDS protocol |
Initialize login structure with locale information and other stuff for connection.
locale | locale information (copied to configuration information) |
void * tds_realloc | ( | void ** | pp, |
size_t | new_size | ||
) |
Reallocate a pointer and update it if success.
pp | pointer to pointer to be reallocated |
new_size | new size to be allocated |
void tds_release_dynamic | ( | TDSDYNAMIC ** | pdyn | ) |
Frees dynamic statement.
pdyn | pointer to dynamic statement to be freed. |
|
static |