Apps Components Interfaces All Files Source Tree | source: tos.lib.TinyDB.QueryResultIntf.nc |
QueryResults are collections tuples or partially aggregated results, either produced locally or received over the network.
This interface defines routines to marshall / unmarshall them from tuples and byte arrays.
Note that QueryResults (or ResultTuples) should not be confused with Tuples (see TupleIntf) which are simple, fixed width packed arrays of attribute data collected from local fields. Tuples are used internally to collect data about sensors -- QueryResults are sent to neighboring motes and stored in result buffers for external processing.
ResultTuples can be used to get information about specified subtuples of a result. ResultTuple is defined in TinyDB.h. They are either aggregates (in which case the individual ResultTuples should be converted to QueryResults via fromResultTuple and passed to AggOperator for processing), or
Note that you must be careful with QueryResults, since they are sometimes initalized with pointers into the data structures that they are created from, such that overwriting their data can cause dangerous things to happen and the underlying pointers can become invalid when current tuples / buffers are reused. Situations in which references may be returned are noted carefully below (usually this is done for large results for which extra copies would incur a significant memory overhead).
Author: | Sam Madden |
Commands |
Returns: | The number of fields in this result |
Parameters: |
qr - The query result to add the aggregate data to groupNo - The group number for the aggregate data bytes - The aggregate data size - The size (in bytes) of the aggregate data q - The query this result/data correspond to exprIdx - The expression in q that this is aggregate data for |
Returns: | err_OutOfMemory if there is insufficient space in the result |
err_AlreadyTupleResult if this query result already has base tuple data in it | |
err_InvalidQueryId qr is not a result for query q | |
err_NoError if there was no error |
Commands - Details |
Parameters: |
qr - The query result to initialize. |
Parameters: |
qr - The (initialized) QueryResult to fill in q - The query that t belongs to t - The tuple to write into the QueryResult |
Parameters: |
qr - The QueryResult to build the tuple from q - The query corresponding to the query result / tuple t - (on return) The tuple containing the data from the query result |
Parameters: |
qr - The QueryResult to marshall q - The query corresponding to the query result bytes - The byte array to write the result into. |
Returns: | The specified sub result from this query result (will contain references into qr) |
Parameters: |
i - The result number to retrieve (0 .. numRecords) q - The query corresponding to this query result |