Class v.c.a.s.BaseQuery:

Part of vmc.contrib.axiom.store View In Hierarchy

Known subclasses: vmc.contrib.axiom.store.AttributeQuery, vmc.contrib.axiom.store.ItemQuery, vmc.contrib.axiom.store.MultipleItemQuery

Implements interfaces: vmc.contrib.axiom.iaxiom.IQuery

This is the abstract base implementation of query logic shared between item and attribute queries.

Note: as this is an abstract class, it doesn't *actually* implement IQuery, but all its subclasses must, so it is declared to. Don't instantiate it directly.
Method __init__ Create a generic object-oriented interface to SQL, used to implement
Method cloneQuery Create a similar-but-not-identical copy of this query with certain
Method __repr__ Undocumented
Method explain A debugging API, exposing SQLite's 'EXPLAIN' statement.
Method locateCallSite Undocumented
Method distinct Call this method if you want to avoid repeated results from a query.
Method __iter__ Iterate the results of this query.
Method next This method is deprecated, a holdover from when queries were iterators,
def __init__(self, store, tableClass, comparison=None, limit=None, offset=None, sort=None):
Create a generic object-oriented interface to SQL, used to implement Store.query.
Parametersstorethe store that this query is within.
tableClassa subclass of Item.
comparisonan implementor of iaxiom.IComparison
limitan int that limits the number of results that will be queried for, or None to indicate that all results should be returned.
offsetan int that specifies the offset within the query results to begin iterating from, or None to indicate that we should start at 0.
sortA sort order object. Obtained by doing YourItemClass.yourAttribute.ascending or .descending.
def cloneQuery(self, limit=_noItem):

Create a similar-but-not-identical copy of this query with certain attributes changed.

(Currently this only supports the manipulation of the "limit" parameter, but it is the intent that with a richer query-introspection interface, this signature could be expanded to support many different attributes.)
Parameterslimitan integer, representing the maximum number of rows that this query should return.
Returnsan IQuery provider with the new limit.
def __repr__(self):
Undocumented
def explain(self):
A debugging API, exposing SQLite's 'EXPLAIN' statement.

While this is not a private method, you also probably don't have any
use for it unless you understand this page very well:

    http://www.sqlite.org/opcode.html

Once you do, it can be handy to call this interactively to get a sense
of the complexity of a query.

@return: a list, the first element of which is a L{str} (the SQL
statement which will be run), and the remainder of which is 3-tuples
resulting from the 'EXPLAIN' of that statement.
def _involvedTables(self):
Return a list of tables involved in this query, first checking that no required tables (those in the query target) have been omitted from the comparison.
def _computeFromClause(self, tables):
Generate the SQL string which follows the "FROM" string and before the "WHERE" string in the final SQL statement.
def _sqlAndArgs(self, verb, subject):
Undocumented
def _runQuery(self, verb, subject):
Undocumented
def locateCallSite(self):
Undocumented
def _selectStuff(self, verb='SELECT'):

Return a generator which yields the massaged results of this query with a particular SQL verb.

For an attribute query, massaged results are of the type of that attribute. For an item query, they are items of the type the query is supposed to return.
Parametersverba str containing the SQL verb to execute. This really must be some variant of 'SELECT', the only two currently implemented being 'SELECT' and 'SELECT DISTINCT'.
def _massageData(self, row):
Subclasses must override this method to 'massage' the data received from the database, converting it from data direct from the database into Python objects of the appropriate form.
Parametersrowa tuple of some kind, representing an element of data returned from a call to sqlite.
def distinct(self):
Call this method if you want to avoid repeated results from a query.

You can call this on either an attribute or item query.  For example,
on an attribute query::

    X(store=s, value=1, name=u'foo')
    X(store=s, value=1, name=u'bar')
    X(store=s, value=2, name=u'baz')
    X(store=s, value=3, name=u'qux')
    list(s.query(X).getColumn('value'))
        => [1, 1, 2, 3]
    list(s.query(X).getColumn('value').distinct())
        => [1, 2, 3]

You can also use distinct queries to eliminate duplicate results from
joining two Item types together in a query, like so:

    x = X(store=s, value=1, name=u'hello')
    Y(store=s, other=x, ident=u'a')
    Y(store=s, other=x, ident=u'b')
    Y(store=s, other=x, ident=u'b+')
    list(s.query(X, AND(Y.other == X.storeID,
                        Y.ident.startswith(u'b'))))
        => [X(name=u'hello', value=1, storeID=1)@...,
            X(name=u'hello', value=1, storeID=1)@...]
    list(s.query(X, AND(Y.other == X.storeID,
                        Y.ident.startswith(u'b'))).distinct())
        => [X(name=u'hello', value=1, storeID=1)@...]

@return: an L{iaxiom.IQuery} provider whose values are distinct.
def __iter__(self):
Iterate the results of this query.
def next(self):
This method is deprecated, a holdover from when queries were iterators, rather than iterables.
Returnsone element of massaged data.
API Documentation for vodafone-mobile-connect-card-driver-for-linux, generated by pydoctor at 2008-01-10 13:06:31.