Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

Results processing
[LibTDS API]

Handle tokens in packets. More...

Functions

static int tds5_get_varint_size (int datatype)
 tds5_get_varint_size5() returns the size of a variable length integer returned in a TDS 5.1 result string
static int tds5_process_dyn_result2 (TDSSOCKET *tds)
 New TDS 5.0 token for describing output parameters.
static int tds5_process_optioncmd (TDSSOCKET *tds)
static int tds5_process_result (TDSSOCKET *tds)
 tds5_process_result() is the new TDS 5.0 result set processing routine.
static int tds7_get_data_info (TDSSOCKET *tds, TDSCOLUMN *curcol)
 Read data information from wire.
static int tds7_process_compute_result (TDSSOCKET *tds)
 tds7_process_compute_result() processes compute result sets for TDS 7/8.
static int tds7_process_result (TDSSOCKET *tds)
 tds7_process_result() is the TDS 7.0 result set processing routine.
void tds_add_row_column_size (TDSRESULTINFO *info, TDSCOLUMN *curcol)
 Add a column size to result info row size and calc offset into row.
int tds_alloc_get_string (TDSSOCKET *tds, char **string, int len)
 Read a string from wire in a new allocated buffer.
int tds_client_msg (const TDSCONTEXT *tds_ctx, TDSSOCKET *tds, int msgno, int severity, int state, int line, const char *msg_text)
 tds_client_msg() sends a message to the client application from the CLI or TDS layer.
static int tds_get_data (TDSSOCKET *tds, TDSCOLUMN *curcol, unsigned char *current_row, int i)
 Read a data from wire.
static int tds_get_data_info (TDSSOCKET *tds, TDSCOLUMN *curcol, int is_param)
 Read data information from wire.
int tds_get_token_size (int marker)
 tds_get_token_size() returns the size of a fixed length token used by tds_process_cancel() to determine how to read past a token
TDSDYNAMIC * tds_lookup_dynamic (TDSSOCKET *tds, char *id)
 Find a dynamic given string id.
static const char * tds_pr_op (int op)
static int tds_process_auth (TDSSOCKET *tds)
int tds_process_cancel (TDSSOCKET *tds)
 tds_process_cancel() processes the incoming token stream until it finds an end token (DONE, DONEPROC, DONEINPROC) with the cancel flag set.
static int tds_process_col_fmt (TDSSOCKET *tds)
 tds_process_col_fmt() is the other half of result set processing under TDS 4.2.
static int tds_process_col_name (TDSSOCKET *tds)
 tds_process_col_name() is one half of the result set under TDS 4.2 it contains all the column names, a TDS_COLFMT_TOKEN should immediately follow this token with the datatype/size information This is a 4.2 only function
static int tds_process_colinfo (TDSSOCKET *tds)
static int tds_process_compute (TDSSOCKET *tds, TDS_INT *computeid)
 tds_process_compute() processes compute rows and places them in the row buffer.
static int tds_process_compute_names (TDSSOCKET *tds)
 tds_process_compute_names() processes compute result sets.
static int tds_process_compute_result (TDSSOCKET *tds)
 tds_process_compute_result() processes compute result sets.
static int tds_process_cursor_tokens (TDSSOCKET *tds)
static int tds_process_default_tokens (TDSSOCKET *tds, int marker)
 tds_process_default_tokens() is a catch all function that is called to process tokens not known to other tds_process_* routines
static int tds_process_dyn_result (TDSSOCKET *tds)
static TDSDYNAMIC * tds_process_dynamic (TDSSOCKET *tds)
 tds_process_dynamic() finds the element of the dyns array for the id
static TDS_INT tds_process_end (TDSSOCKET *tds, int marker, int *flags_parm)
 tds_process_end() processes any of the DONE, DONEPROC, or DONEINPROC tokens.
static int tds_process_env_chg (TDSSOCKET *tds)
 tds_process_env_chg() when ever certain things change on the server, such as database, character set, language, or block size.
int tds_process_login_tokens (TDSSOCKET *tds)
 tds_process_login_tokens() is called after sending the login packet to the server.
static int tds_process_msg (TDSSOCKET *tds, int marker)
 tds_process_msg() is called for MSG, ERR, or EED tokens and is responsible for calling the CLI's message handling routine returns TDS_SUCCEED if informational, TDS_ERROR if error.
