Package orm2 :: Module sql :: Class _part
[hide private]
[frames] | no frames]

Class _part

source code

Known Subclasses:
clause, column, statement, identifyer, relation

The _part class is the base class for all SQL statement classes. It proviedes a __str__() method, which calls __sql__() with a minimal standard datasource that will yield SQL92 compliant results.

_part instances are not hashable. This is due to the fact that they are mutable and I don't want to change that. Ignoring the conflict between hashability and mutablity would not result in problems in many cases, but problems it would cause, would be *very* hard to track down (things would suddenly disappear from dicts, see Python Reference Manual chap. 3.3.1).

If you need to use SQL objects as dictionary keys or sets use the orm2.util.stupid_dict class, which implements the mapping interface without relying on hashing. (It uses sequential search instead, so it's not suitable for large datasets.) See the datasource.select() method for an example on how to use stupid_dict instead of Set.

Instance Methods [hide private]
  __sql__(self, runner)
  __str__(self)
  __eq__(self, other)
Two SQL statements are considered equal if attributes containing strings or statements are equal.
  __ne__(self, other)

Method Details [hide private]

__sql__(self, runner)

source code 
None

__str__(self)
(Informal representation operator)

source code 
None

__eq__(self, other)
(Equality operator)

source code 
Two SQL statements are considered equal if attributes containing strings or statements are equal. (That means, that this method will be called recursivly at times.

__ne__(self, other)

source code 
None