ade_qrydefine

Land Desktop Development ARX CPP SDK

Up a level
ade_qrydefine
 
 

Defines a query.

ade_id

ade_qrydefine(

char* joinop,

char* bggroups,

char* not_op,

char* condtype,

struct resbuf* qrycond,

char* endgroups);

Returns the ID of the query condition it creates or ADE_NULLID.

joinop A joining operator: "and" or "or" or "" (none). If "" (none) is specified, the default joining operator is used (see ade_prefgetval).
bggroups For grouping this condition with others in the query definition you are building. Use one or more open parentheses as needed, or "" (none). For example, "((".
not_op The NOT operator, if needed: "not" or "" (none).
condtype A condition type: "Location", "Property", "Data", or "SQL".
qrycond A condition expression. Depends on the condition type. See Condition Expressions below.
endgroups For grouping this condition with others in the query definition you are building. Use one or more close parentheses as needed, or "" (none). For example, "))".

A query definition is composed of one or more conditions, each defined by a separate ade_qrydefine call. You can group conditions by supplying parentheses or empty strings to the bggroups or endgroups parameters as needed.

You must specify all six ade_qrydefine arguments.

Condition Expressions

The qrycond parameter requires a condition expression. Condition expressions are lists. What you include in the list depends on the condition type: Location, Property, Data, or SQL.

Location Expressions Property Expressions
Data Expressions
SQL Expressions

You must release the resbuf.

The following sample creates a resbuf containing the query condition values, (objects classified as Ponds). ade_qrydefine() is called with all required parameters, the returned queryId is checked for ADE_NULLID and an appropriate message is displayed. Then it releases the resbuf, as required.

char* pszJoinOperator = "";     // none
char* pszBgnCondGrouping = "";  // none
char* pszNotOperator = "";      // none
char* pszCondType = "Property";
char* pszEndCondGrouping = "";  // none
struct resbuf* pQueryConditionRb = acutBuildList(
                                                    RTLB,
                                                        RTSTR, "feature",
                                                        RTSTR, "=",
                                                        RTSTR, "Pond",
                                                    RTLE,
                                                    0 );
ade_id queryId = ade_qrydefine(
                                pszJoinOperator,
                                pszBgnCondGrouping,
                                pszNotOperator,
                                pszCondType,
                                pQueryConditionRb,
                                pszEndCondGrouping);

if (queryId != ADE_NULLID) {
    acutPrintf(
        "\nA %s query has been defined."
        , pszCondType);
}
else {
    acutPrintf(
        "\nA %s query was not defined."
        , pszCondType);
}
acutRelRb(pQueryConditionRb);