type Statement (v202411)

  • The Statement object defines the WHERE, ORDER BY, and LIMIT clauses for PQL queries used in Google Ad Manager.

  • It allows for filtering, sorting, and limiting the results retrieved when querying for specific objects.

  • Statements support bind variables for parameterized queries, enhancing flexibility and reusability.

  • They also incorporate the LIKE keyword for wildcard string matching within queries.

  • The Statement structure includes query for the PQL syntax and values to define bind variables and their corresponding values.

Captures the WHERE, ORDER BY and LIMIT clauses of a PQL query. Statements are typically used to retrieve objects of a predefined domain type, which makes SELECT clause unnecessary.

An example query text might be "WHERE status = 'ACTIVE' ORDER BY id LIMIT 30".

Statements support bind variables. These are substitutes for literals and can be thought of as input parameters to a PQL query.

An example of such a query might be "WHERE id = :idValue".

Statements also support use of the LIKE keyword. This provides wildcard string matching.

An example of such a query might be "WHERE name LIKE '%searchString%'".

The value for the variable idValue must then be set with an object of type Value, e.g., NumberValue, TextValue or BooleanValue.
Namespace
https://www.google.com/apis/ads/publisher/v202411

Field

query

xsd:string

Holds the query in PQL syntax. The syntax is:
[WHERE <condition> {[AND | OR] <condition> ...}]
[ORDER BY <property> [ASC | DESC]]
[LIMIT {[<offset>,] <count>} | {<count> OFFSET <offset>}]

<condition>
     := <property> {< | <= | > | >= | = | != } <value>
<condition>
     := <property> {< | <= | > | >= | = | != } <bind variable>
<condition> := <property> IN <list>
<condition> := <property> IS NULL
<condition> := <property> LIKE <wildcard%match>
<bind variable> := :<name>

values

String_ValueMapEntry[]

Holds keys and values for bind variables and their values. The key is the name of the bind variable. The value is the literal value of the variable.

In the example "WHERE status = :bindStatus ORDER BY id LIMIT 30", the bind variable, represented by :bindStatus is named bindStatus, which would also be the parameter map key. The bind variable's value would be represented by a parameter map value of type TextValue. The final result, for example, would be an entry of "bindStatus" => StringParam("ACTIVE").