FreeTDS API
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Macros | Enumerations | Functions | Variables

Function to handle query. More...

Collaboration diagram for Query:

Macros

#define TDS_PUT_N_AS_UCS2(tds, s)
 Utility to convert a constant ascii string to ucs2 and send to server. More...
 

Enumerations

enum  { MUL_STARTED = 1 }
 

Functions

static char * tds5_fix_dot_query (const char *query, size_t *query_len, TDSPARAMINFO *params)
 Substitute ?-style placeholders with named (@param) ones. More...
 
TDSRET tds71_submit_prepexec (TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params)
 tds71_submit_prepexec() creates a temporary stored procedure in the server. More...
 
static char * tds7_build_param_def_from_params (TDSSOCKET *tds, const char *query, size_t query_len, TDSPARAMINFO *params, size_t *out_len)
 Return string with parameters definition, useful for TDS7+. More...
 
static char * tds7_build_param_def_from_query (TDSSOCKET *tds, const char *converted_query, size_t converted_query_len, TDSPARAMINFO *params, size_t *out_len)
 Return string with parameters definition, useful for TDS7+ Looks like "@P1 INT, @P2 VARCHAR(100)". More...
 
static void tds7_put_cursor_fetch (TDSSOCKET *tds, TDS_INT cursor_id, TDS_TINYINT fetch_type, TDS_INT i_row, TDS_INT num_rows)
 
static void tds7_put_params_definition (TDSSOCKET *tds, const char *param_definition, size_t param_length)
 Send parameter definition to server. More...
 
static void tds7_put_query_params (TDSSOCKET *tds, const char *query, size_t query_len)
 Output params types and query (required by sp_prepare/sp_executesql/sp_prepexec) More...
 
static void tds7_send_execute (TDSSOCKET *tds, TDSDYNAMIC *dyn)
 Send dynamic request on TDS 7+ to be executed. More...
 
static size_t tds_ascii_to_ucs2 (char *buffer, const char *buf)
 Accept an ASCII string, convert it to UCS2-LE The input is null-terminated, but the output excludes the null. More...
 
const char * tds_convert_string (TDSSOCKET *tds, TDSICONV *char_conv, const char *s, int len, size_t *out_len)
 Convert a string in an allocated buffer. More...
 
int tds_count_placeholders (const char *query)
 Count the number of placeholders in query. More...
 
static int tds_count_placeholders_ucs2le (const char *query, const char *query_end)
 Count number of placeholders (?) in a query. More...
 
static int tds_cursor_check_allocated (TDSCONNECTION *conn, TDSCURSOR *cursor)
 Check if a cursor is allocated into the server. More...
 
TDSRET tds_cursor_close (TDSSOCKET *tds, TDSCURSOR *cursor)
 
TDSRET tds_cursor_dealloc (TDSSOCKET *tds, TDSCURSOR *cursor)
 Send a deallocation request to server.
 
TDSRET tds_cursor_declare (TDSSOCKET *tds, TDSCURSOR *cursor, TDSPARAMINFO *params, int *something_to_send)
 
TDSRET tds_cursor_fetch (TDSSOCKET *tds, TDSCURSOR *cursor, TDS_CURSOR_FETCH fetch_type, TDS_INT i_row)
 
TDSRET tds_cursor_get_cursor_info (TDSSOCKET *tds, TDSCURSOR *cursor, TDS_UINT *prow_number, TDS_UINT *prow_count)
 
TDSRET tds_cursor_open (TDSSOCKET *tds, TDSCURSOR *cursor, TDSPARAMINFO *params, int *something_to_send)
 
TDSRET tds_cursor_setname (TDSSOCKET *tds, TDSCURSOR *cursor)
 
TDSRET tds_cursor_setrows (TDSSOCKET *tds, TDSCURSOR *cursor, int *something_to_send)
 
TDSRET tds_cursor_update (TDSSOCKET *tds, TDSCURSOR *cursor, TDS_CURSOR_OPERATION op, TDS_INT i_row, TDSPARAMINFO *params)
 
