Cloud Spanner Client - Class ValueMapper (1.55.0)

Reference documentation and code samples for the Cloud Spanner Client class ValueMapper.

Manage value mappings between Google Cloud PHP and Cloud Spanner

Methods

__construct

Parameter
NameDescription
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
NameDescription
parameters array

The key/value parameters.

types array

The types of values.

Returns
TypeDescription
arrayAn 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
NameDescription
values array

The list of values

allowMixedArrayType bool

If true, array values may be of mixed type. Defaults to false.

Returns
TypeDescription
arrayThe 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
NameDescription
columns array

The list of columns.

row array

The row data.

format string

The format in which to return the rows.

Returns
TypeDescription
arrayThe decoded row data.

Constants

TYPE_BOOL

Value: \Google\Cloud\Spanner\V1\TypeCode::BOOL

TYPE_INT64

Value: \Google\Cloud\Spanner\V1\TypeCode::INT64

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'