JsonLinesBinder
in package
implements
PdbDataBinderInterface
Wrap a item with a JSON lines 'concat' binding.
This modifies the update/insert query like ConcatBinder but also encodes the value with JSON and prepends a newline character.
Note, if the item fails to encode - this will throw a JsonException.
Table of Contents
Interfaces
- PdbDataBinderInterface
- This defines how values are formatted and bound to queries.
Properties
Methods
- __construct() : mixed
- getBindingQuery() : string
- Get the SQL snippet for an `UPDATE SET` query.
- getBindingValue() : string|int|float|object
- Get the value to bind to a query.
- parseJsonLines() : iterable<string|int, mixed>
- Parse a JSON lines string.
Properties
$flags
public
int
$flags
$value
public
mixed
$value
Methods
__construct()
public
__construct(mixed $value[, int $flags = 0 ]) : mixed
Parameters
- $value : mixed
- $flags : int = 0
getBindingQuery()
Get the SQL snippet for an `UPDATE SET` query.
public
getBindingQuery(Pdb $pdb, string $column) : string
Parameters
- $pdb : Pdb
- $column : string
Tags
Return values
stringgetBindingValue()
Get the value to bind to a query.
public
getBindingValue() : string|int|float|object
Tags
Return values
string|int|float|objectparseJsonLines()
Parse a JSON lines string.
public
static parseJsonLines(string $item[, int $flags = 0 ]) : iterable<string|int, mixed>
The result is an iterable of decoded JSON blobs. There's no guarantee that these will be arrays, as is the nature of the PHP json routines.
Parameters
- $item : string
- $flags : int = 0