Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
tornado.database.Connection Class Reference

List of all members.

Public Member Functions

def __del__
def __init__
def close
def execute
def execute_lastrowid
def execute_rowcount
def executemany
def executemany_lastrowid
def executemany_rowcount
def get
def iter
def query
def reconnect

Public Attributes

 database
 host
 max_idle_time
 socket

Private Member Functions

def _cursor
def _ensure_connected
def _execute

Private Attributes

 _db
 _db_args
 _last_use_time

Detailed Description

A lightweight wrapper around MySQLdb DB-API connections.

The main value we provide is wrapping rows in a dict/object so that
columns can be accessed by name. Typical usage::

    db = database.Connection("localhost", "mydatabase")
    for article in db.query("SELECT * FROM articles"):
        print article.title

Cursors are hidden by the implementation, but other than that, the methods
are very similar to the DB-API.

We explicitly set the timezone to UTC and the character encoding to
UTF-8 on all connections to avoid time zone and encoding errors.

Definition at line 37 of file database.py.


Constructor & Destructor Documentation

def tornado.database.Connection.__init__ (   self,
  host,
  database,
  user = None,
  password = None,
  max_idle_time = 7 * 3600 
)

Definition at line 53 of file database.py.

Definition at line 89 of file database.py.


Member Function Documentation

def tornado.database.Connection._cursor (   self) [private]

Definition at line 202 of file database.py.

Definition at line 191 of file database.py.

def tornado.database.Connection._execute (   self,
  cursor,
  query,
  parameters 
) [private]

Definition at line 206 of file database.py.

Closes this database connection.

Definition at line 92 of file database.py.

def tornado.database.Connection.execute (   self,
  query,
  parameters 
)
Executes the given query, returning the lastrowid from the query.

Definition at line 138 of file database.py.

def tornado.database.Connection.execute_lastrowid (   self,
  query,
  parameters 
)
Executes the given query, returning the lastrowid from the query.

Definition at line 142 of file database.py.

def tornado.database.Connection.execute_rowcount (   self,
  query,
  parameters 
)
Executes the given query, returning the rowcount from the query.

Definition at line 151 of file database.py.

def tornado.database.Connection.executemany (   self,
  query,
  parameters 
)
Executes the given query against all the given param sequences.

We return the lastrowid from the query.

Definition at line 160 of file database.py.

def tornado.database.Connection.executemany_lastrowid (   self,
  query,
  parameters 
)
Executes the given query against all the given param sequences.

We return the lastrowid from the query.

Definition at line 167 of file database.py.

def tornado.database.Connection.executemany_rowcount (   self,
  query,
  parameters 
)
Executes the given query against all the given param sequences.

We return the rowcount from the query.

Definition at line 179 of file database.py.

def tornado.database.Connection.get (   self,
  query,
  parameters 
)
Returns the first row returned for the given query.

Definition at line 126 of file database.py.

def tornado.database.Connection.iter (   self,
  query,
  parameters 
)
Returns an iterator for the given query and parameters.

Definition at line 104 of file database.py.

def tornado.database.Connection.query (   self,
  query,
  parameters 
)
Returns a row list for the given query and parameters.

Definition at line 116 of file database.py.

Closes the existing database connection and re-opens it.

Definition at line 98 of file database.py.


Member Data Documentation

Definition at line 53 of file database.py.

Definition at line 53 of file database.py.

Definition at line 53 of file database.py.

Definition at line 53 of file database.py.

Definition at line 53 of file database.py.

Definition at line 53 of file database.py.

Definition at line 53 of file database.py.


The documentation for this class was generated from the following file:


rosbridge_server
Author(s): Jonathan Mace
autogenerated on Mon Oct 6 2014 06:58:14