classe Builder étends QueryBuilder (Voir la source)

Propriétés

protected string $table

The table name

depuis  QueryBuilder
protected string $select

Select statement collector

depuis  QueryBuilder
protected string $where

Where statement collector

depuis  QueryBuilder
protected array $where_data_binding

The data binding information

depuis  QueryBuilder
protected string $join

Join statement collector

depuis  QueryBuilder
protected string $limit

Limit statement collector

depuis  QueryBuilder
protected string $group

Group statement collector

depuis  QueryBuilder
protected string $having

Having statement collector

depuis  QueryBuilder
protected string $order

Order By statement collector

depuis  QueryBuilder
protected string $as

Define the table as

depuis  QueryBuilder
protected PDO $connection

The PDO instance

depuis  QueryBuilder
protected bool $first

Define whether to retrieve information from the list

depuis  QueryBuilder
protected string $prefix

The table prefix

depuis  QueryBuilder
protected string $model

The model instance

Méthodes

__construct(string $table, PDO $connection)

QueryBuilder Constructor

select(array $select = ['*'])

Add select column.

as(string $as)

Create the table as

where(string $column, mixed $comparator = '=', mixed $value = null, string $boolean = 'and')

Add where clause into the request

whereRaw(string $where)

Add where clause into the request

orWhere(string $column, mixed $comparator = '=', mixed $value = null)

orWhere, add a condition of type:

whereNull(string $column, string $boolean = 'and')

Where clause with comparison in << is null >>

whereNotNull($column, string $boolean = 'and')

Where clause with comparison in <>

whereBetween(string $column, array $range, string $boolean = 'and')

Where clause with comparison <>

whereNotBetween(string $column, array $range)

WHERE column NOT BETWEEN '' AND ''

whereIn(string $column, array $range, string $boolean = 'and')

Where clause with <> comparison

whereNotIn(string $column, array $range)

Where clause with <> comparison

join(string $table, string $first, mixed $comparator = '=', string|null $second = null)

Join clause

leftJoin(string $table, string $first, mixed $comparator = '=', string|null $second = null)

Left Join clause

rightJoin(string $table, string $first, mixed $comparator = '=', string|null $second = null)

Right Join clause

andOn(string $first, mixed $comparator = '=', string $second = null)

On, if chained with itself must add an << and >> before, otherwise if chained with "orOn" who add a "before"

orOn(string $first, mixed $comparator = '=', string $second = null)

Clause On, followed by a combination by a comparator <> The user has to do an "on()" before using the "orOn"

groupBy(string $column)

Clause Group By

group(string $column) déprécié

Clause Group By

having(string $column, mixed $comparator = '=', mixed $value = null, string $boolean = 'and')

clause having, is used with a groupBy

orderBy(string $column, string $type = 'asc')

Clause Order By

jump(int $offset = 0)

Jump = Offset

take(int $limit)

Take = Limit

int|float
max(string $column)

Max

int|float
min(string $column)

Min

int|float
avg(string $column)

Avg

int|float
sum(string $column)

Sum

int
count(string $column = '*')

Count

array|object|null
get(array $columns = [])

Get informations

object|null
first()

Get the first record

object|null
last()

Get the last record

int
update(array $data = [])

Update action

int
delete()

Delete Action

int
remove(string $column, mixed $comparator = '=', string $value = null)

Remove simplified stream from delete.

int
increment(string $column, int $step = 1)

Action increment, add 1 by default to the specified field

int
decrement(string $column, int $step = 1)

Decrement action, subtracts 1 by default from the specified field

distinct(string $column)

Allows a query with the DISTINCT clause

bool
truncate()

Truncate Action, empty the table

int
insert(array $values)

Insert Action

string|int|bool
insertAndGetLastId(array $values)

InsertAndGetLastId action launches the insert and lastInsertId actions

bool
drop()

Drop Action, remove the table

array
paginate(int $number_of_page, int $current = 0, int $chunk = null)

Paginate, make pagination system

bool
exists(string|null $column = null, mixed $value = null)

Check if rows exists

string
getLastInsertId(string|null $name = null)

Turn back the id of the last insertion

string
jsonSerialize()

JsonSerialize implementation

string
toJson(int $option = 0)

Transformation automatically the result to JSON

string
toSql()

Formats the select request

