db
index
/home/dlink/vlib/vlib/db.py

 
Modules
       
MySQLdb
conf
os
singleton

 
Classes
       
__builtin__.object
Db
Factory
SingletonFactory
exceptions.Exception(exceptions.BaseException)
DbError

 
class Db(__builtin__.object)
    Preside over Database connection and Database cursor.
 
example:
  db = Db({'engine':'mysql', 'host':'db1', 'db':'books', 
           'user':'bookmgr', 'passwd':'mepassword', 'dictcursor':True })
 
Use db.factory.create() for reusing single database connections.
 
  Methods defined here:
__del__(self)
__init__(self, params)
Db Class constructor
Params: engine, host, db, user, password, [ port ], [ dictcursor ]
close(self)
close_cursor(self)
commit(self)
connect(self, params)
open_cursor(self)
if 'dictcursor' in params:
    self.cursor = self.connection.cursor(MySQLdb.cursors.DictCursor)
else:
    self.cursor = self.connection.cursor()
query(self, sql, from_trans=False, params=None)
rollback(self)
startTransaction(self)

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

 
class DbError(exceptions.Exception)
    
Method resolution order:
DbError
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 Factory(__builtin__.object)
     Methods defined here:
create(self, **params)

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

 
class SingletonFactory(__builtin__.object)
    Factory class for providing unique Db class instances.
 
  Methods defined here:
__init__(self)
create(self, **params)
Given the parameters:
    engine, host, db, user, password, [ port ], [ dictcursor ]
Return a singleton instance of the Db class for those arguments.

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

 
Functions
       
getInstance()

 
Data
        AUTOCOMMIT = True
DEBUG = 0
DEBUG_OPENCLOSE = 0
DEBUG_PROCESSLIST = 0
DEBUG_SQL = 0
PORT = 3306
singletonFactory = <db.SingletonFactory object>