static int tds_process_param_result (TDSSOCKET *tds, TDSPARAMINFO **info)
 tds_process_param_result() processes output parameters of a stored procedure.
static int tds_process_param_result_tokens (TDSSOCKET *tds)
static int tds_process_params_result_token (TDSSOCKET *tds)
 tds_process_params_result_token() processes params on TDS5.
static int tds_process_result (TDSSOCKET *tds)
 tds_process_result() is the TDS 5.0 result set processing routine.
static int tds_process_row (TDSSOCKET *tds)
 tds_process_row() processes rows and places them in the row buffer.
int tds_process_simple_query (TDSSOCKET *tds)
 Process results for simple query as "SET TEXTSIZE" or "USE dbname" If the statement returns results, beware they are discarded.
int tds_process_tokens (TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsigned flag)
 process all streams.
const char * tds_prtype (int token)
static int tds_set_spid (TDSSOCKET *tds)
void tds_swap_datatype (int coltype, unsigned char *buf)
void tds_swap_numeric (TDS_NUMERIC *num)

Detailed Description

Handle tokens in packets.

Many PDU (packets data unit) contain tokens. (like result description, rows, data, errors and many other).


Function Documentation

static int tds5_process_result TDSSOCKET *  tds  )  [static]
 

tds5_process_result() is the new TDS 5.0 result set processing routine.

It is responsible for populating the tds->res_info structure. This is a TDS 5.0 only function

static int tds7_get_data_info TDSSOCKET *  tds,
TDSCOLUMN curcol
[static]
 

Read data information from wire.

Parameters:
tds state information for the socket and the TDS protocol
curcol column where to store information

static int tds7_process_compute_result TDSSOCKET *  tds  )  [static]
 

tds7_process_compute_result() processes compute result sets for TDS 7/8.

They is are very similar to normal result sets.

static int tds7_process_result TDSSOCKET *  tds  )  [static]
 

tds7_process_result() is the TDS 7.0 result set processing routine.

It is responsible for populating the tds->res_info structure. This is a TDS 7.0 only function

void tds_add_row_column_size TDSRESULTINFO info,
TDSCOLUMN curcol
 

Add a column size to result info row size and calc offset into row.

Parameters:
info result where to add column
curcol column to add

int tds_alloc_get_string TDSSOCKET *  tds,
char **  string,
int  len
 

Read a string from wire in a new allocated buffer.

Parameters:
tds state information for the socket and the TDS protocol
len length of string to read

int tds_client_msg const TDSCONTEXT *  tds_ctx,
TDSSOCKET *  tds,
int  msgno,
int  severity,
int  state,
int  line,
const char *  msg_text
 

tds_client_msg() sends a message to the client application from the CLI or TDS layer.

A client message is one that is generated from with the library and not from the server. The message is sent to the CLI (the err_handler) so that it may forward it to the client application or discard it if no msg handler has been by the application. tds->parent contains a void pointer to the parent of the tds socket. This can be cast back into DBPROCESS or CS_CONNECTION by the CLI and used to determine the proper recipient function for this message.

Todo:
This procedure is deprecated, because the client libraries use differing messages and message numbers. The general approach is to emit ct-lib error information and let db-lib and ODBC map that to their number and text.

static int tds_get_data TDSSOCKET *  tds,
TDSCOLUMN curcol,
unsigned char *  current_row,
int  i
[static]
 

Read a data from wire.

Parameters:
tds state information for the socket and the TDS protocol
curcol column where store column information
current_row pointer to row data to store information
i column position in current_row
Returns:
TDS_FAIL on error or TDS_SUCCEED

static int tds_get_data_info TDSSOCKET *  tds,
TDSCOLUMN curcol,
int  is_param
[static]
 

Read data information from wire.

Parameters:
tds state information for the socket and the TDS protocol
curcol column where to store information

TDSDYNAMIC* tds_lookup_dynamic TDSSOCKET *  tds,
char *  id
 

Find a dynamic given string id.

Returns:
dynamic or NULL is not found
Parameters:
tds state information for the socket and the TDS protocol
id dynamic id to search

int tds_process_cancel TDSSOCKET *  tds  ) 
 

tds_process_cancel() processes the incoming token stream until it finds an end token (DONE, DONEPROC, DONEINPROC) with the cancel flag set.

