PHP Class System\Database\query

Inheritance: extends System\Database\Builder
Show file Open project: anchorcms/anchor-cms

Public Properties

Property Type Description
$bind array Array values to bind to the query
$columns array Array of columns to build the select
$connection object Database connector object
$fetch_class string The class name of the object to create when fetching from the database
$groupby array Columns to group by
$join array Array of table joins to build
$limit integer Number of rows to limit
$offset integer Number of rows to offset
$sortby array Columns to sort by
$table string The current database table
$where array Array of where clauses to build

Public Methods

Method Description
__construct ( $table, $connection = null ) Create a new database query instance
apply ( $class ) : object Set the class name for fetch queries, return self for chaining
column ( $columns = [], $column_number ) : string Fetch a single column from the query
count ( ) : string Run a count function on database query
delete ( ) : integer Delete a row in the database
fetch ( $columns = null ) : object Fetch a single row from the query
get ( $columns = null ) : object Fetch a result set from the query
group ( $column ) : object Add a group by column to the query
insert ( $row ) : object Insert a row into the database
insert_get_id ( $row ) : integer Insert a row into the database and return the inserted ID
join ( $table, $left, $operator, $right, $type = 'INNER' ) : object Add a table join to the query
left_join ( $table, $left, $operator, $right ) : object Add a left table join to the query
or_where ( $column, $operator, $value ) : object Add a where clause to the query starting with OR
skip ( $num ) : object Set a row offset on the query
sort ( $column, $mode = 'ASC' ) : object Add a sort by column to the query
table ( $table, $connection = null ) : object Create a new database query instance for chaining
take ( $num ) : object Set a row limit on the query
update ( $row ) : integer Update row in the database
where ( $column, $operator, $value ) : object Add a where clause to the query
where_in ( $column, $values ) : object Add a where clause to the query starting with IN

Method Details

__construct() public method

Create a new database query instance
public __construct ( $table, $connection = null )

apply() public method

Set the class name for fetch queries, return self for chaining
public apply ( $class ) : object
return object

column() public method

Fetch a single column from the query
public column ( $columns = [], $column_number ) : string
return string

count() public method

Run a count function on database query
public count ( ) : string
return string

delete() public method

Delete a row in the database
public delete ( ) : integer
return integer

fetch() public method

Fetch a single row from the query
public fetch ( $columns = null ) : object
return object

get() public method

Fetch a result set from the query
public get ( $columns = null ) : object
return object

group() public method

Add a group by column to the query
public group ( $column ) : object
return object

insert() public method

Insert a row into the database
public insert ( $row ) : object
return object

insert_get_id() public method

Insert a row into the database and return the inserted ID
public insert_get_id ( $row ) : integer
return integer

join() public method

Add a table join to the query
public join ( $table, $left, $operator, $right, $type = 'INNER' ) : object
return object

left_join() public method

Add a left table join to the query
public left_join ( $table, $left, $operator, $right ) : object
return object

or_where() public method

Add a where clause to the query starting with OR
public or_where ( $column, $operator, $value ) : object
return object

skip() public method

Set a row offset on the query
public skip ( $num ) : object
return object

sort() public method

Add a sort by column to the query
public sort ( $column, $mode = 'ASC' ) : object
return object

table() public static method

Create a new database query instance for chaining
public static table ( $table, $connection = null ) : object
return object Query

take() public method

Set a row limit on the query
public take ( $num ) : object
return object

update() public method

Update row in the database
public update ( $row ) : integer
return integer

where() public method

Add a where clause to the query
public where ( $column, $operator, $value ) : object
return object

where_in() public method

Add a where clause to the query starting with IN
public where_in ( $column, $values ) : object
return object

Property Details

$bind public property

Array values to bind to the query
public array $bind
return array

$columns public property

Array of columns to build the select
public array $columns
return array

$connection public property

Database connector object
public object $connection
return object

$fetch_class public property

The class name of the object to create when fetching from the database
public string $fetch_class
return string

$groupby public property

Columns to group by
public array $groupby
return array

$join public property

Array of table joins to build
public array $join
return array

$limit public property

Number of rows to limit
public int $limit
return integer

$offset public property

Number of rows to offset
public int $offset
return integer

$sortby public property

Columns to sort by
public array $sortby
return array

$table public property

The current database table
public string $table
return string

$where public property

Array of where clauses to build
public array $where
return array