Apps     Components     Interfaces     All Files     Source Tree     source: tos.lib.TinyDB.ParsedQueryIntf.nc

Interface: ParsedQueryIntf

The ParsedQueryIntf is used for interacting with ParsedQueries (e.g. Queries whose fields have been converted into schema indices) This is the primary way in which most of TinyDB Interacts with queries -- routines are provided to get and set expressions and fields, and also to map from named fields into offsets in results for queries
Author: Sam Madden (madden@cs.berkeley.edu)

Components providing this interface:
tos.lib.TinyDB.ParsedQuery

Components requiring this interface:
tos.lib.TinyDB.AggOperator
tos.lib.TinyDB.DBBufferC
tos.lib.TinyDB.QueryResult
tos.lib.TinyDB.Tuple
tos.lib.TinyDB.TupleRouterM

Commands

Commands - Details

numResultFields

uint8_t numResultFields(ParsedQueryPtr q, bool *agg)

Returns: the number of fields in results from this query. Note that this is either the number of fields in tuples for this query or the number of aggregate expressions, depending on whether any aggregate expressions exist.

Parameters:

agg - (on return) Whether there are aggregate results in this query


getResultField

TinyDBError getResultField(ParsedQueryPtr q, QueryResultPtr qr, uint8_t resultid, char *result_buf)

Copy data from the field resultid (as returned by getResultId) of qr into result_buf

Parameters:

q - The query that qr belongs to

qr - The QueryResult to copy data from

resultid - The index of the desired field from qr

result_buf - (on return) Data from the specified field will be copied into this buffer Note that no bounds checking is performed -- insure that result_buf is at least big enough to hold the result -- if this is a Tuple field, see TupleIntf.fieldSize(...). If it is an aggregate field, see AggOperator.finalizeAggExpr

Returns: err_InvalidIndex if the specified resultid is not valid

getResultId

TinyDBError getResultId(ParsedQueryPtr q, Field *f, uint8_t *id)

Return the index (to be used in getResultField) of the field corresponding to f in this quey.

Parameters:

q - The query to which f belongs

f - The field to look for

id - (on return) The id of the field f (if it exists)

Returns: err_InvalidIndex if the query does not contain a corresponding field