A lightweight extension of PHP's mysqli in which we provide a additional error logging functionality and the ability to ask the connection what instance type it is.

Additionally this class will prevent any writing queries (insert/update) from executing.

package Sporcle
subpackage MysqliRO
author Dan Munro

 Methods

__construct() over-rides the native mysqli constructor in order to track the instance type of the db, otherwise the mysqli constructor docs still apply.

__construct(string $host, string $user, string $pass, string $db, int $instanceType) 
Inherited

returns Mysqli A new mysqli connection
inherited_from \Sporcle\DB\Mysqli::__construct()

Parameters

$host

string

The db host

$user

string

The db user

$pass

string

The db passwork

$db

string

The name of the database

$instanceType

int

The type of db connection requested

autocommit()

autocommit() 
Inherited

inherited_from mysqli::autocommit()
inherited_from \Sporcle\DB\Mysqli::autocommit()

change_user()

change_user() 
Inherited

inherited_from mysqli::change_user()
inherited_from \Sporcle\DB\Mysqli::change_user()

character_set_name()

character_set_name() 
Inherited

inherited_from mysqli::character_set_name()
inherited_from \Sporcle\DB\Mysqli::character_set_name()

close()

close() 
Inherited

inherited_from mysqli::close()
inherited_from \Sporcle\DB\Mysqli::close()

commit()

commit() 
Inherited

inherited_from mysqli::commit()
inherited_from \Sporcle\DB\Mysqli::commit()

connect()

connect() 
Inherited

inherited_from mysqli::connect()
inherited_from \Sporcle\DB\Mysqli::connect()

debug()

debug() 
Inherited

inherited_from mysqli::debug()
inherited_from \Sporcle\DB\Mysqli::debug()

dump_debug_info()

dump_debug_info() 
Inherited

inherited_from mysqli::dump_debug_info()
inherited_from \Sporcle\DB\Mysqli::dump_debug_info()

escape_string()

escape_string() 
Inherited

inherited_from mysqli::escape_string()
inherited_from \Sporcle\DB\Mysqli::escape_string()

Returns the instance type of the connection passed to the object in its constructor.

getInstanceType() : int
Inherited

inherited_from \Sporcle\DB\Mysqli::getInstanceType()

Returns

intThe instance type of the connection.

get_charset()

get_charset() 
Inherited

inherited_from mysqli::get_charset()
inherited_from \Sporcle\DB\Mysqli::get_charset()

get_client_info()

get_client_info() 
Inherited

inherited_from mysqli::get_client_info()
inherited_from \Sporcle\DB\Mysqli::get_client_info()

get_server_info()

get_server_info() 
Inherited

inherited_from mysqli::get_server_info()
inherited_from \Sporcle\DB\Mysqli::get_server_info()

get_warnings()

get_warnings() 
Inherited

inherited_from mysqli::get_warnings()
inherited_from \Sporcle\DB\Mysqli::get_warnings()

init()

init() 
Inherited

inherited_from mysqli::init()
inherited_from \Sporcle\DB\Mysqli::init()

kill()

kill() 
Inherited

inherited_from mysqli::kill()
inherited_from \Sporcle\DB\Mysqli::kill()

more_results()

more_results() 
Inherited

inherited_from mysqli::more_results()
inherited_from \Sporcle\DB\Mysqli::more_results()

multi_query()

multi_query() 
Inherited

inherited_from mysqli::multi_query()
inherited_from \Sporcle\DB\Mysqli::multi_query()

mysqli()

mysqli() 
Inherited

inherited_from mysqli::mysqli()
inherited_from \Sporcle\DB\Mysqli::mysqli()

next_result()

next_result() 
Inherited

inherited_from mysqli::next_result()
inherited_from \Sporcle\DB\Mysqli::next_result()

options()

options() 
Inherited

inherited_from mysqli::options()
inherited_from \Sporcle\DB\Mysqli::options()

ping()

ping() 
Inherited

inherited_from mysqli::ping()
inherited_from \Sporcle\DB\Mysqli::ping()

prepare()

prepare() 
Inherited

inherited_from mysqli::prepare()
inherited_from \Sporcle\DB\Mysqli::prepare()

Queries the database with additional logging functionality and a check that the isn't attempting to write to a slave.

query(string $queryStr) : \Sporcle\DB\mysqli_result

Parameters

$queryStr

string

The SQL query to run against the database.

Returns

\Sporcle\DB\mysqli_resultThe result object from the query, or false on failure.

real_connect()

real_connect() 
Inherited

inherited_from mysqli::real_connect()
inherited_from \Sporcle\DB\Mysqli::real_connect()

real_escape_string()

real_escape_string() 
Inherited

inherited_from mysqli::real_escape_string()
inherited_from \Sporcle\DB\Mysqli::real_escape_string()

real_query()

real_query() 
Inherited

inherited_from mysqli::real_query()
inherited_from \Sporcle\DB\Mysqli::real_query()

refresh()

refresh() 
Inherited

inherited_from mysqli::refresh()
inherited_from \Sporcle\DB\Mysqli::refresh()

rollback()

rollback() 
Inherited

inherited_from mysqli::rollback()
inherited_from \Sporcle\DB\Mysqli::rollback()

select_db()

select_db() 
Inherited

inherited_from mysqli::select_db()
inherited_from \Sporcle\DB\Mysqli::select_db()

set_charset()

set_charset() 
Inherited

inherited_from mysqli::set_charset()
inherited_from \Sporcle\DB\Mysqli::set_charset()

set_local_infile_default()

set_local_infile_default() 
Inherited

inherited_from mysqli::set_local_infile_default()
inherited_from \Sporcle\DB\Mysqli::set_local_infile_default()

set_local_infile_handler()

set_local_infile_handler() 
Inherited

inherited_from mysqli::set_local_infile_handler()
inherited_from \Sporcle\DB\Mysqli::set_local_infile_handler()

set_opt()

set_opt() 
Inherited

inherited_from mysqli::set_opt()
inherited_from \Sporcle\DB\Mysqli::set_opt()

ssl_set()

ssl_set() 
Inherited

inherited_from mysqli::ssl_set()
inherited_from \Sporcle\DB\Mysqli::ssl_set()

stat()

stat() 
Inherited

inherited_from mysqli::stat()
inherited_from \Sporcle\DB\Mysqli::stat()

stmt_init()

stmt_init() 
Inherited

inherited_from mysqli::stmt_init()
inherited_from \Sporcle\DB\Mysqli::stmt_init()

store_result()

store_result() 
Inherited

inherited_from mysqli::store_result()
inherited_from \Sporcle\DB\Mysqli::store_result()

thread_safe()

thread_safe() 
Inherited

inherited_from mysqli::thread_safe()
inherited_from \Sporcle\DB\Mysqli::thread_safe()

use_result()

use_result() 
Inherited

inherited_from mysqli::use_result()
inherited_from \Sporcle\DB\Mysqli::use_result()

Checks if the query that is about to be performed will write to the database.

isQueryWriting(string $queryStr) 

If so, that is a problem because this is a read only connection.

access private

Parameters

$queryStr

string

The SQL query to run against the database.

 Properties

 

<p>is used when deterimining if the query can be performed against the connection. This will be useful primarily when preventing insert or update queries from running on a slave.</p>

$instanceType : int
Inherited

inherited_from \Sporcle\DB\Mysqli::$$instanceType