NCBI C++ ToolKit
Classes | Macros | Typedefs | Functions | Variables
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/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:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

struct  tds_varmax_stream
 

Macros

#define TDS_DONT_DEFINE_DEFAULT_FUNCTIONS
 
#define USE_ICONV   (tds->conn->use_iconv)
 
#define MIN(a, b)   (((a) < (b)) ? (a) : (b))
 
#define MAX(a, b)   (((a) > (b)) ? (a) : (b))
 
#define TDS_DECLARE_FUNCS(name)    extern const TDSCOLUMNFUNCS tds_ ## name ## _funcs
 

Typedefs

typedef struct tds_varmax_stream TDSVARMAXSTREAM
 

Functions

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

Variables

const TDSCOLUMNFUNCS tds_generic_funcs
 
const TDSCOLUMNFUNCS tds_numeric_funcs
 
const TDSCOLUMNFUNCS tds_variant_funcs
 
const TDSCOLUMNFUNCS tds_msdatetime_funcs
 
const TDSCOLUMNFUNCS tds_clrudt_funcs
 
const TDSCOLUMNFUNCS tds_sybbigtime_funcs
 
const TDSCOLUMNFUNCS tds_invalid_funcs
 

Detailed Description

Handle different data handling from network.

Definition in file data.c.

Macro Definition Documentation

◆ MAX

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

Definition at line 217 of file data.c.

◆ MIN

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

Definition at line 215 of file data.c.

◆ TDS_DECLARE_FUNCS

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

Definition at line 1652 of file data.c.

◆ TDS_DONT_DEFINE_DEFAULT_FUNCTIONS

#define TDS_DONT_DEFINE_DEFAULT_FUNCTIONS

Definition at line 198 of file data.c.

◆ USE_ICONV

#define USE_ICONV   (tds->conn->use_iconv)

Definition at line 206 of file data.c.

Typedef Documentation

◆ TDSVARMAXSTREAM

Function Documentation

◆ tds72_get_varmax()

static TDSRET tds72_get_varmax ( TDSSOCKET tds,
TDSCOLUMN curcol 
)
static

◆ tds_clrudt_get_info()

TDSRET tds_clrudt_get_info ( TDSSOCKET tds,
TDSCOLUMN col 
)

◆ tds_clrudt_put_info()

TDSRET tds_clrudt_put_info ( TDSSOCKET tds,
TDSCOLUMN col 
)

Definition at line 1462 of file data.c.

References tds, tds_put_byte, and TDS_SUCCESS.

◆ tds_clrudt_row_len()

TDS_INT tds_clrudt_row_len ( TDSCOLUMN col)

Definition at line 1455 of file data.c.

◆ TDS_COMPILE_CHECK() [1/3]

