Initiate execution of a registered procedure.
RETCODE dbreginit(dbproc, procedure_name, namelen) DBPROCESS *dbproc; DBCHAR *procedure_name; DBSMALLINT namelen;
A pointer to the DBPROCESS structure that provides the connection for a particular front-end/server process. It contains all the information that DB-Library/C uses to manage communications and data between the front end and server.
A pointer to the name of the registered procedure being executed.
The length of procedure_name, in bytes. If procedure_name is null-terminated, pass namelen as DBNULLTERM.
SUCCEED or FAIL.
dbreginit initiates the execution of a registered procedure. Because a notification procedure is simply a special type of registered procedure, execution of a notification procedure may also be initiated using dbreginit.
To execute a registered procedure, a DB-Library/C application must:
Initiate the call using dbreginit
Pass the procedure’s parameters, if any, using dbregparam
Execute the procedure using dbregexec
This is an example of executing a registered procedure:
DBPROCESS *dbproc;
DBINT newprice = 55;
DBINT status;
/*
** Initiate execution of the registered procedure
** "price_change".
*/
dbreginit (dbproc, "price_change", DBNULLTERM);
/*
** The registered procedure has two parameters:
** name varchar(255)
** newprice int
** So pass these parameters to the registered
** procedure.
*/
dbregparam (dbproc, "name", SYBVARCHAR, NULL,
"sybase");
dbregparam (dbproc, "newprice", SYBINT4, 4, 4,
&newprice);
/* Execute the registered procedure: */
status = dbregexec (dbproc, DBNOTIFYALL);
if (status == FAIL)
{
fprintf(stderr, "ERROR: Failed to execute \
price_change!\n");
}
else if (status == DBNOPROC)
{
fprintf(stderr, "ERROR: Price_change does \
not exist!\n");
}
else
{
fprintf(stdout, "Success in executing \
price_change!\n");
}
dbregparam, dbregexec, dbregwatch, dbreglist, dbregwatchlist