IQueryBuilder
interface IQueryBuilder (View source)
Defines an interface for a query builder that can be used to construct SQL queries.
The query builder provides a fluent API for building complex queries with features like select, join, where, order, limit, and more.
Methods
Specifies the columns to select in the query.
Specifies that the query should return distinct results.
Specifies the table(s) to select from.
Adds a join clause to the query.
Adds a self join clause to the query.
Adds a left join clause to the query.
Adds a right join clause to the query.
Adds an inner join clause to the query.
Adds an outer join clause to the query.
Adds a cross join clause to the query.
Adds an ON clause to the current join.
Adds an AND ON clause to the current join.
Adds an OR ON clause to the current join.
Adds a WHERE clause to the query.
Adds an AND WHERE clause to the query.
Adds an OR WHERE clause to the query.
Adds a HAVING clause to the query.
Adds an AND HAVING clause to the query.
Adds an OR HAVING clause to the query.
Adds a GROUP BY clause to the query.
Adds an ORDER BY clause to the query.
Adds an ORDER BY clause with ASC sorting to the query.
Adds an ORDER BY clause with DESC sorting to the query.
Adds a LIMIT clause to the query.
Builds the final SQL query string.
Builds the final SQL query string without any modifications.
Gets the values that will be bound to the query.
Gets all the metadata associated with the query.
Executes the query and returns the result.
Executes the query and returns all the results.
Details
static IQueryBuilder
select(array|string ...$data)
Specifies the columns to select in the query.
static IQueryBuilder
distinct(array|string ...$data)
Specifies that the query should return distinct results.
static IQueryBuilder
from(array|string ...$data)
Specifies the table(s) to select from.
static IQueryBuilder
join(array|string ...$data)
Adds a join clause to the query.
static IQueryBuilder
selfJoin(array|string ...$data)
Adds a self join clause to the query.
static IQueryBuilder
leftJoin(array|string ...$data)
Adds a left join clause to the query.
static IQueryBuilder
rightJoin(array|string ...$data)
Adds a right join clause to the query.
static IQueryBuilder
innerJoin(array|string ...$data)
Adds an inner join clause to the query.
static IQueryBuilder
outerJoin(array|string ...$data)
Adds an outer join clause to the query.
static IQueryBuilder
crossJoin(array|string ...$data)
Adds a cross join clause to the query.
static IQueryBuilder
on(array|string ...$data)
Adds an ON clause to the current join.
static IQueryBuilder
andOn(array|string ...$data)
Adds an AND ON clause to the current join.
static IQueryBuilder
orOn(array|string ...$data)
Adds an OR ON clause to the current join.
static IQueryBuilder
where(array|string ...$data)
Adds a WHERE clause to the query.
static IQueryBuilder
andWhere(array|string ...$data)
Adds an AND WHERE clause to the query.
static IQueryBuilder
orWhere(array|string ...$data)
Adds an OR WHERE clause to the query.
static IQueryBuilder
having(array|string ...$data)
Adds a HAVING clause to the query.
static IQueryBuilder
andHaving(array|string ...$data)
Adds an AND HAVING clause to the query.
static IQueryBuilder
orHaving(array|string ...$data)
Adds an OR HAVING clause to the query.
static IQueryBuilder
group(array|string ...$data)
Adds a GROUP BY clause to the query.
static IQueryBuilder
order(array|string ...$data)
Adds an ORDER BY clause to the query.
static IQueryBuilder
orderAsc(array|string ...$data)
Adds an ORDER BY clause with ASC sorting to the query.
static IQueryBuilder
orderDesc(array|string ...$data)
Adds an ORDER BY clause with DESC sorting to the query.
static IQueryBuilder
limit(array|string ...$data)
Adds a LIMIT clause to the query.
string
build()
Builds the final SQL query string.
string
buildRaw()
Builds the final SQL query string without any modifications.
array
getValues()
Gets the values that will be bound to the query.
object
getAllMetadata()
Gets all the metadata associated with the query.
mixed
fetch(int|null $fetchStyle = null, mixed $fetchArgument = null, mixed $optArgs = null)
Executes the query and returns the result.
array|bool
fetchAll(int|null $fetchStyle = null, mixed $fetchArgument = null, mixed $optArgs = null)
Executes the query and returns all the results.