NCBI C++ ToolKit
|
Function to handle query. More...
Classes | |
struct | tds_quoteout_stream |
Macros | |
#define | TDS_PUT_N_AS_UCS2(tds, s) |
Utility to convert a constant ascii string to ucs2 and send to server. More... | |
#define | TDS_PUT_N_AS_UCS2(tds, s) |
Utility to convert a constant ascii string to ucs2 and send to server. More... | |
Typedefs | |
typedef struct tds_quoteout_stream | TDSQUOTEOUTSTREAM |
Enumerations | |
enum | { MUL_STARTED = 1 } |
enum | { MUL_STARTED = 1 } |
Functions | |
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, ssize_t len, size_t *out_len) |
Convert a string in an allocated buffer. More... | |
static TDSRET | tds_query_flush_packet (TDSSOCKET *tds) |
Flush query packet. More... | |
void | tds_set_cur_dyn (TDSSOCKET *tds, TDSDYNAMIC *dyn) |
Set current dynamic. More... | |
TDSRET | tds_submit_query (TDSSOCKET *tds, const char *query) |
tds_submit_query() sends a language string to the database server for processing. More... | |
static char * | tds5_fix_dot_query (const char *query, size_t *query_len, TDSPARAMINFO *params) |
Substitute ?-style placeholders with named (@param) ones. More... | |
static TDSRET | tds_put_data (TDSSOCKET *tds, TDSCOLUMN *curcol) |
Write data to wire \tds. More... | |
static TDSRET | tds_start_query_head (TDSSOCKET *tds, unsigned char packet_type, TDSHEADERS *head) |
Start query packet of a given type \tds. More... | |
void | tds_start_query (TDSSOCKET *tds, unsigned char packet_type) |
Start query packet of a given type \tds. 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 \tds. More... | |
const char * | tds_skip_comment (const char *s) |
Skip a comment in a query. More... | |
const char * | tds_skip_quoted (const char *s) |
Skip quoting string (like 'sfsf', "dflkdj" or [dfkjd]) More... | |
const char * | tds_next_placeholder (const char *start) |
Get position of next placeholder. More... | |
int | tds_count_placeholders (const char *query) |
Count the number of placeholders in query. More... | |
static const char * | tds_skip_comment_ucs2le (const char *s, const char *end) |
Skip a comment in a query. More... | |
static const char * | tds_skip_quoted_ucs2le (const char *s, const char *end) |
Return pointer to end of a quoted string. 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 int | tds_count_placeholders_ucs2le (const char *query, const char *query_end) |
Count number of placeholders (?) in a query. More... | |
TDSRET | tds_get_column_declaration (TDSSOCKET *tds, TDSCOLUMN *curcol, char *out) |
Return declaration for column (like "varchar(20)") \tds. 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 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 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_put_params_definition (TDSSOCKET *tds, const char *param_definition, size_t param_length) |
Send parameter definition to server \tds. 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_execdirect (TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head) |
Submit a prepared query with parameters. 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... | |
size_t | tds_fix_column_size (TDSSOCKET *tds, TDSCOLUMN *curcol) |
Get column size for 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 int | tds7_send_execute (TDSSOCKET *tds, TDSDYNAMIC *dyn) |
Send dynamic request on TDS 7+ to be executed \tds. More... | |
TDSRET | tds_submit_execute (TDSSOCKET *tds, TDSDYNAMIC *dyn) |
tds_submit_execute() sends a previously prepared dynamic statement to the server. More... | |
static int | tds_put_params (TDSSOCKET *tds, TDSPARAMINFO *info, int flags) |
Send parameters to server. More... | |
int | tds_needs_unprepare (TDSCONNECTION *conn, TDSDYNAMIC *dyn) |
Check if dynamic request must be unprepared. More... | |
TDSRET | tds_deferred_unprepare (TDSCONNECTION *conn, TDSDYNAMIC *dyn) |
Unprepare dynamic on idle. More... | |
TDSRET | tds_submit_unprepare (TDSSOCKET *tds, TDSDYNAMIC *dyn) |
Send a unprepare request for a prepared query. More... | |
static TDSRET | tds_send_emulated_rpc (TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params) |
Send RPC as string query. 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_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 size_t | tds_quote (TDSSOCKET *tds, char *buffer, char quoting, const char *id, size_t len) |
Quote a string properly. More... | |
size_t | tds_quote_id (TDSSOCKET *tds, char *buffer, const char *id, ssize_t idlen) |
Quote an id. More... | |
size_t | tds_quote_string (TDSSOCKET *tds, char *buffer, const char *str, ssize_t len) |
Quote a string. More... | |
static void | tds_set_cur_cursor (TDSSOCKET *tds, TDSCURSOR *cursor) |
Set current cursor. More... | |
TDSRET | tds_cursor_declare (TDSSOCKET *tds, TDSCURSOR *cursor, TDSPARAMINFO *params, int *something_to_send) |
TDSRET | tds_cursor_open (TDSSOCKET *tds, TDSCURSOR *cursor, TDSPARAMINFO *params, int *something_to_send) |
TDSRET | tds_cursor_setrows (TDSSOCKET *tds, TDSCURSOR *cursor, int *something_to_send) |
static void | tds7_put_cursor_fetch (TDSSOCKET *tds, TDS_INT cursor_id, TDS_TINYINT fetch_type, TDS_INT i_row, TDS_INT num_rows) |
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_close (TDSSOCKET *tds, TDSCURSOR *cursor) |
TDSRET | tds_cursor_setname (TDSSOCKET *tds, TDSCURSOR *cursor) |
TDSRET | tds_cursor_update (TDSSOCKET *tds, TDSCURSOR *cursor, TDS_CURSOR_OPERATION op, TDS_INT i_row, TDSPARAMINFO *params) |
static int | tds_cursor_check_allocated (TDSCONNECTION *conn, TDSCURSOR *cursor) |
Check if a cursor is allocated into the server. More... | |
TDSRET | tds_cursor_dealloc (TDSSOCKET *tds, TDSCURSOR *cursor) |
Send a deallocation request to server. More... | |
TDSRET | tds_deferred_cursor_dealloc (TDSCONNECTION *conn, TDSCURSOR *cursor) |
Deallocate cursor on idle. More... | |
static void | tds_quote_and_put (TDSSOCKET *tds, const char *s, const char *end) |
Send a string to server while quoting it. More... | |
static TDSRET | tds_put_param_as_string (TDSSOCKET *tds, TDSPARAMINFO *params, int n) |
Send a parameter to server. More... | |
static TDSRET | tds_send_emulated_execute (TDSSOCKET *tds, const char *query, TDSPARAMINFO *params) |
Emulate prepared execute traslating to a normal language. More... | |
TDSRET | tds_multiple_init (TDSSOCKET *tds, TDSMULTIPLE *multiple, TDS_MULTIPLE_TYPE type, TDSHEADERS *head) |
TDSRET | tds_multiple_done (TDSSOCKET *tds, TDSMULTIPLE *multiple) |
TDSRET | tds_multiple_query (TDSSOCKET *tds, TDSMULTIPLE *multiple, const char *query, TDSPARAMINFO *params) |
TDSRET | tds_multiple_execute (TDSSOCKET *tds, TDSMULTIPLE *multiple, TDSDYNAMIC *dyn) |
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_begin_tran (TDSSOCKET *tds) |
Send a rollback request. More... | |
TDSRET | tds_submit_rollback (TDSSOCKET *tds, int cont) |
Send a rollback request. More... | |
TDSRET | tds_submit_commit (TDSSOCKET *tds, int cont) |
Send a commit request. More... | |
TDSRET | tds_disconnect (TDSSOCKET *tds) |
static const char * | tds50_char_declaration_from_usertype (TDSSOCKET *tds, TDS_INT usertype, unsigned int *p_size) |
static TDSRET | tds7_write_param_def_from_query (TDSSOCKET *tds, const char *converted_query, size_t converted_query_len, TDSPARAMINFO *params) |
Write string with parameters definition, useful for TDS7+. More... | |
static TDSRET | tds7_write_param_def_from_params (TDSSOCKET *tds, const char *query, size_t query_len, TDSPARAMINFO *params) |
Write string with parameters definition, useful for TDS7+. More... | |
static TDSRET | tds5_put_params (TDSSOCKET *tds, TDSPARAMINFO *info, int flags) |
Send parameters to server. More... | |
static TDSRET | tds4_send_emulated_rpc (TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params) |
Send RPC as string query. More... | |
static size_t | tds_quote (char *buffer, char quoting, const char *id, size_t len) |
Quote a string properly. More... | |
size_t | tds_quote_id_rpc (TDSSOCKET *tds, char *buffer, const char *id, ssize_t idlen) |
Quote an id for a RPC call. More... | |
static int | tds_quoteout_stream_write (TDSOUTSTREAM *stream, size_t len) |
static void | tds_quoteout_stream_init (TDSQUOTEOUTSTREAM *stream, TDSSOCKET *tds) |
static TDSRET | tds_put_char_param_as_string (TDSSOCKET *tds, const TDSCOLUMN *curcol) |
TDSRET | tds_submit_rollback (TDSSOCKET *tds, bool cont) |
Send a rollback request. More... | |
TDSRET | tds_submit_commit (TDSSOCKET *tds, bool cont) |
Send a commit request. More... | |
Variables | |
static const TDSCONTEXT | empty_ctx = {0} |
static const TDSCONTEXT | empty_ctx = {0} |
Function to handle query.
#define TDS_PUT_N_AS_UCS2 | ( | tds, | |
s | |||
) |
Utility to convert a constant ascii string to ucs2 and send to server.
Used to send internal store procedure names to server. \tds
s | constanst string to send |
#define TDS_PUT_N_AS_UCS2 | ( | tds, | |
s | |||
) |
Utility to convert a constant ascii string to ucs2 and send to server.
Used to send internal store procedure names to server. \tds
s | constanst string to send |
typedef struct tds_quoteout_stream TDSQUOTEOUTSTREAM |
|
static |
Send RPC as string query.
This function is used on old protocol which does not support RPC queries. \tds
rpc_name | name of RPC to invoke |
params | parameters to send to server |
Definition at line 1933 of file query.c.
References buf, tds_column::column_name, tds_column::column_output, tds_result_info::columns, i, n, tds_result_info::num_cols, tds, tds_dstr_cstr(), tds_dstr_isempty(), tds_dstr_len(), tds_get_column_declaration(), tds_put_param_as_string(), tds_put_string, and tds_query_flush_packet().
Referenced by tds_submit_rpc().
|
static |
Definition at line 709 of file query.c.
References tds_socket::conn, tds_connection::ncharsize, NULL, tds, USER_CHAR_TYPE, USER_NCHAR_TYPE, USER_NVARCHAR_TYPE, USER_SYSNAME_TYPE, and USER_VARCHAR_TYPE.
Referenced by tds_get_column_declaration().
|
static |
Substitute ?-style placeholders with named (@param) ones.
Sybase does not support ?-style placeholders so convert them. Also the function replace parameters names.
query | query string | |
[in,out] | query_len | pointer to query length. On input length of input query, on output length of output query |
params | parameters to send to server |
Definition at line 229 of file query.c.
References tds_column::column_name, tds_result_info::columns, free(), i, len, NULL, tds_result_info::num_cols, out(), query, ncbi::grid::netcache::search::fields::size, tds_dstr_copy(), tds_new, tds_next_placeholder(), and TDS_RESIZE.
Referenced by tds_submit_query_params().
|
static |
Send parameters to server.
\tds
info | parameters to send |
flags | 0 or TDS_PUT_DATA_USE_NAME |
Definition at line 1753 of file query.c.
References CHECK_PARAMINFO_EXTRA, CHECK_TDS_EXTRA, tds_socket::conn, flags, i, info, tds, TDS5_PARAMFMT2_TOKEN, TDS5_PARAMFMT_TOKEN, TDS5_PARAMS_TOKEN, tds_capability_has_req, TDS_FAIL, tds_freeze, tds_freeze_abort, tds_freeze_close, tds_freeze_written, TDS_PROPAGATE, tds_put_byte, tds_put_data(), tds_put_data_info(), TDS_PUT_DATA_LONG_STATUS, tds_put_smallint, TDS_REQ_WIDETABLE, and TDS_SUCCESS.
Referenced by tds_submit_execdirect(), tds_submit_execute(), tds_submit_query_params(), and tds_submit_rpc().
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.
Creates a temporary stored procedure in the server and execute it.
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. |
params | parameters to use. It can be NULL even if parameters are present. Used only for TDS7+ |
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. |
params | parameters to use. It can be NULL even if parameters are present. |
Definition at line 1478 of file query.c.
References tds_connection::char_convs, CHECK_PARAMINFO_EXTRA, CHECK_TDS_EXTRA, client2ucs2, tds_result_info::columns, tds_socket::conn, tds_socket::current_op, failure, free(), i, int, IS_TDS71_PLUS, IS_TDS7_PLUS, NULL, tds_result_info::num_cols, query, SYBINTN, tds, tds7_build_param_def_from_query(), tds7_put_params_definition(), tds7_put_query_params(), tds7_write_param_def_from_query(), tds_alloc_dynamic, tds_convert_string(), tds_convert_string_free, tds_dynamic_deallocated, TDS_FAIL, TDS_FAILED, tds_freeze, tds_freeze_abort, tds_freeze_close, TDS_IDLE, TDS_OP_PREPEXEC, TDS_PROPAGATE, tds_put_byte, tds_put_data(), tds_put_data_info(), TDS_PUT_N_AS_UCS2, tds_put_smallint, tds_query_flush_packet(), tds_release_dynamic, TDS_RPC, tds_set_cur_dyn(), tds_set_state, TDS_SP_PREPEXEC, tds_start_query(), TDS_SUCCEED, and TDS_WRITING.
|
static |
Return string with parameters definition, useful for TDS7+.
tds | state information for the socket and the TDS protocol |
query | query to send to server encoded as ucs2 |
query_len | query length in bytes |
params | parameters to build declaration |
out_len | length output buffer in bytes |
Definition at line 993 of file query.c.
References assert, tds_connection::char_convs, CHECK_PARAMINFO_EXTRA, CHECK_TDS_EXTRA, client2ucs2, tds_column::column_name, tds_result_info::columns, tds_socket::conn, free(), i, IS_TDS7_PLUS, isalnum(), l(), len, NULL, tds_result_info::num_cols, query, ncbi::grid::netcache::search::fields::size, tdsiconvinfo::suppress, tds, tds_ascii_to_ucs2(), tds_dstr_cstr(), tds_dstr_isempty(), tds_dstr_len(), tds_get_column_declaration(), tds_iconv, tds_new, tds_new0, tds_next_placeholder_ucs2le(), TDS_RESIZE, and to_server.
Referenced by tds_submit_query_params().
|
static |
Return string with parameters definition, useful for TDS7+ Looks like "@P1 INT, @P2 VARCHAR(100)".
tds | state information for the socket and the TDS protocol |
converted_query | query to send to server in ucs2 encoding |
converted_query_len | query length in bytes |
params | parameters to build declaration |
out_len | length output buffer in bytes |
Definition at line 929 of file query.c.
References assert, CHECK_PARAMINFO_EXTRA, CHECK_TDS_EXTRA, tds_result_info::columns, tds_socket::conn, count, free(), i, IS_TDS7_PLUS, len, NULL, ncbi::grid::netcache::search::fields::size, strcat, tds, tds_ascii_to_ucs2(), tds_count_placeholders_ucs2le(), TDS_FAILED, tds_get_column_declaration(), tds_new, and TDS_RESIZE.
Referenced by tds71_submit_prepexec(), tds_cursor_open(), tds_submit_execdirect(), tds_submit_prepare(), and tds_submit_query_params().
|
static |
Definition at line 2605 of file query.c.
References tds_socket::conn, IS_TDS71_PLUS, SYBINTN, tds, tds_put_byte, tds_put_int, TDS_PUT_N_AS_UCS2, tds_put_smallint, and TDS_SP_CURSORFETCH.
Referenced by tds_cursor_fetch().
|
static |
Send parameter definition to server \tds.
param_definition | parameter definition string. Encoded in ucs2 |
param_length | parameter definition string length in bytes |
Definition at line 1158 of file query.c.
References CHECK_TDS_EXTRA, tds_connection::collation, tds_socket::conn, IS_TDS71_PLUS, SYBNTEXT, tds, tds_put_byte, TDS_PUT_INT, and tds_put_n.
Referenced by tds71_submit_prepexec(), tds_cursor_open(), tds_submit_execdirect(), tds_submit_prepare(), and tds_submit_query_params().
Output params types and query (required by sp_prepare/sp_executesql/sp_prepexec)
tds | state information for the socket and the TDS protocol |
query | query (in ucs2le codings) |
query_len | query length in bytes |
Definition at line 1107 of file query.c.
References assert, buf, CHECK_TDS_EXTRA, tds_connection::collation, tds_socket::conn, i, IS_TDS71_PLUS, IS_TDS7_PLUS, len, query, SYBNTEXT, tds, tds_count_placeholders_ucs2le(), tds_next_placeholder_ucs2le(), tds_put_byte, TDS_PUT_INT, tds_put_n, and tds_put_string.
Referenced by tds71_submit_prepexec(), tds_cursor_open(), tds_submit_execdirect(), tds_submit_prepare(), and tds_submit_query_params().
|
static |
Send dynamic request on TDS 7+ to be executed \tds.
dyn | dynamic query to execute |
Definition at line 1713 of file query.c.
References tds_socket::current_op, i, info, tds_dynamic::num_id, tds_dynamic::params, SYBINTN, tds, TDS_FAIL, TDS_FAILED, TDS_OP_EXECUTE, tds_put_byte, tds_put_data(), tds_put_data_info(), tds_put_int, TDS_PUT_N_AS_UCS2, tds_put_smallint, and TDS_SUCCESS.
Referenced by tds_multiple_execute(), and tds_submit_execute().
|
static |
Write string with parameters definition, useful for TDS7+.
Looks like "@P1 INT, @P2 VARCHAR(100)"
tds | state information for the socket and the TDS protocol |
query | query to send to server encoded in ucs2le |
query_len | query length in bytes |
params | parameters to build declaration |
Definition at line 1019 of file query.c.
References assert, CHECK_PARAMINFO_EXTRA, CHECK_TDS_EXTRA, tds_connection::collation, tds_column::column_name, tds_result_info::columns, tds_socket::conn, free(), i, IS_TDS71_PLUS, IS_TDS7_PLUS, isalnum(), len, NULL, tds_result_info::num_cols, query, SYBNTEXT, tds, tds_dstr_cstr(), tds_dstr_isempty(), tds_dstr_len(), TDS_FAIL, tds_freeze, tds_freeze_abort, tds_freeze_close_len, tds_freeze_written, tds_get_column_declaration(), tds_new0, tds_next_placeholder_ucs2le(), tds_put_byte, tds_put_n, tds_put_smallint, tds_put_string, and TDS_SUCCESS.
Referenced by tds_submit_query_params().
|
static |
Write string with parameters definition, useful for TDS7+.
Looks like "@P1 INT, @P2 VARCHAR(100)"
tds | state information for the socket and the TDS protocol |
converted_query | query to send to server in ucs2le encoding |
converted_query_len | query length in bytes |
params | parameters to build declaration |
Definition at line 958 of file query.c.
References assert, CHECK_PARAMINFO_EXTRA, CHECK_TDS_EXTRA, tds_connection::collation, tds_result_info::columns, tds_socket::conn, count, i, IS_TDS71_PLUS, IS_TDS7_PLUS, tds_result_info::num_cols, SYBNTEXT, tds, tds_count_placeholders_ucs2le(), TDS_FAIL, TDS_FAILED, tds_freeze, tds_freeze_abort, tds_freeze_close_len, tds_freeze_written, tds_get_column_declaration(), tds_put_byte, tds_put_n, tds_put_string, and TDS_SUCCESS.
Referenced by tds71_submit_prepexec(), tds_cursor_open(), tds_submit_execdirect(), tds_submit_prepare(), and tds_submit_query_params().
Accept an ASCII string, convert it to UCS2-LE The input is null-terminated, but the output excludes the null.
buffer | buffer where to store output |
buf | string to write |
Definition at line 92 of file query.c.
References assert, buf, and buffer.
Referenced by tds7_build_param_def_from_params(), and tds7_build_param_def_from_query().
const char* tds_convert_string | ( | TDSSOCKET * | tds, |
TDSICONV * | char_conv, | ||
const char * | s, | ||
ssize_t | len, | ||
size_t * | out_len | ||
) |
Convert a string in an allocated buffer.
tds | state information for the socket and the TDS protocol |
char_conv | information about the encodings involved |
s | input string |
len | input string length (in bytes), -1 for null terminated |
out_len | returned output length (in bytes) |
tds | state information for the socket and the TDS protocol |
char_conv | information about the encodings involved |
s | input string |
len | input string length (in bytes), -1 for NUL-terminated |
out_len | returned output length (in bytes) |
Definition at line 127 of file query.c.
References buf, tdsiconvdir::charset, CHECK_TDS_EXTRA, tdsiconvinfo::flags, free(), tdsiconvinfo::from, len, tds_encoding::min_bytes_per_char, NULL, tdsiconvinfo::suppress, tds, TDS_ENCODING_MEMCPY, tds_iconv, tds_new, and to_server.
Referenced by tds71_submit_prepexec(), tds_cursor_open(), tds_cursor_update(), tds_put_data_info(), tds_put_param_as_string(), tds_start_query_head(), tds_submit_execdirect(), tds_submit_prepare(), tds_submit_query_params(), and tds_submit_rpc().
Count the number of placeholders in query.
Count the number of placeholders ('?') in a query.
query | query string |
Definition at line 604 of file query.c.
References count, query, and tds_next_placeholder().
Referenced by tds_send_emulated_execute().
Count number of placeholders (?) in a query.
query | query encoded in ucs2 |
query_end | end of query |
Definition at line 724 of file query.c.
References count, query, and tds_next_placeholder_ucs2le().
Referenced by tds7_build_param_def_from_query(), tds7_put_query_params(), and tds_submit_query_params().
|
static |
Check if a cursor is allocated into the server.
If not is allocated it assure is removed from the connection list \tds
Definition at line 3102 of file query.c.
References conn, IS_TDS7_PLUS, tds_cursor::srv_status, TDS_CUR_ISTAT_CLOSED, TDS_CUR_ISTAT_DEALLOC, TDS_CUR_ISTAT_UNUSED, and tds_cursor_deallocated.
Referenced by tds_cursor_dealloc(), and tds_deferred_cursor_dealloc().
Definition at line 2855 of file query.c.
References CHECK_TDS_EXTRA, tds_socket::conn, tds_socket::current_op, tds_cursor::cursor_id, tds_cursor_status::dealloc, IS_TDS50, IS_TDS71_PLUS, IS_TDS7_PLUS, tds_socket::out_flag, tds_cursor::status, SYBINTN, tds, TDS_CURCLOSE_TOKEN, TDS_CURSOR_STATE_REQUESTED, TDS_CURSOR_STATE_SENT, TDS_DBG_INFO1, TDS_FAIL, TDS_NORMAL, TDS_OP_CURSORCLOSE, tds_put_byte, tds_put_int, TDS_PUT_N_AS_UCS2, tds_put_smallint, tds_query_flush_packet(), TDS_RPC, tds_set_cur_cursor(), tds_set_state, TDS_SP_CURSORCLOSE, tds_start_query(), TDS_WRITING, and tdsdump_log.
Send a deallocation request to server.
Definition at line 3117 of file query.c.
References CHECK_TDS_EXTRA, tds_socket::conn, tds_cursor::cursor_id, tds_cursor_status::dealloc, IS_TDS50, IS_TDS7_PLUS, tds_socket::out_flag, tds_cursor::status, tds, TDS_CURCLOSE_TOKEN, tds_cursor_check_allocated(), TDS_CURSOR_STATE_REQUESTED, TDS_CURSOR_STATE_SENT, TDS_DBG_ERROR, TDS_DBG_INFO1, TDS_FAIL, TDS_NORMAL, tds_put_byte, tds_put_int, tds_put_smallint, tds_query_flush_packet(), tds_set_cur_cursor(), tds_set_state, TDS_SUCCESS, TDS_WRITING, and tdsdump_log.
TDSRET tds_cursor_declare | ( | TDSSOCKET * | tds, |
TDSCURSOR * | cursor, | ||
TDSPARAMINFO * | params, | ||
int * | something_to_send | ||
) |
Definition at line 2367 of file query.c.
References CHECK_TDS_EXTRA, tds_socket::conn, tds_cursor::cursor_id, tds_cursor::cursor_name, IS_TDS50, IS_TDS7_PLUS, tds_socket::out_flag, tds_cursor::query, tds_cursor::srv_status, tds_socket::state, tds, TDS_CUR_ISTAT_CLOSED, TDS_CUR_ISTAT_DECLARED, TDS_CUR_ISTAT_RDONLY, TDS_CURDECLARE_TOKEN, TDS_DBG_ERROR, TDS_DBG_INFO1, TDS_END_LEN, TDS_FAIL, TDS_NORMAL, TDS_PUT_BYTE, tds_put_byte, tds_put_n, TDS_PUT_SMALLINT, tds_put_string, tds_put_tinyint, tds_set_state, TDS_START_LEN_TINYINT, TDS_START_LEN_USMALLINT, TDS_SUCCESS, TDS_WRITING, and tdsdump_log.
TDSRET tds_cursor_fetch | ( | TDSSOCKET * | tds, |
TDSCURSOR * | cursor, | ||
TDS_CURSOR_FETCH | fetch_type, | ||
TDS_INT | i_row | ||
) |
Definition at line 2659 of file query.c.
References CHECK_TDS_EXTRA, tds_socket::conn, tds_socket::current_op, tds_cursor::cursor_id, tds_cursor::cursor_name, tds_cursor::cursor_rows, IS_TDS50, IS_TDS72_PLUS, IS_TDS7_PLUS, len, tds_socket::out_flag, tds, tds7_put_cursor_fetch(), TDS_CURFETCH_TOKEN, TDS_CURSOR_FETCH_ABSOLUTE, TDS_CURSOR_FETCH_RELATIVE, TDS_DBG_INFO1, TDS_FAIL, TDS_IDLE, TDS_NORMAL, TDS_OP_CURSORFETCH, TDS_PUT_BYTE, tds_put_byte, tds_put_int, tds_put_n, TDS_PUT_SMALLINT, tds_put_tinyint, tds_query_flush_packet(), TDS_RPC, tds_set_cur_cursor(), tds_set_state, tds_start_query(), TDS_SUCCESS, TDS_WRITING, tdsdump_log, and tds_cursor::type.
TDSRET tds_cursor_get_cursor_info | ( | TDSSOCKET * | tds, |
TDSCURSOR * | cursor, | ||
TDS_UINT * | prow_number, | ||
TDS_UINT * | prow_count | ||
) |
Definition at line 2738 of file query.c.
References assert, CHECK_TDS_EXTRA, tds_column::column_data, tds_column::column_size, tds_column::column_type, tds_result_info::columns, tds_socket::conn, tds_socket::current_op, tds_socket::current_results, tds_cursor::cursor_id, tds_socket::has_status, IS_TDS71_PLUS, IS_TDS7_PLUS, tds_result_info::num_cols, tds_column::on_server, tds_socket::ret_status, SYBINTN, tds, TDS_DBG_FUNC, TDS_DBG_INFO1, TDS_DONE_COUNT, TDS_DONE_ERROR, TDS_FAIL, TDS_FAILED, TDS_NO_MORE_RESULTS, TDS_OP_NONE, TDS_PARAM_RESULT, tds_process_tokens, TDS_PROPAGATE, tds_put_byte, tds_put_int, TDS_PUT_N_AS_UCS2, tds_put_smallint, tds_query_flush_packet(), TDS_RETURN_PROC, TDS_RPC, tds_set_cur_cursor(), tds_set_state, TDS_SP_CURSORFETCH, tds_start_query(), TDS_SUCCESS, TDS_WRITING, and tdsdump_log.
TDSRET tds_cursor_open | ( | TDSSOCKET * | tds, |
TDSCURSOR * | cursor, | ||
TDSPARAMINFO * | params, | ||
int * | something_to_send | ||
) |
Definition at line 2414 of file query.c.
References tds_connection::char_convs, CHECK_TDS_EXTRA, client2ucs2, tds_connection::collation, tds_result_info::columns, tds_cursor::concurrency, tds_socket::conn, tds_socket::current_op, tds_cursor::cursor_id, tds_cursor::cursor_name, free(), i, IS_TDS50, IS_TDS71_PLUS, IS_TDS7_PLUS, NULL, tds_result_info::num_cols, tds_socket::out_flag, tds_cursor::query, tds_socket::state, SYBINTN, SYBNTEXT, tds, tds7_build_param_def_from_query(), tds7_put_params_definition(), tds7_put_query_params(), tds7_write_param_def_from_query(), tds_convert_string(), tds_convert_string_free, TDS_CUROPEN_TOKEN, TDS_DBG_ERROR, TDS_DBG_INFO1, TDS_END_LEN, TDS_FAIL, TDS_FAILED, tds_freeze, tds_freeze_abort, tds_freeze_close, TDS_IDLE, TDS_NORMAL, TDS_OP_CURSOROPEN, TDS_PUT_BYTE, tds_put_byte, tds_put_data(), tds_put_data_info(), TDS_PUT_INT, tds_put_int, tds_put_n, TDS_PUT_N_AS_UCS2, TDS_PUT_SMALLINT, tds_put_smallint, tds_put_string, TDS_RPC, tds_set_cur_cursor(), tds_set_state, TDS_SP_CURSOROPEN, TDS_START_LEN_TINYINT, TDS_START_LEN_USMALLINT, tds_start_query(), TDS_SUCCESS, TDS_WRITING, tdsdump_log, and tds_cursor::type.
Definition at line 2914 of file query.c.
References CHECK_TDS_EXTRA, tds_connection::collation, tds_socket::conn, tds_socket::current_op, tds_cursor::cursor_id, tds_cursor::cursor_name, int, IS_TDS71_PLUS, IS_TDS7_PLUS, len, SYBINTN, tds, TDS_DBG_INFO1, TDS_END_LEN, TDS_FAIL, tds_freeze, tds_freeze_close_len, tds_freeze_written, TDS_OP_CURSOROPTION, tds_put_byte, tds_put_int, tds_put_n, TDS_PUT_N_AS_UCS2, tds_put_smallint, tds_put_string, tds_query_flush_packet(), TDS_RPC, tds_set_cur_cursor(), tds_set_state, TDS_SP_CURSOROPTION, TDS_START_LEN_USMALLINT, tds_start_query(), TDS_SUCCESS, TDS_WRITING, tdsdump_log, XSYBNVARCHAR, and XSYBVARCHAR.
Definition at line 2558 of file query.c.
References CHECK_TDS_EXTRA, tds_socket::conn, tds_cursor::cursor_id, tds_cursor::cursor_name, tds_cursor::cursor_rows, IS_TDS50, IS_TDS7_PLUS, tds_socket::out_flag, tds_cursor::srv_status, tds_socket::state, tds, TDS_CUR_ISTAT_CLOSED, TDS_CUR_ISTAT_DECLARED, TDS_CUR_ISTAT_ROWCNT, TDS_CURINFO_TOKEN, TDS_DBG_INFO1, TDS_END_LEN, TDS_FAIL, TDS_NORMAL, TDS_PUT_BYTE, tds_put_byte, tds_put_int, tds_put_n, TDS_PUT_SMALLINT, tds_put_string, tds_set_cur_cursor(), tds_set_state, TDS_START_LEN_TINYINT, TDS_START_LEN_USMALLINT, TDS_SUCCESS, TDS_WRITING, and tdsdump_log.
TDSRET tds_cursor_update | ( | TDSSOCKET * | tds, |
TDSCURSOR * | cursor, | ||
TDS_CURSOR_OPERATION | op, | ||
TDS_INT | i_row, | ||
TDSPARAMINFO * | params | ||
) |
Definition at line 2979 of file query.c.
References tds_connection::char_convs, CHECK_TDS_EXTRA, client2ucs2, tds_connection::collation, tds_result_info::columns, tds_socket::conn, tds_socket::current_op, tds_cursor::cursor_id, IS_TDS50, IS_TDS71_PLUS, IS_TDS7_PLUS, n, NULL, tds_result_info::num_cols, tds_socket::out_flag, SYBINTN, tds_column::table_name, table_name, tds, tds_convert_string(), tds_convert_string_free, TDS_CURSOR_UPDATE, TDS_DBG_INFO1, tds_dstr_cstr(), tds_dstr_isempty(), TDS_END_LEN, TDS_FAIL, tds_freeze, tds_freeze_close_len, tds_freeze_written, TDS_IDLE, TDS_NORMAL, TDS_OP_CURSOR, tds_put_byte, tds_put_data(), tds_put_data_info(), TDS_PUT_DATA_PREFIX_NAME, TDS_PUT_DATA_USE_NAME, tds_put_int, tds_put_n, TDS_PUT_N_AS_UCS2, TDS_PUT_SMALLINT, tds_put_smallint, tds_put_string, tds_query_flush_packet(), TDS_RPC, tds_set_cur_cursor(), tds_set_state, TDS_SP_CURSOR, TDS_START_LEN_USMALLINT, tds_start_query(), TDS_WRITING, tdsdump_log, and XSYBNVARCHAR.
TDSRET tds_deferred_cursor_dealloc | ( | TDSCONNECTION * | conn, |
TDSCURSOR * | cursor | ||
) |
Deallocate cursor on idle.
This let libTDS close the cursor when possible. \tds
cursor | cursor to close |
Definition at line 3168 of file query.c.
References CHECK_CONN_EXTRA, CHECK_CURSOR_EXTRA, conn, tds_cursor::defer_close, tds_cursor_check_allocated(), and TDS_SUCCESS.
TDSRET tds_deferred_unprepare | ( | TDSCONNECTION * | conn, |
TDSDYNAMIC * | dyn | ||
) |
Unprepare dynamic on idle.
This let libTDS close the prepared statement when possible. \tds
dyn | dynamic request to close |
Definition at line 1893 of file query.c.
References CHECK_CONN_EXTRA, CHECK_DYNAMIC_EXTRA, conn, tds_dynamic::defer_close, tds_dynamic_deallocated, tds_needs_unprepare(), and TDS_SUCCESS.
Definition at line 3823 of file query.c.
References CHECK_TDS_EXTRA, tds_socket::conn, empty_ctx, IS_TDS50, tds_socket::out_flag, tds_socket::query_timeout, tds, TDS_DBG_FUNC, TDS_FAIL, tds_get_ctx, TDS_LOGOUT_TOKEN, TDS_NORMAL, tds_process_simple_query, tds_put_byte, tds_query_flush_packet(), tds_set_ctx, tds_set_state, TDS_SUCCESS, TDS_WRITING, and tdsdump_log.
Get column size for wire.
Definition at line 1573 of file query.c.
References tds_column::column_output, tds_column::column_size, tds_column::column_type, tds_column::column_varint_size, is_unicode_type, MAX, MIN, min(), tds_column::on_server, ncbi::grid::netcache::search::fields::size, SYBNTEXT, XSYBNCHAR, and XSYBNVARCHAR.
Referenced by tds_get_column_declaration().
Return declaration for column (like "varchar(20)") \tds.
Return declaration for column (like "varchar(20)").
curcol | column |
out | buffer to hold declaration |
This depends on:
\tds
curcol | column |
out | buffer to hold declaration |
Definition at line 743 of file query.c.
References assert, CHECK_COLUMN_EXTRA, CHECK_TDS_EXTRA, tds_column::column_prec, tds_column::column_scale, tds_column::column_size, tds_column::column_type, tds_column::column_usertype, tds_column::column_varint_size, tds_socket::conn, int, IS_TDS50, IS_TDS7_PLUS, MIN, NULL, tds_column::on_server, out(), ncbi::grid::netcache::search::fields::size, SYB5BIGDATETIME, SYB5BIGTIME, SYBBINARY, SYBBIT, SYBBITN, SYBCHAR, SYBDATE, SYBDATETIME, SYBDATETIME4, SYBDATETIMN, SYBDECIMAL, SYBFLT8, SYBFLTN, SYBIMAGE, SYBINT1, SYBINT2, SYBINT4, SYBINT8, SYBINTN, SYBLONGBINARY, SYBMONEY, SYBMONEY4, SYBMONEYN, SYBMSDATE, SYBMSDATETIME2, SYBMSDATETIMEOFFSET, SYBMSTIME, SYBNTEXT, SYBNUMERIC, SYBNVARCHAR, SYBREAL, SYBSINT1, SYBTEXT, SYBTIME, SYBUINT1, SYBUINT2, SYBUINT4, SYBUINT8, SYBUNIQUE, SYBVARBINARY, SYBVARCHAR, SYBVARIANT, SYBVOID, tds, tds50_char_declaration_from_usertype(), TDS_DBG_ERROR, TDS_FAIL, tds_fix_column_size(), tds_get_conversion_type, TDS_SUCCESS, tdsdump_log, USER_UNICHAR_TYPE, USER_UNITEXT_TYPE, USER_UNIVARCHAR_TYPE, XSYBBINARY, XSYBCHAR, XSYBNCHAR, XSYBNVARCHAR, XSYBVARBINARY, and XSYBVARCHAR.
Referenced by tds4_send_emulated_rpc(), tds7_build_param_def_from_params(), tds7_build_param_def_from_query(), tds7_write_param_def_from_params(), tds7_write_param_def_from_query(), and tds_send_emulated_rpc().
TDSRET tds_multiple_done | ( | TDSSOCKET * | tds, |
TDSMULTIPLE * | multiple | ||
) |
Definition at line 3402 of file query.c.
References assert, tds, and tds_query_flush_packet().
TDSRET tds_multiple_execute | ( | TDSSOCKET * | tds, |
TDSMULTIPLE * | multiple, | ||
TDSDYNAMIC * | dyn | ||
) |
Definition at line 3422 of file query.c.
References assert, tds_socket::conn, tds_multiple::flags, IS_TDS72_PLUS, IS_TDS7_PLUS, MUL_STARTED, tds_dynamic::params, tds_dynamic::query, tds, tds7_send_execute(), TDS_MULTIPLE_EXECUTE, tds_put_byte, tds_put_string, tds_send_emulated_execute(), TDS_SUCCESS, and tds_multiple::type.
TDSRET tds_multiple_init | ( | TDSSOCKET * | tds, |
TDSMULTIPLE * | multiple, | ||
TDS_MULTIPLE_TYPE | type, | ||
TDSHEADERS * | head | ||
) |
Definition at line 3376 of file query.c.
References tds_socket::conn, tds_multiple::flags, head, IS_TDS7_PLUS, tds, TDS_FAIL, TDS_MULTIPLE_EXECUTE, TDS_MULTIPLE_QUERY, TDS_MULTIPLE_RPC, TDS_QUERY, TDS_RPC, tds_set_state, tds_start_query_head(), TDS_SUCCESS, TDS_WRITING, tds_multiple::type, and type.
TDSRET tds_multiple_query | ( | TDSSOCKET * | tds, |
TDSMULTIPLE * | multiple, | ||
const char * | query, | ||
TDSPARAMINFO * | params | ||
) |
Definition at line 3410 of file query.c.
References assert, tds_multiple::flags, MUL_STARTED, query, tds, TDS_MULTIPLE_QUERY, tds_put_string, tds_send_emulated_execute(), and tds_multiple::type.
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. \tds
dyn | dynamic request to check |
Definition at line 1871 of file query.c.
References CHECK_CONN_EXTRA, CHECK_DYNAMIC_EXTRA, conn, tds_dynamic::emulated, tds_dynamic::id, IS_TDS7_PLUS, and tds_dynamic::num_id.
Referenced by tds_deferred_unprepare().
Get position of next placeholder.
start | pointer to part of query to search |
Definition at line 568 of file query.c.
References NULL, tds_skip_comment(), and tds_skip_quoted().
Referenced by tds5_fix_dot_query(), tds_count_placeholders(), tds_send_emulated_execute(), and tds_submit_query_params().
|
static |
Found the next placeholder (? or @param) in a string.
String must be encoded in ucs2.
start | start of the string (or part of it) |
end | end of string |
named | true if named parameters should be returned |
Definition at line 676 of file query.c.
References assert, isalnum(), prev(), tds_skip_comment_ucs2le(), and tds_skip_quoted_ucs2le().
Referenced by tds7_build_param_def_from_params(), tds7_put_query_params(), and tds_count_placeholders_ucs2le().
Definition at line 3203 of file query.c.
References tds_encoding::canonic, tds_column::char_conv, tds_connection::char_convs, tdsiconvdir::charset, client2server_chardata, client2ucs2, tds_column::column_cur_size, tds_column::column_data, tds_column::column_type, tds_socket::conn, tdsiconvinfo::from, if(), is_blob_col, IS_TDS7_PLUS, is_unicode_type, tds_column::on_server, r(), tds_quoteout_stream::stream, tds, tds_convert_stream, TDS_FAIL, tds_iconv_get_info(), tds_put_string, tds_quoteout_stream_init(), tds_staticin_stream_init, TDS_SUCCESS, and to_server.
Referenced by tds_put_param_as_string().
Write data to wire \tds.
curcol | column where store column information |
Definition at line 281 of file query.c.
References tds_column::funcs, tds_column_funcs::put_data, and tds.
Referenced by tds71_submit_prepexec(), tds7_send_execute(), tds_cursor_open(), tds_cursor_update(), tds_put_params(), tds_submit_execdirect(), tds_submit_query_params(), and tds_submit_rpc().
Put data information to wire.
tds | state information for the socket and the TDS protocol |
curcol | column where to store information |
flags | bit flags on how to send data (use TDS_PUT_DATA_USE_NAME for use name information) |
Definition at line 1619 of file query.c.
References tds_connection::char_convs, CHECK_COLUMN_EXTRA, CHECK_TDS_EXTRA, client2ucs2, tds_column::column_name, tds_column::column_output, tds_column::column_type, tds_column::column_usertype, tds_socket::conn, flags, tds_column::funcs, int, IS_TDS7_PLUS, len, tds_column::on_server, tds_column_funcs::put_info, tds, tds_convert_string(), tds_convert_string_free, TDS_DBG_ERROR, tds_dstr_cstr(), tds_dstr_len(), TDS_FAIL, TDS_PUT_BYTE, tds_put_byte, TDS_PUT_DATA_LONG_STATUS, TDS_PUT_DATA_PREFIX_NAME, TDS_PUT_DATA_USE_NAME, tds_put_int, tds_put_n, TDS_SUCCESS, and tdsdump_log.
Referenced by tds71_submit_prepexec(), tds7_send_execute(), tds_cursor_open(), tds_cursor_update(), tds_put_params(), tds_submit_execdirect(), tds_submit_query_params(), and tds_submit_rpc().
Calc information length in bytes (useful for calculating full packet length)
tds | state information for the socket and the TDS protocol |
curcol | column where to store information |
flags | bit flags on how to send data (use TDS_PUT_DATA_USE_NAME for use name information) |
Definition at line 1689 of file query.c.
References CHECK_COLUMN_EXTRA, CHECK_TDS_EXTRA, tds_column::column_name, tds_socket::conn, flags, tds_column::funcs, IS_TDS7_PLUS, len, tds_column_funcs::put_info_len, tds, TDS_DBG_ERROR, tds_dstr_len(), TDS_PUT_DATA_USE_NAME, and tdsdump_log.
Referenced by tds_put_params().
|
static |
Send a parameter to server.
Parameters are converted to string and sent to server. \tds
params | parameters structure |
n | number of parameter to send |
Definition at line 3218 of file query.c.
References assert, buf, conv_result::c, tds_column::char_conv, CHECK_PARAMINFO_EXTRA, CHECK_TDS_EXTRA, tds_column::column_cur_size, tds_column::column_data, tds_column::column_size, tds_column::column_type, tds_result_info::columns, tds_socket::conn, tdsiconvinfo::flags, free(), i, int, is_blob_col, is_blob_type, IS_TDS50_PLUS, n, SYB5BIGDATETIME, SYB5BIGTIME, SYBBINARY, SYBCHAR, SYBDATE, SYBDATETIME, SYBDATETIME4, SYBDATETIMN, SYBIMAGE, SYBMSDATE, SYBMSDATETIME2, SYBMSDATETIMEOFFSET, SYBMSTIME, SYBNTEXT, SYBNVARCHAR, SYBTEXT, SYBTIME, SYBUNIQUE, SYBVARBINARY, SYBVARCHAR, tds, tds_convert, tds_convert_string(), tds_convert_string_free, TDS_ENCODING_MEMCPY, TDS_FAIL, tds_get_conversion_type, tds_get_ctx, tds_hex_digits, tds_put_n, tds_put_string, tds_quote_and_put(), TDS_SUCCESS, XSYBBINARY, XSYBCHAR, XSYBNCHAR, XSYBNVARCHAR, XSYBVARBINARY, and XSYBVARCHAR.
Referenced by tds_send_emulated_execute(), and tds_send_emulated_rpc().
|
static |
Send parameters to server.
\tds
info | parameters to send |
flags | 0 or TDS_PUT_DATA_USE_NAME |
Definition at line 1821 of file query.c.
References CHECK_PARAMINFO_EXTRA, CHECK_TDS_EXTRA, tds_socket::conn, flags, i, info, len, tds, TDS5_PARAMFMT2_TOKEN, TDS5_PARAMFMT_TOKEN, TDS5_PARAMS_TOKEN, tds_capability_has_req, TDS_FAIL, TDS_FAILED, tds_put_byte, tds_put_data(), tds_put_data_info(), tds_put_data_info_length(), TDS_PUT_DATA_LONG_STATUS, tds_put_int, tds_put_smallint, TDS_REQ_WIDETABLE, and TDS_SUCCESS.
Referenced by tds_submit_execdirect(), tds_submit_execute(), tds_submit_query_params(), and tds_submit_rpc().
Flush query packet.
Used at the end of packet write to really send packet to server. \tds
Definition at line 181 of file query.c.
References tds, tds_flush_packet, TDS_PENDING, and tds_set_state.
Referenced by tds71_submit_prepexec(), tds_cursor_close(), tds_cursor_dealloc(), tds_cursor_fetch(), tds_cursor_get_cursor_info(), tds_cursor_setname(), tds_cursor_update(), tds_disconnect(), tds_multiple_done(), tds_send_emulated_rpc(), tds_submit_begin_tran(), tds_submit_commit(), tds_submit_execdirect(), tds_submit_execute(), tds_submit_optioncmd(), tds_submit_prepare(), tds_submit_query_params(), tds_submit_rollback(), tds_submit_rpc(), and tds_submit_unprepare().
Quote a string properly.
Output string is always NUL-terminated
buffer | output buffer. If NULL function will just return required bytes |
quoting | quote character (should be one of '\'', '"', ']') |
id | string to quote |
len | length of string to quote |
Definition at line 2188 of file query.c.
References buffer, len, and ncbi::grid::netcache::search::fields::size.
Referenced by tds_quote_id(), tds_quote_id_rpc(), and tds_quote_string().
|
static |
Quote a string properly.
Output string is always NUL-terminated \tds
buffer | output buffer. If NULL function will just return required bytes |
quoting | quote character |
id | string to quote |
len | length of string to quote |
Definition at line 2260 of file query.c.
References buffer, CHECK_TDS_EXTRA, len, ncbi::grid::netcache::search::fields::size, and tds.
Referenced by tds_quote_id(), and tds_quote_string().
Send a string to server while quoting it.
\tds
s | string start |
end | string end |
Definition at line 3190 of file query.c.
References buf, CHECK_TDS_EXTRA, i, tds, and tds_put_string.
Referenced by tds_put_param_as_string().
Quote an id.
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 (< 0 for NUL terminated) |
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 (< 0 for NUL terminated) |
Definition at line 2302 of file query.c.
References buffer, CHECK_TDS_EXTRA, tds_socket::conn, i, len, tds_connection::product_version, tds, TDS_IS_MSSQL, tds_quote(), and TDS_SYB_VER.
Quote an id for a RPC call.
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 (< 0 for NUL terminated) |
Definition at line 2274 of file query.c.
References buffer, CHECK_TDS_EXTRA, len, tds, TDS_IS_MSSQL, and tds_quote().
Quote a string.
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) |
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 NUL-terminated) |
len | length of string (-1 for NUL-terminated) |
Definition at line 2346 of file query.c.
References buffer, len, str(), tds, and tds_quote().
|
static |
Definition at line 3194 of file query.c.
References tds_output_stream::buf_len, tds_output_stream::buffer, tds_quoteout_stream::buffer, tds_quoteout_stream::stream, tds, tds_quoteout_stream::tds, tds_quoteout_stream_write(), and tds_output_stream::write.
Referenced by tds_put_char_param_as_string().
|
static |
Definition at line 3164 of file query.c.
References assert, buf, tds_quoteout_stream::buffer, tds_socket::conn, IS_TDS7_PLUS, len, QUOTE, tds, tds_quoteout_stream::tds, and TDS_HOST2LE.
Referenced by tds_quoteout_stream_init().
tds_send_cancel() sends an empty packet (8 byte header only) tds_process_cancel should be called directly after this.
tds | state information for the socket and the TDS protocol |
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.
Definition at line 2159 of file query.c.
References CHECK_TDS_EXTRA, tds_socket::conn, tds_socket::in_cancel, tds_connection::list_mtx, tds_socket::out_flag, tds_socket::out_pos, tds_socket::state, tds, TDS_CANCEL, TDS_DBG_FUNC, tds_flush_packet, TDS_IDLE, tds_mutex_trylock, tds_mutex_unlock, tds_put_cancel, TDS_SUCCESS, tds_wakeup_send, tdsdump_log, tds_connection::wakeup, and tds_socket::wire_mtx.
|
static |
Emulate prepared execute traslating to a normal language.
Definition at line 3335 of file query.c.
References assert, CHECK_TDS_EXTRA, i, tds_result_info::num_cols, query, tds, tds_count_placeholders(), TDS_FAIL, tds_next_placeholder(), tds_put_param_as_string(), tds_put_string, TDS_QUERY, tds_start_query(), and TDS_SUCCESS.
Referenced by tds_multiple_execute(), tds_multiple_query(), tds_submit_execdirect(), and tds_submit_execute().
|
static |
Send RPC as string query.
This function is used on old protocol which does not support RPC queries. \tds
rpc_name | name of RPC to invoke |
params | parameters to send to server |
Definition at line 1994 of file query.c.
References buf, tds_column::column_name, tds_column::column_output, tds_result_info::columns, i, n, tds_result_info::num_cols, tds, tds_dstr_cstr(), tds_dstr_isempty(), tds_dstr_len(), tds_get_column_declaration(), tds_put_param_as_string(), tds_put_string, and tds_query_flush_packet().
Referenced by tds_submit_rpc().
Set current cursor.
Current cursor is the one will receive output from server. \tds
cursor | cursor to set as current |
Definition at line 2358 of file query.c.
References tds_socket::cur_cursor, tds_cursor::ref_count, tds, and tds_release_cursor.
Referenced by tds_cursor_close(), tds_cursor_dealloc(), tds_cursor_fetch(), tds_cursor_get_cursor_info(), tds_cursor_open(), tds_cursor_setname(), tds_cursor_setrows(), and tds_cursor_update().
void tds_set_cur_dyn | ( | TDSSOCKET * | tds, |
TDSDYNAMIC * | dyn | ||
) |
Set current dynamic.
\tds
dyn | dynamic to set |
Definition at line 194 of file query.c.
References tds_socket::cur_dyn, tds_dynamic::ref_count, tds, and tds_release_cur_dyn().
Referenced by tds71_submit_prepexec(), tds_submit_execute(), tds_submit_prepare(), and tds_submit_unprepare().
Skip a comment in a query.
s | start of the string (or part of it) |
Definition at line 523 of file query.c.
Referenced by tds_next_placeholder().
Skip a comment in a query.
s | start of the string (or part of it). Encoded in ucs2 |
end | end of string |
Definition at line 622 of file query.c.
Referenced by tds_next_placeholder_ucs2le(), and test_generic().
Skip quoting string (like 'sfsf', "dflkdj" or [dfkjd])
s | pointer to first quoting character.Should be ', " or [. |
Definition at line 548 of file query.c.
Referenced by tds_next_placeholder().
Return pointer to end of a quoted string.
At the beginning pointer should point to delimiter.
s | start of string to skip encoded in ucs2 |
end | pointer to end of string |
Definition at line 650 of file query.c.
References assert.
Referenced by tds_next_placeholder_ucs2le(), and test_generic().
void tds_start_query | ( | TDSSOCKET * | tds, |
unsigned char | packet_type | ||
) |
Start query packet of a given type \tds.
packet_type | packet type |
Definition at line 351 of file query.c.
References NULL, tds, and tds_start_query_head().
Referenced by tds71_submit_prepexec(), tds_cursor_close(), tds_cursor_fetch(), tds_cursor_get_cursor_info(), tds_cursor_open(), tds_cursor_setname(), tds_cursor_update(), tds_send_emulated_execute(), tds_submit_begin_tran(), tds_submit_commit(), tds_submit_execute(), tds_submit_prepare(), tds_submit_rollback(), and tds_submit_unprepare().
|
static |
Start query packet of a given type \tds.
packet_type | packet type |
head | extra information to put in a TDS7 header |
Definition at line 293 of file query.c.
References tds_connection::char_convs, client2ucs2, tds_socket::conn, head, int, IS_TDS72_PLUS, NULL, tds_socket::out_flag, tds, tds_connection::tds72_transaction, tds_convert_string(), tds_convert_string_free, TDS_FAIL, TDS_IDLE, tds_put_int, tds_put_n, tds_put_smallint, tds_set_state, and TDS_SUCCESS.
Referenced by tds_multiple_init(), tds_start_query(), tds_submit_execdirect(), tds_submit_query_params(), and tds_submit_rpc().
Send a rollback request.
TDS 7.2+ need this in order to handle transactions correctly if MARS is used. \tds
Definition at line 3738 of file query.c.
References CHECK_TDS_EXTRA, tds_socket::conn, IS_TDS72_PLUS, tds, TDS7_TRANS, TDS_FAIL, tds_put_byte, tds_put_smallint, tds_query_flush_packet(), tds_set_state, tds_start_query(), tds_submit_query(), and TDS_WRITING.
Send a commit request.
TDS 7.2+ need this in order to handle transactions correctly if MARS is used. \tds
cont | true to start a new transaction |
Definition at line 3783 of file query.c.
References CHECK_TDS_EXTRA, tds_socket::conn, IS_TDS72_PLUS, tds, TDS7_TRANS, TDS_FAIL, tds_put_byte, tds_put_smallint, tds_query_flush_packet(), tds_set_state, tds_start_query(), tds_submit_query(), and TDS_WRITING.
Send a commit request.
TDS 7.2+ need this in order to handle transactions correctly if MARS is used. \tds
cont | true to start a new transaction |
Definition at line 3797 of file query.c.
References CHECK_TDS_EXTRA, tds_socket::conn, IS_TDS72_PLUS, tds, TDS7_TRANS, TDS_FAIL, tds_put_byte, tds_put_smallint, tds_query_flush_packet(), tds_set_state, tds_start_query(), tds_submit_query(), and TDS_WRITING.
TDSRET tds_submit_execdirect | ( | TDSSOCKET * | tds, |
const char * | query, | ||
TDSPARAMINFO * | params, | ||
TDSHEADERS * | head | ||
) |
Submit a prepared query with parameters.
tds | state information for the socket and the TDS protocol |
query | language query with given placeholders (?) |
params | parameters to send |
Definition at line 1326 of file query.c.
References tds_connection::char_convs, CHECK_PARAMINFO_EXTRA, CHECK_TDS_EXTRA, client2ucs2, tds_result_info::columns, tds_socket::conn, tds_socket::cur_dyn, tds_socket::current_op, tds_dynamic::emulated, free(), head, i, tds_dynamic::id, int, IS_TDS50, IS_TDS71_PLUS, IS_TDS7_PLUS, NULL, tds_result_info::num_cols, tds_socket::out_flag, tds_dynamic::params, tds_dynamic::query, query, strdup, tds, TDS5_DYNAMIC_TOKEN, tds5_put_params(), tds7_build_param_def_from_query(), tds7_put_params_definition(), tds7_put_query_params(), tds7_write_param_def_from_query(), tds_alloc_dynamic, tds_convert_string(), tds_convert_string_free, TDS_DYN_EXEC_IMMED, tds_dynamic_deallocated, TDS_END_LEN, TDS_FAIL, TDS_FAILED, tds_flush_packet, tds_freeze, tds_freeze_abort, tds_freeze_close, TDS_IDLE, TDS_NORMAL, TDS_OP_EXECUTESQL, TDS_PROPAGATE, TDS_PUT_BYTE, tds_put_byte, tds_put_data(), tds_put_data_info(), tds_put_n, TDS_PUT_N_AS_UCS2, tds_put_params(), TDS_PUT_SMALLINT, tds_put_smallint, tds_put_string, tds_query_flush_packet(), tds_release_cur_dyn(), tds_release_dynamic, TDS_RPC, tds_send_emulated_execute(), tds_set_state, TDS_SP_EXECUTESQL, TDS_START_LEN_TINYINT, TDS_START_LEN_USMALLINT, tds_start_query_head(), tds_submit_query(), TDS_SUCCEED, TDS_SUCCESS, and TDS_WRITING.
TDSRET tds_submit_execute | ( | TDSSOCKET * | tds, |
TDSDYNAMIC * | dyn | ||
) |
tds_submit_execute() sends a previously prepared dynamic statement to the server.
Sends a previously prepared dynamic statement to the server.
tds | state information for the socket and the TDS protocol |
dyn | dynamic proc to execute. Must build from same tds. |
Definition at line 1753 of file query.c.
References CHECK_DYNAMIC_EXTRA, CHECK_TDS_EXTRA, tds_socket::conn, tds_dynamic::emulated, tds_dynamic::id, int, IS_TDS7_PLUS, tds_dynamic::num_id, tds_socket::out_flag, tds_dynamic::params, tds_dynamic::query, tds, TDS5_DYNAMIC_TOKEN, tds5_put_params(), tds7_send_execute(), TDS_DBG_FUNC, TDS_END_LEN, TDS_FAIL, TDS_FAILED, TDS_IDLE, TDS_NORMAL, TDS_PROPAGATE, tds_put_byte, tds_put_n, tds_put_params(), tds_put_smallint, tds_put_string, tds_query_flush_packet(), TDS_RPC, tds_send_emulated_execute(), tds_set_cur_dyn(), tds_set_state, TDS_START_LEN_TINYINT, TDS_START_LEN_USMALLINT, tds_start_query(), TDS_WRITING, TDS_ZERO_FREE, and tdsdump_log.
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. \tds
command | command type. |
option | option to set/get. |
param | parameter value |
param_size | length of parameter value in bytes |
Definition at line 3455 of file query.c.
References CHECK_TDS_EXTRA, cmd, tds_column::column_cur_size, tds_column::column_data, tds_column::column_size, tds_column::column_type, tds_result_info::columns, command, tds_socket::conn, tds_socket::current_results, conv_result::i, tds_option_arg::i, IS_TDS50, IS_TDS7_PLUS, NULL, tds_column::on_server, option, tds_socket::option_value, tds_socket::out_flag, SYBINT4, tds, tds_convert, TDS_DBG_FUNC, TDS_FAIL, TDS_FAILED, tds_get_conversion_type, tds_get_ctx, TDS_NORMAL, TDS_OPT_ANSINULL, TDS_OPT_ARITHABORTOFF, TDS_OPT_ARITHABORTON, TDS_OPT_ARITHIGNOREOFF, TDS_OPT_ARITHIGNOREON, TDS_OPT_AUTHOFF, TDS_OPT_AUTHON, TDS_OPT_CHAINXACTS, TDS_OPT_CHARSET, TDS_OPT_CURCLOSEONXACT, TDS_OPT_CURREAD, TDS_OPT_CURWRITE, TDS_OPT_DATEFIRST, TDS_OPT_DATEFORMAT, TDS_OPT_FIPSFLAG, TDS_OPT_FMTDMY, TDS_OPT_FMTDYM, TDS_OPT_FMTMDY, TDS_OPT_FMTMYD, TDS_OPT_FMTYDM, TDS_OPT_FMTYMD, TDS_OPT_FORCEPLAN, TDS_OPT_FORMATONLY, TDS_OPT_GETDATA, TDS_OPT_IDENTITYOFF, TDS_OPT_IDENTITYON, TDS_OPT_ISOLATION, TDS_OPT_LIST, TDS_OPT_NATLANG, TDS_OPT_NOCOUNT, TDS_OPT_NOEXEC, TDS_OPT_PARSEONLY, TDS_OPT_QUOTED_IDENT, TDS_OPT_RESTREES, TDS_OPT_ROWCOUNT, TDS_OPT_SET, TDS_OPT_SHOWPLAN, TDS_OPT_STAT_IO, TDS_OPT_STAT_TIME, TDS_OPT_TEXTSIZE, TDS_OPT_TRUNCABORT, TDS_OPTIONCMD_TOKEN, tds_process_simple_query, tds_process_tokens, TDS_PROPAGATE, tds_put_byte, tds_put_n, tds_put_smallint, tds_query_flush_packet(), TDS_RETURN_DONE, TDS_RETURN_ROW, TDS_ROW_RESULT, TDS_ROWFMT_RESULT, tds_set_state, TDS_STOPAT_ROWFMT, tds_submit_query(), TDS_SUCCESS, TDS_TOKEN_RESULTS, TDS_WRITING, tdsdump_log, and tds_option_arg::ti.
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.
Creates a temporary stored procedure in the server.
Under TDS 4.2 dynamic statements are emulated building sql command
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. |
params | parameters to use. It can be NULL even if parameters are present. Used only for TDS7+ |
Under TDS 4.2 dynamic statements are emulated building sql command. TDS 5 does not uses parameters type. TDS 7+ uses parameter types to prepare the query. You should prepare again the query if parameters changes.
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. |
params | parameters to use. It can be NULL even if parameters are present. Used only for TDS7+ |
Definition at line 1187 of file query.c.
References tds_connection::char_convs, CHECK_PARAMINFO_EXTRA, CHECK_TDS_EXTRA, client2ucs2, tds_socket::conn, tds_socket::current_op, tds_dynamic::emulated, failure, free(), tds_dynamic::id, int, IS_TDS50, IS_TDS71_PLUS, IS_TDS7_PLUS, NULL, tds_socket::out_flag, tds_dynamic::query, query, strdup, SYBINTN, tds, TDS5_DYNAMIC_TOKEN, tds7_build_param_def_from_query(), tds7_put_params_definition(), tds7_put_query_params(), tds7_write_param_def_from_query(), tds_alloc_dynamic, tds_capability_has_req, tds_convert_string(), tds_convert_string_free, TDS_DYN_PREPARE, tds_dynamic_deallocated, TDS_END_LEN, TDS_FAIL, TDS_FAILED, tds_freeze, tds_freeze_abort, tds_freeze_close, TDS_IDLE, TDS_NORMAL, TDS_OP_PREPARE, tds_put_byte, tds_put_int, tds_put_n, TDS_PUT_N_AS_UCS2, tds_put_smallint, tds_put_string, tds_query_flush_packet(), tds_release_cur_dyn(), tds_release_dynamic, TDS_REQ_PROTO_DYNPROC, TDS_RPC, tds_set_cur_dyn(), tds_set_state, TDS_SP_PREPARE, TDS_START_LEN_TINYINT, TDS_START_LEN_USMALLINT, tds_start_query(), TDS_SUCCEED, TDS_SUCCESS, and TDS_WRITING.
tds_submit_query() sends a language string to the database server for processing.
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. \tds
query | language query to submit |
Definition at line 212 of file query.c.
References NULL, query, tds, and tds_submit_query_params().
Referenced by tds_submit_begin_tran(), tds_submit_commit(), tds_submit_execdirect(), tds_submit_optioncmd(), tds_submit_queryf(), and tds_submit_rollback().
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.
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. \tds
query | language query to submit |
params | parameters of query |
Definition at line 369 of file query.c.
References tds_connection::char_convs, CHECK_PARAMINFO_EXTRA, CHECK_TDS_EXTRA, client2ucs2, tds_connection::collation, tds_column::column_name, tds_result_info::columns, tds_socket::conn, count, tds_socket::current_op, flags, free(), head, i, IS_TDS50, IS_TDS71_PLUS, IS_TDS7_PLUS, NULL, tds_result_info::num_cols, tds_socket::out_flag, query, SYBNTEXT, tds, tds5_fix_dot_query(), tds5_put_params(), tds7_build_param_def_from_params(), tds7_build_param_def_from_query(), tds7_put_params_definition(), tds7_put_query_params(), tds7_write_param_def_from_params(), tds7_write_param_def_from_query(), tds_convert_string(), tds_convert_string_free, tds_count_placeholders_ucs2le(), tds_dstr_isempty(), TDS_END_LEN, TDS_FAIL, TDS_FAILED, tds_freeze, tds_freeze_abort, tds_freeze_close, TDS_IDLE, TDS_LANGUAGE_TOKEN, tds_next_placeholder(), TDS_NORMAL, TDS_OP_EXECUTESQL, TDS_PROPAGATE, tds_put_byte, tds_put_data(), tds_put_data_info(), TDS_PUT_DATA_USE_NAME, TDS_PUT_INT, tds_put_n, TDS_PUT_N_AS_UCS2, tds_put_params(), tds_put_smallint, tds_put_string, TDS_QUERY, tds_query_flush_packet(), TDS_RPC, tds_set_state, TDS_SP_EXECUTESQL, TDS_START_LEN_UINT, tds_start_query_head(), TDS_SUCCESS, and TDS_WRITING.
Referenced by tds_submit_query().
Format and submit a query \tds.
queryf | query format. printf like expansion is performed on this query. |
Definition at line 500 of file query.c.
References CHECK_TDS_EXTRA, free(), NULL, query, tds, TDS_FAIL, tds_submit_query(), and vasprintf.
Send a rollback request.
TDS 7.2+ need this in order to handle transactions correctly if MARS is used. \tds
cont | true to start a new transaction |
Definition at line 3752 of file query.c.
References CHECK_TDS_EXTRA, tds_socket::conn, IS_TDS72_PLUS, tds, TDS7_TRANS, TDS_FAIL, tds_put_byte, tds_put_smallint, tds_query_flush_packet(), tds_set_state, tds_start_query(), tds_submit_query(), and TDS_WRITING.
Send a rollback request.
TDS 7.2+ need this in order to handle transactions correctly if MARS is used. \tds
cont | true to start a new transaction |
Definition at line 3766 of file query.c.
References CHECK_TDS_EXTRA, tds_socket::conn, IS_TDS72_PLUS, tds, TDS7_TRANS, TDS_FAIL, tds_put_byte, tds_put_smallint, tds_query_flush_packet(), tds_set_state, tds_start_query(), tds_submit_query(), and TDS_WRITING.
TDSRET tds_submit_rpc | ( | TDSSOCKET * | tds, |
const char * | rpc_name, | ||
TDSPARAMINFO * | params, | ||
TDSHEADERS * | head | ||
) |
tds_submit_rpc() call a RPC from server.
Calls a RPC from server.
Output parameters will be stored in tds->param_info
tds | state information for the socket and the TDS protocol |
rpc_name | name of RPC |
params | parameters informations. NULL for no parameters |
Output parameters will be stored in tds->param_info.
tds | state information for the socket and the TDS protocol |
rpc_name | name of RPC |
params | parameters informations. NULL for no parameters |
Definition at line 2051 of file query.c.
References assert, tds_connection::char_convs, CHECK_PARAMINFO_EXTRA, CHECK_TDS_EXTRA, client2ucs2, tds_result_info::columns, tds_socket::conn, head, i, int, IS_TDS50, IS_TDS7_PLUS, tds_result_info::num_cols, tds_socket::out_flag, tds, tds4_send_emulated_rpc(), tds5_put_params(), tds_convert_string(), tds_convert_string_free, TDS_DBRPC_TOKEN, TDS_END_LEN, TDS_FAIL, TDS_FAILED, tds_freeze, tds_freeze_close_len, tds_freeze_written, TDS_IDLE, TDS_NORMAL, TDS_PROPAGATE, tds_put_byte, tds_put_data(), tds_put_data_info(), TDS_PUT_DATA_USE_NAME, tds_put_n, tds_put_params(), TDS_PUT_SMALLINT, tds_put_smallint, tds_put_string, tds_query_flush_packet(), tds_release_cur_dyn(), TDS_RPC, tds_send_emulated_rpc(), tds_set_state, TDS_START_LEN_TINYINT, TDS_START_LEN_USMALLINT, tds_start_query_head(), TDS_SUCCESS, tds_connection::tds_version, and TDS_WRITING.
TDSRET tds_submit_unprepare | ( | TDSSOCKET * | tds, |
TDSDYNAMIC * | dyn | ||
) |
Send a unprepare request for a prepared query.
tds | state information for the socket and the TDS protocol |
dyn | dynamic query |
Definition at line 1916 of file query.c.
References CHECK_DYNAMIC_EXTRA, CHECK_TDS_EXTRA, tds_socket::conn, tds_socket::current_op, tds_dynamic::emulated, tds_dynamic::id, int, IS_TDS71_PLUS, IS_TDS7_PLUS, tds_dynamic::num_id, tds_socket::out_flag, SYBINTN, tds, TDS5_DYNAMIC_TOKEN, TDS_DBG_FUNC, TDS_DYN_DEALLOC, TDS_END_LEN, TDS_FAIL, TDS_NORMAL, TDS_OP_DYN_DEALLOC, TDS_OP_UNPREPARE, tds_put_byte, tds_put_int, tds_put_n, TDS_PUT_N_AS_UCS2, tds_put_smallint, tds_put_string, TDS_QUERY, tds_query_flush_packet(), TDS_RPC, tds_set_cur_dyn(), tds_set_state, TDS_SP_UNPREPARE, TDS_START_LEN_TINYINT, TDS_START_LEN_USMALLINT, tds_start_query(), TDS_WRITING, and tdsdump_log.
|
static |
Definition at line 3820 of file query.c.
Referenced by tds_disconnect().
|
static |
Definition at line 3806 of file query.c.
Referenced by tds_disconnect().