TDS_COMPILE_CHECK ( tds_variant_offset  ,
TDS_OFFSET(TDSVARIANT, data = =TDS_OFFSET(TDSBLOB, textvalue) 
)

◆ TDS_COMPILE_CHECK() [2/3]

TDS_COMPILE_CHECK ( tds_variant_size  ,
sizeof(((TDSVARIANT *) 0) ->data = =sizeof(((TDSBLOB *) 0) ->textvalue) 
)

◆ TDS_COMPILE_CHECK() [3/3]

TDS_COMPILE_CHECK ( variant_size  ,
sizeof(TDSBLOB) >=sizeof(TDSVARIANT  
)

◆ tds_generic_get()

TDSRET tds_generic_get ( TDSSOCKET tds,
TDSCOLUMN curcol 
)

◆ tds_generic_get_info()

TDSRET tds_generic_get_info ( TDSSOCKET tds,
TDSCOLUMN col 
)

◆ tds_generic_put()

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

◆ tds_generic_put_info()

TDSRET tds_generic_put_info ( TDSSOCKET tds,
TDSCOLUMN col 
)

◆ tds_generic_put_info_len()

unsigned tds_generic_put_info_len ( TDSSOCKET tds,
TDSCOLUMN col 
)

◆ tds_generic_row_len()

TDS_INT tds_generic_row_len ( TDSCOLUMN col)

◆ tds_get_cardinal_type()

TDS_SERVER_TYPE tds_get_cardinal_type ( TDS_SERVER_TYPE  datatype,
int  usertype 
)

◆ tds_get_char_dynamic()

static TDSRET tds_get_char_dynamic ( TDSSOCKET tds,
TDSCOLUMN curcol,
void **  pp,
size_t  allocated,
TDSINSTREAM r_stream 
)
static

◆ tds_get_column_funcs()

static const TDSCOLUMNFUNCS * tds_get_column_funcs ( TDSCONNECTION conn,
int  type 
)
static

◆ tds_invalid_get()

TDSRET tds_invalid_get ( TDSSOCKET tds,
TDSCOLUMN col 
)

Definition at line 1548 of file data.c.

References TDS_FAIL.

◆ tds_invalid_get_info()

TDSRET tds_invalid_get_info ( TDSSOCKET tds,
TDSCOLUMN col 
)

Definition at line 1536 of file data.c.

References TDS_FAIL.

◆ tds_invalid_put()

TDSRET tds_invalid_put ( TDSSOCKET tds,
TDSCOLUMN col,
int  bcp7 
)

Definition at line 1566 of file data.c.

References TDS_FAIL.

◆ tds_invalid_put_info()

TDSRET tds_invalid_put_info ( TDSSOCKET tds,
TDSCOLUMN col 
)

Definition at line 1554 of file data.c.

References TDS_FAIL.

◆ tds_invalid_put_info_len()

unsigned tds_invalid_put_info_len ( TDSSOCKET tds,
TDSCOLUMN col 
)

Definition at line 1560 of file data.c.

◆ tds_invalid_row_len()

TDS_INT tds_invalid_row_len ( TDSCOLUMN col)

Definition at line 1542 of file data.c.

◆ tds_msdatetime_get()

TDSRET tds_msdatetime_get ( TDSSOCKET tds,
TDSCOLUMN col 
)

◆ tds_msdatetime_get_info()

TDSRET tds_msdatetime_get_info ( TDSSOCKET tds,
TDSCOLUMN col 
)

◆ tds_msdatetime_put()

TDSRET tds_msdatetime_put ( TDSSOCKET tds,
TDSCOLUMN col,
int  bcp7 
)

◆ tds_msdatetime_put_info()

TDSRET tds_msdatetime_put_info ( TDSSOCKET tds,
TDSCOLUMN col 
)

◆ tds_msdatetime_row_len()

TDS_INT tds_msdatetime_row_len ( TDSCOLUMN col)

Definition at line 1316 of file data.c.

◆ tds_numeric_get()

TDSRET tds_numeric_get ( TDSSOCKET tds,
TDSCOLUMN curcol 
)

◆ tds_numeric_get_info()

TDSRET tds_numeric_get_info ( TDSSOCKET tds,
TDSCOLUMN col 
)

◆ tds_numeric_put()

TDSRET tds_numeric_put ( TDSSOCKET tds,
TDSCOLUMN col,
int  bcp7 
)

◆ tds_numeric_put_info()

TDSRET tds_numeric_put_info ( TDSSOCKET tds,
TDSCOLUMN col 
)

◆ tds_numeric_put_info_len()

unsigned tds_numeric_put_info_len ( TDSSOCKET tds,
TDSCOLUMN col 
)

Definition at line 1260 of file data.c.

References CHECK_COLUMN_EXTRA, CHECK_TDS_EXTRA, and tds.

◆ tds_numeric_row_len()

TDS_INT tds_numeric_row_len ( TDSCOLUMN col)

Definition at line 1191 of file data.c.

◆ tds_set_column_type()

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

◆ tds_set_param_type()

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

◆ 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

Definition at line 1733 of file data.c.

References tdsnumeric::array, tdsnumeric::precision, tds_numeric_bytes_per_prec, and tds_swap_bytes.

Referenced by tds_numeric_get(), tds_numeric_put(), and tds_variant_get().

◆ tds_sybbigtime_get()

TDSRET tds_sybbigtime_get ( TDSSOCKET tds,
TDSCOLUMN col 
)

◆ tds_sybbigtime_get_info()

TDSRET tds_sybbigtime_get_info ( TDSSOCKET tds,
TDSCOLUMN col 
)

◆ tds_sybbigtime_put()

TDSRET tds_sybbigtime_put ( TDSSOCKET tds,
TDSCOLUMN col,
int  bcp7 
)

◆ tds_sybbigtime_put_info()

TDSRET tds_sybbigtime_put_info ( TDSSOCKET tds,
TDSCOLUMN col 
)

Definition at line 1506 of file data.c.

References tds, tds_put_byte, and TDS_SUCCESS.

◆ tds_sybbigtime_put_info_len()

unsigned tds_sybbigtime_put_info_len ( TDSSOCKET tds,
TDSCOLUMN col 
)

Definition at line 1514 of file data.c.

◆ tds_sybbigtime_row_len()

TDS_INT tds_sybbigtime_row_len ( TDSCOLUMN col)

Definition at line 1483 of file data.c.

◆ tds_variant_get()

TDSRET tds_variant_get ( TDSSOCKET tds,
TDSCOLUMN curcol 
)

◆ tds_variant_put()

TDSRET tds_variant_put ( TDSSOCKET tds,
TDSCOLUMN col,
int  bcp7 
)

Definition at line 1296 of file data.c.

References TDS_FAIL.

◆ tds_variant_put_info()

TDSRET tds_variant_put_info ( TDSSOCKET tds,
TDSCOLUMN col 
)

Definition at line 1289 of file data.c.

References TDS_FAIL.

◆ tds_varmax_stream_read()

static int tds_varmax_stream_read ( TDSINSTREAM stream,
void *  ptr,
size_t  len 
)
static

Definition at line 494 of file data.c.

References tds_varmax_stream::chunk_left, len, tds_varmax_stream::tds, tds_get_int, and tds_get_n.

Referenced by tds72_get_varmax().

Variable Documentation

◆ tds_clrudt_funcs

const TDSCOLUMNFUNCS tds_clrudt_funcs
extern

Definition at line 109 of file data.h.

Referenced by tds_get_column_funcs().

◆ tds_generic_funcs

const TDSCOLUMNFUNCS tds_generic_funcs
extern

Definition at line 105 of file data.h.

Referenced by tds_get_column_funcs().

◆ tds_invalid_funcs

const TDSCOLUMNFUNCS tds_invalid_funcs
extern

Definition at line 104 of file data.h.

◆ tds_msdatetime_funcs

const TDSCOLUMNFUNCS tds_msdatetime_funcs
extern

Definition at line 108 of file data.h.

Referenced by tds_get_column_funcs().

◆ tds_numeric_funcs

const TDSCOLUMNFUNCS tds_numeric_funcs
extern

Definition at line 106 of file data.h.

Referenced by tds_get_column_funcs().

◆ tds_sybbigtime_funcs

const TDSCOLUMNFUNCS tds_sybbigtime_funcs
extern

Definition at line 110 of file data.h.

Referenced by tds_get_column_funcs().

◆ tds_variant_funcs

const TDSCOLUMNFUNCS tds_variant_funcs
extern

Definition at line 107 of file data.h.

Referenced by tds_get_column_funcs().

Modified on Mon Jun 17 05:05:06 2024 by modify_doxy.py rev. 669887