Package gavo :: Package svcs :: Module pql :: Class PQLRange
[frames] | no frames]

Class PQLRange

source code

object --+
         |
        PQLRange
Known Subclasses:

a representation of a PQL range.

PQLRanges have a value attribute that is non-None when there is only a single value.

For ranges, there is start, stop and step, all of which may be None.

The attributes contain whatever the parent's valParser (or stepParser) functions return.

Instance Methods
 
__init__(self, value=None, start=None, stop=None, step=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__eq__(self, other) source code
 
__repr__(self)
repr(x)
source code
 
__str__(self)
str(x)
source code
 
getValuesAsSet(self)
returns a set containing all values matching the PQL condition if they form a discrete set or raises a ValueError if not.
source code
 
getSQL(self, colName, sqlPars, cmpExpr=None)
returns an SQL boolean expression for representing this constraint.
source code
 
getSQLForInterval(self, lowerColName, upperColName, sqlPars)
returns an SQL boolean expression for representing this constraint against an upper, lower interval in the DB table.
source code
 
covers(self, value)
returns True if value is covered by this interval.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Methods
 
fromLiteral(cls, literal, destName, valParser, stepParser)
creates a PQLRange from a PQL range literal.
source code
Properties

Inherited from object: __class__

Method Details

__init__(self, value=None, start=None, stop=None, step=None)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

fromLiteral(cls, literal, destName, valParser, stepParser)
Class Method

source code 

creates a PQLRange from a PQL range literal.

For the meaning of the arguments, see PQLPar.fromLiteral.

getSQL(self, colName, sqlPars, cmpExpr=None)

source code 

returns an SQL boolean expression for representing this constraint.

cmpExpr, if given, will be an expression that is compared against. It defaults to colName, but this is, of course, intended to allow stuff like LOWER(colName).

getSQLForInterval(self, lowerColName, upperColName, sqlPars)

source code 

returns an SQL boolean expression for representing this constraint against an upper, lower interval in the DB table.

This will silently discard any step specification.

covers(self, value)

source code 

returns True if value is covered by this interval.

value must be type-true, i.e. in whatever type value, start, and stop have.