bcp_init

Description

Initialize bulk copy.

Syntax

RETCODE bcp_init(dbproc, tblname, hfile, errfile,
               direction)
 
DBPROCESS     *dbproc;
char                    *tblname;
char                    *hfile;
char                    *errfile;
int                         direction;

Parameters

dbproc

A pointer to the DBPROCESS structure that provides the connection for a particular front-end/Adaptive Server process. It contains all the information that DB-Library uses to manage communications and data between the front end and Adaptive Server.

tblname

The name of the database table to be copied in or out. This name may also include the database name or the owner name. For example, pubs2.gracie.titles, pubs2.titles, gracie.titles, and titles are all legal table names.

hfile

The name of the host file to be copied in or out. If no host file is involved (the situation when data is being copied directly from variables), hfile should be NULL.

errfile

The name of the error file to be used. This error file will be filled with progress messages, error messages, and copies of any rows that, for any reason, could not be copied from a host file to an Adaptive Server table.

If errfile is NULL, no error file is used.

If hfile is NULL, errfile is ignored. This is because an error file is not necessary when bulk-copying from program variables.

direction

The direction of the copy. It must be one of two values—DB_IN or DB_OUT. DB_IN indicates a copy from the host into the database table, while DB_OUT indicates a copy from the database table into the host file.

It is illegal to request a bulk copy from the database table (DB_OUT) without supplying a host file name.

Returns

SUCCEED or FAIL.

Usage

See also

bcp_batch, bcp_bind, bcp_colfmt, bcp_collen, bcp_colptr, bcp_columns, bcp_control, bcp_done, bcp_exec, bcp_sendrow