Mydb
in package
implements
MydbInterface, RemoteResourceInterface
Tags
Table of Contents
Interfaces
Properties
- $credentials : MydbCredentialsInterface
- $environment : MydbEnvironmentInterface
- $eventListener : MydbListenerInterface
- $logger : LoggerInterface
- $mysqli : MydbMysqliInterface
- $options : MydbOptionsInterface
- $queryBuilder : MydbQueryBuilderInterface
- $terminating : bool
Methods
- __construct() : mixed
- __destruct() : mixed
- A destructor may be called as soon as there are no references to an object.
- beginTransaction() : void
- close() : void
- Cleanup remote server connection will NOT close persistent connections
- command() : bool
- commitTransaction() : void
- delete() : int|null
- deleteWhere() : int|null
- escape() : string
- getEnumValues() : array<string|int, string>
- getPrimaryKeys() : array<string|int, string>|null
- insert() : string|null
- insertMany() : void
- insertOne() : string|null
- open() : bool
- Open connection to remote server
- query() : array<string|int, mixed>|null
- Execute raw SQL query and return results
- replace() : string|null
- replaceOne() : string|null
- rollbackTransaction() : void
- select() : array<string|int, mixed>|null
- update() : int|null
- updateWhere() : int|null
- updateWhereMany() : void
- connect() : bool
- onError() : void
- onWarning() : void
- readServerResponse() : MydbMysqliResultInterface|null
- sendClientRequest() : bool
Properties
$credentials
protected
MydbCredentialsInterface
$credentials
$environment
protected
MydbEnvironmentInterface
$environment
$eventListener
protected
MydbListenerInterface
$eventListener
$logger
protected
LoggerInterface
$logger
$mysqli
protected
MydbMysqliInterface
$mysqli
$options
protected
MydbOptionsInterface
$options
$queryBuilder
protected
MydbQueryBuilderInterface
$queryBuilder
$terminating
protected
bool
$terminating
= false
Methods
__construct()
public
__construct(MydbCredentialsInterface $credentials, LoggerInterface $logger[, MydbOptionsInterface|null $options = null ][, MydbMysqliInterface|null $mysqli = null ][, MydbEnvironmentInterface|null $environment = null ][, MydbQueryBuilderInterface|null $queryBuilder = null ][, MydbListenerInterface|null $eventListener = null ]) : mixed
Parameters
- $credentials : MydbCredentialsInterface
- $logger : LoggerInterface
- $options : MydbOptionsInterface|null = null
- $mysqli : MydbMysqliInterface|null = null
- $environment : MydbEnvironmentInterface|null = null
- $queryBuilder : MydbQueryBuilderInterface|null = null
- $eventListener : MydbListenerInterface|null = null
__destruct()
A destructor may be called as soon as there are no references to an object.
public
__destruct() : mixed
Tags
beginTransaction()
public
beginTransaction() : void
Tags
close()
Cleanup remote server connection will NOT close persistent connections
public
close() : void
Tags
command()
public
command(string $query) : bool
Parameters
- $query : string
Tags
Return values
boolcommitTransaction()
public
commitTransaction() : void
Tags
delete()
public
delete(string $query) : int|null
Parameters
- $query : string
Tags
Return values
int|nulldeleteWhere()
public
deleteWhere(array<string|int, mixed> $whereFields, string $table[, array<string|int, mixed> $whereNotFields = [] ]) : int|null
Parameters
- $whereFields : array<string|int, mixed>
- $table : string
- $whereNotFields : array<string|int, mixed> = []
Tags
Return values
int|nullescape()
public
escape(float|int|string|MydbExpressionInterface|null $unescaped[, string $quote = "'" ]) : string
Parameters
- $unescaped : float|int|string|MydbExpressionInterface|null
- $quote : string = "'"
Tags
Return values
stringgetEnumValues()
public
getEnumValues(string $table, string $column) : array<string|int, string>
Parameters
- $table : string
- $column : string
Tags
Return values
array<string|int, string>getPrimaryKeys()
public
getPrimaryKeys(string $table) : array<string|int, string>|null
Parameters
- $table : string
Tags
Return values
array<string|int, string>|nullinsert()
public
insert(string $query) : string|null
Parameters
- $query : string
Tags
Return values
string|nullinsertMany()
public
insertMany(array<string|int, mixed> $data, array<string|int, string> $cols, string $table[, bool $ignore = false ][, string $onDuplicateSql = '' ]) : void
Parameters
- $data : array<string|int, mixed>
- $cols : array<string|int, string>
- $table : string
- $ignore : bool = false
- $onDuplicateSql : string = ''
Tags
insertOne()
public
insertOne(array<string, float|int|MydbExpressionInterface|string|null> $data, string $table) : string|null
Parameters
- $data : array<string, float|int|MydbExpressionInterface|string|null>
- $table : string
Tags
Return values
string|nullopen()
Open connection to remote server
public
open([int $retry = 0 ]) : bool
Parameters
- $retry : int = 0
-
retry failed connection attempts
Tags
Return values
boolquery()
Execute raw SQL query and return results
public
query(string $query) : array<string|int, mixed>|null
Parameters
- $query : string
Tags
Return values
array<string|int, mixed>|nullreplace()
public
replace(string $query) : string|null
Parameters
- $query : string
Tags
Return values
string|nullreplaceOne()
public
replaceOne(array<string, float|int|MydbExpressionInterface|string|null> $data, string $table) : string|null
Parameters
- $data : array<string, float|int|MydbExpressionInterface|string|null>
- $table : string
Tags
Return values
string|nullrollbackTransaction()
public
rollbackTransaction() : void
Tags
select()
public
select(string $query) : array<string|int, mixed>|null
Parameters
- $query : string
Tags
Return values
array<string|int, mixed>|nullupdate()
public
update(string $query) : int|null
Parameters
- $query : string
Tags
Return values
int|nullupdateWhere()
public
updateWhere(array<string, float|int|string|MydbExpressionInterface|null> $update, array<string|int, mixed> $whereFields, string $table[, array<string|int, mixed> $whereNotFields = [] ]) : int|null
Parameters
- $update : array<string, float|int|string|MydbExpressionInterface|null>
- $whereFields : array<string|int, mixed>
- $table : string
- $whereNotFields : array<string|int, mixed> = []
Tags
Return values
int|nullupdateWhereMany()
public
updateWhereMany(array<string|int, mixed> $columnSetWhere, array<string|int, mixed> $where, string $table) : void
Parameters
- $columnSetWhere : array<string|int, mixed>
-
['col1' => [ ['current1', 'new1'], ['current2', 'new2']]
- $where : array<string|int, mixed>
-
['col2' => 'value2', 'col3' => ['v3', 'v4']]
- $table : string
-
'mytable'
Tags
connect()
protected
connect([int $retry = 0 ]) : bool
Parameters
- $retry : int = 0
Tags
Return values
boolonError()
protected
onError(MydbException $exception[, string|null $sql = null ]) : void
Parameters
- $exception : MydbException
- $sql : string|null = null
Tags
onWarning()
protected
onWarning(string $warningMessage[, string|null $sql = null ]) : void
Parameters
- $warningMessage : string
- $sql : string|null = null
readServerResponse()
protected
readServerResponse(string $query) : MydbMysqliResultInterface|null
Parameters
- $query : string
Tags
Return values
MydbMysqliResultInterface|nullsendClientRequest()
protected
sendClientRequest(string $query) : bool
Parameters
- $query : string