PHP 클래스 Google\Cloud\Datastore\Query\GqlQuery

By default, parameters MUST be bound using named or positional bindings. Literals are disabled by default, and must be enabled by setting $options['allowLiterals'] to true. As with any SQL-style language, using parameter binding is highly recommended. Idiomatic usage is via {@see \Google\Cloud\Datastore\DatastoreClient::gqlQuery()}. Example: use Google\Cloud\ServiceBuilder; $cloud = new ServiceBuilder(); $datastore = $cloud->datastore(); $query = $datastore->gqlQuery('SELECT * FROM Companies WHERE companyName = @companyName', [ 'bindings' => [ 'companyName' => 'Google' ] ]); $res = $datastore->runQuery($query); foreach ($res as $company) { echo $company['companyName']; // Google } Positional binding is also supported $query = $datastore->gqlQuery('SELECT * FROM Companies WHERE companyName = @1', [ 'bindings' => [ 'Google' ] ]); While not recommended, you can use literals in your query string: $query = $datastore->gqlQuery("SELECT * FROM Companies WHERE companyName = 'Google'", [ 'allowLiterals' => true ]);
또한 보기: https://cloud.google.com/datastore/docs/apis/gql/gql_reference GQL Reference
상속: implements Google\Cloud\Datastore\Query\QueryInterface, use trait Google\Cloud\ArrayTrait, use trait Google\Cloud\Datastore\DatastoreTrait
파일 보기 프로젝트 열기: GoogleCloudPlatform/gcloud-php 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( EntityMapper $entityMapper, string $query, array $options = [] )
canPaginate ( ) : boolean Indicate that this type does not support automatic pagination.
jsonSerialize ( ) : array Define the json respresentation of the object.
queryKey ( ) : string Return the query_type union field name.
queryObject ( ) : array Format the query for use in the API
start ( string $cursor ) : void Fulfill the interface, but cursors are handled inside the query string.

비공개 메소드들

메소드 설명
determineBindingType ( array $options ) : string Determine whether the query should use named or positional bindings.
mapBindings ( string $bindingType, array $bindings ) : array Format bound values for the API

메소드 상세

__construct() 공개 메소드

public __construct ( EntityMapper $entityMapper, string $query, array $options = [] )
$entityMapper Google\Cloud\Datastore\EntityMapper An instance of EntityMapper
$query string The GQL Query string.
$options array [optional] { Configuration Options @type bool $allowLiterals Whether literal values will be allowed in the query string. Parameter binding is strongly encouraged over literals. **Defaults to** `false`. @type array $bindings An array of values to bind to the query string. Queries using Named Bindings should provide a key/value set, while queries using Positional Bindings must provide a simple array. Applications with no need for multitenancy should not set this value. }

canPaginate() 공개 메소드

Indicate that this type does not support automatic pagination.
public canPaginate ( ) : boolean
리턴 boolean

jsonSerialize() 공개 메소드

Define the json respresentation of the object.
public jsonSerialize ( ) : array
리턴 array

queryKey() 공개 메소드

Return the query_type union field name.
public queryKey ( ) : string
리턴 string

queryObject() 공개 메소드

This method is used internally to run queries and is not intended for use outside the internal library API
public queryObject ( ) : array
리턴 array

start() 공개 메소드

Fulfill the interface, but cursors are handled inside the query string.
public start ( string $cursor ) : void
$cursor string
리턴 void