Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.stsci.edu/spst/UnixTransition/doc/stpydb.html
Дата изменения: Fri Apr 8 12:46:15 2016
Дата индексирования: Sun Apr 10 20:01:34 2016
Кодировка:
Python: module stpydb
 
 
stpydb (version 16.02.11)
index
stpydb.py

##########################################################################
#
#                        Version 0.9 
#
# File:     stpydb.py
#
# Purpose:  This module contains a class, called stpydb, which is an
#           STScI-specific Python layer over public domain Python APIs.
#           The layer is currently supports SYBASE and MS SQL databases
#           through the Sybase, pyodbc, pymssql modules.
#
#           See documentation in the stpydb class below for details.
#
# Public Members:
#   __init__            - Constructor that sets up connection
#   getParamModeChar    - Returns the query param substitution char
#   setParamModeChar    - Defines the query param substitution char
#   setParam            - Defines value for a named parameter
#   query               - Pass a query string
#   execute             - Executes the query returning one row at a time
#   executeAll          - Executes the query returning all rows
#   executeUpdate       - Executes an update/insert/delete query
#   close               - Shuts down the connection
#   clear               - Clears an unfinished query
#   rowcount            - Returns #rows affected by a query
#   beginTransaction    - Starts a transaction on a given connection
#   commitTransaction   - Commits a transaction on a given connection
#   rollbackTransaction - Aborts a transaction on a given connection
#   getDescription      - Returns meta data info on last select query
#   printDescription    - Prints meta data report on last select query
#   callproc            - Run a stored procedure
#
# Modification History:
#    Date       Who     Notes
#    ---------- ------- -------------------------------------------------
#    12/10/1999 Bauer   Original implementation v0.1.  Lots of assistance
#                       Danny Jones and Don Chance
#    02/20/2000 Chance  Significant updates to 0.1 release.
#    03/10/2000 Bauer   Bug fixes per Kia's testing and code review
#    03/22/2000 Chance  Fixed many small problems found by Kia
#    06/14/2000 Chance  Fixed rowcount for updates
#    04/18/2001 Chance  Fixed bug in error path of stpydbConnection constructor
#    07/25/2001 Chance  Populate self.args in error handler class
#    03/11/2003 Chance  Make error message more generic; removed returns from
#                       class constructors
#    03/04/2005 Reinhart Mods to stpydbGetenv to allow running on Mac OS X
#    07/05/2006 Chance  Updated for thread safety and 0.37 version of Sybase module
#    06/17/2006 Chance  Fix bugs introduced with 0.37 change
#    05/09/2007 Chance  Detect dead connections
#    05/17/2007 Chance  modified for Sybase 0.38
#    05/28/2008 Reinhart Enhance to support using ODBC to connect to database
#    06/27/2008 Chance  Major refactoring
#    03/25/2009 Chance incorporate pymssql changes from J. Boia
#    06/24/2009 Chance Fix bugs; update for new version pymssql
#    08/03/2009 Chance Fix more bugs.
#    08/07/2009 Chance Fix incorrect query mangling for ODBC
#    10/26/2009 Chance Use connection pooling with ODBC
#    12/10/2009 Chance Fix bug when error is raised
#    01/05/2010 Chance Fix callproc
#    01/21/2010 Chance better quote handling for sql server
#    04/28/2011 Chance fix executeUpdate for Sybase version > 0.38
#    06/08/2011 Chance fix bug with cursor clear.
#    07/15/2011 Chance fix callproc for MSSQL and ODBC
#    07/19/2011 Chance fix callproc for stored procedure that does not return
#                      anything
#    05/23/2012 Chance get username from USERNAME environment variable
#                      instead of LOGNAME on Windows
#    05/13/2013 Chance add beginTransaction method to STODBC to fix problem
#                      with transactions not being properly committed (from
#                      Linda Thompson).
#    09/30/2013 Chance use single quotes rather than double quotes inside
#                      stored procedures (from Mark Kyprianou)
#    05/19/2014 Chance make Python 3 compatible
#    10/27/2014 Chance make sure you're really connected to the database you
#                      requested when using pymssql
#    06/10/2015 Chance code cleanup; SET QUOTED_IDENTIFIER OFF for pyodbc
#                         stored procedures
#    07/06/2015 Chance fix stpydbprintError for pymssql
#    07/17/2015 Chance fix rowcount on updates for Sybase
#    11/19/2015 Jones  close cursors before closing connection
#    02/11/2016 Chance Fix Sybase executeUpdate to work for 'select ... into'
#                        statements
#
##########################################################################
#

 
Modules
       
os
sys

 
Classes
       
__builtin__.object
STdatabase
STMockDB
STPooledConnectionDB
STMSSQL
STODBC
STSybase
mockdb
mockdb_connection
mockdb_cursor
stpydbConnection
MSSQLConnection
MockConnection
ODBCConnection
SybaseConnection
stpydbCursor
stpydbMSSQLCursor
stpydbODBCCursor
stpydbSybaseCursor
stpydbmockCursor
exceptions.Exception(exceptions.BaseException)
mockdbError
stpydbErrorHandler

 
class MSSQLConnection(stpydbConnection)
    A connection class for MS SQL.
 
 
Method resolution order:
MSSQLConnection
stpydbConnection
__builtin__.object

Methods defined here:
__init__(self, userName, serverName, dbmsName)

Methods inherited from stpydbConnection:
age(self)
getCursor(self)
is_alive(self)
is_locked(self)

Data descriptors inherited from stpydbConnection:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class MockConnection(stpydbConnection)
    A class for fake database connections.
 
 
Method resolution order:
MockConnection
stpydbConnection
__builtin__.object

Methods defined here:
__init__(self, userName, serverName, dbmsName)
set_result(self, result)

Methods inherited from stpydbConnection:
age(self)
getCursor(self)
is_alive(self)
is_locked(self)

Data descriptors inherited from stpydbConnection:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class ODBCConnection(stpydbConnection)
    A connection class for ODBC.
 
 
Method resolution order:
ODBCConnection
stpydbConnection
__builtin__.object

Methods defined here:
__init__(self, userName, serverName, dbmsName)

Methods inherited from stpydbConnection:
age(self)
getCursor(self)
is_alive(self)
is_locked(self)

Data descriptors inherited from stpydbConnection:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class STMSSQL(STPooledConnectionDB)
    
Method resolution order:
STMSSQL
STPooledConnectionDB
STdatabase
__builtin__.object

Methods defined here:
__init__(self, serverName, dbmsName, moduleName='')
Constructor used to establish connection to the database.
 
