Rebar Project - MySQL Engine
Public Member Functions | List of all members
MysqlConnection Class Reference

Public Member Functions

 connect ($dbhost, $dbname, $dbuser, $dbpass)
 
 ping ()
 
 close ()
 
 rawQuery ($sqlstring)
 
 createPS ($sqlstring)
 
 lastError ()
 

Detailed Description

SVN

Id
MysqlConnection.php 14 2017-02-02 21:06:24Z phil
Author
Phil Riesch phil@.nosp@m.phil.nosp@m.riesc.nosp@m.h.co.nosp@m.m

LICENSE

The PHP Rebar Project Copyright 2017 Philip Riesch phil@.nosp@m.phil.nosp@m.riesc.nosp@m.h.co.nosp@m.m

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

– Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

– Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

– Neither the name of Philip J. Riesch nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PHILIP J. RIESCH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

DESCRIPTION

The MysqlConnection controls the tangible connection to a specific Mysql Server instance. This class is used by MysqlFacets in order to use the mysqli library in order to execute queries on the database.

Member Function Documentation

MysqlConnection::close ( )

Close the database connection.

MysqlConnection::connect (   $dbhost,
  $dbname,
  $dbuser,
  $dbpass 
)

Connect to the Mysql database. Throws Exception if error occurs.

Parameters
$dbhoststring Database hostname
$dbnamestring Target database name
$dbuserstring Authorized database username
$dbpassstring Database user password
MysqlConnection::createPS (   $sqlstring)

Used by the bound MysqlFacet class(es). Creates a new prepared statement for making read and write queries on the database.

Parameters
$sqlstringstring The SQL string to prepare
MysqlConnection::lastError ( )

Used by the bound MysqlFacet class(es). If an error occurrs during query execution, then retrieve the mysqli error string that was generated.

MysqlConnection::ping ( )

Ping the Mysql database to check connectivity. Throws Exception if the database could not be pinged.

MysqlConnection::rawQuery (   $sqlstring)

Used by the bound MysqlFacet class(es). Makes a raw query on the database.

This is used by ControlQueries, since mysqli prepared statements currently do not support control commands like LOCK, START TRANSACTION, etc.

Parameters
$sqlstringstring The SQL string to execute

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