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)
/* Known ABL functions that may appear on the left hand side of the query operator



Top Method Summary
Options Name Purpose
+ Consultingwerk.ListSortField ByClauseList () Returns the List of SortField's representing the ByClause
+ 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.IQueryExpression ParseQueryString (character, HandleFieldWithoutOperatorEnum) Parses an ABL Query String for a single buffer info an IQueryExpression
+ Consultingwerk.IQueryExpression ParseQueryString (character, HandleFieldWithoutOperatorEnum, IFieldWithoutOperatorCallback) Parses an ABL Query String for a single buffer info an IQueryExpression
+ Consultingwerk.IQueryExpression ParseQueryString (character, IFieldWithoutOperatorCallback) 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
# ROWID ParseToRowidFunction (character) Parses a DATE(month, day, year) function call into a DATE value
# 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
+ CHARACTER ByClause


Method Detail
Top

PUBLIC Consultingwerk.ListSortField ByClauseList ()

Purpose: Returns the List of SortField's representing the ByClause
Notes: Based on QueryHelper:QuerySortList

Returns Consultingwerk.ListSortField
The ListSortField representing the ByClause
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

PUBLIC Consultingwerk.IQueryExpression ParseQueryString (character, HandleFieldWithoutOperatorEnum)

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
poHandleFieldWithoutOperatorEnum Consultingwerk.HandleFieldWithoutOperatorEnum
The HandleFieldWithoutOperatorEnum value indicating how to handle (logical) fields with no operator
Returns Consultingwerk.IQueryExpression
The IQueryExpression instance representing the query string
Top

PUBLIC Consultingwerk.IQueryExpression ParseQueryString (character, HandleFieldWithoutOperatorEnum, IFieldWithoutOperatorCallback)

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
poHandleFieldWithoutOperatorEnum Consultingwerk.HandleFieldWithoutOperatorEnum
The HandleFieldWithoutOperatorEnum value indicating how to handle (logical) fields with no operator
poFieldWithoutOperatorCallback Consultingwerk.IFieldWithoutOperatorCallback
The callback to validate fields for shortcut logical expressions
Returns Consultingwerk.IQueryExpression
The IQueryExpression instance representing the query string
Top

PUBLIC Consultingwerk.IQueryExpression ParseQueryString (character, IFieldWithoutOperatorCallback)

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
poFieldWithoutOperatorCallback Consultingwerk.IFieldWithoutOperatorCallback
The callback to validate fields for shortcut logical expressions
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 ROWID ParseToRowidFunction (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 ROWID
The DATE value represented by the DATE() function
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


Returns CHARACTER
Top

PUBLIC CHARACTER ByClause


Returns CHARACTER


©2006-2023 Consultingwerk Ltd.         info@consultingwerk.de         http://www.consultingwerk.de       15.04.2024 05:53:25