FreeTDS API
 
Loading...
Searching...
No Matches
data.c File Reference

Handle different data handling from network. More...

#include <config.h>
#include <stdarg.h>
#include <stdio.h>
#include <assert.h>
#include <freetds/utils.h>
#include <freetds/tds.h>
#include <freetds/bytes.h>
#include <freetds/iconv.h>
#include <freetds/checks.h>
#include <freetds/stream.h>
#include <freetds/data.h>
#include <freetds/pushvis.h>
#include <freetds/popvis.h>
#include "tds_types.h"
Include dependency graph for data.c:

Classes

struct  tds_varmax_stream
 

Macros

#define MAX(a, b)
 
#define MIN(a, b)
 
#define TDS_DECLARE_FUNCS(name)
 
#define TDS_DONT_DEFINE_DEFAULT_FUNCTIONS
 
#define USE_ICONV   (tds->conn->use_iconv)
 

Typedefs

typedef struct tds_varmax_stream TDSVARMAXSTREAM
 

Functions

static TDSRET tds72_get_varmax (TDSSOCKET *tds, TDSCOLUMN *curcol)
 
TDSRET tds_clrudt_get_info (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDSRET tds_clrudt_put_info (TDSSOCKET *tds, TDSCOLUMN *col)
 
unsigned tds_clrudt_put_info_len (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDS_INT tds_clrudt_row_len (TDSCOLUMN *col)
 
 TDS_COMPILE_CHECK (tds_variant_offset, TDS_OFFSET(TDSVARIANT, data)==TDS_OFFSET(TDSBLOB, textvalue))
 
 TDS_COMPILE_CHECK (tds_variant_size, sizeof(((TDSVARIANT *) 0) ->data)==sizeof(((TDSBLOB *) 0) ->textvalue))
 
 TDS_COMPILE_CHECK (variant_size, sizeof(TDSBLOB) >=sizeof(TDSVARIANT))
 
 TDS_DECLARE_FUNCS (clrudt)
 
 TDS_DECLARE_FUNCS (generic)
 
 TDS_DECLARE_FUNCS (invalid)
 
 TDS_DECLARE_FUNCS (msdatetime)
 
 TDS_DECLARE_FUNCS (numeric)
 
 TDS_DECLARE_FUNCS (sybbigtime)
 
 TDS_DECLARE_FUNCS (variant)
 
TDSRET tds_generic_get (TDSSOCKET *tds, TDSCOLUMN *curcol)
 Read a data from wire.
 
TDSRET tds_generic_get_info (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDSRET tds_generic_put (TDSSOCKET *tds, TDSCOLUMN *curcol, int bcp7)
 Write data to wire.
 
TDSRET tds_generic_put_info (TDSSOCKET *tds, TDSCOLUMN *col)
 Put data information to wire.
 
unsigned tds_generic_put_info_len (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDS_INT tds_generic_row_len (TDSCOLUMN *col)
 
TDS_SERVER_TYPE tds_get_cardinal_type (TDS_SERVER_TYPE datatype, int usertype)
 
static TDSRET tds_get_char_dynamic (TDSSOCKET *tds, TDSCOLUMN *curcol, void **pp, size_t allocated, TDSINSTREAM *r_stream)
 
static const TDSCOLUMNFUNCStds_get_column_funcs (TDSCONNECTION *conn, int type)
 
TDSRET tds_invalid_get (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDSRET tds_invalid_get_info (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDSRET tds_invalid_put (TDSSOCKET *tds, TDSCOLUMN *col, int bcp7)
 
TDSRET tds_invalid_put_info (TDSSOCKET *tds, TDSCOLUMN *col)
 
unsigned tds_invalid_put_info_len (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDS_INT tds_invalid_row_len (TDSCOLUMN *col)
 
TDSRET tds_msdatetime_get (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDSRET tds_msdatetime_get_info (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDSRET tds_msdatetime_put (TDSSOCKET *tds, TDSCOLUMN *col, int bcp7)
 
TDSRET tds_msdatetime_put_info (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDS_INT tds_msdatetime_row_len (TDSCOLUMN *col)
 
TDSRET tds_numeric_get (TDSSOCKET *tds, TDSCOLUMN *curcol)
 
TDSRET tds_numeric_get_info (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDSRET tds_numeric_put (TDSSOCKET *tds, TDSCOLUMN *col, int bcp7)
 
TDSRET tds_numeric_put_info (TDSSOCKET *tds, TDSCOLUMN *col)
 
unsigned tds_numeric_put_info_len (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDS_INT tds_numeric_row_len (TDSCOLUMN *col)
 
void tds_set_column_type (TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
 Set type of column initializing all dependency.
 
void tds_set_param_type (TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
 Set type of column initializing all dependency.
 
static void tds_swap_numeric (TDS_NUMERIC *num)
 Converts numeric from Microsoft representation to internal one (Sybase).
 
TDSRET tds_sybbigtime_get (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDSRET tds_sybbigtime_get_info (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDSRET tds_sybbigtime_put (TDSSOCKET *tds, TDSCOLUMN *col, int bcp7)
 
TDSRET tds_sybbigtime_put_info (TDSSOCKET *tds, TDSCOLUMN *col)
 
unsigned tds_sybbigtime_put_info_len (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDS_INT tds_sybbigtime_row_len (TDSCOLUMN *col)
 
TDSRET tds_variant_get (TDSSOCKET *tds, TDSCOLUMN *curcol)
 
TDSRET tds_variant_put (TDSSOCKET *tds, TDSCOLUMN *col, int bcp7)
 
TDSRET tds_variant_put_info (TDSSOCKET *tds, TDSCOLUMN *col)
 
static int tds_varmax_stream_read (TDSINSTREAM *stream, void *ptr, size_t len)
 

Detailed Description

Handle different data handling from network.

Macro Definition Documentation

◆ MAX

#define MAX ( a,
b )
Value:
(((a) > (b)) ? (a) : (b))

◆ MIN

#define MIN ( a,
b )
Value:
(((a) < (b)) ? (a) : (b))

◆ TDS_DECLARE_FUNCS

#define TDS_DECLARE_FUNCS ( name)
Value:
extern const TDSCOLUMNFUNCS tds_ ## name ## _funcs

Function Documentation

◆ tds_generic_get()

TDSRET tds_generic_get ( TDSSOCKET * tds,
TDSCOLUMN * curcol )

Read a data from wire.

Parameters
tdsstate information for the socket and the TDS protocol
curcolcolumn where store column information
Returns
TDS_FAIL on error or TDS_SUCCESS
Here is the call graph for this function:

◆ tds_generic_put()

TDSRET tds_generic_put ( TDSSOCKET * tds,
TDSCOLUMN * curcol,
int bcp7 )

Write data to wire.

Parameters
tdsstate information for the socket and the TDS protocol
curcolcolumn where store column information
Returns
TDS_FAIL on error or TDS_SUCCESS
Here is the call graph for this function:

◆ tds_generic_put_info()

TDSRET tds_generic_put_info ( TDSSOCKET * tds,
TDSCOLUMN * col )

Put data information to wire.

Parameters
tdsstate information for the socket and the TDS protocol
colcolumn where to store information
Returns
TDS_SUCCESS or TDS_FAIL
Here is the call graph for this function:

◆ tds_set_column_type()

void tds_set_column_type ( TDSCONNECTION * conn,
TDSCOLUMN * curcol,
TDS_SERVER_TYPE type )

Set type of column initializing all dependency.

column_usertype should already be set.

Parameters
curcolcolumn to set
typetype to set
Here is the caller graph for this function:

◆ tds_set_param_type()

void tds_set_param_type ( TDSCONNECTION * conn,
TDSCOLUMN * curcol,
TDS_SERVER_TYPE type )

Set type of column initializing all dependency.

Parameters
tdsstate information for the socket and the TDS protocol
curcolcolumn to set
typetype to set
Here is the call graph for this function:

◆ tds_swap_numeric()

static void tds_swap_numeric ( TDS_NUMERIC * num)
static

Converts numeric from Microsoft representation to internal one (Sybase).

Parameters
numnumeric data to convert
Here is the caller graph for this function: