home *** CD-ROM | disk | FTP | other *** search
- .Na "dbrpcinit"
- .mc |
- .Aa
- .Fu
- Initialize a remote procedure call.
- .Ih "remote procedure call"
- .Ih "stored procedure, calling"
- .Ih "call, remote procedure"
- .Sy
- .Sf "RETCODE dbrpcinit(dbproc, rpcname, options)"
- .Sp "DBPROCESS" "*dbproc"
- .Sp "char" "*rpcname"
- .Sp "DBSMALLINT" "options"
- .Co
- .Bl
- An application can call a stored procedure in two ways:
- by executing a command buffer containing a \*N EXECUTE statement or by making a
- remote procedure call (``rpc'').
- .Bl
- Remote procedure calls have a few advantages over EXECUTE statements:
- .in +3n
- .Bl *
- An rpc passes the stored procedure's parameters in their
- native datatypes, in contrast to
- the EXECUTE statement, which passes parameters
- as ASCII characters.
- Therefore,
- the rpc method is faster and usually more compact than the EXECUTE statement,
- because it does not require either the application program or the server to
- convert between native datatypes and their ASCII equivalents.
- .Bl *
- It is simpler and faster to accommodate stored procedure return parameters
- with an rpc, instead of an EXECUTE statement.
- With an rpc, the return parameters are automatically available to the application.
- (Note, however, that a return parameter must be specified as such
- when it's originally added to the rpc via the \f2dbrpcparam()\f1 routine.)
- If, on the other hand,
- a stored procedure is called with an EXECUTE statement, the return parameter values
- are available only if the command batch containing the EXECUTE statement uses
- local variables, not constants, as the return parameters.
- This involves additional parsing each time the command batch is executed.
- .in -3n
- .Bl
- To make a remote procedure call,
- first call \f2dbrpcinit()\f1 to specify the stored procedure that's to be invoked.
- Then call \f2dbrpcparam()\f1 once for each of the stored procedure's parameters.
- Finally, call \f2dbrpcsend()\f1 to signify the end of the parameter list.
- This causes the server to begin executing the specified procedure.
- You can then call \f2dbsqlok()\f1, \f2dbresults()\f1, and \f2dbnextrow()\f1
- to process the stored procedure's results.
- (Note that you will need to call \f2dbresults()\f1 multiple times if the
- stored procedure contains more than one SELECT statement.)
- After all of the stored procedure's results have been processed,
- you can call the routines that process return parameters and status numbers,
- such as \f2dbretdata()\f1 and \f2dbretstatus()\f1.
- .Bl
- For an example of a remote procedure call,
- see Example 8 in the \f2\*L Reference Supplement\f1.
- .Bz
- .Pa
- .Pi dbproc
- A pointer to the DBPROCESS structure that provides the connection
- for a particular front-end/server process. It contains all the
- information that \*L uses to manage communications and data between the
- front end and the server.
- .Pi rpcname
- A pointer to the name of the stored procedure to be invoked.
- .Pi options
- A two-byte bitmask of rpc options. So far, the only option
- available is DBRPCRECOMPILE, which causes the stored
- procedure to be recompiled before it is executed.
- .in -.375i
- .Re
- .br
- SUCCEED or FAIL.
- .Sa
- dbnextrow,
- dbresults,
- dbretdata,
- dbretstatus,
- dbrpcparam,
- dbrpcsend,
- dbsqlok
- .mc
-