SYBPERL

Section: User Commands (1)
Updated: 3 September 1991
Index Return to Main Contents
 

NAME

sybperl - Perl access to Sybase databases  

SYNOPSIS

$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
 

DESCRIPTION

Sybperl is a version of Perl which has been extended (via the usersubs feature) to allow access to Sybase databases.  

Functions

Sybperl basically maps the calls existing in the Sybase DB-Library to Perl. The usage of these functions is the same as in DB-Library, unless specifically noted.

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).

 

UNIMPLEMENTED FEATURES

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.

 

OPTIONS

See the Perl(1) manual page.

 

FILES

$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.

 

SEE ALSO

Perl(1L), Sybase Open Client DB Library Reference Manual, h2ph(1L).

 

AUTHOR

Michael Peppler, ITF Management SA - mpeppler@itf.ch


 

Index

NAME
SYNOPSIS
DESCRIPTION
Functions
UNIMPLEMENTED FEATURES
OPTIONS
FILES
SEE ALSO
AUTHOR

This document was created by man2html, using the manual pages.
Time: 10:21:38 GMT, December 12, 2024