Internal bcp functions
[Bulk copy functions]

Collaboration diagram for Internal bcp functions:


Detailed Description

Static functions internal to the bcp library.


Functions

static RETCODE _bcp_exec_out (DBPROCESS *dbproc, DBINT *rows_copied)
static RETCODE _bcp_read_hostfile (DBPROCESS *dbproc, FILE *hostfile, int *row_error)
static offset_type _bcp_measure_terminated_field (FILE *hostfile, BYTE *terminator, int term_len)
static int _bcp_add_fixed_columns (DBPROCESS *dbproc, int behaviour, BYTE *rowbuffer, int start)
static int _bcp_add_variable_columns (DBPROCESS *dbproc, int behaviour, BYTE *rowbuffer, int start, int *var_cols)
static RETCODE _bcp_exec_in (DBPROCESS *dbproc, DBINT *rows_copied)
static RETCODE _bcp_start_copy_in (DBPROCESS *dbproc)
static RETCODE _bcp_build_bulk_insert_stmt (TDSSOCKET *tds, TDS_PBCB *clause, TDSCOLUMN *bcpcol, int first)
static RETCODE _bcp_start_new_batch (DBPROCESS *dbproc)
static RETCODE _bcp_send_colmetadata (DBPROCESS *dbproc)
static char * _bcp_fgets (char *buffer, size_t size, FILE *f)
static int _bcp_readfmt_colinfo (DBPROCESS *dbproc, char *buf, BCP_HOSTCOLINFO *ci)
static RETCODE _bcp_send_bcp_record (DBPROCESS *dbproc, int behaviour)
static RETCODE _bcp_get_col_data (DBPROCESS *dbproc, TDSCOLUMN *bindcol)
static RETCODE _bcp_get_term_var (BYTE *pdata, BYTE *term, int term_len)
static int rtrim (char *istr, int ilen)
static void _bcp_free_columns (DBPROCESS *dbproc)
static RETCODE _bcp_free_storage (DBPROCESS *dbproc)


Function Documentation

static int _bcp_add_fixed_columns DBPROCESS dbproc,
int  behaviour,
BYTE rowbuffer,
int  start
[static]
 

Parameters:
dbproc contains all information needed by db-lib to manage communications with the server.
behaviour 
rowbuffer 
start 
Returns:
SUCCEED or FAIL.
See also:
BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow()

Definition at line 1536 of file bcp.c.

References _bcp_get_col_data(), BCP_REC_FETCH_DATA, tds_dblib_dbprocess::bcpinfo, DB_BCPINFO::bindinfo, tds_column::column_nullable, tds_column::column_type, tds_result_info::columns, FAIL, is_nullable_type, tds_result_info::num_cols, SUCCEED, TDS_DBG_FUNC, TDS_DBG_INFO1, and tdsdump_log.

static int _bcp_add_variable_columns DBPROCESS dbproc,
int  behaviour,
BYTE rowbuffer,
int  start,
int *  var_cols
[static]
 

Parameters:
dbproc contains all information needed by db-lib to manage communications with the server.
behaviour 
rowbuffer 
start 
var_cols 
Returns:
SUCCEED or FAIL.
See also:
BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow()

Definition at line 1604 of file bcp.c.

References _bcp_get_col_data(), BCP_REC_FETCH_DATA, tds_dblib_dbprocess::bcpinfo, DB_BCPINFO::bindinfo, tds_column::column_nullable, tds_column::column_type, tds_result_info::columns, FAIL, is_nullable_type, tds_result_info::num_cols, SUCCEED, TDS_DBG_FUNC, and tdsdump_log.

static RETCODE _bcp_build_bulk_insert_stmt TDSSOCKET tds,
TDS_PBCB clause,
TDSCOLUMN bcpcol,
int  first
[static]
 

Parameters:
tds 
clause 
bcpcol 
first 
Returns:
SUCCEED or FAIL.
See also:
BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow()

Definition at line 2234 of file bcp.c.

