libasynql  3.2.0
Asynchronous MySQL access library for PocketMine plugins.
MysqlCredentials Class Reference
Inheritance diagram for MysqlCredentials:

Public Member Functions

 __construct (string $host, string $username, string $password, string $schema, int $port=3306, string $socket="")
 
 newMysqli ()
 
 __toString ()
 
 __debugInfo ()
 
 jsonSerialize ()
 

Static Public Member Functions

static fromArray (array $array, ?string $defaultSchema=null)
 

Detailed Description

Definition at line 31 of file MysqlCredentials.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( string  $host,
string  $username,
string  $password,
string  $schema,
int  $port = 3306,
string  $socket = "" 
)

Constructs a new MysqlCredentials by passing parameters directly.

Parameters
string$host
string$username
string$password
string$schema
int$port
string$socket

Definition at line 79 of file MysqlCredentials.php.

Member Function Documentation

◆ __debugInfo()

__debugInfo ( )

Prepares value to be var_dump()'ed without leaking password

Returns
array

Definition at line 117 of file MysqlCredentials.php.

◆ __toString()

__toString ( )

Produces a human-readable output without leaking password

Returns
string

Definition at line 108 of file MysqlCredentials.php.

◆ fromArray()

static fromArray ( array  $array,
?string  $defaultSchema = null 
)
static

Creates a new MysqlCredentials instance from an array (e.g. from Config), with the following defaults:

host: 127.0.0.1
username: root
password: ""
schema: {$defaultSchema}
port: 3306
socket: ""
Parameters
array$array
string | null$defaultSchemadefault null
Returns
MysqlCredentials
Exceptions
ConfigExceptionIf schema is missing and $defaultSchema is null/not passed

Definition at line 61 of file MysqlCredentials.php.

◆ jsonSerialize()

jsonSerialize ( )

Definition at line 128 of file MysqlCredentials.php.

◆ newMysqli()

newMysqli ( )

Creates a new mysqli instance

Returns
mysqli
Exceptions
SqlError

Definition at line 95 of file MysqlCredentials.php.


The documentation for this class was generated from the following file: