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

Public Member Functions

 __construct ($connection)
 

Protected Member Functions

 queryPrepare ($queryobj)
 
 queryExec ($querydata=null)
 
 lastSelectResult (&$result)
 
 lastInsertID (&$insert_id)
 
 queryFinish ()
 

Detailed Description

SVN

Id
MysqlFacet.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 MysqlFacet class is the abstract base class that you should use to build model-specific partitions of your database schema.

This class allows you to group queries into logical "facets" of a larger system. These facets are then bound to MysqlConnection objects that direct the facet towards where they should be submitting their queries for processing.

This is the abstract base class that you would implement in order to create your database access class(es).

Constructor & Destructor Documentation

MysqlFacet::__construct (   $connection)

Constructor. Assigns the database connection that should be used.

Parameters
$connectionMysqlConnection The connection to use

Member Function Documentation

MysqlFacet::lastInsertID ( $insert_id)
protected

If the last query that you executed was of type InsertQuery, and the table that you queried on contains an auto-incrementing primary key, you would use this function in order to retrieve the last generated insert ID.

Attempting to call this function when the prepared query is not of type InsertQuery will result in an exception being raised.

Parameters
&$insert_idint The insert ID is written to this ref
MysqlFacet::lastSelectResult ( $result)
protected

If the last Query that you executed was of type SelectQuery, you would use this function in order to retrieve the result of the last execution.

Attempting to call this function when the prepared query is not of type SelectQuery will result in an Exception being raised.

Parameters
&$resultarray The result is written as an array to this ref
MysqlFacet::queryExec (   $querydata = null)
protected

Once a query has been prepared using queryPrepare, use this function in order to execute a query. If your query requires that data also be passed into it, then you would pass it as an array.

Keep in mind that you only need to prepare a query once. You can then execute that query multiple times once it has been prepared.

Attempting to pass query data for a Query that is of type ControlQuery will result in an Exception being raised.

Parameters
$querydataarray|null The query data to pass to the query
MysqlFacet::queryFinish ( )
protected

Finish the query: close the prepared statement. Calling this function is required before subsequent calls to queryPrepare.

MysqlFacet::queryPrepare (   $queryobj)
protected

Prepare a new query for execution.

Attempting to prepare a new query without first closing an already prepared query using queryFinish will result in an Exception being raised.

Parameters
$queryobjQuery The query object to prepare.

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