References buffer, _pbcb::cb, tds_column::column_name, tds_column::column_namelen, tds_column::column_prec, tds_column::column_scale, tds_column::column_size, tds_column::column_type, FAIL, free(), _pbcb::from_malloc, malloc(), tds_column::on_server, _pbcb::pb, SUCCEED, SYBBIT, SYBBITN, SYBDATETIME, SYBDATETIME4, SYBDATETIMN, SYBDECIMAL, SYBFLT8, SYBFLTN, SYBIMAGE, SYBINT1, SYBINT2, SYBINT4, SYBINT8, SYBINTN, SYBMONEY, SYBMONEY4, SYBMONEYN, SYBNTEXT, SYBNUMERIC, SYBREAL, SYBTEXT, SYBUNIQUE, TDS_DBG_FUNC, tds_quote_id, tdsdump_log, XSYBBINARY, XSYBCHAR, XSYBNCHAR, XSYBNVARCHAR, XSYBVARBINARY, and XSYBVARCHAR.

Referenced by _bcp_start_copy_in().

static RETCODE _bcp_exec_in DBPROCESS dbproc,
DBINT rows_copied
[static]
 

Parameters:
dbproc contains all information needed by db-lib to manage communications with the server.
rows_copied 
Returns:
SUCCEED or FAIL.
See also:
BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow()

Definition at line 1825 of file bcp.c.

References _bcp_read_hostfile(), _bcp_send_colmetadata(), _bcp_start_copy_in(), BCP_HOSTCOLINFO::column_error, dbperror(), BCP_HOSTFILEINFO::errorfile, FAIL, free(), fseeko, ftello, HOST_COL_CONV_ERROR, HOST_COL_NULL_ERROR, BCP_HOSTFILEINFO::host_colcount, BCP_HOSTFILEINFO::host_columns, BCP_HOSTFILEINFO::hostfile, tds_dblib_dbprocess::hostfileinfo, IS_TDS7_PLUS, malloc(), MORE_ROWS, tds_socket::out_flag, SEEK_SET, SYBEBCUO, SYBEBUOE, TDS_BULK, TDS_QUERYING, tds_set_state, and tds_dblib_dbprocess::tds_socket.

Referenced by bcp_exec().

static RETCODE _bcp_exec_out DBPROCESS dbproc,
DBINT rows_copied
[static]
 

Parameters:
dbproc contains all information needed by db-lib to manage communications with the server.
rows_copied 
Returns:
SUCCEED or FAIL.
See also:
BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow()

Definition at line 726 of file bcp.c.

References tds_dblib_dbprocess::bcpinfo, tds_column::column_nullable, tds_column::column_size, tds_column::column_type, tds_result_info::columns, BCP_HOSTCOLINFO::datatype, DB_QUERYOUT, dbperror(), DB_BCPINFO::direction, errno, FAIL, BCP_HOSTFILEINFO::host_colcount, BCP_HOSTFILEINFO::host_columns, BCP_HOSTFILEINFO::hostfile, tds_dblib_dbprocess::hostfileinfo, tds_result_info::num_cols, tds_socket::res_info, si, SYBBIT, SYBBITN, SYBCHAR, SYBDATETIME, SYBDATETIME4, SYBDECIMAL, SYBEBCUO, SYBFLT8, SYBINT1, SYBINT2, SYBINT4, SYBINT8, SYBMONEY, SYBMONEY4, SYBNUMERIC, SYBREAL, SYBTEXT, SYBVARCHAR, BCP_HOSTCOLINFO::tab_colnum, DB_BCPINFO::tablename, TDS_CANCELLED, TDS_FAIL, tds_process_tokens, tds_dblib_dbprocess::tds_socket, tds_submit_query, tds_submit_queryf, and TDS_TOKEN_RESULTS.

Referenced by bcp_exec().

static char* _bcp_fgets char *  buffer,
size_t  size,
FILE *  f
[static]
 

Parameters:
buffer 
size 
f 
Returns:
SUCCEED or FAIL.
See also:
BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow()

Definition at line 2520 of file bcp.c.

Referenced by bcp_readfmt().

static void _bcp_free_columns DBPROCESS dbproc  )  [static]
 

Parameters:
dbproc contains all information needed by db-lib to manage communications with the server.
Returns:
SUCCEED or FAIL.
See also:
BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow()

Definition at line 3403 of file bcp.c.

