SELECT Statement

Let us break down the simplest of statements, the SELECT statement. I will try to walk through the process of creating the following: “SELECT column FROM table WHERE column = value;”. ┬áThis will be the “long” way of doing it, by explicitly creating each instance of the statement components. In the end, I wish to have the methods of the statement class itself create its own component classes. This way the volume of code needed to create the statement will be greatly reduced. Also, during instance destruction, I can have the statement class destroy all of its components. Therefore, a user would only need to unset the statement class and free all the memory associated with the class. This example is only to determine a flow to the process. It seems quite complex and cumbersome. Hopes are to use a chaining system, as briefly described in “The Last Relationship, I Think“, to reduce code and simplify the process.

  1. Initiate an sqlSelect object.
  2. Create a table reference instance.
  3. Pass the table reference to the sqlSelect object.
  4. Using the table reference, initiate a column definition object.
  5. Create an sqlSelectExpression instance.
  6. Pass the column definition object to the sqlSelectExpression object.
  7. Pass the sqlSelectExpression object to the sqlSelect object.
  8. Create an sqlConditionGroup object.
  9. Create an sqlWhereCondition object.
  10. Pass the sqlWhereCondition object to the sqlConditionGroup object.
  11. Pass the sqlConditionGroup object to the sqlSelect instance.

One Comment

  1. […] It is cumbersome at best and follows along the process flow introduced in the last post, “Select Statement“. I show this only to demonstrate the foundation of how the statement is ultimately put […]

Leave a Reply