# sqlobject.dbconnection module

class sqlobject.dbconnection.Boolean(value)

  Bases: `object`

  A bool class that also understands some special string keywords

  Understands: yes/no, true/false, on/off, 1/0, case ignored.

class sqlobject.dbconnection.ConnMethodWrapper(method, connection)

  Bases: `object`

class sqlobject.dbconnection.ConnWrapper(soClass, connection)

  Bases: `object`

  This represents a SQLObject class that is bound to a specific connection (instances have a connection instance variable, but classes are global, so this is binds the connection variable lazily when a class method is accessed)

class sqlobject.dbconnection.ConnectionHub

  Bases: `object`

  This object serves as a hub for connections, so that you can pass in a ConnectionHub to a SQLObject subclass as though it was a connection, but actually bind a real database connection later. You can also bind connections on a per-thread basis.

  You must hang onto the original ConnectionHub instance, as you cannot retrieve it again from the class or instance.

  To use the hub, do something like:

      hub = ConnectionHub()
      class MyClass(SQLObject):
          _connection = hub

      hub.threadConnection = connectionFromURI('...')

  doInTransaction(func, *args, **kw)

    This routine can be used to run a function in a transaction, rolling the transaction back if any exception is raised from that function, and committing otherwise.

    Use like:

        sqlhub.doInTransaction(process_request, os.environ)

    This will run `process_request(os.environ)`. The return value will be preserved.

  getConnection()
  property threadConnection

class sqlobject.dbconnection.ConnectionURIOpener

  Bases: `object`

  connectionForURI(uri, oldUri=False, **args)
  dbConnectionForScheme(scheme)
  registerConnection(schemes, builder)
  registerConnectionInstance(inst)

class sqlobject.dbconnection.ConsoleWriter(connection, loglevel)

  Bases: `object`

  write(text)

class sqlobject.dbconnection.DBAPI(**kw)

  Bases: `sqlobject.dbconnection.DBConnection`

  Subclass must define a makeConnection() method, which returns a newly-created connection object.

  `queryInsertID` must also be defined.

  accumulateSelect(select, *expressions)

    Apply an accumulate function(s) (SUM, COUNT, MIN, AVG, MAX, etc…) to the select object.

  clearTable(tableName)
  close()
  createBinary(value)

    Create a binary object wrapper for the given database.

  createColumn(soClass, col)
  createColumns(soClass)
  createEmptyDatabase()

    Create an empty database.

  createIndexSQL(soClass, index)
  createReferenceConstraint(soClass, col)
  createReferenceConstraints(soClass)
  createSQL(soClass)
  createTable(soClass)
  createTableSQL(soClass)
  dbName = None
  dropTable(tableName, cascade=False)
  getConnection()
  iterSelect(select)
  make_odbc_conn_str(odb_source, db, host=None, port=None, user=None, password=None)
  printDebug(conn, s, name, type='query')
  query(s)
  queryAll(s)
  queryAllDescription(s)
  queryForSelect(select)
  queryInsertID(soInstance, id, names, values)
  queryOne(s)
  releaseConnection(conn, explicit=False)
  sqlrepr(v)
  transaction()

class sqlobject.dbconnection.DBConnection(name=None, debug=False, debugOutput=False, cache=True, style=None, autoCommit=True, debugThreading=False, registry=None, logger=None, loglevel=None)

  Bases: `object`

  classmethod connectionFromOldURI(uri)
  classmethod connectionFromURI(uri)
  expireAll()

    Expire all instances of objects for this connection.

  oldUri()
  soClassAdded(soClass)

    This is called for each new class; we use this opportunity to create an instance method that is bound to the class and this connection.

  uri()

class sqlobject.dbconnection.Iteration(dbconn, rawconn, select, keepConnection=False)

  Bases: `object`

  next()

class sqlobject.dbconnection.LogWriter(connection, logger, loglevel)

  Bases: `object`

  write(text)

class sqlobject.dbconnection.Transaction(dbConnection)

  Bases: `object`

  assertActive()
  begin()
  close()
  commit(close=False)
  iterSelect(select)
  query(s)
  queryAll(s)
  queryInsertID(soInstance, id, names, values)
  queryOne(s)
  rollback()

sqlobject.dbconnection.connectionForURI(uri, oldUri=False, **args)

sqlobject.dbconnection.dbConnectionForScheme(scheme)

sqlobject.dbconnection.makeDebugWriter(connection, loggerName, loglevel)

sqlobject.dbconnection.registerConnection(schemes, builder)

sqlobject.dbconnection.registerConnectionInstance(inst)