home *** CD-ROM | disk | FTP | other *** search
- .Na "dbcmd"
- .Aa
- .Fu
- Add text to the DBPROCESS command buffer.
- .Ih "command buffer, adding text to"
- .Sy
- .Sf "RETCODE dbcmd(dbproc, cmdstring)"
- .Sp "DBPROCESS" "*dbproc"
- .Sp "char" "*cmdstring"
- .Co
- .Bl
- This routine adds text to the \*N command buffer in the DBPROCESS
- structure.
- It adds to the existing command buffer\(emit doesn't
- delete or overwrite the current contents except after the
- buffer has been sent to \*S (see below).
- A single command buffer may contain multiple commands; in fact, this represents
- an efficient use of the command buffer.
- .Bl
- The application may call
- .I "dbcmd()"
- repeatedly.
- The command strings in
- sequential calls are just concatenated together.
- It is the
- application's responsibility to ensure that any necessary blanks appear between
- the end of one string and the beginning of the next.
- .Bl
- After a call to \f2dbsqlexec()\f1 or \f2dbsqlsend()\f1,
- the first call to either \f2dbcmd()\f1 or \f2dbfcmd()\f1
- automatically clears the command buffer before the new text is entered.
- If this situation is undesirable, set the DBNOAUTOFREE option.
- .Ih "DBNOAUTOFREE option"
- When DBNOAUTOFREE is set, the command buffer is cleared only by an
- explicit call to \f2dbfreebuf()\f1.
- .Bl
- Here's a small example of using \f2dbcmd()\f1 to build up a multi-line SQL command:
- .ta +4n +4n +4n +4n +4n +4n
- .SD
- .in +4n
- DBPROCESS *dbproc;
-
- dbcmd(dbproc, "select name from sysobjects");
- dbcmd(dbproc, " where id < 5");
- dbcmd(dbproc, " and type='S'");
- .in -4n
- .ED
- Note the required spaces at the start of the second and third command strings.
- .Bl
- .I "dbfcmd()"
- is a related function.
- .I "dbfcmd()"
- interprets the
- .I "cmdstring"
- as a format string that is passed to
- .I "sprintf()"
- along with any additional arguments.
- The application can intermingle calls
- to \f2dbcmd()\f1 and \f2dbfcmd()\f1.
- .Bl
- At any time,
- the application can access the
- contents of the command buffer through calls to
- .I "dbgetchar(), dbstrlen(),"
- and
- .I "dbstrcpy()."
- .Bz
- .Pa
- .Pi dbproc
- A pointer to the DBPROCESS structure that provides the connection
- for a particular front-end/\*S process. It contains all the
- information that \*L uses to manage communications and data between the
- front end and \*S.
- .Pi cmdstring
- A null-terminated character string that \f2dbcmd()\f1 copies into
- the command buffer.
- .in -.375i
- .Re
- .br
- SUCCEED or FAIL.
- .Sa
- dbfcmd,
- dbfreebuf,
- dbgetchar,
- dbstrcpy,
- dbstrlen,
- options
-