TDSRET tds_deferred_cursor_dealloc (TDSCONNECTION *conn, TDSCURSOR *cursor)
 Deallocate cursor on idle. More...
 
TDSRET tds_deferred_unprepare (TDSCONNECTION *conn, TDSDYNAMIC *dyn)
 Unprepare dynamic on idle. More...
 
TDSRET tds_disconnect (TDSSOCKET *tds)
 
size_t tds_fix_column_size (TDSSOCKET *tds, TDSCOLUMN *curcol)
 Get column size for wire.
 
TDSRET tds_get_column_declaration (TDSSOCKET *tds, TDSCOLUMN *curcol, char *out)
 Return declaration for column (like "varchar(20)") More...
 
TDSRET tds_multiple_done (TDSSOCKET *tds, TDSMULTIPLE *multiple)
 
TDSRET tds_multiple_execute (TDSSOCKET *tds, TDSMULTIPLE *multiple, TDSDYNAMIC *dyn)
 
TDSRET tds_multiple_init (TDSSOCKET *tds, TDSMULTIPLE *multiple, TDS_MULTIPLE_TYPE type, TDSHEADERS *head)
 
TDSRET tds_multiple_query (TDSSOCKET *tds, TDSMULTIPLE *multiple, const char *query, TDSPARAMINFO *params)
 
int tds_needs_unprepare (TDSCONNECTION *conn, TDSDYNAMIC *dyn)
 Check if dynamic request must be unprepared. More...
 
const char * tds_next_placeholder (const char *start)
 Get position of next placeholder. More...
 
static const char * tds_next_placeholder_ucs2le (const char *start, const char *end, int named)
 Found the next placeholder (? or @param) in a string. More...
 
static TDSRET tds_put_data (TDSSOCKET *tds, TDSCOLUMN *curcol)
 Write data to wire. More...
 
static TDSRET tds_put_data_info (TDSSOCKET *tds, TDSCOLUMN *curcol, int flags)
 Put data information to wire. More...
 
static int tds_put_data_info_length (TDSSOCKET *tds, TDSCOLUMN *curcol, int flags)
 Calc information length in bytes (useful for calculating full packet length) More...
 
static TDSRET tds_put_param_as_string (TDSSOCKET *tds, TDSPARAMINFO *params, int n)
 Send a parameter to server. More...
 
static void tds_put_params (TDSSOCKET *tds, TDSPARAMINFO *info, int flags)
 Send parameters to server. More...
 
static TDSRET tds_query_flush_packet (TDSSOCKET *tds)
 Flush query packet. More...
 
static size_t tds_quote (TDSSOCKET *tds, char *buffer, char quoting, const char *id, size_t len)
 Quote a string properly. More...
 
static void tds_quote_and_put (TDSSOCKET *tds, const char *s, const char *end)
 Send a string to server while quoting it. More...
 
size_t tds_quote_id (TDSSOCKET *tds, char *buffer, const char *id, int idlen)
 Quote an id. More...
 
size_t tds_quote_string (TDSSOCKET *tds, char *buffer, const char *str, int len)
 Quote a string. More...
 
TDSRET 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. More...
 
static TDSRET tds_send_emulated_execute (TDSSOCKET *tds, const char *query, TDSPARAMINFO *params)
 Emulate prepared execute traslating to a normal language.
 
static TDSRET tds_send_emulated_rpc (TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params)
 Send RPC as string query. More...
 
static void tds_set_cur_cursor (TDSSOCKET *tds, TDSCURSOR *cursor)
 Set current cursor. More...
 
void tds_set_cur_dyn (TDSSOCKET *tds, TDSDYNAMIC *dyn)
 Set current dynamic. More...
 
const char * tds_skip_comment (const char *s)
 Skip a comment in a query. More...
 
static const char * tds_skip_comment_ucs2le (const char *s, const char *end)
 Skip a comment in a query. More...
 
const char * tds_skip_quoted (const char *s)
 Skip quoting string (like 'sfsf', "dflkdj" or [dfkjd]) More...
 
