Namespace: Consultingwerk
Class 
QueryParser Copy to Clipboard
Parent classes:
Inherits: Progress.Lang.Object
Implements: Consultingwerk.IQueryParser

File:QueryParser
Purpose:Allow parsing of an ABL Query String for a single buffer into
an IQueryExpression (QueryExpression, ListQueryExpression, ...)
Description:Default IQueryParser implementation, SCL-501
Author(s):Mike Fechner / Consultingwerk Ltd.
Created:Sat Oct 25 09:52:24 CEST 2014
Notes:Known limitations - currently not supported:
- Array field names are only supported when there is no white space character between the field name and the []
- Expressions other than constant values as the value of a query term
- AND needs to be following a SPACE, i.o.W. cannot parse (term)AND(term), need to be given as (term) AND (term)



Top Method Summary
Options Name Purpose
+ Consultingwerk.OperatorEnum OperatorFromString (character) Returns the Enum member with the given name
# DATE ParseDateFunction (character) Parses a DATE(month, day, year) function call into a DATE value
# DATETIME ParseDateTimeFunction (character) Parses a DATETIME(month, day, year) function call into a DATE value
# DATETIME-TZ ParseDateTimeTzFunction (character) Parses a DATETIME-TZ(month, day, year) function call into a DATE value
+ Consultingwerk.IQueryExpression ParseQueryString (character) Parses an ABL Query String for a single buffer info an IQueryExpression
# Consultingwerk.OperatorEnum ParseQueryTermOperator (character) Parses a QueryOperator from a character value
# Consultingwerk.IQueryExpression ParseTerm (character) Parses a single query term
# CHARACTER TrimForOrPreselect (character) Trims FOR EACH|FIRST|... <table> or PRESELECT EACH|FIRST|... <table> from the Query String
# CHARACTER TrimWhere (character) Trims FOR EACH|FIRST|... <table> or PRESELECT EACH|FIRST|... <table> from the Query String

Top Property Summary
Options Name Purpose
+ CHARACTER BufferName Gets and sets the name of the Buffer to be appended to unqualified field references
+ CHARACTER ByClause Returns the ByClause of the previous parsing operation


Method Detail
Top

PUBLIC Consultingwerk.OperatorEnum OperatorFromString (character)

Purpose: Returns the Enum member with the given name
Notes: Supports the Enum member names as well as =, <>, >=, >, <= and <

Parameters:
pcName CHARACTER
The Name of the Enum member
Returns Consultingwerk.OperatorEnum
The Enum member with the given name
Top

PROTECTED DATE ParseDateFunction (character)

Purpose: Parses a DATE(month, day, year) function call into a DATE value
Notes:

Parameters:
pcString CHARACTER
The CHARACTER Value representing the DATE() function
Returns DATE
The DATE value represented by the DATE() function
Top

PROTECTED DATETIME ParseDateTimeFunction (character)

Purpose: Parses a DATETIME(month, day, year) function call into a DATE value
Notes:

Parameters:
pcString CHARACTER
The CHARACTER Value representing the DATETIME() function
Returns DATETIME
The DATETIME value represented by the DATETIME() function
Top

PROTECTED DATETIME-TZ ParseDateTimeTzFunction (character)

Purpose: Parses a DATETIME-TZ(month, day, year) function call into a DATE value
Notes:

Parameters:
pcString CHARACTER
The CHARACTER Value representing the DATETIME-TZ() function
Returns DATETIME-TZ
The DATETIME-TZ value represented by the DATETIME-TZ() function
Top

PUBLIC Consultingwerk.IQueryExpression ParseQueryString (character)

Purpose: Parses an ABL Query String for a single buffer info an IQueryExpression
Notes: The Consultingwerk.QueryExpression class contains static methods to help
testing if the result of the method ParseQueryString contains expressions
for a given buffer field name
- LOGICAL HasExpressionForField (pcFieldName, poExpression)
- QueryExpression GetExpressionForField (pcFieldName, poExpression)

Parameters:
pcQueryString CHARACTER
The ABL QueryString to parse
Returns Consultingwerk.IQueryExpression
The IQueryExpression instance representing the query string
Top

PROTECTED Consultingwerk.OperatorEnum ParseQueryTermOperator (character)

Purpose: Parses a QueryOperator from a character value
Notes:
Throws: Consultingwerk.Exceptions.InvalidQueryOperatorException

Parameters:
pcOperatorValue CHARACTER
The value for parse, e.g. "=", "EQ", ">=", etc.
Returns Consultingwerk.OperatorEnum
The resulting Query Operator
Top

PROTECTED Consultingwerk.IQueryExpression ParseTerm (character)

Purpose: Parses a single query term
Notes: A term consists from a field name (including DB and Table), the operator and a value
Throws: Consultingwerk.Exceptions.InvalidQueryTermException

Parameters:
pcQueryTerm CHARACTER
The query term to parse
Returns Consultingwerk.IQueryExpression
The IQueryExpression for the query term
Top

PROTECTED CHARACTER TrimForOrPreselect (character)

Purpose: Trims FOR EACH|FIRST|... <table> or PRESELECT EACH|FIRST|... <table>
from the Query String
Notes:

Parameters:
pcQueryString CHARACTER
The ABL QueryString to parse
Returns CHARACTER
The Query String without the leading FOR EACH/PRESELECT EACH <table>
Top

PROTECTED CHARACTER TrimWhere (character)

Purpose: Trims FOR EACH|FIRST|... <table> or PRESELECT EACH|FIRST|... <table>
from the Query String
Notes:

Parameters:
pcQueryString CHARACTER
The ABL QueryString to parse
Returns CHARACTER
The Query String without the leading FOR EACH/PRESELECT EACH <table>


Property Detail
Top

PUBLIC CHARACTER BufferName

Purpose: Gets and sets the name of the Buffer to be appended to unqualified
field references
Notes:

Returns CHARACTER
Top

PUBLIC CHARACTER ByClause

Purpose: Returns the ByClause of the previous parsing operation
Notes:

Returns CHARACTER


©2006-2016 Consultingwerk Ltd.         info@consultingwerk.de         http://www.consultingwerk.de       26.08.2016 08:30:41