Archive for the ‘Breaking Down The Statement’ Category

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

Relationships

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

SQL Query Builder :: The Idea

Today I decided to create an SQL query builder class for PHP and MySQL. I am envisioning a single class interface with basic, easy to understand methods. The class should handle the vast majority of MySQL data manipulation statements including all JOIN configurations and nested queries. The class needs to provide a basic SQL statement […]