- 2.0.1-RC1 (latest)
 - 2.0.0-RC1
 - 1.106.0
 - 1.105.1
 - 1.104.1
 - 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 Result.
Represent a Cloud Spanner lookup result (either read or executeSql).
Example:
use Google\Cloud\Spanner\SpannerClient;
$spanner = new SpannerClient();
$database = $spanner->connect('my-instance', 'my-database');
$result = $database->execute('SELECT * FROM Posts');
Namespace
Google \ Cloud \ SpannerMethods
__construct
| Parameters | |
|---|---|
| Name | Description | 
operation | 
        
          Google\Cloud\Spanner\Operation
          Runs operations against Google Cloud Spanner.  | 
      
session | 
        
          Google\Cloud\Spanner\Session\Session
          The session used for any operations executed.  | 
      
call | 
        
          callable
          A callable, yielding a generator filled with results.  | 
      
transactionContext | 
        
          string
          The transaction's context.  | 
      
mapper | 
        
          Google\Cloud\Spanner\ValueMapper
          Maps values.  | 
      
retries | 
        
          int
          Number of attempts to resume a broken stream, assuming a resume token is present. Defaults to 3.  | 
      
rows
Return the formatted and decoded rows. If the stream is interrupted and a resume token is available, attempts will be made on your behalf to resume.
Example:
$rows = $result->rows();
| Parameter | |
|---|---|
| Name | Description | 
format | 
        
          string
          Determines the format in which rows are returned.
  | 
      
| Returns | |
|---|---|
| Type | Description | 
Generator | 
        |
columns
Return column names.
Will be populated once the result set is iterated upon.
Example:
$columns = $result->columns();
| Returns | |
|---|---|
| Type | Description | 
array|null | 
        |
metadata
Return result metadata.
Will be populated once the result set is iterated upon.
Example:
$metadata = $result->metadata();
| Returns | |
|---|---|
| Type | Description | 
array|null | 
        [ResultSetMetadata](https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.v1#google.spanner.v1.ResultSetMetadata). | 
session
Return the session associated with the result stream.
Example:
$session = $result->session();
| Returns | |
|---|---|
| Type | Description | 
Google\Cloud\Spanner\Session\Session | 
        |
stats
Get the query plan and execution statistics for the query that produced this result set.
By default, statistics are returned by default only when executing a DML
statement. To receive statistics for a SELECT statement, set
$options.queryMode to Result::MODE_PROFILE, as demonstrated below.
Setting $options.queryMode to Result::MODE_PLAN will return the query
plan without any results or execution statistics information.
Example:
$stats = $result->stats();
// Executing a query with stats returned.
use Google\Cloud\Spanner\Result;
$res = $database->execute('SELECT * FROM Posts', [
    'queryMode' => Result::MODE_PROFILE
]);
| Returns | |
|---|---|
| Type | Description | 
array|null | 
        [ResultSetStats](https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.v1#google.spanner.v1.ResultSetStats). | 
snapshot
Returns a snapshot which was begun in the read or execute, if one exists.
Will be populated once the result set is iterated upon.
Example:
$snapshot = $result->snapshot();
| Returns | |
|---|---|
| Type | Description | 
Google\Cloud\Spanner\Snapshot|null | 
        |
transaction
Returns a transaction which was begun in the read or execute, if one exists.
Will be populated once the result set is iterated upon.
Example:
$transaction = $result->transaction();
| Returns | |
|---|---|
| Type | Description | 
Google\Cloud\Spanner\Transaction|null | 
        |
getIterator
| Returns | |
|---|---|
| Type | Description | 
Generator | 
        |
Constants
BUFFER_RESULT_LIMIT
Value: 10RETURN_NAME_VALUE_PAIR
Value: 'nameValuePair'RETURN_ASSOCIATIVE
Value: 'associative'RETURN_ZERO_INDEXED
Value: 'zeroIndexed'MODE_NORMAL
Value: \Google\Cloud\Spanner\V1\ExecuteSqlRequest\QueryMode::NORMALMODE_PLAN
Value: \Google\Cloud\Spanner\V1\ExecuteSqlRequest\QueryMode::PLANMODE_PROFILE
Value: \Google\Cloud\Spanner\V1\ExecuteSqlRequest\QueryMode::PROFILE