Query

The abstract base class for all query types (Select, Insert, Update, Delete). It provides common functionality for managing table names, database connections, and WHERE clauses.

Methods

setTable($table, $alias)

Sets the target table for the query.

Example:

$query->setTable('users', 'u');

where($column, $operator, $value, $columnJoin, $paramName, $parameterized)

Adds an AND condition to the WHERE clause.

Example:

$query->where('status', '=', 'active');

orWhere($column, $operator, $value, $columnJoin, $paramName, $parameterized)

Adds an OR condition to the WHERE clause.

whereEqual($column, $value)

Adds an equality (=) condition to the WHERE clause.

whereIn($column, $values)

Adds an IN condition to the WHERE clause.

execute(IConnection $connection)

Executes the query using the provided or default connection.

Example:

$result = $query->execute();

setParam($paramName, $value)

Manually sets a parameter value for the query.

setConnection(IConnection $connection)

Sets the database connection to use for the query.

select($table, $columns)

Static factory method to create a Select query.

insert($table, $data)

Static factory method to create an Insert query.

update($table, $data)

Static factory method to create an Update query.

delete($table)

Static factory method to create a Delete query.