It contains the necessary parameters needed to make a connection
as outlined in the formal parameter list above.
 
Note the following example constructor calls: '
 
import stpydb
 
q1 = stpydb.stpydb()
 
q2 = stpydb.stpydb('R2D2', 'pstdev1')
 
q3 = stpydb.stpydb('R2D2', 'pstdev1', 'xyz.py')
 
q4 = stpydb.stpydb(dbmsName='pstdev1')
beginTransaction(self, name=None)
pymssql doesn't really support transactions, but turning autocommit off means that
you must do a 'commit' for the transaction to stick.
callproc(self, name, params=(), return_status=False)
Execute a stored procedure.  Paramaters to the procedure can
be a sequence or dictionary which contains one entry for each
argument that the procedure expects. Examples:
 
    c.callproc('sp_who')
    c.callproc('sp_columns', ['pm_constants'])
    c.callproc('sp_columns', {'table_name': 'pm_constants', 'column_name': 'number_of_gyros'})
 
A list of dictionaries is returned.
query(self, queryString)
Builds up a query string for eventual execution.
 
It continually concatenates the string passed into an internal buffer
and ships it to the database when one of the execute methods is called.
 
Replaces all double-quotes with single quotes since these are not equal
to MS SQL Server.

Methods inherited from STdatabase:
begin(self, name=None)
See beginTransaction.
clear(self)
Clears the current stpydb object for use in another query.
This must be done if you exit out of an execute() loop prior to
fetching all of the data.
close(self)
Closes down a connection for the particular server and database combination.
 
Notes:
 
1 No more queries can be executed on the object.  Attempting this
will result in an error.
 
2 This is normally not called by the average Python utility!
This is because the connection is automatically closed for you when
the application terminates.  You should only use this when you
have a long running application, such as a GUI, where you do not
want to hold open idle database resources for a long time.
commit(self, name=None)
See commitTransaction.
commitTransaction(self, name=None)
Commits the previous transaction.
 
Commits a previously activated transaction on the current connection.
If there is no transaction active the call may result in an
error (depending on the database server).
 
The optional name argument allows you to make use of the Sybase ability
to nest and name transactions.
 
See also:        beginTransaction() and rollbackTransaction()
execute(self, results, updateMode=False)
Executes a query.  One row is return through 'results'.
 
Executes a select query (remember that the query has been built up
in the query() calls).  This is executed within a loop and the loop
will fire for each row that gets returned or processed.
 
This method takes a parameter that can be either a Python list
or a Python dictionary. The query results are returned one row at
a time in 'results'.
 
* When the result is passed back as a list, you must get at the result
  data by indexing into the list.  This list is in column order of the
  query.  The column ordering starts at 0.  Note that this can get
  complicated for wildcard select statements or for large queries.
 
* When the result is passed back as a dictionary, you can obtain the
  column value by using the column name (exact name with correct case)
  as the index to the dictionary.
 
Note that query column names are determined defacto when possible.
However, if you use an SQL feature such as an aggregate, you must
provide a column name for the dictionary interface to behave properly.
 
Finally, useful run-time debug information can be obtained when the
appropriate settings have been made prior to execution by the user.
 
See also:        executeAll() and executeUpdate()
executeAll(self, results)
Executes a query and returns all rows at once through 'results'.
 
Executes a select query (remember that the query has been built up
in the query() calls).  The entire query is exectued and returned
instead of returning one single row as in execute().
 
This method takes a parameter that can be either a list of Python lists
or a list of Python dictionaries.  Again all query results are
returned.  See execute() for details on the list and dictionary that
is returned to determine what method you want to use.
 
Finally, useful run-time debug information can be obtained when the
appropriate settings have been made prior to execution by the user.
 
See also:        execute() and executeUpdate()
executeUpdate(self)
Executes an update, insert, or other SQL DML query on the connection.
This should be used for executing any query that will change the
contents or settings in the database.
 
Remember that the udpate query has been built up in the prior
query() calls.
 
Useful run-time debug information can be obtained when the
appropriate settings have been made prior to execution by the user.
 
See also:        execute() and executeAll()
getDescription(self)
Get the description information.
 
Returns a meta data information about the most recently executed
select query.  This format of the data is lightly described in
the API - see that for further details.  At a high level it
contains column specific information including its name, data type,
size, and some other information.
 
Notes:
 
* If you run this function before a query has been processed through
execute() or executeAll() the return value will be None.
 
* You can call the method printDescription() to get a feel for the
each element in the dictionary type of information that is returned.
 
* The order of data in each tuple of the list is:
 
    1 field name
 
    2 field type code
 
    3 field display size
 
    4 field internal size
 
    5 field precision
 
    6 field scale
 
    7 field nulls OK status
 
See also:        printDescription()
getParamModeChar(self)
Returns the parameter substitution character currently in use.
 
See also:        setParamModeChar()
getRowcount(self)
Returns the rowcount of the previously executed query.
 
You should not call this until after the query has completed execution.
printDescription(self)
Prints the descriptions of the query columns in the previously executed select statement.
 
See also:        getDescription()
printQuery(self)
# Private member that displays the query through the debug interface
rollback(self, name=None)
See rollbackTransaction.
rollbackTransaction(self, name=None)
Execute a transaction rollback.
 
Rolls back a previously activated transaction on the current connection.
If there is no transaction active the call may result in an
error (depending on the database server).  A rollback means any
updates applied during the transaction are erased and the database
is rolled back to the state prior to the start of the transaction.
 
The optional name argument allows you to make use of the Sybase ability
to nest and name transactions.
 
See also:        beginTransaction() and commitTransaction()
setParam(self, paramName, value=None)
Set a parameter within a query.
 
This is used to set the values for parameters in a query.  It
provides a generic parameter passing mechanism for your queries.
This was originally done because the API query mechanisms did not
work.
 
Restrictions:
 
* Currently only parameter types String, Int, Long, and Float are
supported.
 
* Strings with nested single quoted may not work.
 
paramName format Notes:
 
* If paramName is a string, it is assumed to be the parameter
name and 'value' its value.
 
* if paramName is a list with the first element a string, the
first element is assumed to be the parameter name and the
second the value.  The parameter 'value' is ignored.
 
* If paramName is a list of lists, each sublist is a parameter
name and value pair. The parameter 'value' is ignored.
setParamModeChar(self, modeChar)
Allows you to override the default parameter substitution character.
 
See also:        getParamModeChar()

Data descriptors inherited from STdatabase:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from STdatabase:
myConnId = 0
queryInProgress = False

 
class STMockDB(STdatabase)
    
