1.1 Sybase -- Provide interface to Sybase

The Sybase module contains the following:

__version__
A string which specifies the version of the Sybase module.

apilevel
Specifies the level of DB-API compliance. Currently set to '2.0'.

threadsafety
Specifies the DB-API threadsafety. The Sybase module allows threads to share the module, connections and cursors.

paramstyle
Specifies the DB-API parameter style. The Sybase module uses question marks as parameter place holders.

Cursor (owner)
Return a new instance of the Cursor class which implements the DB-API 2.0 cursor functionality.

The owner argument must be an instance of the Connection class.

Bulkcopy (owner, table, direction)
Return a new instance of the Bulkcopy class.

The owner argument must be an instance of the Connection class. A bulk copy context will be established for the table named in the table argument, the bulkcopy direction must be either CS_BLK_IN or CS_BLK_OUT as defined in the _sybase module.

This is an extension of the DB-API 2.0 specification.

Connection (dsn, user, passwd [, database = None][, strip = 0][, auto_commit = 0][, bulkcopy = 0][, delay_connect = 0])
Return a new instance of the Connection class which implements the DB-API 2.0 connection functionality.

The dsn argument identifies the Sybase server, user and passwd are the Sybase username and password respectively. The optional arguments and their effect are:

database

Specifies the database to use - has the same effect as the following SQL.

use database

strip

If non-zero then all char columns will be right stripped of whitespace.

auto_commit

Controls Sybase chained transaction mode. When non-zero, chained transaction mode is turned off. From the Sybase SQL manual:

If you set chained transaction mode, Adaptive Server implicitly invokes a begin transaction before the following statements: delete, insert, open, fetch, select, and update. You must still explicitly close the transaction with a commit.

bulkcopy

Must be non-zero if you are going to perform bulkcopy operations on the connection.

delay_connect

If non-zero the returned Connection object will be initialised but not connected. This allows you to set additional options on the connection before completing the connection to the server. Call the connect() method to complete the connection.

db = Sybase.connect('SYBASE', 'sa', '', delay_connect = 1)
db.set_property(Sybase.CS_HOSTNAME, 'secret')
db.connect()

connect (dsn, user, passwd [, database = None][, strip = 0][, auto_commit = 0][, bulkcopy = 0][, delay_connect = 0])
Implements the DB-API 2.0 connect() function.

Creates a new Connection object passing the function arguments to the Connection constructor.