Skip to main content

Syntax of Queries in Class Definitions

Describes the structure of a query definition. See Query Definitions for links to general information on defining queries.

Introduction

A class query is a named query that is part of a class structure and that can be accessed via dynamic SQL.

You can define class queries within any class; there is no requirement to contain them within persistent classes.

Details

A query definition has the following structure:

/// description 
Query name(formal_spec) As classname [ keyword_list ]  
{ implementation }

Where:

  • description (optional) is intended for display in the Class Reference. The description is blank by default. See Creating Class Documentation.

  • name (required) is the name of the query. This must be a valid class member name, and must not conflict with any other class member names.

  • formal_spec (optional) specifies the list of arguments that are passed to the query.

    Specifically, this is the list of arguments that are passed to the query via the Execute() method of the associated query class.

    See the comments for formal_spec in Syntax of Methods in Class Definitions.

  • classname (required) specifies the query class used by this query.

    This is typically %SQLQueryOpens in a new tab for SQL-based queries and %QueryOpens in a new tab for custom queries. See Class Queries.

    Note:

    Custom class queries are not supported for sharded classes.

  • keyword_list (optional) is a comma-separated list of keywords that further define the query.

    See Query Syntax and Keywords for a complete keyword list.

    If this list is omitted, also omit the square brackets.

  • implementation (optional) is zero or more lines of code that define the query.

See Also

FeedbackOpens in a new tab