Method resolution order:
STMockDB
STdatabase
__builtin__.object

Methods defined here:
__init__(self, serverName, dbmsName, moduleName='')
Constructor used to establish a connection to a mock database.
 
The mock database can be pre-loaded with the return results.
 
Useful for testing, where a connection to a real database could prove problematic
because the returned results from a real database may vary over time.
set_result(self, result)

Methods inherited from STdatabase:
begin(self, name=None)
See beginTransaction.
beginTransaction(self, name=None)
Activates a transaction on the current connection.
 
The transaction must eventually be committed or rolled back via the
commitTransaction() or rollbackTransaction() calls.  Failure to do this
prior to the connection close (explicit or at image exit) will result
in a rollback transaction.
 
The optional name argument allows you to make use of the Sybase ability
to nest and name transactions.
 
Notes:
 
* Not all databases support transactions - use this accordingly.
 
* Nested transactions are supported IFF the database supports them.
 
* Named trasactions are not currently supported in this interface.
 
See also:        commitTransaction() and rollbackTransaction()
callproc(self, name, params=())
Execute a stored procedure.  Paramaters to the procedure can
be a sequence or dictionary which contains one entry for each
argument that the procedure expects. Examples:
 
    c.callproc('sp_who')
    c.callproc('sp_columns', ['pm_constants'])
    c.callproc('sp_columns', {'table_name': 'pm_constants', 'column_name': 'number_of_gyros'})
 
A list of dictionaries is returned.
clear(self)
Clears the current stpydb object for use in another query.
This must be done if you exit out of an execute() loop prior to
fetching all of the data.
close(self)
Closes down a connection for the particular server and database combination.
 
Notes:
 
1 No more queries can be executed on the object.  Attempting this
will result in an error.
 
2 This is normally not called by the average Python utility!
This is because the connection is automatically closed for you when
the application terminates.  You should only use this when you
have a long running application, such as a GUI, where you do not
want to hold open idle database resources for a long time.
commit(self, name=None)
See commitTransaction.
commitTransaction(self, name=None)
Commits the previous transaction.
 
Commits a previously activated transaction on the current connection.
If there is no transaction active the call may result in an
error (depending on the database server).
 
The optional name argument allows you to make use of the Sybase ability
to nest and name transactions.
 
See also:        beginTransaction() and rollbackTransaction()
execute(self, results, updateMode=False)
Executes a query.  One row is return through 'results'.
 
Executes a select query (remember that the query has been built up
in the query() calls).  This is executed within a loop and the loop
will fire for each row that gets returned or processed.
 
This method takes a parameter that can be either a Python list
or a Python dictionary. The query results are returned one row at
a time in 'results'.
 
* When the result is passed back as a list, you must get at the result
  data by indexing into the list.  This list is in column order of the
  query.  The column ordering starts at 0.  Note that this can get
  complicated for wildcard select statements or for large queries.
 
* When the result is passed back as a dictionary, you can obtain the
  column value by using the column name (exact name with correct case)
  as the index to the dictionary.
 
Note that query column names are determined defacto when possible.
However, if you use an SQL feature such as an aggregate, you must
provide a column name for the dictionary interface to behave properly.
 
Finally, useful run-time debug information can be obtained when the
appropriate settings have been made prior to execution by the user.
 
See also:        executeAll() and executeUpdate()
executeAll(self, results)
Executes a query and returns all rows at once through 'results'.
 
Executes a select query (remember that the query has been built up
in the query() calls).  The entire query is exectued and returned
instead of returning one single row as in execute().
 
This method takes a parameter that can be either a list of Python lists
or a list of Python dictionaries.  Again all query results are
returned.  See execute() for details on the list and dictionary that
is returned to determine what method you want to use.
 
Finally, useful run-time debug information can be obtained when the
appropriate settings have been made prior to execution by the user.
 
See also:        execute() and executeUpdate()
executeUpdate(self)
Executes an update, insert, or other SQL DML query on the connection.
This should be used for executing any query that will change the
contents or settings in the database.
 
Remember that the udpate query has been built up in the prior
query() calls.
 
Useful run-time debug information can be obtained when the
appropriate settings have been made prior to execution by the user.
 
See also:        execute() and executeAll()
getDescription(self)
Get the description information.
 
Returns a meta data information about the most recently executed
select query.  This format of the data is lightly described in
the API - see that for further details.  At a high level it
contains column specific information including its name, data type,
size, and some other information.
 
Notes:
 
* If you run this function before a query has been processed through
execute() or executeAll() the return value will be None.
 
* You can call the method printDescription() to get a feel for the
each element in the dictionary type of information that is returned.
 
* The order of data in each tuple of the list is:
 
    1 field name
 
    2 field type code
 
    3 field display size
 
    4 field internal size
 
    5 field precision
 
    6 field scale
 
    7 field nulls OK status
 
See also:        printDescription()
getParamModeChar(self)
Returns the parameter substitution character currently in use.
 
See also:        setParamModeChar()
getRowcount(self)
Returns the rowcount of the previously executed query.
 
You should not call this until after the query has completed execution.
printDescription(self)
Prints the descriptions of the query columns in the previously executed select statement.
 
See also:        getDescription()
printQuery(self)
# Private member that displays the query through the debug interface
query(self, queryString)
Builds up a query string for eventual execution.
 
It continually concatenates the string passed into an internal buffer
and ships it to the database when one of the execute methods is called.
rollback(self, name=None)
See rollbackTransaction.
rollbackTransaction(self, name=None)
Execute a transaction rollback.
 
Rolls back a previously activated transaction on the current connection.
If there is no transaction active the call may result in an
error (depending on the database server).  A rollback means any
updates applied during the transaction are erased and the database
is rolled back to the state prior to the start of the transaction.
 
The optional name argument allows you to make use of the Sybase ability
to nest and name transactions.
 
See also:        beginTransaction() and commitTransaction()
setParam(self, paramName, value=None)
Set a parameter within a query.
 
This is used to set the values for parameters in a query.  It
provides a generic parameter passing mechanism for your queries.
This was originally done because the API query mechanisms did not
work.
 
Restrictions:
 
* Currently only parameter types String, Int, Long, and Float are
supported.
 
* Strings with nested single quoted may not work.
 
paramName format Notes:
 
* If paramName is a string, it is assumed to be the parameter
name and 'value' its value.
 
* if paramName is a list with the first element a string, the
first element is assumed to be the parameter name and the
second the value.  The parameter 'value' is ignored.
 
