Skip to main content
Version: 2025

SqlParser

Namespace: PPJ.Runtime.Sql

Assembly: PPJ.Web.50 (5.0.0.0)

Converts SAL bind markers and INTO clauses into provider SQL and parameter descriptions.

public class SqlParser

Use a new parser for each independent statement; the parser retains the bind and INTO lists it builds.

Example:

using PPJ.Runtime.Sql;

var parser = new SqlParser();
string sql = parser.ParseSql("SELECT Name INTO :customerName FROM Customers WHERE Id = :customerId");
int inputCount = parser.BindList.Count;

Constructors

Instance member SqlParser()

Initializes a parser with named parameters enabled and the @ parameter prefix.

Properties

Instance member BindList

ArrayList: Gets the parsed bind parameter descriptions.

Instance member IntoList

ArrayList: Gets the parsed INTO target descriptions.

Instance member IsCommand

Boolean: Gets or sets whether the input is a command whose INTO clause must not be extracted.

Instance member NamedParameters

Boolean: Gets or sets whether provider markers use generated parameter names.

Instance member OptimizeParameters

Boolean: Gets or sets whether repeated bind expressions reuse an existing parameter description.

Instance member ParametersPrefix

String: Gets or sets the prefix used to generate provider parameter markers.

Instance member PositionalParameters

Boolean: Gets or sets whether generated parameter markers use parameter positions.

Methods

Static member FixCommand(command)

Normalizes procedure arguments by adding missing colon bind markers.

ParameterTypeDescription
commandStringThe procedure invocation text to normalize.

Returns: String. The trimmed command with normalized argument markers.

Static member FixList(list)

Normalizes a comma-separated bind list by adding missing colon markers.

ParameterTypeDescription
listStringThe comma-separated variable expressions to parse or normalize.

Returns: String. The normalized list, or the original value when null or empty.

Instance member ParseInto(list)

Parses an INTO target list into the parser's target collection.

ParameterTypeDescription
listStringThe comma-separated variable expressions to parse or normalize.

Instance member ParseSql(sql)

Extracts INTO targets and replaces bind expressions with provider parameter markers.

ParameterTypeDescription
sqlStringThe SQL statement containing SAL bind markers and an optional INTO clause.

Returns: String. The SQL text to send to the provider.