\Google\AdsApi\AdWords\QueryQueryValidator

Validates parts of an AWQL string.

Summary

Methods
Properties
Constants
validateFieldName()
validateCustomDateRange()
validateServiceQuery()
validateReportQuery()
No public properties found
PATTERN_LITERAL_STRING
REDACTED_LITERAL_STRING
No protected methods found
No protected properties found
N/A
containKeywords()
containAllKeywords()
containAnyKeywords()
validateQuery()
No private properties found
N/A

Constants

PATTERN_LITERAL_STRING

PATTERN_LITERAL_STRING

The regular expression pattern to identify whether an AWQL string contains literal strings by searching for single and double quotes.

For example, the AWQL string below contains a double quoted literal string: SELECT Id WHERE Name = "I'M THE LIMIT INC"

REDACTED_LITERAL_STRING

REDACTED_LITERAL_STRING

The replacement for any literal strings found in an AWQL string.

Methods

validateFieldName()

validateFieldName(string  $fieldName): \Google\AdsApi\AdWords\Query\ValidationResult

Validates a field name for using in the SELECT, WHERE or ORDER BY clauses of an AWQL string.

Parameters

string $fieldName

the field name to be validated

Returns

\Google\AdsApi\AdWords\Query\ValidationResult

the object containing whether the validation is passed or failed with detail explanation

validateCustomDateRange()

validateCustomDateRange(string  $startDateString,string  $endDateString): \Google\AdsApi\AdWords\Query\ValidationResult

Validates the start and end dates of a custom date range in the DURING clause of an AWQL string.

Parameters

string $startDateString

the start date string

string $endDateString

the end date string

Returns

\Google\AdsApi\AdWords\Query\ValidationResult

the object containing whether the validation is passed or failed with detail explanation

validateServiceQuery()

validateServiceQuery(string  $awqlString,boolean|null  $allowPagination = true): \Google\AdsApi\AdWords\Query\ValidationResult

Validates a service query AWQL string.

Parameters

string $awqlString

the AWQL string to be validated

boolean|null $allowPagination

optional, indicates whether the AWQL is allowed to have the pagination (LIMIT) clause

Returns

\Google\AdsApi\AdWords\Query\ValidationResult

the object containing whether the validation is passed or failed with detail explanation

validateReportQuery()

validateReportQuery(string  $awqlString): \Google\AdsApi\AdWords\Query\ValidationResult

Validates a report query AWQL string.

Parameters

string $awqlString

the AWQL string to be validated

Returns

\Google\AdsApi\AdWords\Query\ValidationResult

the object containing whether the validation is passed or failed with detail explanation

containKeywords()

containKeywords(string  $awqlString,array<mixed,string>  $clauseKeywords,boolean  $containAll): boolean

Checks if an AWQL string contains certain clauses by searching for the clause opening keywords.

Parameters

string $awqlString

the AWQL string to check

array<mixed,string> $clauseKeywords

the clause opening keywords (e.g. SELECT, FROM, WHERE, ORDER BY) to search

boolean $containAll

whether the AWQL string should contain all of the given keywords. Set to false for checking whether the AWQL string should contain any of the given keywords

Returns

boolean —

true if the AWQL string contains all or any the clause keywords accordingly to the $containAll parameter; Otherwise, returns false

containAllKeywords()

containAllKeywords(string  $awqlString,array<mixed,string>  $clauseKeywords): boolean

Checks if the AWQL string contains all of the clause opening keywords.

Parameters

string $awqlString

the AWQL string to check

array<mixed,string> $clauseKeywords

the clause opening keywords (e.g. SELECT, FROM, WHERE, ORDER BY) to search

Returns

boolean —

true if the AWQL string contains all of the given keywords; Otherwise, returns false

containAnyKeywords()

containAnyKeywords(string  $awqlString,array<mixed,string>  $clauseKeywords): boolean

Checks if the AWQL string contains any of the given clause opening keywords.

Parameters

string $awqlString

the AWQL string to check

array<mixed,string> $clauseKeywords

the clause opening keywords (e.g. SELECT, FROM, WHERE, ORDER BY) to search

Returns

boolean —

true if the AWQL string contains any of the given keywords; Otherwise, returns false

validateQuery()

validateQuery(string  $awqlString,array<mixed,string>  $requiredKeywords,array<mixed,string>  $forbiddenKeywords): \Google\AdsApi\AdWords\Query\ValidationResult

Checks if the AWQL string contains the required clause opening keywords, but not the forbidden ones.

Parameters

string $awqlString

the AWQL string to check

array<mixed,string> $requiredKeywords

the opening keywords (e.g. SELECT, FROM, WHERE, ORDER BY) for the required clauses

array<mixed,string> $forbiddenKeywords

the opening keywords (e.g. SELECT, FROM, WHERE, ORDER BY) for the forbidden clauses

Returns

\Google\AdsApi\AdWords\Query\ValidationResult

the object containing whether the validation is passed or failed with detail explanation