home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer) / NeXT_Developer-3.3.iso / usr / sybase / doc / bcp_init.man < prev    next >
Encoding:
Text File  |  1993-04-22  |  5.1 KB  |  133 lines

  1.  
  2.   1                       Version 4.0 -- 5/1/89                 bcp_init
  3.   ______________________________________________________________________
  4.  
  5.   NAME:  bcp_init
  6.  
  7.   FUNCTION:
  8.        Initialize bulk copy.
  9.  
  10.   SYNTAX:
  11.        RETCODE bcp_init(dbproc, tblname, hfile, errfile, direction)
  12.  
  13.        DBPROCESS *dbproc;
  14.        char      *tblname;
  15.        char      *hfile;
  16.        char      *errfile;
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.   bcp_init                Version 4.0 -- 5/1/89                        2
  25.   ______________________________________________________________________
  26.        int       direction;
  27.  
  28.   COMMENTS:
  29.  
  30.        o bcp_init() performs the necessary initializations  for  a  bulk
  31.          copy  of  data  between the front-end and a SQL Server. It sets
  32.          the default host file data formats and examines  the  structure
  33.          of the database table.
  34.        o If a host file is being used (see the description of the  hfile
  35.          parameter, below), the default data formats are as follows:
  36.  
  37.             o The order, type, length and number of the columns  in  the
  38.               host  file  are assumed to be identical to the order, type
  39.               and number of the columns in the database table.
  40.             o If a given database column's data  is  fixed-length,  then
  41.               the host file's data column will also be fixed-length.  If
  42.               a given database column's data is variable-length  or  may
  43.  
  44.  
  45.  
  46.   3                       Version 4.0 -- 5/1/89                 bcp_init
  47.   ______________________________________________________________________
  48.               contain NULL values, the host file's data column  will  be
  49.               prefixed by a 4-byte length value for SYBTEXT and SYBIMAGE
  50.               data types, and a 1-byte length value for all other types.
  51.  
  52.             o There are no terminators of any  kind  between  host  file
  53.               columns.
  54.          Any  of  these  defaults   can   be   overridden   by   calling
  55.          bcp_columns() and bcp_colfmt().
  56.  
  57.        o To use the bulk copy routines to copy data to a database  table
  58.          requires the following:
  59.             o The DBPROCESS structure must be usable for bulk copy  pur-
  60.               poses. This is accomplished by calling BCP_SETL():
  61.  
  62.                  login = dblogin();
  63.                  BCP_SETL(login, TRUE);
  64.  
  65.  
  66.  
  67.  
  68.   bcp_init                Version 4.0 -- 5/1/89                        4
  69.   ______________________________________________________________________
  70.  
  71.             o If the table has no indexes, the  database  option  select
  72.               into/bulkcopy  must  be  set to "true".  The following SQL
  73.               command will do this:
  74.  
  75.                  sp_dboption 'mydb', 'select into/bulkcopy', 'true'
  76.  
  77.               See  the  Commands  Reference  for  further   details   on
  78.               sp_dboption.
  79.        o If  no  host  file  is  being  used,  it's  necessary  to  call
  80.          bcp_bind() to specify the format and location in memory of each
  81.          column's data value.
  82.  
  83.        o bcp_init() must be called before any other bulk copy functions.
  84.          Failure to do so will result in an error.
  85.        o For information on the bcp utility program, see its manual page
  86.          in the Commands Reference.
  87.  
  88.  
  89.  
  90.   5                       Version 4.0 -- 5/1/89                 bcp_init
  91.   ______________________________________________________________________
  92.  
  93.   PARAMETERS:
  94.        dbproc -  A pointer to the DBPROCESS structure that provides  the
  95.            connection for a particular front-end/SQL Server process.  It
  96.            contains all the information that DB-Library uses  to  manage
  97.            communications and data between the front end and SQL Server.
  98.        tblname -  The name of the database table to be copied in or out.
  99.            This  name  may  also  include the database name or the owner
  100.            name.  For  example,  "pubs.gracie.titles",   "pubs..titles",
  101.            "gracie.titles", and "titles" are all legal table names.
  102.        hfile -  The name of the host file to be copied in or out.  If no
  103.            host  file  is  involved  (the  situation  when data is being
  104.            copied directly from variables), hfile should be NULL.
  105.        errfile -  The name of the error file to be used. This error file
  106.            will  be  filled  with progress messages, error messages, and
  107.            copies of any rows which, for any reason, could not be copied
  108.            from a host file to a SQL Server table.  If NULL is passed as
  109.  
  110.  
  111.  
  112.   bcp_init                Version 4.0 -- 5/1/89                        6
  113.   ______________________________________________________________________
  114.            errfile, no error file will be used.
  115.        direction -  The direction of the copy. It must  be  one  of  two
  116.            values-DB_IN  or DB_OUT. DB_IN indicates a copy from the host
  117.            into the database table, while DB_OUT indicates a  copy  from
  118.            the database table into the host file.
  119.  
  120.            It is illegal to request a bulk copy from the database  table
  121.            (DB_OUT) without supplying a host file name.
  122.  
  123.   RETURNS:
  124.        SUCCEED or FAIL.
  125.  
  126.   SEE ALSO:
  127.        bcp_batch,   bcp_bind,   bcp_colfmt,   bcp_collen,    bcp_colptr,
  128.        bcp_columns, bcp_control, bcp_done, bcp_exec, bcp_sendrow
  129.  
  130.  
  131.  
  132.  
  133.