class SQLParserUtils (View source)

Utility class that parses sql statements with regard to types and parameters.

Methods

static array
getPlaceholderPositions(string $statement, bool $isPositional = true)

Get an array of the placeholders in an sql statements as keys and their positions in the query string.

static 
expandListParameters(string $query, array $params, array $types)

For a positional query this method can rewrite the sql statement with regard to array parameters.

Details

static array getPlaceholderPositions(string $statement, bool $isPositional = true)

Get an array of the placeholders in an sql statements as keys and their positions in the query string.

Returns an integer => integer pair (indexed from zero) for a positional statement and a string => int[] pair for a named statement.

Parameters

string $statement
bool $isPositional

Return Value

array

static expandListParameters(string $query, array $params, array $types)

For a positional query this method can rewrite the sql statement with regard to array parameters.

Parameters

string $query
array $params
array $types