Methods

Sets the initial columns to select from.

__construct(array $columns) 

Parameters

$columns

array

column list

Creates a new "AND HAVING" condition for the query.

and_having(mixed $column, string $op, mixed $value) : \Fuel\Core\Database_Query_Builder_Select

fluent This method is part of a fluent interface and will return the same instance

Parameters

$column

mixed

column name or array($column, $alias) or object

$op

string

logic operator

$value

mixed

column value

Returns

Closes an open "AND HAVING (.

and_having_close() : \Fuel\Core\Database_Query_Builder_Select

..)" grouping.

fluent This method is part of a fluent interface and will return the same instance

Returns

Opens a new "AND HAVING (.

and_having_open() : \Fuel\Core\Database_Query_Builder_Select

..)" grouping.

fluent This method is part of a fluent interface and will return the same instance

Returns

Adds "AND ON .

and_on(mixed $c1, string $op, mixed $c2) : \Fuel\Core\Database_Query_Builder_Select

.." conditions for the last created JOIN statement.

fluent This method is part of a fluent interface and will return the same instance

Parameters

$c1

mixed

column name or array($column, $alias) or object

$op

string

logic operator

$c2

mixed

column name or array($column, $alias) or object

Returns

Compile the SQL query and return it.

compile(mixed $db) : string

Parameters

$db

mixed

Database_Connection instance or instance name

Returns

string

Enables or disables selecting only unique columns using "SELECT DISTINCT"

distinct(boolean $value) : \Fuel\Core\Database_Query_Builder_Select

fluent This method is part of a fluent interface and will return the same instance

Parameters

$value

boolean

enable or disable distinct columns

Returns

Choose the tables to select "FROM .

from(mixed $tables) : \Fuel\Core\Database_Query_Builder_Select

.."

fluent This method is part of a fluent interface and will return the same instance

Parameters

$tables

mixed

table name or array($table, $alias)

Returns

Creates a "GROUP BY .

group_by(mixed $columns) : \Fuel\Core\Database_Query_Builder_Select

.." filter.

fluent This method is part of a fluent interface and will return the same instance

Parameters

$columns

mixed

column name or array($column, $column) or object

Returns

Alias of and_having()

having(mixed $column, string $op, mixed $value) : \Fuel\Core\Database_Query_Builder_Select

fluent This method is part of a fluent interface and will return the same instance

Parameters

$column

mixed

column name or array($column, $alias) or object

$op

string

logic operator

$value

mixed

column value

Returns

Closes an open "AND HAVING (.

having_close() : \Fuel\Core\Database_Query_Builder_Select

..)" grouping.

fluent This method is part of a fluent interface and will return the same instance

Returns

Alias of and_having_open()

having_open() : \Fuel\Core\Database_Query_Builder_Select

fluent This method is part of a fluent interface and will return the same instance

Returns

Adds addition tables to "JOIN .

join(mixed $table, string $type) : \Fuel\Core\Database_Query_Builder_Select

..".

fluent This method is part of a fluent interface and will return the same instance

Parameters

$table

mixed

column name or array($column, $alias)

$type

string

join type (LEFT, RIGHT, INNER, etc)

Returns

Start returning results after "OFFSET .

offset(integer $number) : \Fuel\Core\Database_Query_Builder_Select

.."

fluent This method is part of a fluent interface and will return the same instance

Parameters

$number

integer

starting result number

Returns

Adds "ON .

on(mixed $c1, string $op, mixed $c2) : \Fuel\Core\Database_Query_Builder_Select

.." conditions for the last created JOIN statement.

fluent This method is part of a fluent interface and will return the same instance

Parameters

$c1

mixed

column name or array($column, $alias) or object

$op

string

logic operator

$c2

mixed

column name or array($column, $alias) or object

Returns

Adds a closing bracket for the last created JOIN statement.

on_close() : \Fuel\Core\Database_Query_Builder_Select

fluent This method is part of a fluent interface and will return the same instance

Returns

Adds an opening bracket the last created JOIN statement.

on_open() : \Fuel\Core\Database_Query_Builder_Select

fluent This method is part of a fluent interface and will return the same instance

Returns

Creates a new "OR HAVING" condition for the query.

or_having(mixed $column, string $op, mixed $value) : \Fuel\Core\Database_Query_Builder_Select

fluent This method is part of a fluent interface and will return the same instance

Parameters

$column

mixed

column name or array($column, $alias) or object

$op

string

logic operator

$value

mixed

column value

Returns

Closes an open "OR HAVING (.

or_having_close() : \Fuel\Core\Database_Query_Builder_Select

..)" grouping.

fluent This method is part of a fluent interface and will return the same instance

Returns

Opens a new "OR HAVING (.

or_having_open() : \Fuel\Core\Database_Query_Builder_Select

..)" grouping.

fluent This method is part of a fluent interface and will return the same instance

Returns

Adds "OR ON .

or_on(mixed $c1, string $op, mixed $c2) : \Fuel\Core\Database_Query_Builder_Select

.." conditions for the last created JOIN statement.

fluent This method is part of a fluent interface and will return the same instance

Parameters

$c1

mixed

column name or array($column, $alias) or object

$op

string

logic operator

$c2

mixed

column name or array($column, $alias) or object

Returns

Reset the query parameters

reset() : \Fuel\Core\Database_Query_Builder_Select

fluent This method is part of a fluent interface and will return the same instance

Returns

Choose the columns to select from.

select(mixed $columns) : \Fuel\Core\Database_Query_Builder_Select

fluent This method is part of a fluent interface and will return the same instance

Parameters

$columns

mixed

column name or array($column, $alias) or object

Returns

Choose the columns to select from, using an array.

select_array(array $columns, bool $reset) : \Fuel\Core\Database_Query_Builder_Select

fluent This method is part of a fluent interface and will return the same instance

Parameters

$columns

array

list of column names or aliases

$reset

bool

if true, don't merge but overwrite

Returns

 Properties

 

<p>whether to select distinct values</p>

$_distinct : bool

 

<p>table name</p>

$_from : array

 

<p>group by clauses</p>

$_group_by : array

 

<p>having clauses</p>

$_having : array

 

<p>join objects</p>

$_join : array

 

<p>last join statement</p>

$_last_join : \Fuel\Core\Database_Query_Builder_Join

 

<p>offset</p>

$_offset : integer

 

<p>columns to select</p>

$_select : array