- 1.104.0 (latest)
- 1.103.0
- 1.102.0
- 1.101.0
- 1.100.0
- 1.98.0
- 1.97.0
- 1.96.0
- 1.95.0
- 1.94.0
- 1.93.1
- 1.92.1
- 1.91.0
- 1.90.0
- 1.89.0
- 1.88.0
- 1.87.0
- 1.86.0
- 1.85.0
- 1.84.0
- 1.83.0
- 1.82.0
- 1.81.0
- 1.80.0
- 1.79.0
- 1.78.0
- 1.77.0
- 1.76.1
- 1.68.0
- 1.67.0
- 1.66.0
- 1.65.0
- 1.64.0
- 1.63.2
- 1.62.1
- 1.61.0
- 1.60.0
- 1.59.0
- 1.58.4
- 1.57.0
- 1.56.0
- 1.55.0
- 1.54.2
Reference documentation and code samples for the Cloud Spanner Client class Operation.
Common interface for running operations against Cloud Spanner. This class is intended for internal use by the client library only. Implementors should access these operations via Database or Transaction .
Usage examples may be found in classes making use of this class:
Namespace
Google \ Cloud \ SpannerMethods
__construct
connection
Connection\ConnectionInterface
A connection to Google Cloud Spanner. This object is created by SpannerClient, and should not be instantiated outside of this client.
returnInt64AsObject
bool
If true, 64 bit integers will be returned as a Google\Cloud\Core\Int64 object for 32 bit platform compatibility.
commit
Commit all enqueued mutations.
session
mutations
array
A list of mutations to apply.
options
array
Configuration options.
↳ transactionId
string
The ID of the transaction.
↳ returnCommitStats
bool
If true, return the full response. Defaults to false
.
↳ maxCommitDelay
Duration
The amount of latency this request is willing to incur in order to improve throughput. Defaults tonull.
↳ requestOptions
array
Request options. For more information on available options, please see the upstream documentation
. Please note, if using the priority
setting you may utilize the constants available on V1\RequestOptions\Priority
to set a value.
commitWithResponse
session
mutations
array
A list of mutations to apply.
options
array
Configuration options.
↳ transactionId
string
The ID of the transaction.
↳ returnCommitStats
bool
If true, return the full response. Defaults to false
.
↳ maxCommitDelay
Duration
The amount of latency this request is willing to incur in order to improve throughput. Defaults tonull.
↳ requestOptions
array
Request options. For more information on available options, please see the upstream documentation
. Please note, if using the priority
setting you may utilize the constants available on V1\RequestOptions\Priority
to set a value.
array
rollback
Rollback a Transaction.
session
Session\Session
The session to use for the rollback. Note that the session MUST be the same one in which the transaction was created.
transactionId
string
The transaction to roll back.
options
array
[optional] Configuration Options.
void
execute
Run a query.
session
sql
string
The query string.
options
array
Configuration options.
↳ requestOptions
array
Request options. For more information on available options, please see the upstream documentation
. Please note, if using the priority
setting you may utilize the constants available on V1\RequestOptions\Priority
to set a value.
↳ transaction
array
Transaction selector options.
↳ directedReadOptions
array
Directed read options. V1\DirectedReadOptions
If using the replicaSelection::type
setting, utilize the constants available in V1\DirectedReadOptions\ReplicaSelection\Type
to set a value.
executeUpdate
Execute a DML statement and return an affected row count.
session
transaction
sql
string
The SQL string to execute.
options
array
Configuration options.
↳ requestOptions
array
Request options. For more information on available options, please see the upstream documentation
. Please note, if using the priority
setting you may utilize the constants available on V1\RequestOptions\Priority
to set a value.
↳ transaction
array
Transaction selector options.
int
executeUpdateBatch
Execute multiple DML statements.
For detailed usage instructions, see Transaction::executeUpdateBatch() .
session
transaction
statements
array[]
A list of DML statements to run. Each statement
must contain a sql
key, where the value is a DML string. If the
DML contains placeholders, values are provided as a key/value array
in key parameters
. If parameter types are required, they must be
provided in key paramTypes
. Generally, Google Cloud PHP can
infer types. Explicit type declarations are required in the case
of struct parameters, or when a null value exists as a parameter.
Accepted values for primitive types are defined as constants on Database
, and are as follows: Database::TYPE_BOOL
, Database::TYPE_INT64
, Database::TYPE_FLOAT64
, Database::TYPE_TIMESTAMP
, Database::TYPE_DATE
, Database::TYPE_STRING
, Database::TYPE_BYTES
. If the value is an array, use ArrayType
to declare the array
parameter types. Likewise, for structs, use StructType
.
options
array
Configuration Options.
↳ requestOptions
array
Request options. For more information on available options, please see the upstream documentation
. Please note, if using the priority
setting you may utilize the constants available on V1\RequestOptions\Priority
to set a value.
↳ transaction
array
Transaction selector options.
read
Lookup rows in a database.
session
table
string
The table name.
keySet
columns
array
A list of column names to return.
options
array
Configuration Options.
↳ index
string
The name of an index on the table.
↳ offset
int
The number of rows to offset results by.
↳ limit
int
The number of results to return.
↳ requestOptions
array
Request options. For more information on available options, please see the upstream documentation
. Please note, if using the priority
setting you may utilize the constants available on V1\RequestOptions\Priority
to set a value.
↳ transaction
array
Transaction selector options.
↳ directedReadOptions
array
Directed read options. V1\DirectedReadOptions
If using the replicaSelection::type
setting, utilize the constants available in V1\DirectedReadOptions\ReplicaSelection\Type
to set a value.
transaction
See also:
session
options
array
Configuration Options.
↳ singleUse
bool
If true, a Transaction ID will not be allocated up front. Instead, the transaction will be considered "single-use", and may be used for only a single operation. Defaults to false
.
↳ isRetry
bool
If true, the resulting transaction will indicate that it is the result of a retry operation. Defaults to false
.
↳ begin
createTransaction
Create a Transaction instance from a response object.
session
res
array
[optional] The createTransaction response.
options
array
[optional] Options for the transaction object. @type array $begin The begin transaction options. Refer
snapshot
See also:
session
options
array
Configuration Options.
↳ singleUse
bool
If true, a Transaction ID will not be allocated up front. Instead, the transaction will be considered "single-use", and may be used for only a single operation. Defaults to false
.
↳ className
string
If set, an instance of the given class will be instantiated. This setting is intended for internal use. Defaults to Google\Cloud\Spanner\Snapshot
.
↳ directedReadOptions
array
Directed read options. V1\DirectedReadOptions
If using the replicaSelection::type
setting, utilize the constants available in V1\DirectedReadOptions\ReplicaSelection\Type
to set a value.
mixed
createSnapshot
Create a Snapshot instance from a response object.
session
res
array
[optional] The createTransaction response.
className
string
[optional] The class to instantiate with a
snapshot. Defaults to Google\Cloud\Spanner\Snapshot
.
mixed
createSession
Create a new session.
Sessions are handled behind the scenes and this method does not need to be called directly.
databaseName
string
The database name
options
array
Configuration options.
↳ labels
array
Labels to be applied to each session created in the pool. Label keys must be between 1 and 63 characters long and must conform to the following regular expression: [a-z]([-a-z0-9]*[a-z0-9])?
. Label values must be between 0 and 63 characters long and must conform to the regular expression ([a-z]([-a-z0-9]*[a-z0-9])?)?
. No more than 64 labels can be associated with a given session. See https://goo.gl/xmQnxf
for more information on and examples of labels.
↳ creator_role
string
The user created database role which creates the session.
session
Lazily instantiates a session. There are no network requests made at this point. To see the operations that can be performed on a session please see Session\Session .
Sessions are handled behind the scenes and this method does not need to be called directly.
sessionName
string
The session's name.
partitionQuery
Begin a partitioned SQL query.
session
transactionId
string
The transaction to run in.
sql
string
The query string to execute.
options
array
Configuration Options
↳ maxPartitions
int
The desired maximum number of partitions to return. For example, this may be set to the number of workers available. The maximum value is currently 200,000. This is only a hint. The actual number of partitions returned may be smaller than this maximum count request. Defaults to 10000
.
↳ partitionSizeBytes
int
The desired data size for each partition generated. This is only a hint. The actual size of each partition may be smaller or larger than this size request. Defaults to 1000000000
(i.e. 1 GiB).
↳ parameters
array
A key/value array of Query Parameters, where the key is represented in the query string prefixed by a @
symbol.
↳ types
array
A key/value array of Query Parameter types. Generally, Google Cloud PHP can infer types. Explicit type definitions are only necessary for null parameter values. Accepted values are defined as constants on ValueMapper
, and are as follows: Database::TYPE_BOOL
, Database::TYPE_INT64
, Database::TYPE_FLOAT64
, Database::TYPE_TIMESTAMP
, Database::TYPE_DATE
, Database::TYPE_STRING
, Database::TYPE_BYTES
, Database::TYPE_ARRAY
and Database::TYPE_STRUCT
. If the parameter type is an array, the type should be given as an array, where the first element is Database::TYPE_ARRAY
and the second element is the array type, for instance [Database::TYPE_ARRAY, Database::TYPE_INT64]
.
partitionRead
Begin a partitioned read.
session
transactionId
string
The transaction to run in.
table
string
The table name.
keySet
columns
array
A list of column names to return.
options
array
Configuration Options
↳ maxPartitions
int
The desired maximum number of partitions to return. For example, this may be set to the number of workers available. The maximum value is currently 200,000. This is only a hint. The actual number of partitions returned may be smaller than this maximum count request. Defaults to 10000
.
↳ partitionSizeBytes
int
The desired data size for each partition generated. This is only a hint. The actual size of each partition may be smaller or larger than this size request. Defaults to 1000000000
(i.e. 1 GiB).
↳ index
string
The name of an index on the table.
__debugInfo
Represent the class in a more readable and digestable fashion.
Constants
OP_INSERT
Value: 'insert'
OP_UPDATE
Value: 'update'
OP_INSERT_OR_UPDATE
Value: 'insertOrUpdate'
OP_REPLACE
Value: 'replace'
OP_DELETE
Value: 'delete'