Dbwrapper
Static class to access a basic functions of DB.
Tags
Table of Contents
- $wrapper : CoreDbwrapper
- Instance of Dbwrapper.
- affected_rows() : int
- connect() : bool
- Check connection to DB.
- delete() : object
- Delete API.
- error() : mixed
- Get error of connection.
- execute() : ResultSet
- Execute a object type SQL.
- expression() : string
- Create Laminas\Db\Sql\Predicate\Expression for uses in Zend DB.
- fetch_assoc() : mixed
- free_result() : mixed
- insert() : object
- Insert API.
- insert_id() : mixed
- num_rows() : int
- pagination() : mixed
- Navigation menu used with Paginator.
- paginator() : Paginator
- Generate a paginator query.
- prefix() : string|array<string|int, mixed>
- Prefix for tables.
- query() : ResultSet
- Execute a query.
- quoteValue() : string
- Quote value for safe using in DB.
- select() : object
- Select API.
- sqlString() : string
- Get a sql query string.
- table_exists() : bool
- Check if table exist.
- toArray() : array<string|int, mixed>
- Get an array of result of DB::query.
- update() : object
- Update API.
- wrapper() : mixed
- Add wrapper to script.
Properties
$wrapper
Instance of Dbwrapper.
private
static CoreDbwrapper
$wrapper
Methods
affected_rows()
public
static affected_rows([mixed $result = false ]) : int
Parameters
- $result : mixed = false
Return values
int —connect()
Check connection to DB.
public
static connect() : bool
Return values
bool —delete()
Delete API.
public
static delete([string|TableIdentifier|null $table = null ][, bool $prefixed = null ]) : object
Parameters
- $table : string|TableIdentifier|null = null
- $prefixed : bool = null
Return values
object —error()
Get error of connection.
public
static error([object|false $result = false ]) : mixed
Parameters
- $result : object|false = false
Return values
mixed —execute()
Execute a object type SQL.
public
static execute(object $object) : ResultSet
Parameters
- $object : object
Return values
ResultSet —expression()
Create Laminas\Db\Sql\Predicate\Expression for uses in Zend DB.
public
static expression([string $expresion = null ]) : string
Parameters
- $expresion : string = null
Return values
string —fetch_assoc()
public
static fetch_assoc(mixed &$result) : mixed
Parameters
- $result : mixed
Return values
mixed —free_result()
public
static free_result(mixed $result) : mixed
Parameters
- $result : mixed
Return values
mixed —insert()
Insert API.
public
static insert([string|TableIdentifier|null $table = null ][, bool $prefixed = null ]) : object
Parameters
- $table : string|TableIdentifier|null = null
- $prefixed : bool = null
Return values
object —insert_id()
public
static insert_id() : mixed
Return values
mixed —num_rows()
public
static num_rows(mixed $result) : int
Parameters
- $result : mixed
Return values
int —pagination()
Navigation menu used with Paginator.
public
static pagination(Paginator $paginator, string $url[, bool|null $forcePages = null ]) : mixed
Parameters
- $paginator : Paginator
- $url : string
- $forcePages : bool|null = null
-
Force to show pages if only have 1 page
Return values
mixed —paginator()
Generate a paginator query.
public
static paginator(Select $select[, int $page = 1 ][, int $perpage = 25 ]) : Paginator
Parameters
- $select : Select
- $page : int = 1
- $perpage : int = 25
Return values
Paginator —prefix()
Prefix for tables.
public
static prefix(string|array<string|int, mixed> $tablename[, false|string $force = false ]) : string|array<string|int, mixed>
Parameters
- $tablename : string|array<string|int, mixed>
-
Name of table
- $force : false|string = false
-
If you want to force a prefix
Return values
string|array<string|int, mixed> —query()
Execute a query.
public
static query(string $sql) : ResultSet
Parameters
- $sql : string
Return values
ResultSet —quoteValue()
Quote value for safe using in DB.
public
static quoteValue(string $value) : string
Parameters
- $value : string
Return values
string —select()
Select API.
public
static select([string|array<string|int, mixed>|TableIdentifier|null $table = null ][, bool $prefixed = null ]) : object
Parameters
- $table : string|array<string|int, mixed>|TableIdentifier|null = null
- $prefixed : bool = null
Return values
object —sqlString()
Get a sql query string.
public
static sqlString() : string
Return values
string —table_exists()
Check if table exist.
public
static table_exists(string $tablename) : bool
Parameters
- $tablename : string
Return values
bool —toArray()
Get an array of result of DB::query.
public
static toArray(mixed $result) : array<string|int, mixed>
Parameters
- $result : mixed
Return values
array<string|int, mixed> —update()
Update API.
public
static update([string|TableIdentifier|null $table = null ][, bool $prefixed = null ]) : object
Parameters
- $table : string|TableIdentifier|null = null
- $prefixed : bool = null
Return values
object —wrapper()
Add wrapper to script.
public
static wrapper(CoreDbwrapper $wrapper) : mixed
Parameters
- $wrapper : CoreDbwrapper