static const char * tds_skip_quoted_ucs2le (const char *s, const char *end)
 Return pointer to end of a quoted string. More...
 
void tds_start_query (TDSSOCKET *tds, unsigned char packet_type)
 Start query packet of a given type. More...
 
static TDSRET tds_start_query_head (TDSSOCKET *tds, unsigned char packet_type, TDSHEADERS *head)
 Start query packet of a given type. More...
 
TDSRET tds_submit_begin_tran (TDSSOCKET *tds)
 Send a rollback request. More...
 
TDSRET tds_submit_commit (TDSSOCKET *tds, int cont)
 Send a commit request. More...
 
TDSRET tds_submit_execdirect (TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head)
 Submit a prepared query with parameters. More...
 
TDSRET tds_submit_execute (TDSSOCKET *tds, TDSDYNAMIC *dyn)
 tds_submit_execute() sends a previously prepared dynamic statement to the server. More...
 
TDSRET tds_submit_optioncmd (TDSSOCKET *tds, TDS_OPTION_CMD command, TDS_OPTION option, TDS_OPTION_ARG *param, TDS_INT param_size)
 Send option commands to server. More...
 
TDSRET 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. More...
 
TDSRET tds_submit_query (TDSSOCKET *tds, const char *query)
 tds_submit_query() sends a language string to the database server for processing. More...
 
TDSRET tds_submit_query_params (TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head)
 tds_submit_query_params() sends a language string to the database server for processing. More...
 
TDSRET tds_submit_queryf (TDSSOCKET *tds, const char *queryf,...)
 Format and submit a query. More...
 
TDSRET tds_submit_rollback (TDSSOCKET *tds, int cont)
 Send a rollback request. More...
 
TDSRET tds_submit_rpc (TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params, TDSHEADERS *head)
 tds_submit_rpc() call a RPC from server. More...
 
TDSRET tds_submit_unprepare (TDSSOCKET *tds, TDSDYNAMIC *dyn)
 Send a unprepare request for a prepared query. More...
 

Variables

static const TDSCONTEXT empty_ctx = {0}
 

Detailed Description

Function to handle query.

Macro Definition Documentation

#define TDS_PUT_N_AS_UCS2 (   tds,
 
)
Value:
do { \
char buffer[sizeof(s)*2-2]; \
tds_put_smallint(tds, sizeof(buffer)/2); \
tds_put_n(tds, buffer, tds_ascii_to_ucs2(buffer, s)); \
} while(0)
static size_t tds_ascii_to_ucs2(char *buffer, const char *buf)
Accept an ASCII string, convert it to UCS2-LE The input is null-terminated, but the output excludes t...
Definition: query.c:88

Utility to convert a constant ascii string to ucs2 and send to server.

Used to send internal store procedure names to server.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
sconstanst string to send

Function Documentation

static char* tds5_fix_dot_query ( const char *  query,
size_t *  query_len,
TDSPARAMINFO params 
)
static

Substitute ?-style placeholders with named (@param) ones.

Sybase does not support ?-style placeholders so convert them. Also the function replace parameters names.

Parameters
queryquery string
[in,out]query_lenpointer to query length. On input length of input query, on output length of output query
paramsparameters to send to server
Returns
new query or NULL on error

Here is the call graph for this function:

Here is the caller graph for this function:

TDSRET tds71_submit_prepexec ( TDSSOCKET tds,
const char *  query,
const char *  id,
TDSDYNAMIC **  dyn_out,
TDSPARAMINFO params 
)

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

Parameters
tdsstate information for the socket and the TDS protocol
querylanguage query with given placeholders (?)
idstring to identify the dynamic query. Pass NULL for automatic generation.
dyn_outwill receive allocated TDSDYNAMIC*. Any older allocated dynamic won't be freed, Can be NULL.
paramsparameters to use. It can be NULL even if parameters are present. Used only for TDS7+
Returns
TDS_FAIL or TDS_SUCCESS

