home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 for Intel / NeXTSTEP 3.2 for Intel.iso / NextLibrary / Documentation / Sybase / DBLIB / Section2 / dbcmd.nr < prev    next >
Encoding:
Text File  |  1993-04-22  |  2.3 KB  |  88 lines

  1. .Na "dbcmd" 
  2. .Aa
  3. .Fu
  4. Add text to the DBPROCESS command buffer.
  5. .Ih "command buffer, adding text to"
  6. .Sy
  7. .Sf "RETCODE dbcmd(dbproc, cmdstring)"
  8. .Sp "DBPROCESS" "*dbproc"
  9. .Sp "char" "*cmdstring"
  10. .Co
  11. .Bl
  12. This routine adds text to the \*N command buffer in the DBPROCESS
  13. structure.
  14. It adds to the existing command buffer\(emit doesn't
  15. delete or overwrite the current contents except after the
  16. buffer has been sent to \*S (see below).
  17. A single command buffer may contain multiple commands; in fact, this represents
  18. an efficient use of the command buffer.
  19. .Bl
  20. The application may call
  21. .I "dbcmd()"
  22. repeatedly.
  23. The command strings in
  24. sequential calls are just concatenated together. 
  25. It is the
  26. application's responsibility to ensure that any necessary blanks appear between
  27. the end of one string and the beginning of the next.
  28. .Bl
  29. After a call to \f2dbsqlexec()\f1 or \f2dbsqlsend()\f1,
  30. the first call to either \f2dbcmd()\f1 or \f2dbfcmd()\f1 
  31. automatically clears the command buffer before the new text is entered.
  32. If this situation is undesirable, set the DBNOAUTOFREE option.
  33. .Ih "DBNOAUTOFREE option"
  34. When DBNOAUTOFREE is set, the command buffer is cleared only by an
  35. explicit call to \f2dbfreebuf()\f1.
  36. .Bl
  37. Here's a small example of using \f2dbcmd()\f1 to build up a multi-line SQL command:
  38. .ta +4n +4n +4n +4n +4n +4n
  39. .SD
  40. .in +4n
  41. DBPROCESS       *dbproc;
  42.  
  43. dbcmd(dbproc, "select name from sysobjects");
  44. dbcmd(dbproc, " where id < 5");
  45. dbcmd(dbproc, " and type='S'");
  46. .in -4n
  47. .ED
  48. Note the required spaces at the start of the second and third command strings.
  49. .Bl
  50. .I "dbfcmd()"
  51. is a related function.
  52. .I "dbfcmd()"
  53. interprets the
  54. .I "cmdstring"
  55. as a format string that is passed to 
  56. .I "sprintf()"
  57. along with any additional arguments.
  58. The application can intermingle calls
  59. to \f2dbcmd()\f1 and \f2dbfcmd()\f1.
  60. .Bl
  61. At any time,
  62. the application can access the
  63. contents of the command buffer through calls to
  64. .I "dbgetchar(), dbstrlen(),"
  65. and
  66. .I "dbstrcpy()."
  67. .Bz
  68. .Pa
  69. .Pi dbproc
  70. A pointer to the DBPROCESS structure that provides the connection
  71. for a particular front-end/\*S process.  It contains all the
  72. information that \*L uses to manage communications and data between the
  73. front end and \*S.
  74. .Pi cmdstring
  75. A null-terminated character string that \f2dbcmd()\f1 copies into
  76. the command buffer.
  77. .in -.375i
  78. .Re
  79. .br
  80. SUCCEED or FAIL.
  81. .Sa
  82. dbfcmd,
  83. dbfreebuf,
  84. dbgetchar, 
  85. dbstrcpy,
  86. dbstrlen,
  87. options
  88.