Database
in package
Database Class
Tags
Table of Contents
- $connection : mysqli
- $db_data : array<string|int, mixed>
- DB Data
- $debug : DebugLib
- $last_query : string
- __construct() : mixed
- Constructor
- affectedRows() : array<string|int, mixed>
- affectedRows
- backupDb() : string
- backupDb
- beginTransaction() : void
- Start a transaction
- closeConnection() : bool
- closeConnection
- commitTransaction() : void
- Confirm and commit a transaction
- escapeValue() : mixed
- escapeValue
- fetchAll() : array<string|int, mixed>
- fetchAll
- fetchArray() : array<string|int, mixed>
- fetchArray
- fetchAssoc() : array<string|int, mixed>
- fetchAssoc
- fetchRow() : array<string|int, mixed>
- fetchRow
- freeResult() : void
- freeResult
- insertId() : int
- insertId
- numFields() : int
- numFields
- numRows() : int
- numRows
- openConnection() : void
- Open connection
- query() : mixed
- query
- queryFetch() : mixed
- queryFetch
- queryFetchAll() : mixed
- queryFetchAll
- queryMulty() : mixed
- Multi Query
- rollbackTransaction() : void
- Rollback changes since transaction begin
- serverInfo() : array<string|int, mixed>
- serverInfo
- setAutoCommit() : void
- Set the auto commit for transactions
- testConnection() : bool
- Test if MySQLi connection was stablished
- tryConnection() : mysqli
- tryConnection
- tryDatabase() : bool
- tryDatabase
- confirmQuery() : void
- confirmQuery
- prepareSql() : string
- Prepares the query string to be ready to be executed
Properties
$connection
private
mysqli
$connection
$db_data
DB Data
private
array<string|int, mixed>
$db_data
= ['host' => '', 'user' => '', 'pass' => '', 'name' => '', 'prefix' => '']
$debug
private
DebugLib
$debug
$last_query
private
string
$last_query
Methods
__construct()
Constructor
public
__construct() : mixed
Return values
mixed —affectedRows()
affectedRows
public
affectedRows() : array<string|int, mixed>
Return values
array<string|int, mixed> —backupDb()
backupDb
public
backupDb([array<string|int, mixed> $tables = '*' ]) : string
Parameters
- $tables : array<string|int, mixed> = '*'
-
Data
Return values
string —beginTransaction()
Start a transaction
public
beginTransaction() : void
Return values
void —closeConnection()
closeConnection
public
closeConnection() : bool
Return values
bool —commitTransaction()
Confirm and commit a transaction
public
commitTransaction() : void
Return values
void —escapeValue()
escapeValue
public
escapeValue(mixed $value) : mixed
Parameters
- $value : mixed
-
Value to escape
Return values
mixed —fetchAll()
fetchAll
public
fetchAll(array<string|int, mixed> $result_set) : array<string|int, mixed>
Parameters
- $result_set : array<string|int, mixed>
-
Result set
Return values
array<string|int, mixed> —fetchArray()
fetchArray
public
fetchArray(array<string|int, mixed> $result_set) : array<string|int, mixed>
Parameters
- $result_set : array<string|int, mixed>
-
Result set
Return values
array<string|int, mixed> —fetchAssoc()
fetchAssoc
public
fetchAssoc(array<string|int, mixed> $result_set) : array<string|int, mixed>
Parameters
- $result_set : array<string|int, mixed>
-
Result set
Return values
array<string|int, mixed> —fetchRow()
fetchRow
public
fetchRow(array<string|int, mixed> $result_set) : array<string|int, mixed>
Parameters
- $result_set : array<string|int, mixed>
-
Result set
Return values
array<string|int, mixed> —freeResult()
freeResult
public
freeResult(array<string|int, mixed> $result_set) : void
Parameters
- $result_set : array<string|int, mixed>
-
Result set
Return values
void —insertId()
insertId
public
insertId() : int
Return values
int —numFields()
numFields
public
numFields(array<string|int, mixed> $result_set) : int
Parameters
- $result_set : array<string|int, mixed>
-
Result set
Return values
int —numRows()
numRows
public
numRows(array<string|int, mixed> $result_set) : int
Parameters
- $result_set : array<string|int, mixed>
-
Result set
Return values
int —openConnection()
Open connection
public
openConnection() : void
Return values
void —query()
query
public
query([string $sql = '' ]) : mixed
Parameters
- $sql : string = ''
-
SQL String
Return values
mixed —queryFetch()
queryFetch
public
queryFetch([string $sql = '' ]) : mixed
Parameters
- $sql : string = ''
-
SQL String
Return values
mixed —queryFetchAll()
queryFetchAll
public
queryFetchAll([string $sql = '' ]) : mixed
Parameters
- $sql : string = ''
-
SQL String
Return values
mixed —queryMulty()
Multi Query
public
queryMulty([string $sql = '' ]) : mixed
Parameters
- $sql : string = ''
-
SQL String
Return values
mixed —rollbackTransaction()
Rollback changes since transaction begin
public
rollbackTransaction() : void
Return values
void —serverInfo()
serverInfo
public
serverInfo() : array<string|int, mixed>
Return values
array<string|int, mixed> —setAutoCommit()
Set the auto commit for transactions
public
setAutoCommit([bool $status = true ]) : void
Parameters
- $status : bool = true
Return values
void —testConnection()
Test if MySQLi connection was stablished
public
testConnection() : bool
Return values
bool —tryConnection()
tryConnection
public
tryConnection([string $host = '' ][, string $user = '' ][, string $pass = null ]) : mysqli
Parameters
- $host : string = ''
-
Host
- $user : string = ''
-
User
- $pass : string = null
-
Pass
Return values
mysqli —tryDatabase()
tryDatabase
public
tryDatabase(string $db_name) : bool
Parameters
- $db_name : string
-
DB Name
Return values
bool —confirmQuery()
confirmQuery
private
confirmQuery(array<string|int, mixed> $result) : void
Parameters
- $result : array<string|int, mixed>
-
Result set
Return values
void —prepareSql()
Prepares the query string to be ready to be executed
private
prepareSql(string $query) : string
Parameters
- $query : string