a that point the connetion should be ready to handle a new query.

static int tds_process_col_fmt TDSSOCKET *  tds  )  [static]
 

tds_process_col_fmt() is the other half of result set processing under TDS 4.2.

It follows tds_process_col_name(). It contains all the column type and size information. This is a 4.2 only function

static int tds_process_compute_result TDSSOCKET *  tds  )  [static]
 

tds_process_compute_result() processes compute result sets.

These functions need work but since they get little use, nobody has complained! It is very similar to normal result sets.

static TDS_INT tds_process_end TDSSOCKET *  tds,
int  marker,
int *  flags_parm
[static]
 

tds_process_end() processes any of the DONE, DONEPROC, or DONEINPROC tokens.

Parameters:
tds state information for the socket and the TDS protocol
marker TDS token number
flags_parm filled with bit flags (see TDS_DONE_ constants). Is NULL nothing is returned

static int tds_process_env_chg TDSSOCKET *  tds  )  [static]
 

tds_process_env_chg() when ever certain things change on the server, such as database, character set, language, or block size.

A environment change message is generated There is no action taken currently, but certain functions at the CLI level that return the name of the current database will need to use this.

int tds_process_login_tokens TDSSOCKET *  tds  ) 
 

tds_process_login_tokens() is called after sending the login packet to the server.

It returns the success or failure of the login dependent on the protocol version. 4.2 sends an ACK token only when successful, TDS 5.0 sends it always with a success byte within

static int tds_process_param_result TDSSOCKET *  tds,
TDSPARAMINFO **  pinfo
[static]
 

tds_process_param_result() processes output parameters of a stored procedure.

This differs from regular row/compute results in that there is no total number of parameters given, they just show up singly.

static int tds_process_result TDSSOCKET *  tds  )  [static]
 

tds_process_result() is the TDS 5.0 result set processing routine.

It is responsible for populating the tds->res_info structure. This is a TDS 5.0 only function

int tds_process_simple_query TDSSOCKET *  tds  ) 
 

Process results for simple query as "SET TEXTSIZE" or "USE dbname" If the statement returns results, beware they are discarded.

This function was written to avoid direct calls to tds_process_default_tokens (which caused problems such as ignoring query errors). Results are read until idle state or severe failure (do not stop for statement failure).

Returns:
see tds_process_tokens for results (TDS_NO_MORE_RESULTS is never returned)

int tds_process_tokens TDSSOCKET *  tds,
TDS_INT *  result_type,
int *  done_flags,
unsigned  flag
 

process all streams.

tds_process_tokens() is called after submitting a query with tds_submit_query() and is responsible for calling the routines to populate tds->res_info if appropriate (some query have no result sets)

Parameters:
tds A pointer to the TDSSOCKET structure managing a client/server operation.
result_type A pointer to an integer variable which tds_process_tokens sets to indicate the current type of result.
Values that indicate command status
TDS_DONE_RESULTThe results of a command have been completely processed. This command return no rows.
TDS_DONEPROC_RESULTThe results of a command have been completely processed. This command return rows.
TDS_DONEINPROC_RESULTThe results of a command have been completely processed. This command return rows.
Values that indicate results information is available
TDS_ROWFMT_RESULTRegular Data format information tds->res_info now contains the result details ; tds->current_results now points to that data
TDS_COMPUTEFMT_ RESULTCompute data format information tds->comp_info now contains the result data; tds->current_results now points to that data
TDS_DESCRIBE_RESULT
Values that indicate data is available
ValueMeaningInformation returned
TDS_ROW_RESULTRegular row results 1 or more rows of regular data can now be retrieved
TDS_COMPUTE_RESULTCompute row results A single row of compute data can now be retrieved
TDS_PARAM_RESULTReturn parameter results param_info or cur_dyn->params contain returned parameters
TDS_STATUS_RESULTStored procedure status results tds->ret_status contain the returned code
Parameters:
flag Flags to select token type to stop/return
Todo:
Complete TDS_DESCRIBE_RESULT description
Return values:
TDS_SUCCEED if a result set is available for processing.
TDS_NO_MORE_RESULTS if all results have been completely processed.


Generated on Sat Jul 1 11:11:47 2006 for FreeTDS API by  doxygen 1.4.1