* If paramName is a list of lists, each sublist is a parameter
name and value pair. The parameter 'value' is ignored.
setParamModeChar(self, modeChar)
Allows you to override the default parameter substitution character.
 
See also:        getParamModeChar()

Data descriptors inherited from STdatabase:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from STdatabase:
myConnId = 0
queryInProgress = False

 
class STODBC(STPooledConnectionDB)
    
Method resolution order:
STODBC
STPooledConnectionDB
STdatabase
__builtin__.object

Methods defined here:
__init__(self, serverName, dbmsName, moduleName='')
beginTransaction(self, name=None)
PyODBC doesn't really support transactions, but turning autocommit off means that
you must do a 'commit' for the transaction to stick.
callproc(self, name, params=(), return_status=False)
Execute a stored procedure.  Paramaters to the procedure can
be a sequence or dictionary which contains one entry for each
argument that the procedure expects. Examples:
 
    c.callproc('sp_who')
    c.callproc('sp_columns', ['pm_constants'])
    c.callproc('sp_columns', {'table_name': 'pm_constants', 'column_name': 'number_of_gyros'})
 
A list of dictionaries is returned.
commitTransaction(self, name=None)
Commit the transaction and turn autocommit back ON, since beginTransaction turned it OFF
query(self, queryString)
Builds up a query string for eventual execution.
 
It continually concatenates the string passed into an internal buffer
and ships it to the database when one of the execute methods is called.
 
Replaces all double-quotes with single quotes since these are not equal
to MS SQL Server.

Methods inherited from STdatabase:
begin(self, name=None)
See beginTransaction.
clear(self)
Clears the current stpydb object for use in another query.
This must be done if you exit out of an execute() loop prior to
fetching all of the data.
close(self)
Closes down a connection for the particular server and database combination.
 
Notes:
 
1 No more queries can be executed on the object.  Attempting this
will result in an error.
 
2 This is normally not called by the average Python utility!
This is because the connection is automatically closed for you when
the application terminates.  You should only use this when you
have a long running application, such as a GUI, where you do not
want to hold open idle database resources for a long time.
commit(self, name=None)
See commitTransaction.
execute(self, results, updateMode=False)
Executes a query.  One row is return through 'results'.
 
Executes a select query (remember that the query has been built up
in the query() calls).  This is executed within a loop and the loop
will fire for each row that gets returned or processed.
 
This method takes a parameter that can be either a Python list
or a Python dictionary. The query results are returned one row at
a time in 'results'.
 
* When the result is passed back as a list, you must get at the result
  data by indexing into the list.  This list is in column order of the
  query.  The column ordering starts at 0.  Note that this can get
  complicated for wildcard select statements or for large queries.
 
* When the result is passed back as a dictionary, you can obtain the
  column value by using the column name (exact name with correct case)
  as the index to the dictionary.
 
Note that query column names are determined defacto when possible.
However, if you use an SQL feature such as an aggregate, you must
provide a column name for the dictionary interface to behave properly.
 
Finally, useful run-time debug information can be obtained when the
appropriate settings have been made prior to execution by the user.
 
See also:        executeAll() and executeUpdate()
executeAll(self, results)
Executes a query and returns all rows at once through 'results'.
 
Executes a select query (remember that the query has been built up
in the query() calls).  The entire query is exectued and returned
instead of returning one single row as in execute().
 
This method takes a parameter that can be either a list of Python lists
or a list of Python dictionaries.  Again all query results are
returned.  See execute() for details on the list and dictionary that
is returned to determine what method you want to use.
 
Finally, useful run-time debug information can be obtained when the
appropriate settings have been made prior to execution by the user.
 
See also:        execute() and executeUpdate()
executeUpdate(self)
Executes an update, insert, or other SQL DML query on the connection.
This should be used for executing any query that will change the
contents or settings in the database.
 
Remember that the udpate query has been built up in the prior
query() calls.
 
Useful run-time debug information can be obtained when the
appropriate settings have been made prior to execution by the user.
 
See also:        execute() and executeAll()
getDescription(self)
Get the description information.
 
Returns a meta data information about the most recently executed
select query.  This format of the data is lightly described in
the API - see that for further details.  At a high level it
contains column specific information including its name, data type,
size, and some other information.
 
Notes:
 
* If you run this function before a query has been processed through
execute() or executeAll() the return value will be None.
 
* You can call the method printDescription() to get a feel for the
each element in the dictionary type of information that is returned.
 
* The order of data in each tuple of the list is:
 
    1 field name
 
    2 field type code
 
    3 field display size
 
    4 field internal size
 
    5 field precision
 
    6 field scale
 
    7 field nulls OK status
 
See also:        printDescription()
getParamModeChar(self)
Returns the parameter substitution character currently in use.
 
See also:        setParamModeChar()
getRowcount(self)
Returns the rowcount of the previously executed query.
 
You should not call this until after the query has completed execution.
printDescription(self)
Prints the descriptions of the query columns in the previously executed select statement.
 
See also:        getDescription()
printQuery(self)
# Private member that displays the query through the debug interface
rollback(self, name=None)
See rollbackTransaction.
rollbackTransaction(self, name=None)
Execute a transaction rollback.
 
Rolls back a previously activated transaction on the current connection.
If there is no transaction active the call may result in an
error (depending on the database server).  A rollback means any
updates applied during the transaction are erased and the database
is rolled back to the state prior to the start of the transaction.
 
The optional name argument allows you to make use of the Sybase ability
to nest and name transactions.
 
See also:        beginTransaction() and commitTransaction()
setParam(self, paramName, value=None)
Set a parameter within a query.
 
This is used to set the values for parameters in a query.  It
provides a generic parameter passing mechanism for your queries.
This was originally done because the API query mechanisms did not
work.
 
Restrictions:
 
* Currently only parameter types String, Int, Long, and Float are
supported.
 
* Strings with nested single quoted may not work.
 
paramName format Notes:
 
* If paramName is a string, it is assumed to be the parameter
name and 'value' its value.
 
* if paramName is a list with the first element a string, the
first element is assumed to be the parameter name and the
second the value.  The parameter 'value' is ignored.
 
* If paramName is a list of lists, each sublist is a parameter
name and value pair. The parameter 'value' is ignored.
setParamModeChar(self, modeChar)
Allows you to override the default parameter substitution character.
 
See also:        getParamModeChar()

Data descriptors inherited from STdatabase:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from STdatabase:
myConnId = 0
queryInProgress = False

 
class STPooledConnectionDB(STdatabase)
    
Method resolution order:
STPooledConnectionDB
STdatabase
__builtin__.object