Here is the call graph for this function:

static char * tds7_build_param_def_from_params ( TDSSOCKET tds,
const char *  query,
size_t  query_len,
TDSPARAMINFO params,
size_t *  out_len 
)
static

Return string with parameters definition, useful for TDS7+.

Parameters
tdsstate information for the socket and the TDS protocol
queryquery to send to server encoded as ucs2
query_lenquery length in bytes
paramsparameters to build declaration
out_lenlength output buffer in bytes
Returns
allocated and filled string or NULL on failure (coded in ucs2le charset )

Here is the call graph for this function:

Here is the caller graph for this function:

static char * tds7_build_param_def_from_query ( TDSSOCKET tds,
const char *  converted_query,
size_t  converted_query_len,
TDSPARAMINFO params,
size_t *  out_len 
)
static

Return string with parameters definition, useful for TDS7+ Looks like "@P1 INT, @P2 VARCHAR(100)".

Parameters
tdsstate information for the socket and the TDS protocol
converted_queryquery to send to server in ucs2 encoding
converted_query_lenquery length in bytes
paramsparameters to build declaration
out_lenlength output buffer in bytes
Returns
allocated and filled string or NULL on failure (coded in ucs2le charset )

Here is the call graph for this function:

Here is the caller graph for this function:

static void tds7_put_params_definition ( TDSSOCKET tds,
const char *  param_definition,
size_t  param_length 
)
static

Send parameter definition to server.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
param_definitionparameter definition string. Encoded in ucs2
param_lengthparameter definition string length in bytes

Here is the caller graph for this function:

static void tds7_put_query_params ( TDSSOCKET tds,
const char *  query,
size_t  query_len 
)
static

Output params types and query (required by sp_prepare/sp_executesql/sp_prepexec)

Parameters
tdsstate information for the socket and the TDS protocol
queryquery (in ucs2le codings)
query_lenquery length in bytes

Here is the call graph for this function:

Here is the caller graph for this function:

static void tds7_send_execute ( TDSSOCKET tds,
TDSDYNAMIC dyn 
)
static

Send dynamic request on TDS 7+ to be executed.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
dyndynamic query to execute

Here is the call graph for this function:

Here is the caller graph for this function:

static size_t tds_ascii_to_ucs2 ( char *  buffer,
const char *  buf 
)
static

Accept an ASCII string, convert it to UCS2-LE The input is null-terminated, but the output excludes the null.

Parameters
bufferbuffer where to store output
bufstring to write
Returns
bytes written

Here is the caller graph for this function:

const char* tds_convert_string ( TDSSOCKET tds,
TDSICONV char_conv,
const char *  s,
int  len,
size_t *  out_len 
)

Convert a string in an allocated buffer.

Parameters
tdsstate information for the socket and the TDS protocol
char_convinformation about the encodings involved
sinput string
leninput string length (in bytes), -1 for null terminated
out_lenreturned output length (in bytes)
Returns
string allocated (or input pointer if no conversion required) or NULL if error

Here is the call graph for this function:

Here is the caller graph for this function:

int tds_count_placeholders ( const char *  query)

Count the number of placeholders in query.

Parameters
queryquery string

Here is the call graph for this function:

Here is the caller graph for this function:

static int tds_count_placeholders_ucs2le ( const char *  query,
const char *  query_end 
)
static

Count number of placeholders (?) in a query.

Parameters
queryquery encoded in ucs2
query_endend of query
Returns
number of placeholders found

Here is the call graph for this function:

Here is the caller graph for this function:

static int tds_cursor_check_allocated ( TDSCONNECTION conn,
TDSCURSOR cursor 
)
static

Check if a cursor is allocated into the server.

If not is allocated it assure is removed from the connection list

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
Returns
0 if not allocated <>0 otherwise

Here is the caller graph for this function:

TDSRET tds_deferred_cursor_dealloc ( TDSCONNECTION conn,
TDSCURSOR cursor 
)

Deallocate cursor on idle.

This let libTDS close the cursor when possible.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
cursorcursor to close

