Alpha Framework alpha--model
[ class tree: alpha--model ] [ index: alpha--model ] [ all elements ]

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

[ Top ]
Method Summary
static void   begin()   (non-PHPdoc)
static void   checkBOTableExists()   (non-PHPdoc)
static void   commit()   (non-PHPdoc)
static void   disconnect()   (non-PHPdoc)
static void   getConnection()   (non-PHPdoc)
static void   getLastDatabaseError()   (non-PHPdoc)
static void   rollback()   (non-PHPdoc)
AlphaDAOProviderMySQL   __construct()   The constructor
void   addProperty()   (non-PHPdoc)
void   checkRecordExists()   (non-PHPdoc)
void   checkTableExists()   (non-PHPdoc)
void   checkTableNeedsUpdate()   (non-PHPdoc)
void   createForeignIndex()   (non-PHPdoc)
void   createUniqueIndex()   (non-PHPdoc)
void   delete()   (non-PHPdoc)
void   dropTable()   (non-PHPdoc)
void   findMissingFields()   (non-PHPdoc)
void   getCount()   (non-PHPdoc)
void   getIndexes()   (non-PHPdoc)
void   getMAX()   (non-PHPdoc)
void   getVersion()   (non-PHPdoc)
void   isTableOverloaded()   (non-PHPdoc)
void   load()   (non-PHPdoc)
void   loadAll()   (non-PHPdoc)
void   loadAllByAttribute()   (non-PHPdoc)
void   loadAllByAttributes()   (non-PHPdoc)
void   loadAllByDayUpdated()   (non-PHPdoc)
void   loadAllFieldValuesByAttribute()   (non-PHPdoc)
void   loadByAttribute()   (non-PHPdoc)
void   makeTable()   (non-PHPdoc)
void   query()   (non-PHPdoc)
void   rebuildTable()   (non-PHPdoc)
void   reload()   (non-PHPdoc)
void   save()   (non-PHPdoc)
void   saveAttribute()   (non-PHPdoc)
void   setBO()   (non-PHPdoc)
void   setEnumOptions()   (non-PHPdoc)

[ Top ]
Methods
static method begin  [line 1802]

  static void begin( )

(non-PHPdoc)


API Tags:
See:  alpha/model/AlphaDAOProviderInterface::begin()
Access:  public


Implementation of:
AlphaDAOProviderInterface::begin()
Starts a new database transaction.

[ Top ]
static method checkBOTableExists  [line 1306]

  static void checkBOTableExists( $BOClassName  )

(non-PHPdoc)

Parameters:
   $BOClassName: 

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").

[ Top ]
static method commit  [line 1817]

  static void commit( )

(non-PHPdoc)


API Tags:
See:  alpha/model/AlphaDAOProviderInterface::commit()
Access:  public


Implementation of:
AlphaDAOProviderInterface::commit()
Commits the current database transaction.

[ Top ]
static method disconnect  [line 108]

  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)

[ Top ]
static method getConnection  [line 90]

  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

[ Top ]
static method getLastDatabaseError  [line 119]

  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.

[ Top ]
static method rollback  [line 1832]

  static void rollback( )

(non-PHPdoc)


API Tags:
See:  alpha/model/AlphaDAOProviderInterface::rollback()
Access:  public


Implementation of:
AlphaDAOProviderInterface::rollback()
Aborts the current database transaction.

[ Top ]
Constructor __construct  [line 79]

  AlphaDAOProviderMySQL __construct( )

The constructor


API Tags:
Access:  public

Information Tags:
Since:  1.1

[ Top ]
addProperty  [line 1080]

  void addProperty( $propName  )

(non-PHPdoc)

Parameters:
   $propName: 

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).

[ Top ]
checkRecordExists  [line 1702]

  void checkRecordExists( $OID  )

(non-PHPdoc)

Parameters:
   $OID: 

API Tags:
See:  alpha/model/AlphaDAOProviderInterface::checkRecordExists()
Access:  public


Implementation of:
AlphaDAOProviderInterface::checkRecordExists()
Checks that a record exists for the BO in the database.

[ Top ]
checkTableExists  [line 1275]

  void checkTableExists( )

(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.

[ Top ]
checkTableNeedsUpdate  [line 1341]

  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.

[ Top ]
createForeignIndex  [line 1616]

  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.

[ Top ]
createUniqueIndex  [line 1658]

  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).

[ Top ]
delete  [line 884]

  void delete( )

(non-PHPdoc)


API Tags:
See:  alpha/model/AlphaDAOProviderInterface::delete()
Access:  public


Implementation of:
AlphaDAOProviderInterface::delete()
Deletes the current object from the database.

[ Top ]
dropTable  [line 1058]

  void dropTable( [ $tableName = null]  )

(non-PHPdoc)

Parameters:
   $tableName: 

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!

[ Top ]
findMissingFields  [line 1414]

  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.

[ Top ]
getCount  [line 1185]

  void getCount( [ $attributes = array()], [ $values = array()]  )

(non-PHPdoc)

Parameters:
   $attributes: 
   $values: 

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.

[ Top ]
getIndexes  [line 1477]

  void getIndexes( )

(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.

[ Top ]
getMAX  [line 1156]

  void getMAX( )

(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.

[ Top ]
getVersion  [line 910]

  void getVersion( )

(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).

[ Top ]
isTableOverloaded  [line 1744]

  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.

[ Top ]
load  [line 148]

  void load( $OID  )

(non-PHPdoc)

Parameters:
   $OID: 

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.

[ Top ]
loadAll  [line 347]

  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.

[ Top ]
loadAllByAttribute  [line 403]

  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.

[ Top ]
loadAllByAttributes  [line 503]

  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.

[ Top ]
loadAllByDayUpdated  [line 584]

  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.

[ Top ]
loadAllFieldValuesByAttribute  [line 625]

  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.

[ Top ]
loadByAttribute  [line 234]

  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.

[ Top ]
makeTable  [line 952]

  void makeTable( )

(non-PHPdoc)


API Tags:
See:  alpha/model/AlphaDAOProviderInterface::makeTable()
Access:  public


Implementation of:
AlphaDAOProviderInterface::makeTable()
Builds a new database table for the BO class.

[ Top ]
query  [line 127]

  void query( $sqlQuery  )

(non-PHPdoc)

Parameters:
   $sqlQuery: 

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.

[ Top ]
rebuildTable  [line 1037]

  void rebuildTable( )

(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!

[ Top ]
reload  [line 1687]

  void reload( )

(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.

[ Top ]
save  [line 661]

  void save( )

(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.

[ Top ]
saveAttribute  [line 854]

  void saveAttribute( $attribute, $value  )

(non-PHPdoc)

Parameters:
   $attribute: 
   $value: 

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!

[ Top ]
setBO  [line 1847]

  void setBO( $BO  )

(non-PHPdoc)

Parameters:
   $BO: 

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.

[ Top ]
setEnumOptions  [line 1228]

  void setEnumOptions( )

(non-PHPdoc)


API Tags:
See:  alpha/model/AlphaDAOProviderInterface::setEnumOptions()
Access:  public

Information Tags:
Since:  1.1

Implementation of:
AlphaDAOProviderInterface::setEnumOptions()
Populate all of the enum options for this object from the database.

[ Top ]

Documentation generated on Tue, 13 Dec 2011 20:25:58 +0000 by phpDocumentor 1.4.3