Home | Trees | Index | Help |
---|
Package twisted :: Package enterprise :: Module sqlreflector :: Class SQLReflector |
|
Reflector
--+ |Augmentation
--+ | SQLReflector
I reflect on a database and load RowObjects from it.
In order to do this, I interrogate a relational database to extract schema information and interface with RowObject class objects that can interact with specific tables.Method Summary | |
---|---|
Initialize me against a database. | |
(inherited from Reflector )
| |
(inherited from Reflector )
| |
NOTE: Should this be recursive?! requires better container knowledge... (inherited from Reflector )
| |
util method used by reflectors. (inherited from Reflector )
| |
Build the SQL to delete a row from the table. | |
(Internal) Build SQL to insert a new row. | |
(Internal) Build SQL to update a RowObject. | |
util method used by reflectors. (inherited from Reflector )
| |
(inherited from Augmentation )
| |
delete the row for this object from the database. | |
build SQL to delete me from the db. | |
Escape a string for use in an SQL statement. | |
(inherited from Reflector )
| |
findTypeFor(self,
tableName,
columnName)
| |
Get a TableInfo record about a particular instance. (inherited from Reflector )
| |
insert a new row for this object instance. | |
build SQL to insert my current state. | |
Load a set of RowObjects from a database. | |
Example callback for database operation success. (inherited from Augmentation )
| |
Example callback for database operation failure. (inherited from Augmentation )
| |
This is called once for each registered rowClass to add it and its foreign key relationships for that rowClass to the schema. (inherited from Reflector )
| |
Format a value for use in an SQL statement. | |
NOTE: should this be recursive!?? (inherited from Reflector )
| |
(inherited from Augmentation )
| |
(inherited from Augmentation )
| |
(inherited from Augmentation )
| |
(inherited from Augmentation )
| |
(inherited from Augmentation )
| |
update my contents to the database. | |
build SQL to update my current state. |
Class Variable Summary | |
---|---|
dict |
conditionalLabels
|
int |
populated
|
Method Details |
---|
__init__(self,
dbpool,
rowClasses)
Initialize me against a database.
|
buildDeleteSQL(self, tableInfo)Build the SQL to delete a row from the table. |
buildInsertSQL(self, tableInfo)(Internal) Build SQL to insert a new row. Returns: SQL that is used to insert a new row for a rowObject instance not created from the database. |
buildUpdateSQL(self, tableInfo)(Internal) Build SQL to update a RowObject. Returns: SQL that is used to contruct a rowObject class. |
deleteRow(self, rowObject)delete the row for this object from the database. |
deleteRowSQL(self, rowObject)build SQL to delete me from the db. |
escape_string(self, text)Escape a string for use in an SQL statement. The default implementation escapes ' with '' and \ with \. Redefine this function in a subclass if your database server uses different escaping rules. |
insertRow(self, rowObject)insert a new row for this object instance. |
insertRowSQL(self, rowObject)build SQL to insert my current state. |
loadObjectsFrom(self, tableName, parentRow=None, data=None, whereClause=None, forceChildren=0)Load a set of RowObjects from a database. Create a set of python objects of <rowClass> from the contents of a table populated with appropriate data members. Example:| class EmployeeRow(row.RowObject): | pass | | def gotEmployees(employees): | for emp in employees: | emp.manager = "fred smith" | manager.updateRow(emp) | | reflector.loadObjectsFrom("employee", | data = userData, | whereClause = [("manager" , EQUAL, "fred smith")] | ).addCallback(gotEmployees)NOTE: the objects and all children should be loaded in a single transaction. NOTE: can specify a parentRow _OR_ a whereClause. |
quote_value(self, value, type)Format a value for use in an SQL statement.
|
updateRow(self, rowObject)update my contents to the database. |
updateRowSQL(self, rowObject)build SQL to update my current state. |
Class Variable Details |
---|
conditionalLabels
|
populated
|
Home | Trees | Index | Help |
---|
Generated by Epydoc 1.2 prerelease on Wed Jan 29 06:25:36 2003 | http://epydoc.sf.net |