Here is the call graph for this function:

TDSRET tds_deferred_unprepare ( TDSCONNECTION conn,
TDSDYNAMIC dyn 
)

Unprepare dynamic on idle.

This let libTDS close the prepared statement when possible.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
dyndynamic request to close

Here is the call graph for this function:

TDSRET tds_get_column_declaration ( TDSSOCKET tds,
TDSCOLUMN curcol,
char *  out 
)

Return declaration for column (like "varchar(20)")

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
curcolcolumn
outbuffer to hold declaration
Returns
TDS_FAIL or TDS_SUCCESS

Here is the call graph for this function:

Here is the caller graph for this function:

int tds_needs_unprepare ( TDSCONNECTION conn,
TDSDYNAMIC dyn 
)

Check if dynamic request must be unprepared.

Depending on status and protocol version request should be unprepared or not.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
dyndynamic request to check

Here is the caller graph for this function:

const char* tds_next_placeholder ( const char *  start)

Get position of next placeholder.

Parameters
startpointer to part of query to search
Returns
next placeholder or NULL if not found

Here is the call graph for this function:

Here is the caller graph for this function:

static const char* tds_next_placeholder_ucs2le ( const char *  start,
const char *  end,
int  named 
)
static

Found the next placeholder (? or @param) in a string.

String must be encoded in ucs2.

Parameters
startstart of the string (or part of it)
endend of string
namedtrue if named parameters should be returned
Returns
either start of next placeholder or end if not found

Here is the call graph for this function:

Here is the caller graph for this function:

static TDSRET tds_put_data ( TDSSOCKET tds,
TDSCOLUMN curcol 
)
inlinestatic

Write data to wire.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
curcolcolumn where store column information
Returns
TDS_FAIL on error or TDS_SUCCESS

Here is the caller graph for this function:

static TDSRET tds_put_data_info ( TDSSOCKET tds,
TDSCOLUMN curcol,
int  flags 
)
static

Put data information to wire.

Parameters
tdsstate information for the socket and the TDS protocol
curcolcolumn where to store information
flagsbit flags on how to send data (use TDS_PUT_DATA_USE_NAME for use name information)
Returns
TDS_SUCCESS or TDS_FAIL

Here is the call graph for this function:

Here is the caller graph for this function:

static int tds_put_data_info_length ( TDSSOCKET tds,
TDSCOLUMN curcol,
int  flags 
)
static

Calc information length in bytes (useful for calculating full packet length)

Parameters
tdsstate information for the socket and the TDS protocol
curcolcolumn where to store information
flagsbit flags on how to send data (use TDS_PUT_DATA_USE_NAME for use name information)
Returns
data info length

Here is the call graph for this function:

Here is the caller graph for this function:

static TDSRET tds_put_param_as_string ( TDSSOCKET tds,
TDSPARAMINFO params,
int  n 
)
static

Send a parameter to server.

Parameters are converted to string and sent to server.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
paramsparameters structure
nnumber of parameter to send
Returns
TDS_FAIL or TDS_SUCCESS

Here is the call graph for this function:

Here is the caller graph for this function:

static void tds_put_params ( TDSSOCKET tds,
TDSPARAMINFO info,
int  flags 
)
static

Send parameters to server.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
infoparameters to send
flags0 or TDS_PUT_DATA_USE_NAME

Here is the call graph for this function:

Here is the caller graph for this function:

static TDSRET tds_query_flush_packet ( TDSSOCKET tds)
static

Flush query packet.

Used at the end of packet write to really send packet to server.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.

Here is the call graph for this function:

Here is the caller graph for this function:

static size_t tds_quote ( TDSSOCKET tds,
char *  buffer,
char  quoting,
const char *  id,
size_t  len 
)
static

Quote a string properly.

Output string is always NUL-terminated

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
bufferoutput buffer. If NULL function will just return required bytes
quotingquote character
idstring to quote
lenlength of string to quote
Returns
size of output string

Here is the caller graph for this function:

