WYRDTEK Home Features Reference Downloads About


Reference/es_mbq_prepare

Syntax

int es_mbq_prepare( struct es_mbq *query,
                    struct es_mbd *idef,
                    struct es_sdm *sdef,
                    char *queryplan, int queryplanlen,
                    char *errorbuf, int errorbuflen );

Arguments

es_mbq *query Database query definition.
es_mbd *idef Input database definition.
es_sdm *sdef String dictionary definition.
char *queryplan Query plan buffer.
int queryplanlen Length of queryplan buffer.
char *errorbuf Error message buffer.
int errorbuflen Length of errorbuf buffer.

Return Codes

ES_ERROR_NONE Success. No errors.
ES_ERROR_FAILTOPARSE Failed to parse query or formula definition. See errorbuf for error message.
ES_ERROR_FIELDEXISTS Query expressions addfld() or addformula() failed due to duplicate field definition.
ES_ERROR_INDEXDEFINED Query expression addfldidx() failed due to attempt to add more than one field to a NONE index.
ES_ERROR_INVALIDINDEXTYPE Query expression addfldidx() failed due to attempt to add a non-integer field to an index.
ES_ERROR_INVALIDBATCHSIZE Query expression mbc() failed to invalid batch parameter.
ES_ERROR_CLASSEXISTS Query expression mbc() failed to duplicate class name.
ES_ERROR_UNKNOWNMEMBERTYPE Query expression mbm() failed due to invalid memtype parameter.
ES_ERROR_UNKNOWNCLASS Query expression adddb() failed due to invalid refmbc parameter.
ES_ERROR_UNKNOWNFIELD Query expression adddb() failed due to invalid field parameter.
ES_ERROR_INVALIDFIELDTYPE Query expression adddb() or addkey() failed due to field parameter referring to a non-integer database field.
ES_ERROR_UNKNOWNFIELD Query expression addmembership() failed due to field parameter referring to a non-existent database field.

Description

Parse and prepare for execution the query definition assembled via repeated calls to es_mbq_add(), es_mbq_add_v(), es_mbq_addint(), es_mbq_addflt() or es_mbq_addfile().

idef describes the schema of the input database against which the query will be run. sdef contains the set of string-dictionaries that may be referred to via addsd() query expressions.

Any ES_ERROR_FAILTOPARSE errors will cause errorbuf, if provided (set to NULL otherwise), to be populated with an appropriate error message. queryplan, if provided (set to NULL otherwise), will be populated with the set of aggregator query plans to be executed.

Call es_mbq_exec() on success to actually execute the query.

[Back To Reference] [Back To Reference/es_mbq]