__construct($dbh, $columns = ["*"])
Parameter
Type
Default
Description
$dbh
PDO
required
PDO object for database connection
$columns
array
["*"]
Array of columns or Clause\Method
Parameter
Type
Default
Description
$table
string
required
Table name
Parameter
Type
Default
Description
$clause
Join
required
One or more Join clauses to attach to this query
Parameter
Type
Default
Description
$column
string
required
One or more columns to group the result by
Parameter
Type
Default
Description
$clause
Conditional
required
One or more Conditial clauses to attach to this query
Returns the prepared SQL string for this statement.
Returns the values to be escaped for this statement.
Parameter
Type
Default
Description
$clause
Conditional
required
One or more Conditional clauses to attach to this query
orderBy($column, $direction)
Parameter
Type
Default
Description
$column
string
required
The column to order this query by.
$column
string
null
The order the above column should be sorted in.
Parameter
Type
Default
Description
$clause
Limit
required
A single limit conditional to be applied to this statement.
Returns PHP PDOStatement object.
// SELECT * FROM users WHERE id = ?
$ selectStatement = $ pdo ->select (array ("* " ))
->from ("users " )
->where (new Conditional ("id " , "= " , 1234 ));
$ stmt = $ selectStatement ->execute ();
$ data = $ stmt ->fetch ();