A remote procedure call is simply a call to a stored procedure residing on a remote server. Either an application or another server makes the call. A remote procedure call made by an application has the same effect as an execute command: It executes the stored procedure, generating results accessible through dbresults. However, a remote procedure call is often more efficient than an execute command. Note that if the procedure being executed resides on a server other than the one to which the application is directly connected, commands executed within the procedure cannot be rolled back.
A server can make a remote procedure call to another server. This occurs when a stored procedure being executed on one server contains an execute command for a stored procedure on another server. The execute command causes the first server to log in to the second server and perform a remote procedure call on the procedure. This happens without any intervention from the application, although the application can specify the remote password that the first server uses to log in.
The following routines are used to perform remote procedure calls:
dbrpcinit – initializes a remote procedure call to a stored procedure.
dbrpcparam – adds a parameter to a remote procedure call.
dbrpcsend – signals the end of a remote procedure call, causing the server to begin executing the specified procedure.
dbpoll – when called between dbsqlsend (or dbrpcsend) and dbsqlok, checks if a server response has arrived for a DBPROCESS.
dbsqlok – waits for results from the server and verifies the correctness of the instructions the server is responding to. This routine is used in conjunction with dbsqlsend, dbrpcsend, and dbmoretext. After a successful dbsqlok call, the application must call dbresults to process the results.