Class SelectSqlParser
A simple SELECT Sql parser. It parses a SELECT statement into its constituents parts.
NOTE: This is not a full SQL parser.
It supports nested SELECT statements inside parentheses because it ignores clause keywords while inside parentheses.
It also skips string literals, comments, double quoted identifiers, bracketed identifiers, and backtick quoted identifiers.
public class SelectSqlParser
- Inheritance
-
SelectSqlParser
- Inherited Members
- Extension Methods
Constructors
SelectSqlParser(string)
Constructor. Text can not be null or empty.
public SelectSqlParser(string Text)
Parameters
Textstring
Properties
From
Returns the FROM clause of the parsed statement
public string From { get; set; }
Property Value
GroupBy
Returns the GROUP BY clause of the parsed statement
public string GroupBy { get; set; }
Property Value
Having
Returns the HAVING clause of the parsed statement
public string Having { get; set; }
Property Value
OrderBy
Returns the ORDER BY clause of the parsed statement
public string OrderBy { get; set; }
Property Value
Select
Returns the SELECT clause of the parsed statement
public string Select { get; set; }
Property Value
Where
Returns the WHERE clause of the parsed statement
public string Where { get; set; }
Property Value
Methods
Clear()
Clears the resulting clauses
public void Clear()
Execute(string)
Parses Text into the constituent parts of a SELECT S statement.
Example call: SelectSqlParser.Parse("select * from CUSTOMER").ToString();
public static SelectSqlParser Execute(string Text)
Parameters
Textstring
Returns
Parse(string)
Parses Text into the constituent parts of a SELECT S statement.
public void Parse(string Text)
Parameters
Textstring
ToString()
Returns a string that represents the current object
public override string ToString()