static void tds_quote_and_put ( TDSSOCKET tds,
const char *  s,
const char *  end 
)
static

Send a string to server while quoting it.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
sstring start
endstring end

Here is the call graph for this function:

Here is the caller graph for this function:

size_t tds_quote_id ( TDSSOCKET tds,
char *  buffer,
const char *  id,
int  idlen 
)

Quote an id.

Parameters
tdsstate information for the socket and the TDS protocol
bufferbuffer to store quoted id. If NULL do not write anything (useful to compute quote length)
idid to quote
idlenid length (< 0 for NUL terminated)
Returns
written chars (not including needed terminator)

Here is the call graph for this function:

Here is the caller graph for this function:

size_t tds_quote_string ( TDSSOCKET tds,
char *  buffer,
const char *  str,
int  len 
)

Quote a string.

Parameters
tdsstate information for the socket and the TDS protocol
bufferbuffer to store quoted id. If NULL do not write anything (useful to compute quote length)
strstring to quote (not necessary null-terminated)
lenlength of string (-1 for null terminated)
Returns
written chars (not including needed terminator)

Here is the call graph for this function:

TDSRET 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
tdsstate information for the socket and the TDS protocol
Remarks
tcp will either deliver the packet or time out. (TIME_WAIT determines how long it waits between retries.)

On sending the cancel, we may get EAGAIN. We then select(2) until we know either 1) it succeeded or 2) it didn't. On failure, close the socket, tell the app, and fail the function.

On success, we read(2) and wait for a reply with select(2). If we get one, great. If the client's timeout expires, we tell him, but all we can do is wait some more or give up and close the connection. If he tells us to cancel again, we wait some more.

Here is the call graph for this function:

Here is the caller graph for this function:

static TDSRET tds_send_emulated_rpc ( TDSSOCKET tds,
const char *  rpc_name,
TDSPARAMINFO params 
)
static

Send RPC as string query.

This function is used on old protocol which does not support RPC queries.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
rpc_namename of RPC to invoke
paramsparameters to send to server
Returns
TDS_FAIL or TDS_SUCCESS

Here is the call graph for this function:

Here is the caller graph for this function:

static void tds_set_cur_cursor ( TDSSOCKET tds,
TDSCURSOR cursor 
)
inlinestatic

Set current cursor.

Current cursor is the one will receive output from server.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
cursorcursor to set as current

Here is the caller graph for this function:

void tds_set_cur_dyn ( TDSSOCKET tds,
TDSDYNAMIC dyn 
)

Set current dynamic.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
dyndynamic to set

Here is the caller graph for this function:

const char* tds_skip_comment ( const char *  s)

Skip a comment in a query.

Parameters
sstart of the string (or part of it)
Returns
pointer to end of comment

Here is the caller graph for this function:

static const char* tds_skip_comment_ucs2le ( const char *  s,
const char *  end 
)
static

Skip a comment in a query.

Parameters
sstart of the string (or part of it). Encoded in ucs2
endend of string
Returns
pointer to end of comment

Here is the caller graph for this function:

const char* tds_skip_quoted ( const char *  s)

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

Parameters
spointer to first quoting character.
Should be ', " or [. 
Returns
character after quoting

Here is the caller graph for this function:

static const char* tds_skip_quoted_ucs2le ( const char *  s,
const char *  end 
)
static

Return pointer to end of a quoted string.

At the beginning pointer should point to delimiter.

Parameters
sstart of string to skip encoded in ucs2
endpointer to end of string

Here is the caller graph for this function:

void tds_start_query ( TDSSOCKET tds,
unsigned char  packet_type 
)

Start query packet of a given type.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
packet_typepacket type

Here is the call graph for this function:

Here is the caller graph for this function:

static TDSRET tds_start_query_head ( TDSSOCKET tds,
unsigned char  packet_type,
TDSHEADERS head 
)
static

Start query packet of a given type.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
packet_typepacket type
headextra information to put in a TDS7 header

Here is the call graph for this function:

Here is the caller graph for this function:

