\MainWP\ChildMainWP_Child_DB

Class MainWP_Child_DB

Handles all of the Child Plugin's DB functions.

Summary

Methods
Properties
Constants
use_mysqli()
to_query()
fetch_array()
num_rows()
connect()
select_db()
error()
real_escape_string()
is_result()
get_size()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

use_mysqli()

use_mysqli() : boolean|object

Support old & new versions of WordPress (3.9+).

Returns

boolean|object —

Instantiated object of \mysqli.

to_query()

to_query(string  $query, string  $link) : boolean|\mysqli_result|resource

Run a mysqli query & get a result.

Parameters

string $query

An SQL query.

string $link

A link identifier.

Returns

boolean|\mysqli_result|resource —

For successful SELECT, SHOW, DESCRIBE or EXPLAIN queries, mysqli_query() will return a mysqli_result object. For other successful queries mysqli_query() will return TRUE. Returns FALSE on failure.

fetch_array()

fetch_array(array  $result) : array|false|null

Fetch an array.

Parameters

array $result

A result set identifier.

Returns

array|false|null —

Returns an array of strings that corresponds to the fetched row, or false if there are no more rows.

num_rows()

num_rows(array  $result) : false|integer

Count the number of rows.

Parameters

array $result

A result set identifier returned.

Returns

false|integer —

Returns number of rows in the result set.

connect()

connect(string  $host, string  $user, string  $pass) : false|\mysqli|resource

Connect to Child Site Database.

Parameters

string $host

Can be either a host name or an IP address.

string $user

The MySQL user name.

string $pass

The MySQL user password.

Returns

false|\mysqli|resource —

object which represents the connection to a MySQL Server or false if an error occurred.

select_db()

select_db(string  $db) : boolean

Select Child Site DB.

Parameters

string $db

Database name.

Returns

boolean —

true on success or false on failure.

error()

error() : string

Get any mysqli errors.

Returns

string —

the error text from the last MySQL function, or '' (empty string) if no error occurred.

real_escape_string()

real_escape_string(string  $value) : false|string

Escape a given string.

Parameters

string $value

The string to be escaped. Characters encoded are NUL (ASCII 0), \n, \r, \, ', ", and Control-Z.

Returns

false|string —

the escaped string, or false on error.

is_result()

is_result(resource  $result) : resource|boolean

Check if $result is an Instantiated object of \mysqli.

Parameters

resource $result

Instantiated object of \mysqli.

Returns

resource|boolean —

Instantiated object of \mysqli, true if var is a resource, false otherwise.

get_size()

get_size() : integer|mixed

Get the size of the DB.

Returns

integer|mixed —

Size of the DB or false on failure.