Typical usage is:
$statementBuilder = new StatementBuilder() ->Where("lastModifiedDateTime > :yesterday AND type = :type") ->OrderBy("name DESC") ->Limit(200) ->Offset(20) ->WithBindVariableValue("yesterday", date(DateTimeUtils::$DFP_DATE_TIME_STRING_FORMAT, strtotime('-1 day')) ->WithBindVariableValue("type", "Type") $statement = $statementBuilder->ToStatement(); ... $statementBuilder->IncreaseOffsetBy(20); $statement = $statementBuilder->ToStatement();Datei anzeigen Open project: googleads/googleads-php-lib Class Usage Examples
Method | Description | |
---|---|---|
From ( string $table ) : StatementBuilder | Sets the statement FROM clause in the form of "table". | |
GetBindVariableMap ( ) | Returns the key to value map. | |
GetOffset ( ) : integer | Gets the current offset. | |
IncreaseOffsetBy ( integer $amount ) : StatementBuilder | Increases the offset by the {@code amount}. | |
Limit ( integer $count ) : StatementBuilder |
Sets the statement LIMIT clause in the form of"LIMIT <count>"
e.g. 1000. |
|
Offset ( integer $count ) : StatementBuilder |
Sets the statement OFFSET clause in the form of"OFFSET <count>"
e.g. 200. |
|
OrderBy ( string $orderBy ) : StatementBuilder |
Sets the statement ORDER BY clause in the form of"ORDER BY <property> [ASC | DESC]"
e.g. "type ASC, lastModifiedDateTime DESC". The "ORDER BY " keyword will be ignored. |
|
RemoveLimitAndOffset ( ) : StatementBuilder | Removes the limit and offset from the query. | |
Select ( string $columns ) : StatementBuilder | Sets the statement SELECT clause in the form of "a,b" or "*". | |
ToStatement ( ) : Statement | Gets the {@link Statement} representing the state of this statement builder. | |
Where ( string $conditions ) : StatementBuilder |
Sets the statement WHERE clause in the form of"WHERE <condition> {[AND | OR] <condition> . |
|
WithBindVariableValue ( string $key, mixed $value ) : StatementBuilder | Adds a value to the statement in the form of a {@code Value}. | |
__construct ( ) | Constructs a new instance of this statement builder. |
Method | Description | |
---|---|---|
buildQuery ( ) : string | Builds the query from the clauses. | |
removeKeyword ( string $clause, string $keyword ) : string | Removes the {@code keyword} from the {@code clause} if present. Will remove {@code keyword + " "}. | |
validateQuery ( ) | Checks that the query is valid. |
public IncreaseOffsetBy ( integer $amount ) : StatementBuilder | ||
$amount | integer | the amount to increase the offset |
return | StatementBuilder | a reference to this object |
"LIMIT <count>"
"OFFSET <count>"
"ORDER BY <property> [ASC | DESC]"
public RemoveLimitAndOffset ( ) : StatementBuilder | ||
return | StatementBuilder | a reference to this object |
public ToStatement ( ) : Statement | ||
return | Statement | the {@link Statement} |
public WithBindVariableValue ( string $key, mixed $value ) : StatementBuilder | ||
$key | string | the value key |
$value | mixed | the value either as a primitive, which will be converted to a PQL Value object, or a PQL Value object |
return | StatementBuilder | a reference to this object |
public __construct ( ) |