Main Page   Modules   Compound List   File List   Compound Members   File Members   Related Pages  

Query
[LibTDS API]

Function to handle query. More...

Functions

int tds_submit_query (TDSSOCKET *tds, const char *query)
 tds_submit_query() sends a language string to the database server for processing.

int tds_submit_query_params (TDSSOCKET *tds, const char *query, TDSPARAMINFO *params)
 tds_submit_query_params() sends a language string to the database server for processing.

const char * tds_skip_quoted (const char *s)
 Skip quoting string (like 'sfsf', "dflkdj" or [dfkjd]).

const char * tds_next_placeholders (const char *start)
 Get position of next placeholders.

int tds_count_placeholders (const char *query)
 Count the number of placeholders in query.

int tds_submit_prepare (TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params)
 tds_submit_prepare() creates a temporary stored procedure in the server.

int tds_submit_execdirect (TDSSOCKET *tds, const char *query, TDSPARAMINFO *params)
 Currently works with TDS 5.0 and TDS7+.

int tds_submit_execute (TDSSOCKET *tds, TDSDYNAMIC *dyn)
 tds_submit_execute() sends a previously prepared dynamic statement to the server.

int tds_get_dynid (TDSSOCKET *tds, char **id)
 Get an id for dynamic query based on TDS information.

int tds_submit_unprepare (TDSSOCKET *tds, TDSDYNAMIC *dyn)
 Send a unprepare request for a prepared query.

int tds_submit_rpc (TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params)
 tds_submit_rpc() call a RPC from server.

int tds_send_cancel (TDSSOCKET *tds)
 tds_send_cancel() sends an empty packet (8 byte header only) tds_process_cancel should be called directly after this.

int tds_quote_id (TDSSOCKET *tds, char *buffer, const char *id, int idlen)
 Quote an id.

int tds_quote_string (TDSSOCKET *tds, char *buffer, const char *str, int len)
 Quote a string.


Detailed Description

Function to handle query.


Function Documentation

int tds_get_dynid TDSSOCKET *    tds,
char **    id
 

Get an id for dynamic query based on TDS information.

Parameters:
tds  state information for the socket and the TDS protocol
Returns:
TDS_FAIL or TDS_SUCCEED

const char* tds_next_placeholders const char *    start
 

Get position of next placeholders.

Parameters:
start  pointer to part of query to search
Returns:
next placaholders or NULL if not found

int tds_quote_id TDSSOCKET *    tds,
char *    buffer,
const char *    id,
int    idlen
 

Quote an id.

Parameters:
tds  state information for the socket and the TDS protocol
buffer  buffer to store quoted id. If NULL do not write anything (useful to compute quote length)
id  id to quote
idlen  id length
Returns:
written chars (not including needed terminator)

int tds_quote_string TDSSOCKET *    tds,
char *    buffer,
const char *    str,
int    len
 

Quote a string.

Parameters:
tds  state information for the socket and the TDS protocol
buffer  buffer to store quoted id. If NULL do not write anything (useful to compute quote length)
str  string to quote (not necessary null-terminated)
len  length of string (-1 for null terminated)
Returns:
written chars (not including needed terminator)

int tds_send_cancel TDSSOCKET *    tds
 

tds_send_cancel() sends an empty packet (8 byte header only) tds_process_cancel should be called directly after this.

Parameters:
tds  state information for the socket and the TDS protocol

const char* tds_skip_quoted const char *    s
 

Skip quoting string (like 'sfsf', "dflkdj" or [dfkjd]).

Parameters:
s  pointer to first quoting character (should be '," or [)
Returns:
character after quoting

int tds_submit_execdirect TDSSOCKET *    tds,
const char *    query,
TDSPARAMINFO *    params
 

Currently works with TDS 5.0 and TDS7+.

Parameters:
tds  state information for the socket and the TDS protocol
query  language query with given placeholders (?)
params  parameters to send
Returns:
TDS_FAIL or TDS_SUCCEED

int tds_submit_execute TDSSOCKET *    tds,
TDSDYNAMIC *    dyn
 

tds_submit_execute() sends a previously prepared dynamic statement to the server.

Currently works with TDS 5.0 or TDS7+

Parameters:
tds  state information for the socket and the TDS protocol
dyn  dynamic proc to execute. Must build from same tds.

int tds_submit_prepare TDSSOCKET *    tds,
const char *    query,
const char *    id,
TDSDYNAMIC **    dyn_out,
TDSPARAMINFO *    params
 

tds_submit_prepare() creates a temporary stored procedure in the server.

Under TDS 4.2 dynamic statements are emulated building sql command

Parameters:
tds  state information for the socket and the TDS protocol
query  language query with given placeholders (?)
id  string to identify the dynamic query. Pass NULL for automatic generation.
dyn_out  will receive allocated TDSDYNAMIC*. Any older allocated dynamic won't be freed, Can be NULL.
Returns:
TDS_FAIL or TDS_SUCCEED

int tds_submit_query TDSSOCKET *    tds,
const char *    query
 

tds_submit_query() sends a language string to the database server for processing.

TDS 4.2 is a plain text message with a packet type of 0x01, TDS 7.0 is a unicode string with packet type 0x01, and TDS 5.0 uses a TDS_LANGUAGE_TOKEN to encapsulate the query and a packet type of 0x0f.

Parameters:
tds  state information for the socket and the TDS protocol
query  language query to submit
Returns:
TDS_FAIL or TDS_SUCCEED

int tds_submit_query_params TDSSOCKET *    tds,
const char *    query,
TDSPARAMINFO *    params
 

tds_submit_query_params() sends a language string to the database server for processing.

TDS 4.2 is a plain text message with a packet type of 0x01, TDS 7.0 is a unicode string with packet type 0x01, and TDS 5.0 uses a TDS_LANGUAGE_TOKEN to encapsulate the query and a packet type of 0x0f.

Parameters:
tds  state information for the socket and the TDS protocol
query  language query to submit
params  parameters of query
Returns:
TDS_FAIL or TDS_SUCCEED

int tds_submit_rpc TDSSOCKET *    tds,
const char *    rpc_name,
TDSPARAMINFO *    params
 

tds_submit_rpc() call a RPC from server.

Output parameters will be stored in tds->param_info

Parameters:
tds  state information for the socket and the TDS protocol
rpc_name  name of RPC
params  parameters informations. NULL for no parameters

int tds_submit_unprepare TDSSOCKET *    tds,
TDSDYNAMIC *    dyn
 

Send a unprepare request for a prepared query.

Parameters:
tds  state information for the socket and the TDS protocol
dyn  dynamic query
Returns:
TDS_SUCCEED or TDS_FAIL


Generated on Tue Jan 13 20:54:54 2004 for FreeTDS API by doxygen1.2.18