Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ () — Sybase DB Library C 4.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

  1                       Version 4.0 -- 5/1/89                    dbcmd
  ______________________________________________________________________

  NAME:  dbcmd

  FUNCTION:
       Add text to the DBPROCESS command buffer.

  SYNTAX:
       RETCODE dbcmd(dbproc, cmdstring)

       DBPROCESS *dbproc;
       char      *cmdstring;

  COMMENTS:







  dbcmd                   Version 4.0 -- 5/1/89                        2
  ______________________________________________________________________

       o This routine adds text to the Transact-SQL  command  buffer  in
         the  DBPROCESS  structure.   It  adds  to  the existing command
         buffer-it doesn't delete  or  overwrite  the  current  contents
         except  after  the  buffer  has  been  sent  to SQL Server (see
         below).  A single command buffer may contain multiple commands;
         in  fact,  this  represents  an  efficient  use  of the command
         buffer.
       o The application  may  call  dbcmd()  repeatedly.   The  command
         strings  in sequential calls are just concatenated together. It
         is the application's responsibility to ensure that  any  neces-
         sary blanks appear between the end of one string and the begin-
         ning of the next.

       o After a call to dbsqlexec() or dbsqlsend(), the first  call  to
         either  dbcmd()  or  dbfcmd()  automatically clears the command
         buffer before the new text is entered.  If  this  situation  is
         undesirable, set the DBNOAUTOFREE option.  When DBNOAUTOFREE is


  3                       Version 4.0 -- 5/1/89                    dbcmd
  ______________________________________________________________________
         set, the command buffer is cleared only by an explicit call  to
         dbfreebuf().

       o Here's a small example of using dbcmd() to build  up  a  multi-
         line SQL command:

             DBPROCESS       *dbproc;

             dbcmd(dbproc, "select name from sysobjects");
             dbcmd(dbproc, " where id < 5");
             dbcmd(dbproc, " and type='S'");

         Note the required spaces at the start of the second  and  third
         command strings.
       o dbfcmd()  is  a  related  function.   dbfcmd()  interprets  the
         cmdstring  as a format string that is passed to sprintf() along
         with any additional arguments.  The application can intermingle



  dbcmd                   Version 4.0 -- 5/1/89                        4
  ______________________________________________________________________
         calls to dbcmd() and dbfcmd().

       o At any time, the application can access  the  contents  of  the
         command  buffer  through  calls to dbgetchar(), dbstrlen(), and
         dbstrcpy().

  PARAMETERS:
       dbproc -  A pointer to the DBPROCESS structure that provides  the
           connection for a particular front-end/SQL Server process.  It
           contains all the information that DB-Library uses  to  manage
           communications and data between the front end and SQL Server.
       cmdstring -  A  null-terminated  character  string  that  dbcmd()
           copies into the command buffer.

  RETURNS:
       SUCCEED or FAIL.




  5                       Version 4.0 -- 5/1/89                    dbcmd
  ______________________________________________________________________

  SEE ALSO:
       dbfcmd, dbfreebuf, dbgetchar, dbstrcpy, dbstrlen, options
















Typewritten Software • bear@typewritten.org • Edmonds, WA 98026