Namespace: Consultingwerk.OERA.Ccs
Class 
QueryBuilder Copy to Clipboard
Parent classes:
Inherits: Progress.Lang.Object

File:QueryBuilder
Purpose:Converts a list of query entries into a query string
Syntax:Does currently not take joined data-sources into account
(data-source using a query with 2 or more buffers)
Author(s):Mike Fechner / Consultingwerk Ltd.
Created:Wed Jun 22 02:35:45 CEST 2016
Notes:Currently InList and InRange operators are not optimized
in the way that we should AND/OR the current query group
A AND InList(10,20) now becomes
A AND (B = 10 OR B = 20) but when returning
(A AND B = 10) OR (A AND B = 20) a better index selection
would be performed



Top Method Summary
Options Name Purpose
# LOGICAL AllEntriesAnd (IQueryGroup) Determines if all entries are joined by AND or AND NOT
+ CHARACTER BuildQueryString (character, IQueryDefinition) Returns the ABL Query String for the abstract query
+ CHARACTER BuildQueryString (character, IQueryDefinition, logical) Returns the ABL Query String for the abstract query
# CHARACTER FromQueryGroup (character, IQueryGroup, logical, character, logical) Extends the query string with the given query group
# CHARACTER FromQueryPredicate (character, IQueryPredicate, character, logical) Adds a single query predicate to a query stirng
# CHARACTER InListQueryString (IQueryPredicate, character, logical) Returns the QueryString for an InList QuerY Predicate
# CHARACTER OperatorFromJoin (JoinEnum, character) Returns the query representation for the JoinEnum value
+ Ccs.BusinessLogic.IQueryEntry OptimizeQuerySelection (IQueryEntry) Performs query optimization
# CHARACTER QueryValue (IPrimitiveArrayHolder, integer) Returns the (quoted) query string value from an array holder
# CHARACTER QueryValue (IPrimitiveHolder) Returns the (quoted) query string value
# INTEGER QueryValueExtent (IPrimitiveArrayHolder) Returns the extent size of the value from an array holder


Method Detail
Top

PROTECTED LOGICAL AllEntriesAnd (IQueryGroup)

Purpose: Determines if all entries are joined by AND or AND NOT
Notes:

Parameters:
poQueryGroup Ccs.BusinessLogic.IQueryGroup
The QueryGroup to test
Returns LOGICAL
Logical value indicating if all entries are joined by And or AndNot
Top

PUBLIC CHARACTER BuildQueryString (character, IQueryDefinition)

Purpose: Returns the ABL Query String for the abstract query
Notes: Does currently not take joined data-sources into account (data-source using a query with 2 or more buffers)

Parameters:
pcTableName CHARACTER
The name of the table
poQueryDefinition Ccs.BusinessLogic.IQueryDefinition
The IQueryDefinition that describes the query
Returns CHARACTER
The ABL query string
Top

PUBLIC CHARACTER BuildQueryString (character, IQueryDefinition, logical)

Purpose: Returns the ABL Query String for the abstract query
Notes: Does currently not take joined data-sources into account (data-source using a query with 2 or more buffers)

Parameters:
pcTableName CHARACTER
The name of the table
poQueryDefinition Ccs.BusinessLogic.IQueryDefinition
The IQueryDefinition that describes the query
plQualifyFieldsWithTable LOGICAL
Logical value indicating if the fields should be qualified with the table name
Returns CHARACTER
The ABL query string
Top

PROTECTED CHARACTER FromQueryGroup (character, IQueryGroup, logical, character, logical)

Purpose: Extends the query string with the given query group
Notes:

Parameters:
pcQueryString CHARACTER
The original query string
poQueryGroup Ccs.BusinessLogic.IQueryGroup
The query group to add to the query string
plOutermost LOGICAL
Logical value indicating if the query string contains the outer most query selection
pcTableName CHARACTER
The name of the table
plQualifyFieldsWithTable LOGICAL
Logical value indicating if the fields should be qualified with the table name
Returns CHARACTER
The new query string
Top

PROTECTED CHARACTER FromQueryPredicate (character, IQueryPredicate, character, logical)

Purpose: Adds a single query predicate to a query stirng
Notes:

Parameters:
pcQueryString CHARACTER
The query string to add the predicate to
poQueryPredicate Ccs.BusinessLogic.IQueryPredicate
The query predicate to add to the string
pcTableName CHARACTER
The name of the table
plQualifyFieldsWithTable LOGICAL
Logical value indicating if the fields should be qualified with the table name
Returns CHARACTER
The resulting query string
Top

PROTECTED CHARACTER InListQueryString (IQueryPredicate, character, logical)

Purpose: Returns the QueryString for an InList QuerY Predicate
Notes:

Parameters:
poQueryPredicate Ccs.BusinessLogic.IQueryPredicate
The query predicate to add to the string
pcTableName CHARACTER
The name of the table
plQualifyFieldsWithTable LOGICAL
Logical value indicating if the fields should be qualified with the table name
Returns CHARACTER
The resulting query string
Top

PROTECTED CHARACTER OperatorFromJoin (JoinEnum, character)

Purpose: Returns the query representation for the JoinEnum value
Notes:

Parameters:
poJoin Ccs.BusinessLogic.JoinEnum
The JoinEnum value
pcQueryString CHARACTER
The query string to add the operator to (to determine if this is the first entry)
Returns CHARACTER
The character representation of the join operator
Top

PUBLIC Ccs.BusinessLogic.IQueryEntry OptimizeQuerySelection (IQueryEntry)

Purpose: Performs query optimization
Notes:

Parameters:
poQueryEntry Ccs.BusinessLogic.IQueryEntry
The Query Entry to optimize
Returns Ccs.BusinessLogic.IQueryEntry
The optimized query entry
Top

PROTECTED CHARACTER QueryValue (IPrimitiveArrayHolder, integer)

Purpose: Returns the (quoted) query string value from an array holder
Notes:

Parameters:
poPrimitiveHolder Ccs.Common.Support.IPrimitiveArrayHolder
The IPrimitiveHolder representing the value
piIndex INTEGER
The array index
Returns CHARACTER
The quoted CHARACTER string representing the value
Top

PROTECTED CHARACTER QueryValue (IPrimitiveHolder)

Purpose: Returns the (quoted) query string value
Notes:

Parameters:
poPrimitiveHolder Ccs.Common.Support.IPrimitiveHolder
The IPrimitiveHolder representing the value
Returns CHARACTER
The quoted CHARACTER string representing the value
Top

PROTECTED INTEGER QueryValueExtent (IPrimitiveArrayHolder)

Purpose: Returns the extent size of the value from an array holder
Notes:

Parameters:
poPrimitiveHolder Ccs.Common.Support.IPrimitiveArrayHolder
The IPrimitiveHolder representing the value
Returns INTEGER
The extent size


©2006-2020 Consultingwerk Ltd.         info@consultingwerk.de         http://www.consultingwerk.de       04.02.2020 23:14:17