Package db3k :: Class Connection
[hide private]
[frames] | no frames]

Class Connection

source code

Creates a new checked connection to the database manager. It uses the |create| function to get new connections.

This class must not be used directly from a web application, unless you know what are you doing. Instead a new sub-class or managing methods must be created validating tables in insertions, deletions, and updates.

Instance Methods [hide private]
 
__init__(self, **kwargs) source code
 
getconn(self) source code
 
putconn(self, q) source code
 
__del__(self) source code
 
close(self)
Closes the connection
source code
 
cursor(self)
Returns a cursor from the RDBM backend and the connection owner of the cursor (cursor,connection).
source code
 
execute(self, sqlstring, values=())
Execute a single cursor operation.
source code
 
hquery(self, sqlstring, values={})
Performs the |sqlstring| query and returns an array of dictionaries (fieldname => value)
source code
 
query(self, sqlstring, values={})
Performs the |sqlstring| query and returns an array of arrays of field values
source code
 
ne_delete(self, tabname, condition)
Deletes from |tabname| table where the dictionary |cond| is true
source code
 
delete(self, tabname, condition) source code
 
ne_insert(self, tabname, keyvalues)
Creates the data to execute an Insert |keyvalues| (dictionary of fieldname => value) into the table |tabname|
source code
 
insert(self, tabname, keyvalues)
Insert |keyvalues| (dictionary of fieldname => value) into the table |tabname|
source code
 
join_keys(self, keys, join_string=' AND ') source code
 
ne_update(self, tabname, newvalues, condition)
Creates an sql statement to Update to |newvalues| (dictionary of fieldname => value) the table |tabname| where the |condition| is True.
source code
 
update(self, tabname, newvalues, condition)
Update to |newvalues| (dictionary of fieldname => value) the table |tabname| where the |condition| is True.
source code
Method Details [hide private]

cursor(self)

source code 
Returns a cursor from the RDBM backend and the connection owner of the cursor (cursor,connection). The cursor must be closed by the requester. The connection must be closed or returned to the db3k.Connection object using the self.putconn method

execute(self, sqlstring, values=())

source code 
Execute a single cursor operation. Returns a tuple of resultarray, description

ne_update(self, tabname, newvalues, condition)

source code 
Creates an sql statement to Update to |newvalues| (dictionary of fieldname => value) the table |tabname| where the |condition| is True. Condition can be a string or a dictionary with constraint key-pair set.

update(self, tabname, newvalues, condition)

source code 
Update to |newvalues| (dictionary of fieldname => value) the table |tabname| where the |condition| is True. Condition can be a string or a dictionary with constraint key-pair set.