Table of Contents

Class SelectSqlParser

Namespace
Tripous.Data
Assembly
Tripous.Data.dll

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

Text string

Properties

From

Returns the FROM clause of the parsed statement

public string From { get; set; }

Property Value

string

GroupBy

Returns the GROUP BY clause of the parsed statement

public string GroupBy { get; set; }

Property Value

string

Having

Returns the HAVING clause of the parsed statement

public string Having { get; set; }

Property Value

string

OrderBy

Returns the ORDER BY clause of the parsed statement

public string OrderBy { get; set; }

Property Value

string

Select

Returns the SELECT clause of the parsed statement

public string Select { get; set; }

Property Value

string

Where

Returns the WHERE clause of the parsed statement

public string Where { get; set; }

Property Value

string

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

Text string

Returns

SelectSqlParser

Parse(string)

Parses Text into the constituent parts of a SELECT S statement.

public void Parse(string Text)

Parameters

Text string

ToString()

Returns a string that represents the current object

public override string ToString()

Returns

string