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.
Result::RETURN_NAME_VALUE_PAIR returns items as a
multi-dimensional array containing a name and a value key.
Ex: [0 => ['name' => 'column1', 'value' => 'my_value']].
Result::RETURN_ASSOCIATIVE returns items as an associative array
with the column name as the key. Please note with this option, if
duplicate column names are present a \RuntimeException will be
thrown. Result::RETURN_ZERO_INDEXED returns items as a 0 indexed
array, with the key representing the column number as found by
executing Result::columns(). Ex:
[0 => 'my_value']. Defaults toResult::RETURN_ASSOCIATIVE.
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.
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
]);
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Cloud Spanner Client - Class Result (1.104.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.104.0 (latest)](/php/docs/reference/cloud-spanner/latest/Result)\n- [1.103.0](/php/docs/reference/cloud-spanner/1.103.0/Result)\n- [1.102.0](/php/docs/reference/cloud-spanner/1.102.0/Result)\n- [1.101.0](/php/docs/reference/cloud-spanner/1.101.0/Result)\n- [1.100.0](/php/docs/reference/cloud-spanner/1.100.0/Result)\n- [1.98.0](/php/docs/reference/cloud-spanner/1.98.0/Result)\n- [1.97.0](/php/docs/reference/cloud-spanner/1.97.0/Result)\n- [1.96.0](/php/docs/reference/cloud-spanner/1.96.0/Result)\n- [1.95.0](/php/docs/reference/cloud-spanner/1.95.0/Result)\n- [1.94.0](/php/docs/reference/cloud-spanner/1.94.0/Result)\n- [1.93.1](/php/docs/reference/cloud-spanner/1.93.1/Result)\n- [1.92.1](/php/docs/reference/cloud-spanner/1.92.1/Result)\n- [1.91.0](/php/docs/reference/cloud-spanner/1.91.0/Result)\n- [1.90.0](/php/docs/reference/cloud-spanner/1.90.0/Result)\n- [1.89.0](/php/docs/reference/cloud-spanner/1.89.0/Result)\n- [1.88.0](/php/docs/reference/cloud-spanner/1.88.0/Result)\n- [1.87.0](/php/docs/reference/cloud-spanner/1.87.0/Result)\n- [1.86.0](/php/docs/reference/cloud-spanner/1.86.0/Result)\n- [1.85.0](/php/docs/reference/cloud-spanner/1.85.0/Result)\n- [1.84.0](/php/docs/reference/cloud-spanner/1.84.0/Result)\n- [1.83.0](/php/docs/reference/cloud-spanner/1.83.0/Result)\n- [1.82.0](/php/docs/reference/cloud-spanner/1.82.0/Result)\n- [1.81.0](/php/docs/reference/cloud-spanner/1.81.0/Result)\n- [1.80.0](/php/docs/reference/cloud-spanner/1.80.0/Result)\n- [1.79.0](/php/docs/reference/cloud-spanner/1.79.0/Result)\n- [1.78.0](/php/docs/reference/cloud-spanner/1.78.0/Result)\n- [1.77.0](/php/docs/reference/cloud-spanner/1.77.0/Result)\n- [1.76.1](/php/docs/reference/cloud-spanner/1.76.1/Result)\n- [1.68.0](/php/docs/reference/cloud-spanner/1.68.0/Result)\n- [1.67.0](/php/docs/reference/cloud-spanner/1.67.0/Result)\n- [1.66.0](/php/docs/reference/cloud-spanner/1.66.0/Result)\n- [1.65.0](/php/docs/reference/cloud-spanner/1.65.0/Result)\n- [1.64.0](/php/docs/reference/cloud-spanner/1.64.0/Result)\n- [1.63.2](/php/docs/reference/cloud-spanner/1.63.2/Result)\n- [1.62.1](/php/docs/reference/cloud-spanner/1.62.1/Result)\n- [1.61.0](/php/docs/reference/cloud-spanner/1.61.0/Result)\n- [1.60.0](/php/docs/reference/cloud-spanner/1.60.0/Result)\n- [1.59.0](/php/docs/reference/cloud-spanner/1.59.0/Result)\n- [1.58.4](/php/docs/reference/cloud-spanner/1.58.4/Result)\n- [1.57.0](/php/docs/reference/cloud-spanner/1.57.0/Result)\n- [1.56.0](/php/docs/reference/cloud-spanner/1.56.0/Result)\n- [1.55.0](/php/docs/reference/cloud-spanner/1.55.0/Result)\n- [1.54.2](/php/docs/reference/cloud-spanner/1.54.2/Result) \nReference documentation and code samples for the Cloud Spanner Client class Result.\n\nRepresent a Cloud Spanner lookup result (either read or executeSql).\n\nExample: \n\n use Google\\Cloud\\Spanner\\SpannerClient;\n\n $spanner = new SpannerClient();\n\n $database = $spanner-\u003econnect('my-instance', 'my-database');\n $result = $database-\u003eexecute('SELECT * FROM Posts');\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Spanner\n\nMethods\n-------\n\n### __construct\n\n### rows\n\nReturn the formatted and decoded rows. If the stream is interrupted and\na resume token is available, attempts will be made on your behalf to\nresume.\n\nExample: \n\n $rows = $result-\u003erows();\n\n### columns\n\nReturn column names.\n\nWill be populated once the result set is iterated upon.\n\nExample: \n\n $columns = $result-\u003ecolumns();\n\n### metadata\n\nReturn result metadata.\n\nWill be populated once the result set is iterated upon.\n\nExample: \n\n $metadata = $result-\u003emetadata();\n\n### session\n\nReturn the session associated with the result stream.\n\nExample: \n\n $session = $result-\u003esession();\n\n### stats\n\nGet the query plan and execution statistics for the query that produced\nthis result set.\n\nBy default, statistics are returned by default only when executing a DML\nstatement. To receive statistics for a SELECT statement, set\n`$options.queryMode` to `Result::MODE_PROFILE`, as demonstrated below.\n\nSetting `$options.queryMode` to `Result::MODE_PLAN` will return the query\nplan without any results or execution statistics information.\n\nExample: \n\n $stats = $result-\u003estats();\n\n // Executing a query with stats returned.\n use Google\\Cloud\\Spanner\\Result;\n\n $res = $database-\u003eexecute('SELECT * FROM Posts', [\n 'queryMode' =\u003e Result::MODE_PROFILE\n ]);\n\n### snapshot\n\nReturns a snapshot which was begun in the read or execute, if one exists.\n\nWill be populated once the result set is iterated upon.\n\nExample: \n\n $snapshot = $result-\u003esnapshot();\n\n### transaction\n\nReturns a transaction which was begun in the read or execute, if one exists.\n\nWill be populated once the result set is iterated upon.\n\nExample: \n\n $transaction = $result-\u003etransaction();\n\n### getIterator\n\nConstants\n---------\n\n### BUFFER_RESULT_LIMIT\n\n Value: 10\n\n### RETURN_NAME_VALUE_PAIR\n\n Value: 'nameValuePair'\n\n### RETURN_ASSOCIATIVE\n\n Value: 'associative'\n\n### RETURN_ZERO_INDEXED\n\n Value: 'zeroIndexed'\n\n### MODE_NORMAL\n\n Value: \\Google\\Cloud\\Spanner\\V1\\ExecuteSqlRequest\\QueryMode::NORMAL\n\n### MODE_PLAN\n\n Value: \\Google\\Cloud\\Spanner\\V1\\ExecuteSqlRequest\\QueryMode::PLAN\n\n### MODE_PROFILE\n\n Value: \\Google\\Cloud\\Spanner\\V1\\ExecuteSqlRequest\\QueryMode::PROFILE"]]