MySqlDatabase
in package
implements
IDatabaseDriver
Table of Contents
Interfaces
Properties
Methods
- __config() : mixed
- __construct() : mixed
- debug() : mixed
- Debugs a Query, returns the processed query
- escape() : string
- Escapes a string
- getConnectionError() : null|string
- Gets the last Connection Error
- getFirstRow() : null|array<string|int, mixed>
- Returns the first row affected by a SQL query.
- getFirstRowColumn() : null|string
- Returns the specific column of the first row affected by a SQL query.
- getLastInsertId() : int|string
- Gets the Last Inserted Id
- getPrefix() : string|null
- Returns the current table prefix
- getRows() : null|array<string|int, mixed>
- Returns all rows from a SQL query.
- getRowsAffected() : int
- Gets the amount of rows affected by the last query
- getRowsOneColumn() : null|array<string|int, mixed>
- Returns a single column from all rows affected by a SQL query.
- hasRowsAffected() : int
- Executes a SQL query and returns the number of rows affected by it.
- isAlive() : bool
- Pings the Database and returns if the connection was successful
- isConnected() : bool
- Gets whether the Initial connection has been established
- New() : MySqlDatabase|null
- prepareAndQuery() : mixed
- prepareQuery() : mixed
- query() : mixed
- replaceAndEscape() : mixed
- setCharset() : mixed
- setConfig() : mixed
- Sets the table configuration for the driver to use.
- setPrefix() : void
- Sets the table prefix to be used for all queries.
Properties
$mysqli
private
mixed
$mysqli
$prefix
private
mixed
$prefix
Methods
__config()
public
__config(mixed $host, mixed $username, mixed $password, mixed $database[, mixed $tablePrefix = null ][, mixed $charset = "utf8" ]) : mixed
Parameters
- $host : mixed
- $username : mixed
- $password : mixed
- $database : mixed
- $tablePrefix : mixed = null
- $charset : mixed = "utf8"
__construct()
public
__construct(mixed $config) : mixed
Parameters
- $config : mixed
debug()
Debugs a Query, returns the processed query
public
debug(mixed $query[, mixed $inserts = null ][, mixed $hyphen = NULL ]) : mixed
Parameters
- $query : mixed
-
Query to execute
- $inserts : mixed = null
-
Escapable Inserts
- $hyphen : mixed = NULL
-
Hyphen for the inserts
escape()
Escapes a string
public
escape(mixed $str[, mixed $hyphen = null ]) : string
Parameters
- $str : mixed
-
String to escape
- $hyphen : mixed = null
-
Hyphen for the string
Return values
stringgetConnectionError()
Gets the last Connection Error
public
getConnectionError() : null|string
Return values
null|stringgetFirstRow()
Returns the first row affected by a SQL query.
public
getFirstRow(mixed $query[, mixed $inserts = null ][, mixed $hyphen = null ][, mixed $bypassCache = false ]) : null|array<string|int, mixed>
Parameters
- $query : mixed
-
The query to execute.
- $inserts : mixed = null
-
The values to be inserted into the query.
- $hyphen : mixed = null
-
The string to use as a placeholder for inserts.
- $bypassCache : mixed = false
-
Whether the cache should be bypassed
Return values
null|array<string|int, mixed> —The first row returned by the query or null if the query fails.
getFirstRowColumn()
Returns the specific column of the first row affected by a SQL query.
public
getFirstRowColumn(mixed $query, mixed $column[, mixed $inserts = null ][, mixed $hyphen = null ]) : null|string
Parameters
- $query : mixed
-
The query to execute.
- $column : mixed
-
The column to extract.
- $inserts : mixed = null
-
The values to be inserted into the
- $hyphen : mixed = null
Return values
null|stringgetLastInsertId()
Gets the Last Inserted Id
public
getLastInsertId() : int|string
Return values
int|stringgetPrefix()
Returns the current table prefix
public
getPrefix() : string|null
Return values
string|null —The current table prefix or null if not set.
getRows()
Returns all rows from a SQL query.
public
getRows(mixed $query[, mixed $inserts = null ][, mixed $hyphen = null ][, mixed $bypassCache = false ]) : null|array<string|int, mixed>
Parameters
- $query : mixed
-
The query to execute.
- $inserts : mixed = null
-
The values to be inserted into the query.
- $hyphen : mixed = null
-
The string to use as a placeholder for inserts.
- $bypassCache : mixed = false
-
Whether the cache should be bypassed
Return values
null|array<string|int, mixed> —The rows returned by the query or null if the query fails.
getRowsAffected()
Gets the amount of rows affected by the last query
public
getRowsAffected() : int
Return values
intgetRowsOneColumn()
Returns a single column from all rows affected by a SQL query.
public
getRowsOneColumn(mixed $query, mixed $column[, mixed $inserts = null ][, mixed $hyphen = null ]) : null|array<string|int, mixed>
Parameters
- $query : mixed
-
The query to execute.
- $column : mixed
-
The column to extract.
- $inserts : mixed = null
-
The values to be inserted into the query.
- $hyphen : mixed = null
-
The string to use as a placeholder for inserts.
Return values
null|array<string|int, mixed> —The values of the specified column or null if the query fails.
hasRowsAffected()
Executes a SQL query and returns the number of rows affected by it.
public
hasRowsAffected(mixed $query[, mixed $inserts = null ][, mixed $hyphen = null ]) : int
Parameters
- $query : mixed
-
The query to execute.
- $inserts : mixed = null
-
The values to be inserted into the query.
- $hyphen : mixed = null
-
The string to use as a placeholder for inserts.
Return values
int —The number of rows affected.
isAlive()
Pings the Database and returns if the connection was successful
public
isAlive() : bool
Return values
boolisConnected()
Gets whether the Initial connection has been established
public
isConnected() : bool
Return values
boolNew()
public
static New(mixed $host, mixed $username, mixed $password, mixed $database[, mixed $tablePrefix = null ][, mixed $charset = "utf8" ]) : MySqlDatabase|null
Parameters
- $host : mixed
- $username : mixed
- $password : mixed
- $database : mixed
- $tablePrefix : mixed = null
- $charset : mixed = "utf8"
Return values
MySqlDatabase|nullprepareAndQuery()
public
prepareAndQuery(mixed $query[, mixed $inserts = null ][, mixed $hyphen = NULL ]) : mixed
Parameters
- $query : mixed
- $inserts : mixed = null
- $hyphen : mixed = NULL
prepareQuery()
public
prepareQuery(mixed $query[, mixed $inserts = null ][, mixed $hyphen = NULL ]) : mixed
Parameters
- $query : mixed
- $inserts : mixed = null
- $hyphen : mixed = NULL
query()
public
query(mixed $query) : mixed
Parameters
- $query : mixed
replaceAndEscape()
public
replaceAndEscape(mixed $str, mixed $replace[, mixed $hyphen = NULL ]) : mixed
Parameters
- $str : mixed
- $replace : mixed
- $hyphen : mixed = NULL
setCharset()
public
setCharset(mixed $charset) : mixed
Parameters
- $charset : mixed
setConfig()
Sets the table configuration for the driver to use.
public
setConfig(mixed $config) : mixed
Parameters
- $config : mixed
setPrefix()
Sets the table prefix to be used for all queries.
public
setPrefix(mixed $dbPrefix) : void
Parameters
- $dbPrefix : mixed
-
The prefix for the table names.