Developing Perl Applications

Use the Perl DBI API to develop Perl applications.

SybaseASE Driver Connect Syntax

To use a Perl script to connect to an Adaptive Server, the server must be running and the client installation must be complete with all components installed.

"dbi:SybaseASE:attr=value;attr=value", $user_id, $password, %attrib);

Attributes and Methods

These attributes are currently supported when connecting to a server:

Attribute values can be repeated as long as they are recognized by the driver.

The following is an example of the SybaseASE driver syntax using the DBI->connect method:
 
my $dbh = DBI->connect(“dbi:SybaseASE:server=mumbles;database=prod”, "john_doe",  "xyz" );

Currently supported database handle attributes:

Database handle attributes
Attribute Description Default
dbh->{AutoCommit} = (0|1); Disables or enables AutoCommit. 0
dbh->{LongTruncOK} = (0|1); Disables or enables truncation of text and image types. 0
dbh->{LongReadLen}=(int);

Sets the default read chunk size for TEXT and IMAGE data.

Example: dbh->{LongReadLen} = 64000.

32767
dbh->{syb_show_sql} =(0|1); If set, the current statement is included in the error string returned by $dbh->errstr. 0
dbh->{syb_show_eed} = (0|1); If set, the extended error information is included in the error string returned by $dbh->errstr. 0
dbh->{syb_chained_txn} = (0|1);

If set, CHAINED transactions are used when AutoCommit is off.

Use this attribute only during the connect() call:

  $dbh = 
  DBI->connect('dbi:SybaseASE:', 
  $user, $pwd, 
  {syb_chained_txn => 1});

Using syb_chained_txn at any time with AutoCommit turned off forces a commit on the current handle.

When set to 0, an explicit BEGIN TRAN is issued as needed.

0
dbh->{syb_use_bin_0x} = (0|1); If set, BINARY and VARBINARY values are prefixed with '0x' in the result string. 0
dbh->{syb_binary_images} = (0|1); If set, IMAGE data is returned in raw binary format. Otherwise, IMAGE data is converted in to a Hexadecimal string. 0
dbh->{syb_quoted_identifier}=(0|1); Allows identifiers that clash with Sybase reserved words to be used when quoted using "identifier". 0
dbh->{syb_rowcount}=(int);

If set to a nonzero value, the number of rows returned by a SELECT, or affect an UPDATE or DELETE statement are limited to the rowcount value.

Setting it back to 0 clears the limit.

0
sth->{syb_do_proc_status} = (0|1);

Forces $sth->execute() to fetch the return status of a stored procedure executed in the SQL stream.

If the return status is nonzero, $sth->execute() return undef (that is, fail).

Setting this attribute does not affect existing statement handles; only those that are created after setting it.

To revert behavior of an existing $sth handle, execute: $sth->{syb_do_proc_status} = 0;

0
dbh->{syb_flush_finish} If set, $dbh->finish drains any results remaining for the current command by actually fetching them. This can be used in place of the driver issuing a ct_cancel() command.  
_date_fmt This private method sets the default date conversion and display formats. Currently, the only supported option is locale = “C” which must be set, otherwise the conversion fails.