Methods inherited from STdatabase:
__init__(self, serverName, dbmsName, moduleName='')
Constructor used to establish connection to the database.
 
It contains the necessary parameters needed to make a connection
as outlined in the formal parameter list above.
 
Note the following example constructor calls: '
 
import stpydb
 
q1 = stpydb.stpydb()
 
q2 = stpydb.stpydb('R2D2', 'pstdev1')
 
q3 = stpydb.stpydb('R2D2', 'pstdev1', 'xyz.py')
 
q4 = stpydb.stpydb(dbmsName='pstdev1')
begin(self, name=None)
See beginTransaction.
beginTransaction(self, name=None)
Activates a transaction on the current connection.
 
The transaction must eventually be committed or rolled back via the
commitTransaction() or rollbackTransaction() calls.  Failure to do this
prior to the connection close (explicit or at image exit) will result
in a rollback transaction.
 
The optional name argument allows you to make use of the Sybase ability
to nest and name transactions.
 
Notes:
 
* Not all databases support transactions - use this accordingly.
 
* Nested transactions are supported IFF the database supports them.
 
* Named trasactions are not currently supported in this interface.
 
See also:        commitTransaction() and rollbackTransaction()
callproc(self, name, params=())
Execute a stored procedure.  Paramaters to the procedure can
be a sequence or dictionary which contains one entry for each
argument that the procedure expects. Examples:
 
    c.callproc('sp_who')
    c.callproc('sp_columns', ['pm_constants'])
    c.callproc('sp_columns', {'table_name': 'pm_constants', 'column_name': 'number_of_gyros'})
 
A list of dictionaries is returned.
clear(self)
Clears the current stpydb object for use in another query.
This must be done if you exit out of an execute() loop prior to
fetching all of the data.
close(self)
Closes down a connection for the particular server and database combination.
 
Notes:
 
1 No more queries can be executed on the object.  Attempting this
will result in an error.
 
2 This is normally not called by the average Python utility!
This is because the connection is automatically closed for you when
the application terminates.  You should only use this when you
have a long running application, such as a GUI, where you do not
want to hold open idle database resources for a long time.
commit(self, name=None)
See commitTransaction.
commitTransaction(self, name=None)
Commits the previous transaction.
 
Commits a previously activated transaction on the current connection.
If there is no transaction active the call may result in an
error (depending on the database server).
 
The optional name argument allows you to make use of the Sybase ability
to nest and name transactions.
 
See also:        beginTransaction() and rollbackTransaction()
execute(self, results, updateMode=False)
Executes a query.  One row is return through 'results'.
 
Executes a select query (remember that the query has been built up
in the query() calls).  This is executed within a loop and the loop
will fire for each row that gets returned or processed.
 
This method takes a parameter that can be either a Python list
or a Python dictionary. The query results are returned one row at
a time in 'results'.
 
* When the result is passed back as a list, you must get at the result
  data by indexing into the list.  This list is in column order of the
  query.  The column ordering starts at 0.  Note that this can get
  complicated for wildcard select statements or for large queries.
 
* When the result is passed back as a dictionary, you can obtain the
  column value by using the column name (exact name with correct case)
  as the index to the dictionary.
 
Note that query column names are determined defacto when possible.
However, if you use an SQL feature such as an aggregate, you must
provide a column name for the dictionary interface to behave properly.
 
Finally, useful run-time debug information can be obtained when the
appropriate settings have been made prior to execution by the user.
 
See also:        executeAll() and executeUpdate()
executeAll(self, results)
Executes a query and returns all rows at once through 'results'.
 
Executes a select query (remember that the query has been built up
in the query() calls).  The entire query is exectued and returned
instead of returning one single row as in execute().
 
This method takes a parameter that can be either a list of Python lists
or a list of Python dictionaries.  Again all query results are
returned.  See execute() for details on the list and dictionary that
is returned to determine what method you want to use.
 
Finally, useful run-time debug information can be obtained when the
appropriate settings have been made prior to execution by the user.
 
See also:        execute() and executeUpdate()
executeUpdate(self)
Executes an update, insert, or other SQL DML query on the connection.
This should be used for executing any query that will change the
contents or settings in the database.
 
Remember that the udpate query has been built up in the prior
query() calls.
 
Useful run-time debug information can be obtained when the
appropriate settings have been made prior to execution by the user.
 
See also:        execute() and executeAll()
getDescription(self)
Get the description information.
 
Returns a meta data information about the most recently executed
select query.  This format of the data is lightly described in
the API - see that for further details.  At a high level it
contains column specific information including its name, data type,
size, and some other information.
 
Notes:
 
* If you run this function before a query has been processed through
execute() or executeAll() the return value will be None.
 
* You can call the method printDescription() to get a feel for the
each element in the dictionary type of information that is returned.
 
* The order of data in each tuple of the list is:
 
    1 field name
 
    2 field type code
 
    3 field display size
 
    4 field internal size
 
    5 field precision
 
    6 field scale
 
    7 field nulls OK status
 
See also:        printDescription()
getParamModeChar(self)
Returns the parameter substitution character currently in use.
 
See also:        setParamModeChar()
getRowcount(self)
Returns the rowcount of the previously executed query.
 
You should not call this until after the query has completed execution.
printDescription(self)
Prints the descriptions of the query columns in the previously executed select statement.
 
See also:        getDescription()
printQuery(self)
# Private member that displays the query through the debug interface
query(self, queryString)
Builds up a query string for eventual execution.
 
It continually concatenates the string passed into an internal buffer
and ships it to the database when one of the execute methods is called.
rollback(self, name=None)
See rollbackTransaction.
rollbackTransaction(self, name=None)
Execute a transaction rollback.
 
Rolls back a previously activated transaction on the current connection.
If there is no transaction active the call may result in an
error (depending on the database server).  A rollback means any
updates applied during the transaction are erased and the database
is rolled back to the state prior to the start of the transaction.
 
The optional name argument allows you to make use of the Sybase ability
to nest and name transactions.
 
See also:        beginTransaction() and commitTransaction()
setParam(self, paramName, value=None)
Set a parameter within a query.
 
This is used to set the values for parameters in a query.  It
provides a generic parameter passing mechanism for your queries.
This was originally done because the API query mechanisms did not
work.
 
Restrictions:
 
* Currently only parameter types String, Int, Long, and Float are
supported.
 
* Strings with nested single quoted may not work.
 
paramName format Notes:
 
* If paramName is a string, it is assumed to be the parameter
name and 'value' its value.
 
* if paramName is a list with the first element a string, the
first element is assumed to be the parameter name and the
second the value.  The parameter 'value' is ignored.
 
