IConditionGenerator::GenerateForLeaf method (structuredquery.h)

Generates a special query expression for what would otherwise become a leaf query expression.

Syntax

HRESULT GenerateForLeaf(
  [in]          IConditionFactory   *pConditionFactory,
  [in]          LPCWSTR             pszPropertyName,
  [in]          CONDITION_OPERATION cop,
  [in]          LPCWSTR             pszValueType,
  [in]          LPCWSTR             pszValue,
  [in]          LPCWSTR             pszValue2,
  [in]          IRichChunk          *pPropertyNameTerm,
  [in]          IRichChunk          *pOperationTerm,
  [in]          IRichChunk          *pValueTerm,
  [in]          BOOL                automaticWildcard,
  [out]         BOOL                *pNoStringQuery,
  [out, retval] ICondition          **ppQueryExpression
);

Parameters

[in] pConditionFactory

Type: IConditionFactory*

An IConditionFactory object that can be used to create the necessary nodes.

[in] pszPropertyName

Type: LPCWSTR

Property name, or NULL if there is no property name.

[in] cop

Type: CONDITION_OPERATION

A CONDITION_OPERATION enumerated type identifying the operation.

[in] pszValueType

Type: LPCWSTR

Semantic type describing the values in pszValue and pszValue2.

[in] pszValue

Type: LPCWSTR

A string generated by IConditionGenerator::RecognizeNamedEntities that represents the value. If pszValue2 is not NULL, then this represents the beginning of the value's range.

[in] pszValue2

Type: LPCWSTR

If not NULL, a string generated by IConditionGenerator::RecognizeNamedEntities that represents the end of the value's range. If NULL, then pszValue represents a discrete value.

[in] pPropertyNameTerm

Type: IRichChunk*

Pointer to an IRichChunk object containing information about what part of an input string produced the property name.

[in] pOperationTerm

Type: IRichChunk*

Pointer to an IRichChunk object containing information about what part of an input string produced the operation.

[in] pValueTerm

Type: IRichChunk*

Pointer to an IRichChunk object containing information about what part of an input string produced the value.

[in] automaticWildcard

Type: BOOL

TRUE if the generated condition should return results that begin with the specified value, if meaningful. FALSE if the generated condition should return results matching the specified value exactly.

[out] pNoStringQuery

Type: BOOL*

VARIANT_TRUE if the condition tree in ppQueryExpression should be the full query, or VARIANT_FALSE if the full query should be a disjunction of the condition tree in ppQueryExpression and the condition tree that would have been used if this method had returned S_FALSE.

[out, retval] ppQueryExpression

Type: ICondition**

Receives a pointer to an ICondition condition tree.

Return value

Type: HRESULT

Returns one of the following, or an error value otherwise.

Return code Description
S_OK
Successfully generated a condition.
S_FALSE
A condition was not generated, and the query parser must produce one in some other way.

Remarks

If this method returns S_FALSE, the calling query parser should generate a leaf node N with this property name, operation, and value. If this method returns S_FALSE and pNoStringQuery contains VARIANT_FALSE, the full generated query is a disjunction (OR) with the leaf node N and the condition tree in ppQueryExpression as subconditions.

If this method returns S_OK and pNoStringQuery contains VARIANT_TRUE, the condition tree in ppQueryExpression is the full query.

The value of pszValue2 is non-NULL only for a range query, such as date:1/2/2003..1/30/2006, where pszValue contains the value for 1/2/2003 and pszValue2 contains the value for 1/30/2006. A condition generator can elect to refuse ranges by always returning S_OK when pszValue2 is not NULL.

A condition generator can safely ignore the arguments pPropertyNameTerm, pOperationTerm, and pValueTerm. However, it would use them to produce a leaf node that has correct information about the origins in the query string of the property name, the operator, and the value, by passing them on to MakeLeaf.

In many cases, a condition generator can ignore the argument automaticWildcard because it would not apply. However, if the generated condition tree does some form of string search, where both a prefix search (COP_VALUE_STARTSWITH from CONDITION_OPERATION) and a search for the exact string (COP_EQUAL from CONDITION_OPERATION) are meaningful, then the former should be generated when automaticWildcard is VARIANT_TRUE, and the latter when automaticWildcard is VARIANT_FALSE.

Requirements

   
Minimum supported client Windows XP with SP2, Windows Vista [desktop apps only]
Minimum supported server Windows Server 2003 with SP1 [desktop apps only]
Target Platform Windows
Header structuredquery.h

See also

CONDITION_CREATION_OPTIONS

CONDITION_OPERATION

CONDITION_TYPE

ICondition

ICondition2

IConditionFactory

IConditionGenerator

Reference