Click or drag to resize

SQLSelectParser Class

Class used to parse a SQL SELECT statement into its constituent elements, allow examination and/or modification of those elements, and support constructing an updated SQL SELECT statement from those, possibly modified, elements. The class is appropriate for dissecting a moderately complex SQL SELECT statement to view/modify the FROM clause and/or ORDER BY clause and is currently used by picklist FilterWidgets. The following more complex features of a SQL SELECT statement are not handled at this time:
  • UNION operator
  • INTO clause
Inheritance Hierarchy
SystemObject
  NetQuarrySQLSelectParser

Namespace:  NetQuarry
Assembly:  EAP.Core (in EAP.Core.dll) Version: 2.0.0.0 (4.6.8.0)
Syntax
public class SQLSelectParser

The SQLSelectParser type exposes the following members.

Constructors
  NameDescription
Public methodSQLSelectParser
Constructor. Parses SQL into its constituent elements during construction and sets Valid.
Top
Properties
  NameDescription
Public propertyColumns
Gets the ordered list of selected columns in the SELECT statement.
Public propertyFrom
Gets/sets the FROM clause (without the FROM keyword), if any. A FROM clause is required for proper parsing.
Public propertyGroupBy
Gets/sets the GROUP BY clause (without the GROUP BY keywords), if any.
Public propertyHaving
Gets/sets the HAVING clause (without the HAVING keyword), if any.
Public propertyOrderBy
Gets/sets the ORDER BY clause (without the ORDER BY keywords), if any.
Public propertyValid
Gets whether or not the SQL SELECT statement provided to the constructor was parsed successfully.
Public propertyWhere
Gets/sets the WHERE clause (without the WHERE keyword), if any. In addition to setting this directly, you can use the AddFilter(String) method to add additional filters without having to worry about whether an AND conjunction is required.
Top
Methods
  NameDescription
Public methodAddFilter
Add a filter clause to the Where clause. If Where is non-blank/null the existing clause will be parenthesized and the filter added with an AND conjunction.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodStatic memberTest
Built-in test routine to test tokenization and parsing of canned SQL SELECT statements.
Public methodToSQL
Construct the, possibly modified, SQL SELECT statement from the constituent elements. Note that the results are likely to not be correct if Valid is not true.
Public methodToString
Returns a String that represents the current Object.
(Inherited from Object.)
Top
Extension Methods
  NameDescription
Public Extension MethodEqualValue
Determines if the object value is equal to another object. If the two objects are null, then this returns true. There is special handling for guid comparisons (since a guid could be a string formatted in up to 3 different ways). If the special guid handling is not performed, then the object.Equals method is used.
(Defined by EAPUtil.)
Top
See Also