* If paramName is a list of lists, each sublist is a parameter
name and value pair. The parameter 'value' is ignored.
setParamModeChar(self, modeChar)
Allows you to override the default parameter substitution character.
 
See also:        getParamModeChar()

Data descriptors inherited from STdatabase:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from STdatabase:
myConnId = 0
queryInProgress = False

 
class STSybase(STPooledConnectionDB)
    
Method resolution order:
STSybase
STPooledConnectionDB
STdatabase
__builtin__.object

Methods defined here:
__init__(self, serverName, dbmsName, moduleName='')
Constructor used to establish connection to the database.
 
It contains the necessary parameters needed to make a connection
as outlined in the formal parameter list above.
 
Note the following example constructor calls: '
 
import stpydb
 
q1 = stpydb.stpydb()
 
q2 = stpydb.stpydb('R2D2', 'pstdev1')
 
q3 = stpydb.stpydb('R2D2', 'pstdev1', 'xyz.py')
 
q4 = stpydb.stpydb(dbmsName='pstdev1')
beginTransaction(self, name=None)
Activates a transaction on the current connection.
 
The optional name argument allows you to make use of the Sybase ability
to nest and name transactions.
callproc(self, name, params=(), return_status=False)
Execute a stored procedure.  Paramaters to the procedure can
be a sequence or dictionary which contains one entry for each
argument that the procedure expects. Examples:
 
    c.callproc('sp_who')
    c.callproc('sp_columns', ['pm_constants'])
    c.callproc('sp_columns', {'table_name': 'pm_constants', 'column_name': 'number_of_gyros'})
 
A list of dictionaries is returned.
commitTransaction(self, name=None)
Commits the previous transaction.
 
The optional name argument allows you to make use of the Sybase ability
to nest and name transactions.
rollbackTransaction(self, name=None)
Execute a transaction rollback.
 
The optional name argument allows you to make use of the Sybase ability
to nest and name transactions.

Methods inherited from STdatabase:
begin(self, name=None)
See beginTransaction.
clear(self)
Clears the current stpydb object for use in another query.
This must be done if you exit out of an execute() loop prior to
fetching all of the data.
close(self)
Closes down a connection for the particular server and database combination.
 
Notes:
 
1 No more queries can be executed on the object.  Attempting this
will result in an error.
 
2 This is normally not called by the average Python utility!
This is because the connection is automatically closed for you when
the application terminates.  You should only use this when you
have a long running application, such as a GUI, where you do not
want to hold open idle database resources for a long time.
commit(self, name=None)
See commitTransaction.
execute(self, results, updateMode=False)
Executes a query.  One row is return through 'results'.
 
Executes a select query (remember that the query has been built up
in the query() calls).  This is executed within a loop and the loop
will fire for each row that gets returned or processed.
 
This method takes a parameter that can be either a Python list
or a Python dictionary. The query results are returned one row at
a time in 'results'.
 
* When the result is passed back as a list, you must get at the result
  data by indexing into the list.  This list is in column order of the
  query.  The column ordering starts at 0.  Note that this can get
  complicated for wildcard select statements or for large queries.
 
* When the result is passed back as a dictionary, you can obtain the
  column value by using the column name (exact name with correct case)
  as the index to the dictionary.
 
Note that query column names are determined defacto when possible.
However, if you use an SQL feature such as an aggregate, you must
provide a column name for the dictionary interface to behave properly.
 
Finally, useful run-time debug information can be obtained when the
appropriate settings have been made prior to execution by the user.
 
See also:        executeAll() and executeUpdate()
executeAll(self, results)
Executes a query and returns all rows at once through 'results'.
 
Executes a select query (remember that the query has been built up
in the query() calls).  The entire query is exectued and returned
instead of returning one single row as in execute().
 
This method takes a parameter that can be either a list of Python lists
or a list of Python dictionaries.  Again all query results are
returned.  See execute() for details on the list and dictionary that
is returned to determine what method you want to use.
 
Finally, useful run-time debug information can be obtained when the
appropriate settings have been made prior to execution by the user.
 
See also:        execute() and executeUpdate()
executeUpdate(self)
Executes an update, insert, or other SQL DML query on the connection.
This should be used for executing any query that will change the
contents or settings in the database.
 
Remember that the udpate query has been built up in the prior
query() calls.
 
Useful run-time debug information can be obtained when the
appropriate settings have been made prior to execution by the user.
 
See also:        execute() and executeAll()
getDescription(self)
Get the description information.
 
Returns a meta data information about the most recently executed
select query.  This format of the data is lightly described in
the API - see that for further details.  At a high level it
contains column specific information including its name, data type,
size, and some other information.
 
Notes:
 
* If you run this function before a query has been processed through
execute() or executeAll() the return value will be None.
 
* You can call the method printDescription() to get a feel for the
each element in the dictionary type of information that is returned.
 
* The order of data in each tuple of the list is:
 
    1 field name
 
    2 field type code
 
    3 field display size
 
    4 field internal size
 
    5 field precision
 
    6 field scale
 
    7 field nulls OK status
 
See also:        printDescription()
getParamModeChar(self)
Returns the parameter substitution character currently in use.
 
See also:        setParamModeChar()
getRowcount(self)
Returns the rowcount of the previously executed query.
 
You should not call this until after the query has completed execution.
printDescription(self)
Prints the descriptions of the query columns in the previously executed select statement.
 
See also:        getDescription()
printQuery(self)
# Private member that displays the query through the debug interface
query(self, queryString)
Builds up a query string for eventual execution.
 
It continually concatenates the string passed into an internal buffer
and ships it to the database when one of the execute methods is called.
rollback(self, name=None)
See rollbackTransaction.
setParam(self, paramName, value=None)
Set a parameter within a query.
 
This is used to set the values for parameters in a query.  It
provides a generic parameter passing mechanism for your queries.
This was originally done because the API query mechanisms did not
work.
 
Restrictions:
 
* Currently only parameter types String, Int, Long, and Float are
supported.
 
* Strings with nested single quoted may not work.
 
paramName format Notes:
 
* If paramName is a string, it is assumed to be the parameter
name and 'value' its value.
 
* if paramName is a list with the first element a string, the
first element is assumed to be the parameter name and the
second the value.  The parameter 'value' is ignored.
 
* If paramName is a list of lists, each sublist is a parameter
name and value pair. The parameter 'value' is ignored.
setParamModeChar(self, modeChar)
Allows you to override the default parameter substitution character.
 
See also:        getParamModeChar()