string
getTable()

Returns the name of the table.

string
getPrefix()

Returns the prefix.

setPrefix(string $prefix)

Modify the prefix

setTable(string $table)

Change the table's name

void
setWhereDataBinding(array $data_binding)

Define the data to associate

string
__toString()

__toString

setModel(string $model)

Set model

string
getModel()

Get model

Détails

__construct(string $table, PDO $connection)

QueryBuilder Constructor

Paramètres

string $table
PDO $connection

QueryBuilder select(array $select = ['*'])

Add select column.

SELECT $column | SELECT column1, column2, ...

Paramètres

array $select

Valeur de retour

QueryBuilder

QueryBuilder as(string $as)

Create the table as

Paramètres

string $as

Valeur de retour

QueryBuilder

QueryBuilder where(string $column, mixed $comparator = '=', mixed $value = null, string $boolean = 'and')

Add where clause into the request

WHERE column1 $comparator $value|column

Paramètres

string $column
mixed $comparator
mixed $value
string $boolean

Valeur de retour

QueryBuilder

Exceptions

QueryBuilderException

QueryBuilder whereRaw(string $where)

Add where clause into the request

WHERE column1 $comparator $value|column

Paramètres

string $where

Valeur de retour

QueryBuilder

QueryBuilder orWhere(string $column, mixed $comparator = '=', mixed $value = null)

orWhere, add a condition of type:

[where column = value or column = value]

Paramètres

string $column
mixed $comparator
mixed $value

Valeur de retour

QueryBuilder

Exceptions

QueryBuilderException

QueryBuilder whereNull(string $column, string $boolean = 'and')

Where clause with comparison in << is null >>

WHERE column IS NULL

Paramètres

string $column
string $boolean

Valeur de retour

QueryBuilder

QueryBuilder whereNotNull($column, string $boolean = 'and')

Where clause with comparison in <>

WHERE column NOT NULL

Paramètres

$column
string $boolean

Valeur de retour

QueryBuilder

QueryBuilder whereBetween(string $column, array $range, string $boolean = 'and')

Where clause with comparison <>

WHERE column BETWEEN '' AND ''

Paramètres

string $column
array $range
string $boolean

Valeur de retour

QueryBuilder

Exceptions

QueryBuilderException

QueryBuilder whereNotBetween(string $column, array $range)

WHERE column NOT BETWEEN '' AND ''

Paramètres

string $column
array $range

Valeur de retour

QueryBuilder

QueryBuilder whereIn(string $column, array $range, string $boolean = 'and')

Where clause with <> comparison

Paramètres

string $column
array $range
string $boolean

Valeur de retour

QueryBuilder

Exceptions

QueryBuilderException

QueryBuilder whereNotIn(string $column, array $range)

Where clause with <> comparison

Paramètres

string $column
array $range

Valeur de retour

QueryBuilder

Exceptions

QueryBuilderException

QueryBuilder join(string $table, string $first, mixed $comparator = '=', string|null $second = null)

Join clause

Paramètres

string $table
string $first
mixed $comparator
string|null $second

Valeur de retour

QueryBuilder

QueryBuilder leftJoin(string $table, string $first, mixed $comparator = '=', string|null $second = null)

Left Join clause

Paramètres

string $table
string $first
mixed $comparator
string|null $second

Valeur de retour

QueryBuilder

Exceptions

QueryBuilderException

QueryBuilder rightJoin(string $table, string $first, mixed $comparator = '=', string|null $second = null)

Right Join clause

Paramètres

string $table
string $first
mixed $comparator
string|null $second

Valeur de retour

QueryBuilder

Exceptions

QueryBuilderException

QueryBuilder andOn(string $first, mixed $comparator = '=', string $second = null)

On, if chained with itself must add an << and >> before, otherwise if chained with "orOn" who add a "before"

Paramètres

string $first
mixed $comparator
string $second

Valeur de retour

QueryBuilder

Exceptions

QueryBuilderException

QueryBuilder orOn(string $first, mixed $comparator = '=', string $second = null)

Clause On, followed by a combination by a comparator <> The user has to do an "on()" before using the "orOn"

Paramètres

string $first
mixed $comparator
string $second

Valeur de retour

QueryBuilder

Exceptions

QueryBuilderException

QueryBuilder groupBy(string $column)

