Query\QueryBuilder
Convenience class for creating sql queries
Synopsis
- // methods
- public void __construct()
- public void __destruct()
- public mixed __call()
- public QueryBuilder select()
- public QueryBuilder selectMax()
- public QueryBuilder selectMin()
- public QueryBuilder selectAvg()
- public QueryBuilder selectSum()
- public QueryBuilder returning()
- public QueryBuilder distinct()
- public QueryBuilder explain()
- public QueryBuilder from()
- public QueryBuilder like()
- public QueryBuilder orLike()
- public QueryBuilder notLike()
- public QueryBuilder orNotLike()
- public QueryBuilder having()
- public QueryBuilder orHaving()
- public QueryBuilder where()
- public QueryBuilder orWhere()
- public QueryBuilder whereIn()
- public QueryBuilder orWhereIn()
- public QueryBuilder whereNotIn()
- public QueryBuilder orWhereNotIn()
- public QueryBuilder set()
- public QueryBuilder join()
- public QueryBuilder groupBy()
- public QueryBuilder orderBy()
- public QueryBuilder limit()
- public QueryBuilder groupStart()
- public QueryBuilder notGroupStart()
- public QueryBuilder orGroupStart()
- public QueryBuilder orNotGroupStart()
- public QueryBuilder groupEnd()
- public PDOStatement get()
- public PDOStatement getWhere()
- public int countAll()
- public int countAllResults()
- public PDOStatement insert()
- public PDOStatement insertBatch()
- public PDOStatement update()
- public ?int updateBatch()
- public PDOStatement delete()
- public string getCompiledSelect()
- public string getCompiledInsert()
- public string getCompiledUpdate()
- public string getCompiledDelete()
- public void resetQuery()
Hierarchy
Implements
Coverage
Methods | 0% | 0 / 48 |
Lines | 0% | / |
Members
public
- $connName
—
string
Convenience property for connection management - $queries
—
array
List of queries executed
Methods
public
- __construct() — Constructor
- __destruct() — Destructor
- __call() — Calls a function further down the inheritance chain
- countAll() — Retrieve the number of rows in the selected table
- countAllResults() — Retrieve the number of results for the generated query - used in place of the get() method
- delete() — Deletes data from a table
- distinct() — Adds the 'distinct' keyword to a query
- explain() — Tell the database to give you the query plan instead of result set
- from() — Specify the database table to select from
- get() — Select and retrieve all records from the current table, and/or execute current compiled query
- getCompiledDelete() — Returns the generated 'delete' sql query
- getCompiledInsert() — Returns the generated 'insert' sql query
- getCompiledSelect() — Returns the generated 'select' sql query
- getCompiledUpdate() — Returns the generated 'update' sql query
- getWhere() — Convenience method for get() with a where clause
- groupBy() — Group the results by the selected field(s)
- groupEnd() — Ends a query group
- groupStart() — Adds a paren to the current query for query grouping
- having() — Generates a 'Having' clause
- insert() — Creates an insert clause, and executes it
- insertBatch() — Creates and executes a batch insertion query
- join() — Creates a join phrase in a compiled query
- like() — Creates a Like clause in the sql statement
- limit() — Set a limit on the current sql statement
- notGroupStart() — Adds a paren to the current query for query grouping, prefixed with 'NOT'
- notLike() — Generates a NOT LIKE clause
- orGroupStart() — Adds a paren to the current query for query grouping, prefixed with 'OR'
- orHaving() — Generates a 'Having' clause prefixed with 'OR'
- orLike() — Generates an OR Like clause
- orNotGroupStart() — Adds a paren to the current query for query grouping, prefixed with 'OR NOT'
- orNotLike() — Generates a OR NOT LIKE clause
- orWhere() — Where clause prefixed with "OR"
- orWhereIn() — Where in statement prefixed with "or"
- orWhereNotIn() — OR WHERE NOT IN (FOO) clause
- orderBy() — Order the results by the selected field(s)
- resetQuery() — Clear out the class variables, so the next query can be run
- returning()
- select() — Specifies rows to select in a query
- selectAvg() — Selects the average value of a field from a query
- selectMax() — Selects the maximum value of a field from a query
- selectMin() — Selects the minimum value of a field from a query
- selectSum() — Selects the sum of a field from a query
- set() — Sets values for inserts / updates / deletes
- update() — Creates an update clause, and executes it
- updateBatch() — Creates a batch update, and executes it.
- where() — Specify condition(s) in the where clause of a query Note: this function works with key / value, or a passed array with key / value pairs
- whereIn() — Where clause with 'IN' statement
- whereNotIn() — WHERE NOT IN (FOO) clause
History
-
2019-12-10T12:17:40-05:00 (commit #6a36a85)
Author: Timothy J Warren (tim@timshomepage.net) / Commiter: Timothy J Warren (tim@timshomepage.net)
Update dependencies and tests
-
2018-02-12T16:17:22-05:00 (commit #09b6610)
Author: Timothy J Warren (tim@timshomepage.net) / Commiter: Timothy J Warren (tim@timshomepage.net)
Remove unimplemented replace method
-
2018-01-26T15:45:46-05:00 (commit #33bb440)
Author: Timothy J Warren (tim@timshomepage.net) / Commiter: Timothy J Warren (tim@timshomepage.net)
SQLite improvements, remove nullable PDOStatement return values
-
2018-01-26T08:39:30-05:00 (commit #3067976)
Author: Timothy J Warren (tim@timshomepage.net) / Commiter: Timothy J Warren (tim@timshomepage.net)
Add updateBatch method
-
2018-01-24T15:23:26-05:00 (commit #73e4c35)
Author: Timothy J Warren (tim@timshomepage.net) / Commiter: Timothy J Warren (tim@timshomepage.net)
Remove some old code coupling and boilerplate
-
2018-01-24T15:03:41-05:00 (commit #f967aaf)
Author: Timothy J Warren (tim@timshomepage.net) / Commiter: Timothy J Warren (tim@timshomepage.net)
Remove method separators, update documentation building configuration
-
2018-01-24T13:25:42-05:00 (commit #16e50c3)
Author: Timothy J Warren (tim@timshomepage.net) / Commiter: Timothy J Warren (tim@timshomepage.net)
Fix some missed type hints
-
2018-01-24T13:14:03-05:00 (commit #1d583bc)
Author: Timothy J Warren (tim@timshomepage.net) / Commiter: Timothy J Warren (tim@timshomepage.net)
Add more type hinting
-
2018-01-23T11:22:23-05:00 (commit #e4ca039)
Author: Timothy J Warren (tim@timshomepage.net) / Commiter: Timothy J Warren (tim@timshomepage.net)
Use State class to simplify management of query builder state
-
2018-01-22T16:04:29-05:00 (commit #8401cce)
Author: Timothy J Warren (tim@timshomepage.net) / Commiter: Timothy J Warren (tim@timshomepage.net)
Remove PDOInterface to prevent conflicts in method parameters with native PDO object
-
2018-01-22T15:43:56-05:00 (commit #91eb812)
Author: Timothy J Warren (tim@timshomepage.net) / Commiter: Timothy J Warren (tim@timshomepage.net)
Various refactoring
-
2018-01-19T16:48:52-05:00 (commit #4df07b6)
Author: Timothy J Warren (tim@timshomepage.net) / Commiter: Timothy J Warren (tim@timshomepage.net)
Update test layout to better match source layout
-
2018-01-19T15:47:34-05:00 (commit #369ca6e)
Author: Timothy J Warren (tim@timshomepage.net) / Commiter: Timothy J Warren (tim@timshomepage.net)
Flatten source structure a bit
-
2018-01-19T13:43:19-05:00 (commit #c735c27)
Author: Timothy J Warren (tim@timshomepage.net) / Commiter: Timothy J Warren (tim@timshomepage.net)
Update file headers
-
2016-10-13T21:55:23-04:00 (commit #b8d4768)
Author: Timothy J Warren (tim@timshomepage.net) / Commiter: Timothy J Warren (tim@timshomepage.net)
camelCase methods and properties
-
2016-10-12T22:12:25-04:00 (commit #6740aae)
Author: Timothy J Warren (tim@timshomepage.net) / Commiter: Timothy J Warren (tim@timshomepage.net)
PHP7 or bust!