The Sybase module contains the following:
1
. All
datetime
columns will then be returned as
mxDateTime.DateTime objects.
If you do not wish to use mxDateTime.DateTime objects, set
this to 0
immediately after importing the Sybase
module. All datetime
columns will then be returned as
sybasect.DateTime objects.
'named'
which indicates that the Sybase module
uses named parameters. For example:
c.execute("select * from titles where title like @arg", {'@arg': 'The %'})
except
statement. It is a subclass of the Python StandardError
(defined in the module exceptions).
This is the exception inheritance layout:
StandardError |__Warning |__Error |__InterfaceError |__DatabaseError |__DataError |__OperationalError |__IntegrityError |__InternalError |__ProgrammingError |__NotSupportedError
char
,
varchar
, text
).
image
,
binary
, varbinary
).
bit
,
tinyint
, smallint
, int
, decimal
,
numeric
, float
, real
, money
,
smallmoney
).
datetime
, smalldatetime
).
decimal
, numeric
).
year, month, day) |
datetime
value for
the supplied arguments.
hour, minute, second) |
year, month, day, hour, minute, second) |
datetime
value for
the supplied arguments.
ticks) |
datetime
value from
the given ticks value (number of seconds since the epoch; see the
documentation of the standard Python time module for
details).
ticks) |
ticks) |
datetime
value from
the given ticks value (number of seconds since the epoch; see the
documentation of the standard Python time module for
details).
str) |
owner) |
Cursor objects are usually created via the cursor() method of the Connection object.
The owner argument must be an instance of the Connection class.
owner, table, direction = CS_BLK_IN, arraysize = 20) |
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. arraysize
specifies the number of
in-memory rows that will be batched for each DB request.
This functionality can only be called when the Connection is
in auto_commit
mode. Otherwise a ProgrammingError
exception is raised.
Bulkcopy objects are usually created via the bulkcopy() method of the Connection object.
This is an extension of the DB-API 2.0 specification.
dsn, user, passwd [, ...]) |
The dsn argument identifies the Sybase server, user and passwd are the Sybase username and password respectively.
The optional arguments are the same as those supported by the connect() function.
dsn, user, passwd [, ...]) |
Creates a new Connection object passing the function arguments to the Connection constructor. The optional arguments and their effect are:
= None
Specifies the database to use - has the same effect as the following SQL.
use database
= 0
If non-zero then all char
columns will be right stripped of
whitespace.
= 0
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.
= 0
Must be non-zero if you are going to perform bulkcopy operations on
the connection. You will also need to turn off chained transactions
in order to use bulkcopy (auto_commit=1
).
= 0
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()
= None
Controls the locale of the connection to match that of the server.
db = Sybase.connect('SYBASE', 'sa', '', locale = 'utf8')
= 1
Controls whether or not thread locks will be used on the connection object. When non-zero, the connection allows connections and cursors to be shared between threads. If your program is not multi-threaded you can gain a slight performance improvement by passing zero in this argument.
= ``auto''
Controls the type used when returning a date or time.
The Sybase module imports the low level sybasect extension module via
from sybasect import *
which means that the Sybase module inherits all of the objects defined in that module.
Some of the functions will be useful in your programs.
str [, type = CS_DATETIME_TYPE ]) |
datetime
and smalldatetime
values.
The string passed in the str argument is converted to a datetime value of the type specified in the optional type argument.
CS_DATETIME_TYPE
represents the datetime
Sybase
type and CS_DATETIME4_TYPE
represents
smalldatetime
.
The DateTime class is described in the sybasect module.
num) |
money
values.
The value passed in the num argument is converted to a native Sybase money value.
The DateTime class is described in the sybasect module.
num, [precision = -1 [, scale = -1 ]]) |
numeric
and decimal
values.
Converts the value passed in the num argument to a native Sybase numeric value. The precision and scale arguments control the precision and scale of the returned value.
The Numeric class is described in the sybasect module.