C# Class MicroLite.SqlUtility

A utility class containing useful methods for manipulating SQL.
Show file Open project: TrevorPilley/MicroLite

Public Methods

Method Description
GetFirstParameterPosition ( string commandText ) : int

Gets the position of the first parameter in the specified SQL command text.

GetParameterNames ( string commandText ) : IList

Gets the parameter names from the specified SQL command text or an empty list if the command text does not contain any named parameters.

Will return an empty list if the command text has no parameter names or the parameter names are all '?' (if the dialect does not support named parameters).

RenumberParameters ( string sql, int totalArgumentCount ) : string

Re-numbers the parameters in the SQL based upon the total number of arguments.

Private Methods

Method Description
GetParameterPosition ( string commandText, int position, char matchParameterIdentifiers ) : int

Method Details

GetFirstParameterPosition() public static method

Gets the position of the first parameter in the specified SQL command text.
Thrown if commandText is null.
public static GetFirstParameterPosition ( string commandText ) : int
commandText string The SQL command text.
return int

GetParameterNames() public static method

Gets the parameter names from the specified SQL command text or an empty list if the command text does not contain any named parameters.
Will return an empty list if the command text has no parameter names or the parameter names are all '?' (if the dialect does not support named parameters).
Thrown if commandText is null.
public static GetParameterNames ( string commandText ) : IList
commandText string The SQL command text.
return IList

RenumberParameters() public static method

Re-numbers the parameters in the SQL based upon the total number of arguments.
public static RenumberParameters ( string sql, int totalArgumentCount ) : string
sql string The SQL.
totalArgumentCount int The total number of arguments.
return string