QueryBuilder
class QueryBuilder
Class QueryBuilder
Properties
protected string | $table | The database table name. | |
protected string | $primaryKey | The primary key column name. | |
protected wpdb | $wpdb | The WordPress database object. |
Methods
No description
Retrun a collection of all the records.
Return a collection of records that match the given where conditions.
Set the select columns for the query.
Return the the values of a single column.
Delete one or more records.
Add a where condition to the query.
Add an "or where" condition to the query.
Add a where IN condition to the query.
Add a where IN condition to the query.
Add a where NOT IN condition to the query.
Add a where NOT IN condition to the query.
Add a where BETWEEN condition to the query.
Add a where BETWEEN condition to the query.
Add a where NOT BETWEEN condition to the query.
Add a where NOT BETWEEN condition to the query.
Set the "order by" clause for the query.
Set the offset "limit" clause for the query.
Set the limit "limit" clause for the query.
Return a single column's value from the first result of the query.
Return the count of the records that match the given where conditions.
Insert one or more records.
Update one or more records.
Truncate the table.
Determine if the given operator and value combination is legal.
Get the table description.
Commodity method to get a WordPress table name.
Execute a wpdb->get_results() query.
Execute a wpdb->query() query.
Execute a wpdb->get_var() query.
Return the primary key.
Set the primary key.
Return the table name without the prefix.
Set the table name without the prefix.
Get the table name with the prefix.
No description
No description
Details
at line 102
__construct($table, $primaryKey = "id")
at line 137
Collection
all($columns = ['*'])
Retrun a collection of all the records.
at line 185
Collection
get()
Return a collection of records that match the given where conditions.
at line 195
Model
first()
Return the first record that matches the given where conditions.
at line 207
Model
last()
Return the last record that matches the given where conditions.
at line 220
Model
find($id)
Return the record with the given id.
at line 231
select(array|string $columns = [])
Set the select columns for the query.
at line 245
array
pluck($column_name)
Return the the values of a single column.
at line 260
delete()
Delete one or more records.
at line 280
where(string $column, string $operator = null, mixed $value = null, string $boolean = 'and')
Add a where condition to the query.
at line 317
orWhere($column, $operator = null, $value = null, $boolean = 'or')
Add an "or where" condition to the query.
at line 357
whereIn($column, $value, $boolean = 'and')
Add a where IN condition to the query.
at line 372
orWhereIn($column, $value)
Add a where IN condition to the query.
at line 383
whereNotIn($column, $value, $boolean = 'and')
Add a where NOT IN condition to the query.
at line 398
orWhereNotIn($column, $value)
Add a where NOT IN condition to the query.
at line 409
whereBetween($column, $value, $boolean = 'and')
Add a where BETWEEN condition to the query.
at line 424
orWhereBetween($column, $value)
Add a where BETWEEN condition to the query.
at line 435
whereNotBetween($column, $value, $boolean = 'and')
Add a where NOT BETWEEN condition to the query.
at line 450
orWhereNotBetween($column, $value)
Add a where NOT BETWEEN condition to the query.
at line 458
orderBy($column, $order = 'asc')
Set the "order by" clause for the query.
at line 470
offset($value)
Set the offset "limit" clause for the query.
at line 480
limit($value = 1)
Set the limit "limit" clause for the query.
at line 492
mixed
value($attribute)
Return a single column's value from the first result of the query.
at line 502
int
count()
Return the count of the records that match the given where conditions.
at line 521
int|array
insert(array $values)
Insert one or more records.
at line 551
update(array $values)
Update one or more records.
at line 567
truncate()
Truncate the table.
at line 629
protected bool
invalidOperatorAndValue(string $operator, mixed $value)
Determine if the given operator and value combination is legal.
Prevents using Null values with invalid operators.
at line 758
protected void
getTableDescription()
Get the table description.
at line 827
protected string
getWordPressTableName($table)
Commodity method to get a WordPress table name.
Here we're going to add the prefix to the table name.
at line 845
protected array
getSQLResults($sql, $type = ARRAY_A)
Execute a wpdb->get_results() query.
at line 861
protected mixed
query($sql)
Execute a wpdb->query() query.
at line 877
protected mixed
var($sql)
Execute a wpdb->get_var() query.
at line 902
string
getPrimaryKey()
Return the primary key.
at line 910
setPrimaryKey($primaryKey)
Set the primary key.
at line 920
string
getTable()
Return the table name without the prefix.
at line 930
setTable(string $table)
Set the table name without the prefix.
at line 940
string
getTableName()
Get the table name with the prefix.