References BCP_HOSTCOLINFO::bcp_column_data, BCP_HOSTFILEINFO::host_colcount, BCP_HOSTFILEINFO::host_columns, tds_dblib_dbprocess::hostfileinfo, tds_free_bcp_column_data, TDS_ZERO_FREE, and BCP_HOSTCOLINFO::terminator.

Referenced by _bcp_free_storage(), and bcp_columns().

static RETCODE _bcp_free_storage DBPROCESS dbproc  )  [static]
 

Parameters:
dbproc contains all information needed by db-lib to manage communications with the server.
Returns:
SUCCEED or FAIL.
See also:
BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow()

Definition at line 3429 of file bcp.c.

References _bcp_free_columns(), tds_dblib_dbprocess::bcpinfo, DB_BCPINFO::bindinfo, tds_result_info::current_row, BCP_HOSTFILEINFO::errorfile, BCP_HOSTFILEINFO::hostfile, tds_dblib_dbprocess::hostfileinfo, DB_BCPINFO::insert_stmt, SUCCEED, DB_BCPINFO::tablename, tds_free_results, and TDS_ZERO_FREE.

Referenced by bcp_done(), bcp_exec(), and bcp_init().

static RETCODE _bcp_get_col_data DBPROCESS dbproc,
TDSCOLUMN bindcol
[static]
 

Parameters:
dbproc contains all information needed by db-lib to manage communications with the server.
bindcol 
Returns:
SUCCEED or FAIL.
See also:
BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow()

Definition at line 3246 of file bcp.c.

References _bcp_get_term_var(), tds_column::bcp_column_data, tds_column::bcp_prefix_len, tds_column::bcp_term_len, tds_column::bcp_terminator, tds_column::column_bindlen, tds_column::column_bindtype, tds_column::column_size, tds_column::column_type, tds_column::column_varaddr, _tds_bcpcoldata::data, _tds_bcpcoldata::datalen, dbconvert(), FAIL, is_fixed_type, _tds_bcpcoldata::null_column, si, SUCCEED, tds_get_conversion_type, and tds_get_size_by_type.

Referenced by _bcp_add_fixed_columns(), _bcp_add_variable_columns(), and _bcp_send_bcp_record().

static RETCODE _bcp_get_term_var BYTE pdata,
BYTE term,
int  term_len
[static]
 

Parameters:
pdata 
term 
term_len 
Returns:
SUCCEED or FAIL.
See also:
BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow()

Definition at line 3360 of file bcp.c.

Referenced by _bcp_get_col_data().

static offset_type _bcp_measure_terminated_field FILE *  hostfile,
BYTE terminator,
int  term_len
[static]
 

Parameters:
hostfile 
terminator 
term_len 
Returns:
SUCCEED or FAIL.
See also:
BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow()

Definition at line 1426 of file bcp.c.

References dbperror(), errno, free(), fseeko, ftello, malloc(), SEEK_CUR, SEEK_SET, size, and SYBEMEM.

static RETCODE _bcp_read_hostfile DBPROCESS dbproc,
FILE *  hostfile,
int *  row_error
[static]
 

Parameters:
dbproc contains all information needed by db-lib to manage communications with the server.
hostfile 
row_error 
Returns:
MORE_ROWS, NO_MORE_ROWS, or FAIL.
See also:
BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow()

Definition at line 1095 of file bcp.c.

References tds_dblib_dbprocess::bcpinfo, DB_BCPINFO::bindinfo, BCP_HOSTCOLINFO::column_error, tds_result_info::columns, BCP_HOSTFILEINFO::host_colcount, BCP_HOSTFILEINFO::host_columns, tds_dblib_dbprocess::hostfileinfo, si, BCP_HOSTCOLINFO::tab_colnum, TDS_DBG_FUNC, and tdsdump_log.

Referenced by _bcp_exec_in().

static int _bcp_readfmt_colinfo DBPROCESS dbproc,
char *  buf,
BCP_HOSTCOLINFO ci
[static]
 

Parameters:
dbproc contains all information needed by db-lib to manage communications with the server.
buf 
ci 
Returns:
SUCCEED or FAIL.
See also:
BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow()

Definition at line 2646 of file bcp.c.