Data descriptors inherited from STdatabase:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from STdatabase:
myConnId = 0
queryInProgress = False

 
class STdatabase(__builtin__.object)
     Methods defined here:
__init__(self, serverName, dbmsName, moduleName='')
Constructor used to establish connection to the database.
 
It contains the necessary parameters needed to make a connection
as outlined in the formal parameter list above.
 
Note the following example constructor calls: '
 
import stpydb
 
q1 = stpydb.stpydb()
 
q2 = stpydb.stpydb('R2D2', 'pstdev1')
 
q3 = stpydb.stpydb('R2D2', 'pstdev1', 'xyz.py')
 
q4 = stpydb.stpydb(dbmsName='pstdev1')
begin(self, name=None)
See beginTransaction.
beginTransaction(self, name=None)
Activates a transaction on the current connection.
 
The transaction must eventually be committed or rolled back via the
commitTransaction() or rollbackTransaction() calls.  Failure to do this
prior to the connection close (explicit or at image exit) will result
in a rollback transaction.
 
The optional name argument allows you to make use of the Sybase ability
to nest and name transactions.
 
Notes:
 
* Not all databases support transactions - use this accordingly.
 
* Nested transactions are supported IFF the database supports them.
 
* Named trasactions are not currently supported in this interface.
 
See also:        commitTransaction() and rollbackTransaction()
callproc(self, name, params=())
Execute a stored procedure.  Paramaters to the procedure can
be a sequence or dictionary which contains one entry for each
argument that the procedure expects. Examples:
 
    c.callproc('sp_who')
    c.callproc('sp_columns', ['pm_constants'])
    c.callproc('sp_columns', {'table_name': 'pm_constants', 'column_name': 'number_of_gyros'})
 
A list of dictionaries is returned.
clear(self)
Clears the current stpydb object for use in another query.
This must be done if you exit out of an execute() loop prior to
fetching all of the data.
close(self)
Closes down a connection for the particular server and database combination.
 
Notes:
 
1 No more queries can be executed on the object.  Attempting this
will result in an error.
 
2 This is normally not called by the average Python utility!
This is because the connection is automatically closed for you when
the application terminates.  You should only use this when you
have a long running application, such as a GUI, where you do not
want to hold open idle database resources for a long time.
commit(self, name=None)
See commitTransaction.
commitTransaction(self, name=None)
Commits the previous transaction.
 
Commits a previously activated transaction on the current connection.
If there is no transaction active the call may result in an
error (depending on the database server).
 
The optional name argument allows you to make use of the Sybase ability
to nest and name transactions.
 
See also:        beginTransaction() and rollbackTransaction()
execute(self, results, updateMode=False)
Executes a query.  One row is return through 'results'.
 
Executes a select query (remember that the query has been built up
in the query() calls).  This is executed within a loop and the loop
will fire for each row that gets returned or processed.
 
This method takes a parameter that can be either a Python list
or a Python dictionary. The query results are returned one row at
a time in 'results'.
 
* When the result is passed back as a list, you must get at the result
  data by indexing into the list.  This list is in column order of the
  query.  The column ordering starts at 0.  Note that this can get
  complicated for wildcard select statements or for large queries.
 
* When the result is passed back as a dictionary, you can obtain the
  column value by using the column name (exact name with correct case)
  as the index to the dictionary.
 
Note that query column names are determined defacto when possible.
However, if you use an SQL feature such as an aggregate, you must
provide a column name for the dictionary interface to behave properly.
 
Finally, useful run-time debug information can be obtained when the
appropriate settings have been made prior to execution by the user.
 
See also:        executeAll() and executeUpdate()
executeAll(self, results)
Executes a query and returns all rows at once through 'results'.
 
Executes a select query (remember that the query has been built up
in the query() calls).  The entire query is exectued and returned
instead of returning one single row as in execute().
 
This method takes a parameter that can be either a list of Python lists
or a list of Python dictionaries.  Again all query results are
returned.  See execute() for details on the list and dictionary that
is returned to determine what method you want to use.
 
Finally, useful run-time debug information can be obtained when the
appropriate settings have been made prior to execution by the user.
 
See also:        execute() and executeUpdate()
executeUpdate(self)
Executes an update, insert, or other SQL DML query on the connection.
This should be used for executing any query that will change the
contents or settings in the database.
 
Remember that the udpate query has been built up in the prior
query() calls.
 
Useful run-time debug information can be obtained when the
appropriate settings have been made prior to execution by the user.
 
See also:        execute() and executeAll()
getDescription(self)
Get the description information.
 
Returns a meta data information about the most recently executed
select query.  This format of the data is lightly described in
the API - see that for further details.  At a high level it
contains column specific information including its name, data type,
size, and some other information.
 
Notes:
 
* If you run this function before a query has been processed through
execute() or executeAll() the return value will be None.
 
* You can call the method printDescription() to get a feel for the
each element in the dictionary type of information that is returned.
 
* The order of data in each tuple of the list is:
 
    1 field name
 
    2 field type code
 
    3 field display size
 
    4 field internal size
 
    5 field precision
 
    6 field scale
 
    7 field nulls OK status
 
See also:        printDescription()
getParamModeChar(self)
Returns the parameter substitution character currently in use.
 
See also:        setParamModeChar()
getRowcount(self)
Returns the rowcount of the previously executed query.
 
You should not call this until after the query has completed execution.
printDescription(self)
Prints the descriptions of the query columns in the previously executed select statement.
 
See also:        getDescription()
printQuery(self)
# Private member that displays the query through the debug interface
query(self, queryString)
Builds up a query string for eventual execution.
 
It continually concatenates the string passed into an internal buffer
and ships it to the database when one of the execute methods is called.
rollback(self, name=None)
See rollbackTransaction.
rollbackTransaction(self, name=None)
Execute a transaction rollback.
 
Rolls back a previously activated transaction on the current connection.
If there is no transaction active the call may result in an
error (depending on the database server).  A rollback means any
updates applied during the transaction are erased and the database
is rolled back to the state prior to the start of the transaction.
 
The optional name argument allows you to make use of the Sybase ability
to nest and name transactions.
 
See also:        beginTransaction() and commitTransaction()
setParam(self, paramName, value=None)
Set a parameter within a query.
 
This is used to set the values for parameters in a query.  It
provides a generic parameter passing mechanism for your queries.
This was originally done because the API query mechanisms did not
work.
 
Restrictions:
 
* Currently only parameter types String, Int, Long, and Float are
supported.
 
* Strings with nested single quoted may not work.
 
paramName format Notes:
 
