$dbproc = &dblogin([$user[, $pwd]]) $dbproc1 = &dbopen() &dbclose($dbproc) $ret = &dbcmd($dbproc, $sql_cmd) $ret = &dbsqlexec($dbproc) $ret = &dbresults($dbproc) @data = &dbnextrow($dbproc) $ret = &dbuse($dbproc, $database) $ret = &dbcancel($dbproc) $ret = &dbcanquery($dbproc) $ret = &dbexit($dbproc) $string = &dbstrcpy($dbproc) $ret = &dberrhandle($handler) $ret = &dbmsghandle($handler) $SUCCEED $FAIL $NO_MORE_ROWS $NO_MORE_RESULTS $ComputeId $DBstatus $SybperlVer
The following functions are provided:
$dbproc = &dblogin([$user[, $pwd]]) &dbproc1 = &dbopen() &dbclose($dbproc) $status = &dbcmd($dbproc, $sql_cmd) $status = &dbsqlexec($dbproc) $status = &dbresults($dbproc) @data = &dbnextrow($dbproc) $status = &dbuse($dbproc, $database) $status = &dbcancel($dbproc) $status = &dbcanquery($dbproc) $status = &dbexit($dbproc) $string = &dbstrcpy($dbproc) $old_handler = &dberrhandle($handler) $old_handler = &dbmsghandle($handler)
Differences with DB-Library:
&dblogin takes 2 optional arguements (the userid and the password). These default to the Unix userid, and the null password.
&dblogin returns a DBPROCESS, not a LOGINREC. This simplifies the call to open a connection to a Sybase dataserver somewhat. Further DBPROCESSes can be opened using &dbopen() (No arguments). The number of simultaneous DBPROCESSes is limited to 25 (This can be changed by altering a #define in sybperl.c).
The $dbproc parameter is optional, and defaults to the DBPROCESS returned by &dblogin.
&dbnextrow returns an array of formatted data, based on the datatype of the corresponding columns. &dbnextrow sets the variable $ComputeId when the result row is a computed row (the result of a compute by clause).
The SYBIMAGE data type is not implemented.
The SYBTEXT data type is only implemented for reading (ie dbmoretext() is not implemented).
&dbfcmd is not implemented, but can be emulated by using sprintf as in &dbcmd($dbproc, sprintf("%d", $num_val));
One cannot log in to a specific server (ie dbopen() is always called with a NULL second parameter. However, setting the DSQUERY environment variable (as in $ENV{'DSQUERY'} = $server) will work.
See the Perl(1) manual page.
$PERLLIB/sybperl.pl should be called in all sybperl scripts to set the correct environment variables used by DB-Library. A sample $PERLLIB/sybdb.ph is provided with sybperl. You may want to use h2ph to add definitions to this file.
Perl(1L), Sybase Open Client DB Library Reference Manual, h2ph(1L).
Michael Peppler, ITF Management SA - mpeppler@itf.ch