Package Modeling :: Package DatabaseAdaptors :: Package AbstractDBAPI2AdaptorLayer :: Module AbstractDBAPI2AdaptorContext :: Class AbstractDBAPI2AdaptorContext
[show private | hide private]
[frames | no frames]

Class AbstractDBAPI2AdaptorContext

AdaptorContext --+
                 |
                AbstractDBAPI2AdaptorContext

Known Subclasses:
MySQLAdaptorContext, OracleAdaptorContext, PostgresqlAdaptorContext, SQLiteAdaptorContext

Your inheriting concrete Adaptor class must override:

You normally do not need to override other methods. In particular, dbAPI_cursorForAdaptorChannel() does not need to be overridden.


Method Summary
  __init__(self, anAdaptor)
Initialization.
  adaptorChannelDidClose(self, aChannel)
Informs the AdaptorContext that one of its AdaptorChannel has been closed.
  beginTransaction(self)
Starts a new transaction.
  commitTransaction(self)
Commits the currently opened transaction.
  createAdaptorChannel(self)
Returns a brand new instance of the adequate concrete AdaptorChannel.
  dbAPI_cursorForAdaptorChannel(self)
Returns a 'cursor' for use by an AbstractDBAPI2AdaptorChannel when it is about to open the channel.
  rollbackTransaction(self)
Rollbacks the currently opened transaction.
  _openConnectionIfNecessary(self)
Internally used to open a connection to the underlying database, if necessary.
    Inherited from AdaptorContext
  __addChannel__(self, aChannel)
See interfaces.AdaptorContext for details
  adaptor(self)
See interfaces.AdaptorContext for details
  channels(self)
See interfaces.AdaptorContext for details
  delegate(self)
See interfaces.AdaptorContext for details
  handleDroppedConnection(self)
See interfaces.AdaptorContext for details
  hasBusyChannels(self)
See interfaces.AdaptorContext for details
  hasOpenChannels(self)
See interfaces.AdaptorContext for details
  hasOpenTransaction(self)
See interfaces.AdaptorContext for details
  setDelegate(self, aDelegate)
See interfaces.AdaptorContext for details
  transactionDidBegin(self)
See interfaces.AdaptorContext for details
  transactionDidCommit(self)
See interfaces.AdaptorContext for details
  transactionDidRollback(self)
See interfaces.AdaptorContext for details

Class Variable Summary
tuple __implements__ = (<class Modeling.interfaces.AdaptorCont...
    Inherited from AdaptorContext
str __raise_exception__ = 'AbstractMethod'
str __raise_msg__ = 'Left intentionally unimplemented in thi...

Method Details

__init__(self, anAdaptor)
(Constructor)

Initialization. You do normally not need to override this method. If you do, you must explicitly call the superclass' implementation.
Overrides:
Modeling.AdaptorContext.AdaptorContext.__init__

adaptorChannelDidClose(self, aChannel)

Informs the AdaptorContext that one of its AdaptorChannel has been closed. Never invoke this method yourself, it is automatically called by the AdaptorChannel.

Default behaviour leaves the connection to the database open, even when the AdaptorContext has no opened channels ; setting the environment variable 'MDL_TRANSIENT_DB_CONNECTION' to any true value closes the database connection the AdaptorContext has no opened channels anymore.

You do not need to override this method when designing a concrete AdaptorContext. If you do, however, you must call the superclass implementation, and you must keep in mind that the underlying database connection may have been closed as well.

Parameter 'aChannel' is currently unused.

See also: AbstractDBAPI2AdaptorChannel.closeChannel()
Modeling.AdaptorChannel.closeChannel()
Overrides:
Modeling.AdaptorContext.AdaptorContext.adaptorChannelDidClose

beginTransaction(self)

Starts a new transaction.

Raises GeneralAdaptorException if an transaction has already begun.

See also: Modeling.interfaces.AdaptorContext for details

Overrides:
Modeling.AdaptorContext.AdaptorContext.beginTransaction

commitTransaction(self)

Commits the currently opened transaction.

Raises GeneralAdaptorException if no transaction has begun.

See also: Modeling.interfaces.AdaptorContext for details

Overrides:
Modeling.AdaptorContext.AdaptorContext.commitTransaction

createAdaptorChannel(self)

Returns a brand new instance of the adequate concrete AdaptorChannel.

Implementation hint: say your adaptor's name is 'Dummy', then you'll

probably use the following code:

from DummyAdaptorChannel import DummyAdaptorChannel
db_trace('Creating DummyAdaptorChannel %s'%repr(channel))
channel=DummyAdaptorChannel(self)
self.__addChannel__(channel)
return channel
--> It is very important that you do not forget to append the new
adaptor channel to the list of held channels, using the __addChannel__ method.

Subclasses should override this method without calling the superclass' implementation.

See also: Modeling.interfaces.AdaptorContext for details

Overrides:
Modeling.AdaptorContext.AdaptorContext.createAdaptorChannel

dbAPI_cursorForAdaptorChannel(self)

Returns a 'cursor' for use by an AbstractDBAPI2AdaptorChannel when it is about to open the channel. Never invoke this method, this is automatically invoked by the AbstractDBAPI2AdaptorChannel.

See also: AbstractDBAPI2AdaptorChannel.openChannel()

rollbackTransaction(self)

Rollbacks the currently opened transaction.

Raises GeneralAdaptorException if no transaction has begun.

See also: Modeling.interfaces.AdaptorContext for details

Overrides:
Modeling.AdaptorContext.AdaptorContext.rollbackTransaction

_openConnectionIfNecessary(self)

Internally used to open a connection to the underlying database, if necessary.

Raises GeneralAdaptorException if the connection cannot be opened --in this case the reason why it failed is attached to the exception.


Class Variable Details

__implements__

Type:
tuple
Value:
(<class Modeling.interfaces.AdaptorContext.IAdaptorContext at 0xb77022\
6c>,)                                                                  

Generated by Epydoc 2.1 on Sat Mar 4 13:36:21 2006 http://epydoc.sf.net