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. | |
__getstate__(self)
(inherited from Reflector )
| |
__setstate__(self,
state)
(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 )
| |
createSchema(self)
(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. | |
findInCache(self,
rowClass,
kw)
(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 )
| |
runInteraction(self,
interaction,
*args,
**kw)
(inherited from Augmentation )
| |
runOperation(self,
*args,
**kw)
(inherited from Augmentation )
| |
runQuery(self,
*args,
**kw)
(inherited from Augmentation )
| |
schemaCreated(self,
result)
(inherited from Augmentation )
| |
schemaNotCreated(self,
error)
(inherited from Augmentation )
| |
update my contents to the database. | |
build SQL to update my current state. | |
Implement me to populate schema information for the reflector. | |
construct all the SQL for database operations on <tableName> and populate the class <rowClass> with that info. | |
immediate loading of rowobjects from the table with the whereClause. | |
Used to construct the row classes in a single interaction. |
Class Variable Summary | |
---|---|
dictionary |
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. |
_populate(self)Implement me to populate schema information for the reflector.
|
_populateSchemaFor(self, rc)construct all the SQL for database operations on <tableName> and populate the class <rowClass> with that info. |
_rowLoader(self, transaction, tableName, parentRow, data, whereClause, forceChildren)immediate loading of rowobjects from the table with the whereClause. |
_transPopulateSchema(self)Used to construct the row classes in a single interaction. |
Class Variable Details |
---|
conditionalLabels
|
populated
|
Home | Trees | Index | Help |
---|
Generated by Epydoc 1.1 on Sat Feb 15 21:19:01 2003 | http://epydoc.sf.net |