References BCP_HOSTCOLINFO::column_len, BCP_HOSTCOLINFO::datatype, dbperror(), FALSE, BCP_HOSTCOLINFO::host_column, BCP_HOSTCOLINFO::prefix_len, util::strcmp(), SYBBINARY, SYBBIT, SYBCHAR, SYBDATETIME, SYBDATETIME4, SYBDECIMAL, SYBEBIHC, SYBEBUDF, SYBFLT8, SYBIMAGE, SYBINT1, SYBINT2, SYBINT4, SYBINT8, SYBMONEY, SYBNUMERIC, SYBREAL, and SYBTEXT.

Referenced by bcp_readfmt().

static RETCODE _bcp_send_bcp_record DBPROCESS dbproc,
int  behaviour
[static]
 

Parameters:
dbproc contains all information needed by db-lib to manage communications with the server.
behaviour 
Returns:
SUCCEED or FAIL.
See also:
BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow()

Definition at line 3004 of file bcp.c.

References _bcp_get_col_data(), BCP_REC_FETCH_DATA, tds_dblib_dbprocess::bcpinfo, DB_BCPINFO::bindinfo, tds_column::column_identity, tds_column::column_timestamp, tds_result_info::columns, tds_result_info::current_row, FAIL, DB_BCPINFO::identity_insert_on, IS_TDS7_PLUS, tds_result_info::num_cols, tds_result_info::row_size, SUCCEED, TDS_DBG_FUNC, TDS_DBG_INFO1, tds_dblib_dbprocess::tds_socket, and tdsdump_log.

Referenced by bcp_sendrow().

static RETCODE _bcp_send_colmetadata DBPROCESS dbproc  )  [static]
 

Parameters:
dbproc contains all information needed by db-lib to manage communications with the server.
Returns:
SUCCEED or FAIL.
See also:
BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow()

Definition at line 2428 of file bcp.c.

References tds_dblib_dbprocess::bcpinfo, DB_BCPINFO::bindinfo, tds_column::column_identity, tds_column::column_timestamp, tds_result_info::columns, DB_BCPINFO::identity_insert_on, tds_result_info::num_cols, tds_put_byte, and tds_dblib_dbprocess::tds_socket.

Referenced by _bcp_exec_in(), _bcp_start_new_batch(), and bcp_sendrow().

static RETCODE _bcp_start_copy_in DBPROCESS dbproc  )  [static]
 

Parameters:
dbproc contains all information needed by db-lib to manage communications with the server.
Returns:
SUCCEED or FAIL.
See also:
BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow()

Definition at line 2029 of file bcp.c.

References _bcp_build_bulk_insert_stmt(), tds_dblib_dbprocess::bcpinfo, DB_BCPINFO::bindinfo, _pbcb::cb, tds_column::column_timestamp, tds_result_info::columns, _pbcb::from_malloc, DB_BCPINFO::identity_insert_on, IS_TDS7_PLUS, tds_result_info::num_cols, _pbcb::pb, query, and tds_dblib_dbprocess::tds_socket.

Referenced by _bcp_exec_in(), and bcp_sendrow().

static RETCODE _bcp_start_new_batch DBPROCESS dbproc  )  [static]
 

Parameters:
dbproc contains all information needed by db-lib to manage communications with the server.
Returns:
SUCCEED or FAIL.
See also:
BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow()

Definition at line 2399 of file bcp.c.

References _bcp_send_colmetadata(), tds_dblib_dbprocess::bcpinfo, FAIL, DB_BCPINFO::insert_stmt, IS_TDS7_PLUS, tds_socket::out_flag, SUCCEED, TDS_BULK, tds_process_simple_query, TDS_QUERYING, tds_set_state, tds_dblib_dbprocess::tds_socket, tds_submit_query, and TDS_SUCCEED.

Referenced by bcp_batch().

static int rtrim char *  istr,
int  ilen
[static]
 

Parameters:
istr 
ilen 
Returns:
modified length
See also:
BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow()

Definition at line 3385 of file bcp.c.


Generated on Wed Dec 9 08:16:07 2009 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Wed Dec 09 08:20:18 2009 by modify_doxy.py rev. 173732