TDSRET tds_submit_begin_tran ( TDSSOCKET tds)

Send a rollback request.

TDS 7.2+ need this in order to handle transactions correctly if MARS is used.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
See also
tds_submit_commit, tds_submit_rollback

Here is the call graph for this function:

TDSRET tds_submit_commit ( TDSSOCKET tds,
int  cont 
)

Send a commit request.

TDS 7.2+ need this in order to handle transactions correctly if MARS is used.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
conttrue to start a new transaction
See also
tds_submit_rollback, tds_submit_begin_tran

Here is the call graph for this function:

TDSRET tds_submit_execdirect ( TDSSOCKET tds,
const char *  query,
TDSPARAMINFO params,
TDSHEADERS head 
)

Submit a prepared query with parameters.

Parameters
tdsstate information for the socket and the TDS protocol
querylanguage query with given placeholders (?)
paramsparameters to send
Returns
TDS_FAIL or TDS_SUCCESS

Here is the call graph for this function:

TDSRET tds_submit_execute ( TDSSOCKET tds,
TDSDYNAMIC dyn 
)

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

Parameters
tdsstate information for the socket and the TDS protocol
dyndynamic proc to execute. Must build from same tds.

Here is the call graph for this function:

TDSRET tds_submit_optioncmd ( TDSSOCKET tds,
TDS_OPTION_CMD  command,
TDS_OPTION  option,
TDS_OPTION_ARG param,
TDS_INT  param_size 
)

Send option commands to server.

Option commands are used to change server options.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
commandcommand type.
optionoption to set/get.
paramparameter value
param_sizelength of parameter value in bytes

Here is the call graph for this function:

TDSRET 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
tdsstate information for the socket and the TDS protocol
querylanguage query with given placeholders (?)
idstring to identify the dynamic query. Pass NULL for automatic generation.
dyn_outwill receive allocated TDSDYNAMIC*. Any older allocated dynamic won't be freed, Can be NULL.
paramsparameters to use. It can be NULL even if parameters are present. Used only for TDS7+
Returns
TDS_FAIL or TDS_SUCCESS

Here is the call graph for this function:

TDSRET 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
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
querylanguage query to submit
Returns
TDS_FAIL or TDS_SUCCESS

Here is the call graph for this function:

Here is the caller graph for this function:

TDSRET tds_submit_query_params ( TDSSOCKET tds,
const char *  query,
TDSPARAMINFO params,
TDSHEADERS head 
)

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
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
querylanguage query to submit
paramsparameters of query
Returns
TDS_FAIL or TDS_SUCCESS

Here is the call graph for this function:

Here is the caller graph for this function:

TDSRET tds_submit_queryf ( TDSSOCKET tds,
const char *  queryf,
  ... 
)

Format and submit a query.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
queryfquery format. printf like expansion is performed on this query.

Here is the call graph for this function:

Here is the caller graph for this function:

TDSRET tds_submit_rollback ( TDSSOCKET tds,
int  cont 
)

Send a rollback request.

TDS 7.2+ need this in order to handle transactions correctly if MARS is used.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
conttrue to start a new transaction
See also
tds_submit_begin_tran, tds_submit_commit

Here is the call graph for this function:

TDSRET tds_submit_rpc ( TDSSOCKET tds,
const char *  rpc_name,
TDSPARAMINFO params,
TDSHEADERS head 
)

tds_submit_rpc() call a RPC from server.

Output parameters will be stored in tds->param_info

Parameters
tdsstate information for the socket and the TDS protocol
rpc_namename of RPC
paramsparameters informations. NULL for no parameters

Here is the call graph for this function:

Here is the caller graph for this function:

TDSRET tds_submit_unprepare ( TDSSOCKET tds,
TDSDYNAMIC dyn 
)

Send a unprepare request for a prepared query.

Parameters
tdsstate information for the socket and the TDS protocol
dyndynamic query
Returns
TDS_SUCCESS or TDS_FAIL

Here is the call graph for this function:

Here is the caller graph for this function: