QueryBuilder
class QueryBuilder (View source)
QueryBuilder class
Properties
static protected object | $instance | ||
protected DoliDb | $db | ||
protected bool|null | $result |
Methods
Constructor
Return Query Builder instance
Return query
Reset Query Builder
Execute query
Execute query if not executed & return an array of result(s)
Execute query if not executed & return query result(s) count
Return affected rows count of an INSERT, UPDATE or DELETE query
Return last id after an INSERT query
Escape field value
Add SELECT statement to query
Add more options to SELECT statement (multiple calls allowed)
Add FROM clause to query
Add WHERE clause to query (multiple calls allowed)
Add OR to WHERE clause (multiple calls allowed)
Add GROUP BY clause to query
Add ORDER BY clause to query
Add LIMIT clause to query
Add JOIN clause to query (multiple calls allowed)
Add INSERT statement to query
Add UPDATE statement to query
Add DELETE statement to query
Add TRUNCATE statement to query
Details
at line 46
__construct()
Constructor
at line 60
static
getInstance()
Return Query Builder instance
at line 71
string
get()
Return query
at line 91
reset()
Reset Query Builder
at line 108
bool|null
execute()
Execute query
at line 128
array
result($limit)
Execute query if not executed & return an array of result(s)
at line 160
int|null
count()
Execute query if not executed & return query result(s) count
at line 178
int|null
affected()
Return affected rows count of an INSERT, UPDATE or DELETE query
at line 195
int|null
lastId($table_name, $pk_name)
Return last id after an INSERT query
at line 210
protected string
escape($value)
Escape field value
at line 223
$this
select($select_options = '*', $distinct = false, $table_alias = '')
Add SELECT statement to query
at line 256
$this
addSelect($select_options, $table_alias = '')
Add more options to SELECT statement (multiple calls allowed)
at line 289
$this
from($table_name, $table_alias = '')
Add FROM clause to query
at line 318
$this
where($where_options)
Add WHERE clause to query (multiple calls allowed)
at line 353
$this
orWhere($where_options)
Add OR to WHERE clause (multiple calls allowed)
at line 388
$this
groupBy($group_options)
Add GROUP BY clause to query
at line 401
$this
orderBy($order_options, $order = 'ASC')
Add ORDER BY clause to query
at line 414
$this
limit($limit, $offset)
Add LIMIT clause to query
at line 434
$this
join($table_name, $join_options, $join_type = '')
Add JOIN clause to query (multiple calls allowed)
at line 459
$this
insert($table_name, $data)
Add INSERT statement to query
at line 487
$this
update($table_name, $data)
Add UPDATE statement to query
at line 505
$this
delete($table_name)
Add DELETE statement to query
at line 517
$this
truncate($table_name)
Add TRUNCATE statement to query