Condition Groups

So I have five sqlRelationship classes that can be passed to the SQL statement class. (not discussed yet) The SELECT expressions, SET expressions, and table references can all be stored as arrays within the SQL ┬ástatement class. However, because any WHERE/ON condition can be a complex AND or OR expression, and that they can be embedded within one another, arrays will certainly not work. Example: “(WHERE|ON) col1=col2 AND (col3 > 0 OR col4 = ‘test’)”

I am going to use a condition group comprised of individual WHERE or ON conditions and groups. The condition group can be tagged as an AND or OR type. Once a single condition is passed to the group class, the class will designate itself a “where” or an “on” group. Subsequent conditions passed will need to be of the same type. This designation will be checked by any sqlStatement WHERE clause functions and any sqlTableReference ON clause function to make sure they are of the correct type.

Below is the newest of the proposed UML diagram. You can see the addition of an sqlCondition abstract class extending the sqlRelationship class by which both the WHERE and ON conditions are created. These two classes, WHERE and ON, must be passed to an sqlConditionGroup class before being passed to the final statement class. Example: an sqlTableReference will only accept a group and not a singular sqlCondition. My current relationships, aggregate, composite or association, have not been finalized and may be changed during class creation.

REMEMBER: None of these class are designed to be explicitly constructed. They are “helper” classes to be used by the sqlStatement class to assist with creating the SQL query statement.

sqlNewQuery-UML-20110105

Leave a Reply