\DbQueryCore

SQL query builder

Summary

Methods
Properties
Constants
select()
from()
join()
leftJoin()
innerJoin()
leftOuterJoin()
naturalJoin()
where()
having()
orderBy()
groupBy()
limit()
build()
__toString()
No public properties found
No constants found
No protected methods found
$query
N/A
No private methods found
No private properties found
N/A

Properties

$query

$query : array

Type

array — list of data to build the query

Methods

select()

select(string  $fields) : \DbQuery

Add fields in query selection

Parameters

string $fields

List of fields to concat to other fields

Returns

\DbQuery

from()

from(string  $table,   $alias = null) : \DbQuery

Set table for FROM clause

Parameters

string $table

Table name

$alias

Returns

\DbQuery

join()

join(string  $join) : \DbQuery

Add JOIN clause E.g. $this->join('RIGHT JOIN '._DB_PREFIX_.'product p ON .

..');

Parameters

string $join

Complete string

Returns

\DbQuery

leftJoin()

leftJoin(string  $table, string  $alias = null, string  $on = null) 

Add LEFT JOIN clause

Parameters

string $table

Table name (without prefix)

string $alias

Table alias

string $on

ON clause

innerJoin()

innerJoin(string  $table, string  $alias = null, string  $on = null) 

Add INNER JOIN clause E.g. $this->innerJoin('product p ON .

..')

Parameters

string $table

Table name (without prefix)

string $alias

Table alias

string $on

ON clause

leftOuterJoin()

leftOuterJoin(string  $table, string  $alias = null, string  $on = null) 

Add LEFT OUTER JOIN clause

Parameters

string $table

Table name (without prefix)

string $alias

Table alias

string $on

ON clause

naturalJoin()

naturalJoin(string  $table, string  $alias = null) 

Add NATURAL JOIN clause

Parameters

string $table

Table name (without prefix)

string $alias

Table alias

where()

where(string  $restriction) : \DbQuery

Add a restriction in WHERE clause (each restriction will be separated by AND statement)

Parameters

string $restriction

Returns

\DbQuery

having()

having(string  $restriction) : \DbQuery

Add a restriction in HAVING clause (each restriction will be separated by AND statement)

Parameters

string $restriction

Returns

\DbQuery

orderBy()

orderBy(string  $fields) : \DbQuery

Add an ORDER B restriction

Parameters

string $fields

List of fields to sort. E.g. $this->order('myField, b.mySecondField DESC')

Returns

\DbQuery

groupBy()

groupBy(string  $fields) : \DbQuery

Add a GROUP BY restriction

Parameters

string $fields

List of fields to sort. E.g. $this->group('myField, b.mySecondField DESC')

Returns

\DbQuery

limit()

limit(  $limit,   $offset) : \DbQuery

Limit results in query

Parameters

$limit
$offset

Returns

\DbQuery

build()

build() : string

Generate and get the query

Returns

string

__toString()

__toString()