* If paramName is a string, it is assumed to be the parameter
name and 'value' its value.
 
* if paramName is a list with the first element a string, the
first element is assumed to be the parameter name and the
second the value.  The parameter 'value' is ignored.
 
* If paramName is a list of lists, each sublist is a parameter
name and value pair. The parameter 'value' is ignored.
setParamModeChar(self, modeChar)
Allows you to override the default parameter substitution character.
 
See also:        getParamModeChar()

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
myConnId = 0
queryInProgress = False

 
class SybaseConnection(stpydbConnection)
    A connection class for Sybase.
 
 
Method resolution order:
SybaseConnection
stpydbConnection
__builtin__.object

Methods defined here:
__init__(self, userName, serverName, dbmsName)
is_alive(self)
is_locked(self)

Methods inherited from stpydbConnection:
age(self)
getCursor(self)

Data descriptors inherited from stpydbConnection:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class mockdb(__builtin__.object)
     Methods defined here:
__init__(self)
connect(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class mockdbError(exceptions.Exception)
    Mock DB error
 
 
Method resolution order:
mockdbError
exceptions.Exception
exceptions.BaseException
__builtin__.object

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Methods inherited from exceptions.Exception:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)
__unicode__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message

 
class mockdb_connection(__builtin__.object)
     Methods defined here:
__init__(self)
close(self)
commit(self)
cursor(self)
getCursor(self)
is_alive(self)
is_locked(self)
rollback(self)
set_description(self, description)
set_proc_result(self, proc_result)
set_result(self, result)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class mockdb_cursor(__builtin__.object)
    Mock database cursor.
 
  Methods defined here:
__init__(self)
callproc(self, name, params=())
clear(self)
close(self)
execute(self, query)
fetchall(self)
fetchone(self)
set_description(self, description)
Load a non-standard description list here.
set_proc_result(self, proc_result)
set_result(self, result)
Load the results you want the query to return here.
 
'result' should be a list of dictionaries.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class stpydbConnection(__builtin__.object)
    Abstract superclass for database connections.
 
  Methods defined here:
__init__(self, userName, serverName, dbmsName)
age(self)
getCursor(self)
is_alive(self)
is_locked(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class stpydbCursor(__builtin__.object)
     Methods defined here:
__init__(self, myConnection, id)
callproc(self, name, params=())
clear(self)
close(self)
description(self)
execute(self, query)
execute_update(self, query)
fetchall(self)
fetchone(self)
getRowcount(self)
reserve(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class stpydbErrorHandler(exceptions.Exception)
    
Method resolution order:
stpydbErrorHandler
exceptions.Exception
exceptions.BaseException
__builtin__.object

Methods defined here:
__init__(self, args=None)

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)
__unicode__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message

 
class stpydbMSSQLCursor(stpydbCursor)
    
Method resolution order:
stpydbMSSQLCursor
stpydbCursor
__builtin__.object

Methods inherited from stpydbCursor:
__init__(self, myConnection, id)
callproc(self, name, params=())
clear(self)
close(self)
description(self)
execute(self, query)
execute_update(self, query)
fetchall(self)
fetchone(self)
getRowcount(self)
reserve(self)

Data descriptors inherited from stpydbCursor:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class stpydbODBCCursor(stpydbCursor)
    
Method resolution order:
stpydbODBCCursor
stpydbCursor
__builtin__.object

Methods defined here:
execute_update(self, query)

Methods inherited from stpydbCursor:
__init__(self, myConnection, id)
callproc(self, name, params=())
clear(self)
close(self)
description(self)
execute(self, query)
fetchall(self)
fetchone(self)
getRowcount(self)
reserve(self)

Data descriptors inherited from stpydbCursor:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class stpydbSybaseCursor(stpydbCursor)
    
Method resolution order:
stpydbSybaseCursor
stpydbCursor
__builtin__.object

Methods defined here:
clear(self)
execute_update(self, query)
getRowcount(self)

Methods inherited from stpydbCursor:
__init__(self, myConnection, id)
callproc(self, name, params=())
close(self)
description(self)
execute(self, query)
fetchall(self)
fetchone(self)
reserve(self)

Data descriptors inherited from stpydbCursor:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class stpydbmockCursor(stpydbCursor)
    
Method resolution order:
stpydbmockCursor
stpydbCursor
__builtin__.object

Methods inherited from stpydbCursor:
__init__(self, myConnection, id)
callproc(self, name, params=())
clear(self)
close(self)
description(self)
execute(self, query)
execute_update(self, query)
fetchall(self)
fetchone(self)
getRowcount(self)
reserve(self)

Data descriptors inherited from stpydbCursor:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
ConnectionFactory(userName, serverName, dbmsName)
asctime(...)
asctime([tuple]) -> string
 
Convert a time tuple to a string, e.g. 'Sat Jun 06 16:26:11 1998'.
When the time tuple is not present, current time as returned by localtime()
is used.
cursorFactory(myConnection, id)
Return the correct cursor object depending on the input connection.
getSTScIdatabasePassword(userName, serverName)
gmtime(...)
gmtime([seconds]) -> (tm_year, tm_mon, tm_mday, tm_hour, tm_min,
                       tm_sec, tm_wday, tm_yday, tm_isdst)
 
Convert seconds since the Epoch to a time tuple expressing UTC (a.k.a.
GMT).  When 'seconds' is not passed in, convert the current time instead.
stpydb(serverName=None, dbmsName=None, moduleName='', dbsystemType='')
Factory function for STdatabase objects.
 
The appropriate database object is returned, depending odbn the value dbsystemType.
 
On Solaris, dbsystemType defaults to SYBASE. On Linux and Mac, dbsystemType
defaults to ODBC.
stpydbDebug(debugString)
stpydbGetenv(var)
stpydbPrintError(error, queryString)
time(...)
time() -> floating point number
 
Return the current time in seconds since the Epoch.
Fractions of a second may be present if the system clock provides them.

 
Data
        CONNECTION_MAX_AGE = 3600.0
KNOWN_DB_SYSTEMS = ('SYBASE', 'ODBC', 'MSSQL', 'MOCK')
MAX_CONN = 10
__version__ = '16.02.11'
connList = [<stpydb.SybaseConnection object>, <stpydb.SybaseConnection object>, False, False, False, False, False, False, False, False]
debugFile = ''
debugFileOn = False
debugMode = False
debugStringPrefix = ''
endClock = 0.0
firstTime = False
integer_types = (<type 'int'>, <type 'long'>)
paramModeChar = '@'
startClock = 0.0
systemType = 'SYBASE'