class SQLParserUtils (View source)

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

Constants

POSITIONAL_TOKEN

NAMED_TOKEN

ESCAPED_SINGLE_QUOTED_TEXT

ESCAPED_DOUBLE_QUOTED_TEXT

ESCAPED_BACKTICK_QUOTED_TEXT

ESCAPED_BRACKET_QUOTED_TEXT

Methods

static int[]|string[]
getPlaceholderPositions(string $statement, bool $isPositional = true) deprecated

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

static mixed[]
expandListParameters(string $query, mixed[] $params, int[]|string[] $types)

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

Details

static int[]|string[] getPlaceholderPositions(string $statement, bool $isPositional = true) deprecated

deprecated Will be removed as internal implementation detail.

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

For a statement with positional parameters, returns a zero-indexed list of placeholder position. For a statement with named parameters, returns a map of placeholder positions to their parameter names.

Parameters

string $statement
bool $isPositional

Return Value

int[]|string[]

static mixed[] expandListParameters(string $query, mixed[] $params, int[]|string[] $types)

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

Parameters

string $query The SQL query to execute.
mixed[] $params The parameters to bind to the query.
int[]|string[] $types The types the previous parameters are in.

Return Value

mixed[]

Exceptions

SQLParserUtilsException