Reference documentation and code samples for the Cloud Spanner Client class ValueMapper.
Manage value mappings between Google Cloud PHP and Cloud Spanner
Namespace
Google \ Cloud \ SpannerMethods
__construct
Parameter | |
---|---|
Name | Description |
returnInt64AsObject |
bool
|
formatParamsForExecuteSql
Accepts an array of key/value pairs, where the key is a SQL parameter name and the value is the value interpolated by the server, and returns an array of parameters and inferred parameter types.
Parameters | |
---|---|
Name | Description |
parameters |
array
The key/value parameters. |
types |
array
The types of values. |
Returns | |
---|---|
Type | Description |
array |
An associative array containing params and paramTypes. |
encodeValuesAsSimpleType
Accepts a list of values and encodes the value into a format accepted by the Spanner API.
Parameters | |
---|---|
Name | Description |
values |
array
The list of values |
allowMixedArrayType |
bool
If true, array values may be of mixed type.
Defaults to* |
Returns | |
---|---|
Type | Description |
array |
The encoded values |
decodeValues
Accepts a list of columns (with name and type) and a row from read or executeSql and decodes each value to its corresponding PHP type.
Parameters | |
---|---|
Name | Description |
columns |
array
The list of columns. |
row |
array
The row data. |
format |
string
The format in which to return the rows. |
Returns | |
---|---|
Type | Description |
array |
The decoded row data. |
Constants
TYPE_BOOL
Value: \Google\Cloud\Spanner\V1\TypeCode::BOOL
TYPE_INT64
Value: \Google\Cloud\Spanner\V1\TypeCode::INT64
TYPE_FLOAT32
Value: \Google\Cloud\Spanner\V1\TypeCode::FLOAT32
TYPE_FLOAT64
Value: \Google\Cloud\Spanner\V1\TypeCode::FLOAT64
TYPE_TIMESTAMP
Value: \Google\Cloud\Spanner\V1\TypeCode::TIMESTAMP
TYPE_DATE
Value: \Google\Cloud\Spanner\V1\TypeCode::DATE
TYPE_STRING
Value: \Google\Cloud\Spanner\V1\TypeCode::STRING
TYPE_BYTES
Value: \Google\Cloud\Spanner\V1\TypeCode::BYTES
TYPE_ARRAY
Value: \Google\Cloud\Spanner\V1\TypeCode::PBARRAY
TYPE_STRUCT
Value: \Google\Cloud\Spanner\V1\TypeCode::STRUCT
TYPE_NUMERIC
Value: \Google\Cloud\Spanner\V1\TypeCode::NUMERIC
TYPE_JSON
Value: \Google\Cloud\Spanner\V1\TypeCode::JSON
TYPE_PG_NUMERIC
Value: 'pgNumeric'
TYPE_PG_JSONB
Value: 'pgJsonb'
TYPE_PG_OID
Value: 'pgOid'