home *** CD-ROM | disk | FTP | other *** search
- .Na "dbsqlok"
- .Aa
- .Fu
- Wait for results from the \*S and verify the correctness of the instructions
- the \*S is responding to.
- .Ih "command batch, verifying the correctness of"
- .Sy
- .Sf "RETCODE dbsqlok(dbproc)"
- .Sp "DBPROCESS" "*dbproc"
- .Co
- .Bl
- This routine waits for results from the \*S and verifies the correctness of the
- instructions that the \*S is responding to.
- .sp 0.5v
- The ``instructions that the \*S is responding to'' can be any of the following:
- .in +3n
- .Bl *
- A command batch (when \f2dbsqlok()\f1 is used with \f2dbsqlsend()\f1).
- .Bl *
- Processing information for handling chunks of text or image data
- (when \f2dbsqlok()\f1 is used with \f2dbmoretext()\f1).
- .Bl *
- A remote procedure call (when \f2dbsqlok()\f1 is used with \f2dbrpcsend()\f1).
- .in -3n
- .Bl
- The application must call \f2dbsqlok()\f1
- after a call to \f2dbsqlsend()\f1 or \f2dbrpcsend()\f1,
- and before and after a set of \f2dbmoretext()\f1 calls.
- A successful \f2dbsqlok()\f1 call must always be followed by
- a call to \f2dbresults()\f1 to process the results.
- .Bl
- \f2dbsqlexec()\f1 is equivalent to \f2dbsqlsend()\f1 followed by \f2dbsqlok()\f1.
- .Bl
- The use of \f2dbsqlsend()\f1 with \f2dbsqlok()\f1 is of particular value in UNIX
- applications.
- After sending a query to \*S, \f2dbsqlexec()\f1 waits until
- a response is received or until the timeout period has elapsed.
- By substituting \f2dbsqlsend()\f1 and \f2dbsqlok()\f1 for \f2dbsqlexec()\f1,
- you can sometimes provide a way for a UNIX application
- to respond more effectively to multiple input and output streams.
- The time between the request for
- information from \*S (made via a call to \f2dbsqlsend()\fP)
- and \*S's response (read by calling \f2dbsqlok()\fP)
- can be used, in conjunction with \f2DBIORDESC()\f1 or \f2DBIOWDESC()\f1, to
- service other parts of the application.
- \f2DBIORDESC()\f1 and \f2DBIOWDESC()\f1 are available for UNIX only.
- See the manual pages for those two routines for more information.
- .sp 0.5v
- To manage input data streams efficiently, a UNIX
- application using \f2dbsqlok()\f1 should
- confirm that unread bytes are available,
- either in the \*L network buffer (by calling \f2DBRBUF()\f1) or in the network itself
- (by calling the UNIX \f2select()\f1 function), before calling \f2dbresults()\f1.
- .sp 0.5v
- For a UNIX example that illustrates the use of \f2dbsqlok()\f1 with \f2dbsqlsend()\f1,
- \f2DBRBUF()\f1, \f2DBIORDESC()\f1, and \f2DBIOWDESC()\f1, see the \f2\*L Reference Supplement\f1.
- .sp 0.5v
- On occasion the operating system may inform the application that
- data is ready for \f2dbsqlok()\f1 to read when only the first part of the
- \*S response is present.
- When this occurs, \f2dbsqlok()\f1 waits for the rest of the response or until
- the timeout period has elapsed, just like \f2dbsqlexec()\f1.
- In practice, however, the entire response is usually available at one time.
- .Bl
- \f2dbsqlok()\f1 is also useful in text update operations.
- When chunks of text are sent to \*S via \f2dbwritetext()\f1 and \f2dbmoretext()\f1,
- \f2dbsqlok()\f1 must be called before the first call to \f2dbmoretext()\f1 and after the last
- call to \f2dbmoretext()\f1.
- For an example of its use in this context, see the manual page for \f2dbwritetext()\f1.
- .Bl
- \f2dbsqlok()\f1 is also necessary when making remote procedure calls.
- The application must call it
- after \f2dbrpcsend()\f1 and before \f2dbresults()\f1.
- .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.
- .in -.375i
- .Re
- .br
- SUCCEED or FAIL.
- The most common reason for failing is a SQL syntax error.
- \f2dbsqlok()\f1 will also fail if there are semantic errors, such as
- incorrect column or table names.
- Failure occurs if \f2any\f1 of the commands in the batch contains a semantic or syntax error.
- .sp 0.5v
- In addition, a run-time error, such as a database protection violation, will cause \f2dbsqlok()\f1 to
- fail \f2if\f1 the command buffer contains only a single command.
- If the command buffer contains multiple commands, a run-time error will \f2not\f1 cause \f2dbsqlok()\f1 to fail.
- Instead, failure will occur with the \f2dbresults()\f1 call that processes the command causing the run-time error.
- .sp 0.5v
- The situation is a bit more complicated for run-time errors and stored procedures.
- A run-time error on an EXECUTE command may cause \f2dbsqlok()\f1 to fail,
- in accordance with the rule given in the previous paragraph.
- A run-time error on a statement \f2inside\f1 a stored procedure will not cause \f2dbsqlok()\f1 to fail,
- however.
- For example, if the stored procedure contains an INSERT statement and the user does not have
- insert permission on the database table, the INSERT statement will fail, but \f2dbsqlok()\f1
- will still return SUCCEED.
- To check for run-time errors inside stored procedures, use the \f2dbretstatus()\f1 routine
- to look at the procedure's return status, and trap relevant \*S messages inside your message handler.
- .Sa
- dbcmd,
- dbfcmd,
- DBIORDESC,
- DBIOWDESC,
- dbmoretext,
- dbnextrow,
- DBRBUF,
- dbresults,
- dbretstatus,
- dbrpcsend,
- dbsettime,
- dbsqlexec,
- dbsqlsend,
- dbwritetext
-