The DataSource encapsulates the functionality we need to talk to the
database. Most notably are the insert, select and delete methods.
This class must be subclassed by the adapter.*.datasource.datasource
classes.
It inherits from sql.datasource to provide default implmentations of
the methods the sql module depends upon.
|
__init__(self)
|
|
_dbconn(self)
Return the dbconn for this ds
|
|
query_one(self,
query)
This method is ment for results that return exactly one row or
item
|
|
execute(self,
command,
modify=False)
Execute COMMAND on the database.
|
|
commit(self)
Run commit on this ds's connection.
|
|
rollback(self)
Undo the changes you made to the database since the last
commit()
|
|
cursor(self)
Return a newly created dbi cursor.
|
|
update_cursor(self)
Return the cursor that this ds uses for any query that modifies
the database (to keep the transaction together).
|
|
select(self,
dbclass,
*clauses)
SELECT dbobjs from the database, according to clauses.
|
|
run_select(self,
dbclass,
select)
Run a select statement on this datasource that is ment to return
rows suitable to construct objects of dbclass from them.
|
|
select_one(self,
dbclass,
*clauses)
This method is ment for queries of which you know that they will
return exactly one dbobj.
|
|
count(self,
dbclass,
*clauses)
All clauses except the WHERE clause will be ignored (including
OFFSET and LIMIT!)
|
|
join_select(self,
dbclasses,
*clauses)
|
|
primary_key_where(self,
dbclass,
key)
Return a orm2.sql where clause that will yield the object of
dbclass whoes primary key equals key
|
|
select_by_primary_key(self,
dbclass,
key)
Select a single object of dbclass from its relation, identified by
its primary key.
|
|
select_for_update(self,
dbclass,
key)
This method works like select_by_primary_key above, except that it
doesn't select anything but returns a dummy object (an empty dbobj)
that will allow setting attributes, yielding proper UPDATE
statements.
|
|
insert(self,
dbobj,
dont_select=False)
|
|
select_after_insert(self,
dbobj)
This method will be run after each INSERT statement automaticaly
generated by a ds to pick up default values and primary keys set by
the backend.
|
|
select_after_insert_where(self,
dbobj)
|
|
update(self,
relation,
column,
sql_literal,
where)
Updates are stored in a list and executed on calls to commit() or
to flush_updates() to join updates to the same row into a single SQL
command.
|
|
flush_updates(self)
Execute the updates stored by the update() method (see above).
|
|
close(self)
|
|
delete_by_primary_key(self,
dbclass,
primary_key_value)
|
Inherited from sql.datasource :
backend_encoding ,
escape_string ,
identifyer_quotes ,
string_quotes
|