Class: AlphaDAOProviderMySQL
Source Location: /model/AlphaDAOProviderMySQL.inc
Class AlphaDAOProviderMySQL
Class Overview
Implements interfaces:
MySQL DAO provider (uses the MySQLi native API in PHP).
Located in /model/AlphaDAOProviderMySQL.inc [line 49]
Author(s):
- John Collins <dev@alphaframework.org>
Information Tags:
Version: | $Id: AlphaDAOProviderMySQL.inc 1453 2011-12-04 15:12:54Z johnc $ |
Copyright: | Copyright (c) 2011, John Collins (founder of Alpha Framework). All rights reserved. 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 the Alpha Framework 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 THE COPYRIGHT HOLDER OR
CONTRIBUTORS 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. |
Since: | 1.1 |
License: | The BSD License |
|
Methods
|
Method Summary
static
void
|
begin() |
(non-PHPdoc) |
static
void
|
commit() |
(non-PHPdoc) |
void |
query() |
(non-PHPdoc) |
void |
setBO() |
(non-PHPdoc) |
Methods
(non-PHPdoc)
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::begin() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::begin()
- Starts a new database transaction.
static void checkBOTableExists(
$BOClassName
)
|
|
(non-PHPdoc)
Parameters:
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::checkBOTableExists() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::checkBOTableExists()
- Static method to check the database and see if the table for the indicated BO class name exists (assumes table name will be $BOClassName less "Object").
(non-PHPdoc)
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::commit() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::commit()
- Commits the current database transaction.
static void disconnect(
)
|
|
(non-PHPdoc)
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::disconnect() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::disconnect()
- Disconnects the current database connection if one exists (self::$connection is set)
static void getConnection(
)
|
|
(non-PHPdoc)
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::getConnection() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::getConnection()
- Gets the current connection singleton, or creates a new one if none exists
static void getLastDatabaseError(
)
|
|
(non-PHPdoc)
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::getLastDatabaseError() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::getLastDatabaseError()
- Returns the last database error string for the current connection.
(non-PHPdoc)
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::rollback() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::rollback()
- Aborts the current database transaction.
AlphaDAOProviderMySQL __construct(
)
|
|
The constructor
API Tags:
Information Tags:
void addProperty(
$propName
)
|
|
(non-PHPdoc)
Parameters:
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::addProperty() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::addProperty()
- Adds in a new class property without loosing existing data (does an ALTER TABLE query on the database).
void checkRecordExists(
$OID
)
|
|
(non-PHPdoc)
Parameters:
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::checkRecordExists() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::checkRecordExists()
- Checks that a record exists for the BO in the database.
(non-PHPdoc)
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::checkTableExists() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::checkTableExists()
- Checks to see if the table exists in the database for the current business class.
void checkTableNeedsUpdate(
)
|
|
(non-PHPdoc)
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::checkTableNeedsUpdate() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::checkTableNeedsUpdate()
- Checks to see if the table in the database matches (for fields) the business class definition, i.e. if the database table is in sync with the class definition.
void createForeignIndex(
$attributeName,
$relatedClass,
$relatedClassAttribute
)
|
|
(non-PHPdoc)
Parameters:
|
$attributeName: |
|
|
$relatedClass: |
|
|
$relatedClassAttribute: |
|
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::createForeignIndex() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::createForeignIndex()
- Creates a foreign key constraint (index) in the database on the given attribute.
void createUniqueIndex(
$attribute1Name, [
$attribute2Name = ''], [
$attribute3Name = '']
)
|
|
(non-PHPdoc)
Parameters:
|
$attribute1Name: |
|
|
$attribute2Name: |
|
|
$attribute3Name: |
|
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::createUniqueIndex() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::createUniqueIndex()
- Creates a unique index in the database on the given attribute(s).
(non-PHPdoc)
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::delete() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::delete()
- Deletes the current object from the database.
void dropTable(
[
$tableName = null]
)
|
|
(non-PHPdoc)
Parameters:
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::dropTable() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::dropTable()
- Drops the table if the model requirements have changed. All data is lost!
void findMissingFields(
)
|
|
(non-PHPdoc)
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::findMissingFields() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::findMissingFields()
- Returns an array containing any properties on the class which have not been created on the database table yet.
void getCount(
[
$attributes = array()], [
$values = array()]
)
|
|
(non-PHPdoc)
Parameters:
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::getCount() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::getCount()
- Gets the count from the database for the amount of objects of this class.
(non-PHPdoc)
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::getIndexes() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::getIndexes()
- Gets an array of all of the names of the active database indexes for this class.
(non-PHPdoc)
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::getMAX() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::getMAX()
- Gets the maximum OID value from the database for this class type.
(non-PHPdoc)
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::getVersion() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::getVersion()
- Gets the version_num of the object from the database (returns 0 if the BO is not saved yet).
void isTableOverloaded(
)
|
|
(non-PHPdoc)
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::isTableOverloaded() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::isTableOverloaded()
- Checks to see if the table name matches the classname, and if not if the table name matches the classname name of another BO, i.e. the table is used to store multiple types of BOs.
(non-PHPdoc)
Parameters:
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::load() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::load()
- Populates the child object with the properties retrived from the database for the object $OID.
void loadAll(
[
$start = 0], [
$limit = 0], [
$orderBy = 'OID'], [
$order = 'ASC'], [
$ignoreClassType = false]
)
|
|
(non-PHPdoc)
Parameters:
|
$start: |
|
|
$limit: |
|
|
$orderBy: |
|
|
$order: |
|
|
$ignoreClassType: |
|
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::loadAll() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::loadAll()
- Loads all of the objects of this class into an array which is returned.
void loadAllByAttribute(
$attribute,
$value, [
$start = 0], [
$limit = 0], [
$orderBy = "OID"], [
$order = "ASC"], [
$ignoreClassType = false], [
$constructorArgs = array()]
)
|
|
(non-PHPdoc)
Parameters:
|
$attribute: |
|
|
$value: |
|
|
$start: |
|
|
$limit: |
|
|
$orderBy: |
|
|
$order: |
|
|
$ignoreClassType: |
|
|
$constructorArgs: |
|
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::loadAllByAttribute() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::loadAllByAttribute()
- Loads all of the objects of this class by the specified attribute into an array which is returned.
void loadAllByAttributes(
[
$attributes = array()], [
$values = array()], [
$start = 0], [
$limit = 0], [
$orderBy = 'OID'], [
$order = 'ASC'], [
$ignoreClassType = false]
)
|
|
(non-PHPdoc)
Parameters:
|
$attributes: |
|
|
$values: |
|
|
$start: |
|
|
$limit: |
|
|
$orderBy: |
|
|
$order: |
|
|
$ignoreClassType: |
|
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::loadAllByAttributes() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::loadAllByAttributes()
- Loads all of the objects of this class by the specified attributes into an array which is returned.
void loadAllByDayUpdated(
$date, [
$start = 0], [
$limit = 0], [
$orderBy = "OID"], [
$order = "ASC"], [
$ignoreClassType = false]
)
|
|
(non-PHPdoc)
Parameters:
|
$date: |
|
|
$start: |
|
|
$limit: |
|
|
$orderBy: |
|
|
$order: |
|
|
$ignoreClassType: |
|
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::loadAllByDayUpdated() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::loadAllByDayUpdated()
- Loads all of the objects of this class that where updated (updated_ts value) on the date indicated.
void loadAllFieldValuesByAttribute(
$attribute,
$value,
$returnAttribute, [
$order = 'ASC'], [
$ignoreClassType = false]
)
|
|
(non-PHPdoc)
Parameters:
|
$attribute: |
|
|
$value: |
|
|
$returnAttribute: |
|
|
$order: |
|
|
$ignoreClassType: |
|
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::loadAllFieldValuesByAttribute() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::loadAllFieldValuesByAttribute()
- Loads all of the specified attribute values of this class by the specified attribute into an array which is returned.
void loadByAttribute(
$attribute,
$value, [
$ignoreClassType = false], [
$loadAttributes = array()]
)
|
|
(non-PHPdoc)
Parameters:
|
$attribute: |
|
|
$value: |
|
|
$ignoreClassType: |
|
|
$loadAttributes: |
|
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::loadByAttribute() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::loadByAttribute()
- Populates the child object from the database table by the given attribute value.
(non-PHPdoc)
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::makeTable() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::makeTable()
- Builds a new database table for the BO class.
(non-PHPdoc)
Parameters:
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::query() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::query()
- Returns a 2d array, where each element in the array is another array representing a database row.
(non-PHPdoc)
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::rebuildTable() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::rebuildTable()
- Re-builds the table if the model requirements have changed. All data is lost!
(non-PHPdoc)
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::reload() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::reload()
- Reloads the object from the database, overwritting any attribute values in memory.
(non-PHPdoc)
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::save() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::save()
- Saves the object. If $this->OID is empty or null it will INSERT, otherwise UPDATE.
void saveAttribute(
$attribute,
$value
)
|
|
(non-PHPdoc)
Parameters:
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::saveAttribute() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::saveAttribute()
- Saves the field specified with the value supplied. Only works for persistent BOs. Note that no Alpha type validation is performed with this method!
(non-PHPdoc)
Parameters:
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::setBO() |
Access: | public |
Implementation of:
- AlphaDAOProviderInterface::setBO()
- Provide the BO that we are going to map the data to from this provider.
(non-PHPdoc)
API Tags:
See: | alpha/model/AlphaDAOProviderInterface::setEnumOptions() |
Access: | public |
Information Tags:
Implementation of:
- AlphaDAOProviderInterface::setEnumOptions()
- Populate all of the enum options for this object from the database.
|
|