Archive for the ‘Thought Process’ Category

A Chaining Breakthrough!

To further steal the great foundation of jQuery method chaining, I have realized a way to use a “back” function that will regress backward through the chained functions and return the last object that was manipulated. Wow, that makes it sound confusing but it is not. Imagine the following chained code. Previously this would have […]

My First Statement

Well I have managed to create a simple SELECT statement. 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 together. You will notice that each class is initiated using a “create” […]

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 […]

Statement Types

I can now determine each SQL statement type that I want to build. Each type will be represented by a class, each extending the abstract sqlStatement class. These classes will be made up of multiple instances of sqlRelationship and sqlComponent classes. The statement classes will verify each object passed to determine if it “fits” within […]

Order/Group/Having Clauses

There are a few last minute clauses to an SQL statement that I need to address. The HAVING clause is fairly straight forward. I requires a WHERE condition, so that is what I will use. Any statement class that can take a HAVING clause will accept an sqlConditionGroup as an argument as long as it […]

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 […]

Relationship Components

Much of the arguments passed to any of the sqlRelationship objects will be strings. However, upon my initial analysis, there are a couple of potential arguments that may benefit from an encapsulation into a class. This will help not only with conversion of these arguments to strings for inclusion into the SQL statement, but for […]

The Last Relationship, I Think

There is one last statement clause that need to determine if I can fit the pieces into my “relationship” idea. That clause is the table reference. Each table reference will be a single relationship. Of course, a simple table reference will only be a name, no value or operator needed. Any JOIN table will need […]

Expanding the Relationship Theory

Lets continue to fit the SQL relationship theory into basic SQL statement syntax. You may recall, a statement “relationship”, as defined by myself, is a name/value pair used to create the building blocks of a complete SQL statement. The next step is to analyze the name/value pairs that make up the SET/VALUES expressions used within […]


My initial thought was to break down an SQL statement into pieces. Seems like a fairly obvious idea so I am inclined to go with it. Let us assume these basic pieces: Statement Type, SELECT expression, FROM table references, JOIN clauses, INSERT/REPLACE/UPDATE values, WHERE clauses, and lastly and ORDER/GROUP/HAVING type clause. I think, and I […]