SQLquery class An SQL Statement Text Container.
This class is the parent of the main dbquery class which directs the query to the database. It is mainly a container of SQL query text, in the variable 'sql', but also offers a few basic methods for building queries. For complex queries however, build your own in a string and then just set the 'sql' variable.
Located in /query-defs.php (line 274)
Class | Description |
---|---|
![]() |
DB Query class This class is the one which executes queries against the connected database. |
List of fields in the query
The GROUP BY clause
The LIMIT value
The OFFSET value
The ORDER BY clause
The formatted SQL query itself @see build()
List of tables in the query
Type of query 'SELECT', 'DELETE', 'INSERT' or 'UPDATE'
The query WHERE clause components
Constructor Create a new SQL Query object.
Build the SQL query This takes the various components which have been added to the object and parses them to build the full SQL statement which will be sent to the server. The result is stored in $this->sql.
NOTE: this method calls the appropriate database-specific SQL builder method.
Define field list
Add a list of fields to return in query. This is a cumulative function which may be called more than once to add fields. You can specify the list of fields either as an array, or as a delimited list. If the latter, then default delimiter is a comma, unless you specify your own. Applicable to SELECT, DELETE and UPDATE.
Define table FROM list
A nicer synonym for "tables()" for SELECT
Define group by field list The fields can be an array, or a delimited list. If the latter, then default delimiter is a comma, unless you specify your own.
Define table INSERT INTO list
A nicer synonym for "tables()" for INSERT
Define query LIMIT
Define query OFFSET
Define order field list Defines the Sort order field list. The fields can be an array, or a delimited list. If the latter, then default delimiter is a comma, unless you specify your own.
This is useful when you change some part of the query after it has been executed once, and want it to rebuild the SQL anew before it gets executed again.
Define field assignments Defines the field assignment clauses for UPDATE and INSERT queries.
Define table list
Add the table specification to our list. This is a cumulative function which may be called more than once to add tables. You can specify the list of tables either as an array, or as a delimited list. If the latter, then default delimiter is a comma, unless you specify your own.
Add WHERE clause component
This function allows you to add a WHERE clause component. An example might be something like: "AND c.foo='myval'". Either call this once with the whole WHERE cluase string (minus the word "WHERE"), or multiple times with parts of the where clause as in the example above.
Documentation generated by phpDocumentor 1.3.0RC3