Package gnue :: Package appserver :: Module data :: Class recordset
[show private | hide private]

Class recordset


This class manages the result of a query. An instance of this class can be created via the connection.query() method.
Method Summary
  __init__(self, cache, connections, database, content, conditions, order)
  __iter__(self)
  __len__(self)
This function returns the number of records in this result set.
  close(self)
This function closes a record set which is no longer needed.
  __addFilter(self, row, condition)
This function implements a filter for rows heading for the 'add' destination.
  __buildRecords(self, data)
  __conditionChanged(self, row, condition)
This function iterates over all fields of a condition and returns True if a field has been changed or False otherwise.
  __fieldIsChanged(self, row, path)
This function checks wether a field (described by a path) has been changed or not.
  __getLookupDictionary(self, condition, row, original)
This function creates a dictionary with all fields listed in a given condition as keys and their values based on the given row.
  __getMasterTable(self)
This function returns the name of the master table of the recordset
  __getPathValue(self, row, path, original)
This function returns the value of the property defined by the given path sequence, starting with the first element using a gnue_id of 'row'.
  __getPropertyPath(self, name)
This function creates a path to access a given property based on the content-dictionary.
  __getSortSequence(self, row)
This function creates a sequence of tuples (fieldvalue, direction) for the record specified by 'row' using the given sortorder.
  __mergeWithCache(self, conditions)
  __removeFilter(self, row, condition)
This function implements a filter for rows heading for the 'remove' destination.
  __sortAddition(self)
This function sorts all records from the cache to fit the current sort order.
  __sortOrderChanged(self, row)
This function checks if a field in the sort order has been changed.

Method Details

__init__(self, cache, connections, database, content, conditions, order)
(Constructor)

__iter__(self)
(Iteration protocol support)

__len__(self)
(Length operator)

This function returns the number of records in this result set.

close(self)

This function closes a record set which is no longer needed. It closes the underlying result set.

__addFilter(self, row, condition)

This function implements a filter for rows heading for the 'add' destination. Every row must meet the conditions specified in order to get in.

__buildRecords(self, data)

__conditionChanged(self, row, condition)

This function iterates over all fields of a condition and returns True if a field has been changed or False otherwise.
Parameters:
row - gnue_id of the record to check the condition for
condition - GCondition tree with the condition or None
Returns:
True if a condition field has been changed, False otherwise

__fieldIsChanged(self, row, path)

This function checks wether a field (described by a path) has been changed or not.
Parameters:
row - gnue_id of the record to check the sort order for
path - sequence of tuples (alias, table, field) describing the property.
Returns:
True if the field has been changed, False otherwise

__getLookupDictionary(self, condition, row, original=False)

This function creates a dictionary with all fields listed in a given condition as keys and their values based on the given row.
Parameters:
condition - GCondition tree with the conditions
row - gnue_id of the master record to fetch values from
original - if True, the original (clean) values will be used, otherwise the current values will be used.
Returns:
dictionary with fields and their values

__getMasterTable(self)

This function returns the name of the master table of the recordset
Returns:
name of the master table (=table without fk_alias)

__getPathValue(self, row, path, original=False)

This function returns the value of the property defined by the given path sequence, starting with the first element using a gnue_id of 'row'.
Parameters:
row - gnue_id of the record to be used for the first path element
path - sequence of tuples (alias, table, field) describing the property.
original - if True the original (clean) values are returned, otherwise the current values will be returned.
Returns:
value of the property

__getPropertyPath(self, name)

This function creates a path to access a given property based on the content-dictionary.
Parameters:
name - property name including alias and fieldname, separated by a dot
Returns:
sequence of tuples (alias, tablename, fieldname)

__getSortSequence(self, row)

This function creates a sequence of tuples (fieldvalue, direction) for the record specified by 'row' using the given sortorder.
Parameters:
row - gnue_id of the record to fetch fieldvalues from
Returns:
sort sequence of tuples (value, direction)

__mergeWithCache(self, conditions)

__removeFilter(self, row, condition)

This function implements a filter for rows heading for the 'remove' destination. Every row must match the condition with it's *original* fields in order to get in.

__sortAddition(self)

This function sorts all records from the cache to fit the current sort order.

__sortOrderChanged(self, row)

This function checks if a field in the sort order has been changed.
Parameters:
row - gnue_id of the record to check the sort order for
Returns:
True if a field has been changed, False otherwise


GNUe Home

Private API

Developer's Corner