Clause Group By

Paramètres

string $column

Valeur de retour

QueryBuilder

QueryBuilder group(string $column) déprécié

déprécié

Clause Group By

Paramètres

string $column

Valeur de retour

QueryBuilder

QueryBuilder having(string $column, mixed $comparator = '=', mixed $value = null, string $boolean = 'and')

clause having, is used with a groupBy

Paramètres

string $column
mixed $comparator
mixed $value
string $boolean

Valeur de retour

QueryBuilder

QueryBuilder orderBy(string $column, string $type = 'asc')

Clause Order By

Paramètres

string $column
string $type

Valeur de retour

QueryBuilder

QueryBuilder jump(int $offset = 0)

Jump = Offset

Paramètres

int $offset

Valeur de retour

QueryBuilder

QueryBuilder take(int $limit)

Take = Limit

Paramètres

int $limit

Valeur de retour

QueryBuilder

int|float max(string $column)

Max

Paramètres

string $column

Valeur de retour

int|float

int|float min(string $column)

Min

Paramètres

string $column

Valeur de retour

int|float

int|float avg(string $column)

Avg

Paramètres

string $column

Valeur de retour

int|float

int|float sum(string $column)

Sum

Paramètres

string $column

Valeur de retour

int|float

int count(string $column = '*')

Count

Paramètres

string $column

Valeur de retour

int

array|object|null get(array $columns = [])

Get informations

Paramètres

array $columns

Valeur de retour

array|object|null

object|null first()

Get the first record

Valeur de retour

object|null

object|null last()

Get the last record

Valeur de retour

object|null

int update(array $data = [])

Update action

Paramètres

array $data

Valeur de retour

int

int delete()

Delete Action

Valeur de retour

int

int remove(string $column, mixed $comparator = '=', string $value = null)

Remove simplified stream from delete.

Paramètres

string $column
mixed $comparator
string $value

Valeur de retour

int

Exceptions

QueryBuilderException

int increment(string $column, int $step = 1)

Action increment, add 1 by default to the specified field

Paramètres

string $column
int $step

Valeur de retour

int

int decrement(string $column, int $step = 1)

Decrement action, subtracts 1 by default from the specified field

Paramètres

string $column
int $step

Valeur de retour

int

QueryBuilder distinct(string $column)

Allows a query with the DISTINCT clause

Paramètres

string $column

Valeur de retour

QueryBuilder

bool truncate()

Truncate Action, empty the table

Valeur de retour

bool

int insert(array $values)

Insert Action

The data to be inserted into the database.

Paramètres

array $values

Valeur de retour

int

string|int|bool insertAndGetLastId(array $values)

InsertAndGetLastId action launches the insert and lastInsertId actions

Paramètres

array $values

Valeur de retour

string|int|bool

bool drop()

Drop Action, remove the table

Valeur de retour

bool

array paginate(int $number_of_page, int $current = 0, int $chunk = null)

Paginate, make pagination system

Paramètres

int $number_of_page
int $current
int $chunk

Valeur de retour

array

bool exists(string|null $column = null, mixed $value = null)

Check if rows exists

Paramètres

string|null $column
mixed $value

Valeur de retour

bool

Exceptions

string getLastInsertId(string|null $name = null)

Turn back the id of the last insertion

Paramètres

string|null $name [optional]

Valeur de retour

string

string jsonSerialize()

JsonSerialize implementation

string toJson(int $option = 0)

Transformation automatically the result to JSON

Paramètres

int $option

Valeur de retour

string

string toSql()

Formats the select request

Valeur de retour

string

string getTable()

Returns the name of the table.

Valeur de retour

string

string getPrefix()

Returns the prefix.

Valeur de retour

string

QueryBuilder setPrefix(string $prefix)

Modify the prefix

Paramètres

string $prefix

Valeur de retour

QueryBuilder

QueryBuilder setTable(string $table)

Change the table's name

Paramètres

string $table

Valeur de retour

QueryBuilder

void setWhereDataBinding(array $data_binding)

Define the data to associate

Paramètres

array $data_binding

Valeur de retour

void

string __toString()

__toString

Valeur de retour

string

Builder setModel(string $model)

Set model

Paramètres

string $model

Valeur de retour

Builder

string getModel()

Get model

Valeur de retour

string