Package: alpha::model
Copyright:
Copyright (c) 2012, 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.
License:
The BSD License
Author:
John Collins <
dev@alphaframework.org>
Version:
$Id: AlphaDAOProviderSQLite.inc 1599 2012-11-29 12:31:15Z alphadevx $
Since:
1.2
Located at model/AlphaDAOProviderSQLite.inc
Methods summary
public
|
|
public static
mysqli
|
#
getConnection( )
(non-PHPdoc)
Returns
mysqli
See
alpha/model/AlphaDAOProviderInterface::getConnection()
Implementation of
|
public static
|
#
disconnect( )
(non-PHPdoc)
See
alpha/model/AlphaDAOProviderInterface::disconnect()
Implementation of
|
public static
string
|
#
getLastDatabaseError( )
(non-PHPdoc)
Returns
string
See
alpha/model/AlphaDAOProviderInterface::getLastDatabaseError()
Implementation of
|
public
array
|
#
query( string $sqlQuery )
(non-PHPdoc)
Parameters
- $sqlQuery
string $sqlQuery
Returns
array
Throws
See
alpha/model/AlphaDAOProviderInterface::query()
Implementation of
|
public
|
#
load( integer $OID )
(non-PHPdoc)
Parameters
- $OID
integer $OID The object ID of the business object to load.
Throws
See
alpha/model/AlphaDAOProviderInterface::load()
Implementation of
|
public
|
#
loadByAttribute( string $attribute, string $value, boolean $ignoreClassType = false, array $loadAttributes = array() )
(non-PHPdoc)
Parameters
- $attribute
string $atribute The name of the attribute to load the object by.
- $value
string $value The value of the attribute to load the object by.
- $ignoreClassType
boolean $ignoreClassType Default is false, set to true if you want to load from
overloaded tables and ignore the class type
- $loadAttributes
array $loadAttributes The attributes to load from the database to this object (leave
blank to load all attributes)
Throws
See
alpha/model/AlphaDAOProviderInterface::loadByAttribute()
Implementation of
|
public
array
|
#
loadAll( integer $start = 0, integer $limit = 0, string $orderBy = 'OID', string $order = 'ASC', boolean $ignoreClassType = false )
(non-PHPdoc)
Parameters
- $start
integer $start The start of the SQL LIMIT clause, useful for pagination.
- $limit
integer $limit The amount (limit) of objects to load, useful for pagination.
- $orderBy
string $orderBy The name of the field to sort the objects by.
- $order
string $order The order to sort the objects by.
- $ignoreClassType
boolean $ignoreClassType Default is false, set to true if you want to load from
overloaded tables and ignore the class type
Returns
array An array containing objects of this type of business object.
Throws
See
alpha/model/AlphaDAOProviderInterface::loadAll()
Implementation of
|
public
array
|
#
loadAllByAttribute( string $attribute, string $value, integer $start = 0, integer $limit = 0, string $orderBy = "OID", string $order = "ASC", boolean $ignoreClassType = false, array $constructorArgs = array() )
(non-PHPdoc)
Parameters
- $attribute
string $atribute The attribute to load the objects by.
- $value
string $value The value of the attribute to load the objects by.
- $start
integer $start The start of the SQL LIMIT clause, useful for pagination.
- $limit
integer $limit The amount (limit) of objects to load, useful for pagination.
- $orderBy
string $orderBy The name of the field to sort the objects by.
- $order
string $order The order to sort the objects by.
- $ignoreClassType
boolean $ignoreClassType Default is false, set to true if you want to load from
overloaded tables and ignore the class type.
- $constructorArgs
array $constructorArgs An optional array of contructor arguements to pass to the BOs
that will be generated and returned. Supports a maximum of 5 arguements.
Returns
array An array containing objects of this type of business object.
Throws
See
alpha/model/AlphaDAOProviderInterface::loadAllByAttribute()
Implementation of
|
public
array
|
#
loadAllByAttributes( array $attributes = array(), array $values = array(), integer $start = 0, integer $limit = 0, string $orderBy = 'OID', string $order = 'ASC', boolean $ignoreClassType = false )
(non-PHPdoc)
Parameters
- $attributes
array $atributes The attributes to load the objects by.
- $values
array $values The values of the attributes to load the objects by.
- $start
integer $start The start of the SQL LIMIT clause, useful for pagination.
- $limit
integer $limit The amount (limit) of objects to load, useful for pagination.
- $orderBy
string $orderBy The name of the field to sort the objects by.
- $order
string $order The order to sort the objects by.
- $ignoreClassType
boolean $ignoreClassType Default is false, set to true if you want to load from
overloaded tables and ignore the class type
Returns
array An array containing objects of this type of business object.
Throws
See
alpha/model/AlphaDAOProviderInterface::loadAllByAttributes()
Implementation of
|
public
array
|
#
loadAllByDayUpdated( string $date, integer $start = 0, integer $limit = 0, string $orderBy = "OID", string $order = "ASC", boolean $ignoreClassType = false )
(non-PHPdoc)
Parameters
- $date
string $date The date for which to load the objects updated on, in the format
'YYYY-MM-DD'.
- $start
integer $start The start of the SQL LIMIT clause, useful for pagination.
- $limit
integer $limit The amount (limit) of objects to load, useful for pagination.
- $orderBy
string $orderBy The name of the field to sort the objects by.
- $order
string $order The order to sort the objects by.
- $ignoreClassType
boolean $ignoreClassType Default is false, set to true if you want to load from
overloaded tables and ignore the class type
Returns
array An array containing objects of this type of business object.
Throws
See
alpha/model/AlphaDAOProviderInterface::loadAllByDayUpdated()
Implementation of
|
public
array
|
#
loadAllFieldValuesByAttribute( string $attribute, string $value, string $returnAttribute, string $order = 'ASC', boolean $ignoreClassType = false )
(non-PHPdoc)
Parameters
- $attribute
string $attribute The attribute name to load the field values by.
- $value
string $value The value of the attribute to load the field values by.
- $returnAttribute
string $returnAttribute The name of the attribute to return.
- $order
string $order The order to sort the BOs by.
- $ignoreClassType
boolean $ignoreClassType Default is false, set to true if you want to load from
overloaded tables and ignore the class type.
Returns
array An array of field values.
Throws
See
alpha/model/AlphaDAOProviderInterface::loadAllFieldValuesByAttribute()
Implementation of
|
public
|
#
save( )
(non-PHPdoc)
Throws
See
alpha/model/AlphaDAOProviderInterface::save()
Implementation of
|
public
|
#
saveAttribute( string $attribute, mixed $value )
(non-PHPdoc)
Parameters
- $attribute
string $attribute The name of the attribute to save.
- $value
mixed $value The value of the attribute to save.
Throws
See
alpha/model/AlphaDAOProviderInterface::saveAttribute()
Implementation of
|
public
|
#
saveHistory( )
(non-PHPdoc)
Throws
See
alpha/model/AlphaDAOProviderInterface::saveHistory()
Implementation of
|
public
|
#
delete( )
(non-PHPdoc)
Throws
See
alpha/model/AlphaDAOProviderInterface::delete()
Implementation of
|
public
integer
|
#
getVersion( )
(non-PHPdoc)
Returns
integer
Throws
See
alpha/model/AlphaDAOProviderInterface::getVersion()
Implementation of
|
public
|
#
makeTable( )
(non-PHPdoc)
Throws
See
alpha/model/AlphaDAOProviderInterface::makeTable()
Implementation of
|
public
|
#
makeHistoryTable( )
(non-PHPdoc)
Throws
See
alpha/model/AlphaDAOProviderInterface::makeHistoryTable()
Implementation of
|
public
|
#
rebuildTable( )
(non-PHPdoc)
Throws
See
alpha/model/AlphaDAOProviderInterface::rebuildTable()
Implementation of
|
public
|
#
dropTable( string $tableName = null )
(non-PHPdoc)
Parameters
- $tableName
string $tableName Optional table name, leave blank for the defined table for this class
to be dropped
Throws
See
alpha/model/AlphaDAOProviderInterface::dropTable()
Implementation of
|
public
|
#
addProperty( string $propName )
(non-PHPdoc)
Parameters
- $propName
string $propName The name of the new field to add to the database table.
Throws
See
alpha/model/AlphaDAOProviderInterface::addProperty()
Implementation of
|
public
integer
|
#
getMAX( )
(non-PHPdoc)
Returns
integer The maximum OID value in the class table.
Throws
See
alpha/model/AlphaDAOProviderInterface::getMAX()
Implementation of
|
public
integer
|
#
getCount( array $attributes = array(), array $values = array() )
(non-PHPdoc)
Parameters
- $attributes
array $atributes The attributes to count the objects by (optional).
- $values
array $values The values of the attributes to count the objects by (optional).
Returns
integer
Throws
See
alpha/model/AlphaDAOProviderInterface::getCount()
Implementation of
|
public
integer
|
#
getHistoryCount( )
(non-PHPdoc)
Returns
integer
Throws
See
alpha/model/AlphaDAOProviderInterface::getHistoryCount()
Implementation of
|
public
|
#
setEnumOptions( )
Given that Enum values are not saved in the database for SQLite, an
implementation is not required here.
Given that Enum values are not saved in the database for SQLite, an
implementation is not required here.
(non-PHPdoc)
Throws
See
alpha/model/AlphaDAOProviderInterface::setEnumOptions()
Implementation of
|
public
boolean
|
#
checkTableExists( boolean $checkHistoryTable = false )
(non-PHPdoc)
Parameters
- $checkHistoryTable
boolean $checkHistoryTable Set to true if you want to check for the existance of the
_history table for this DAO.
Returns
boolean
Throws
See
alpha/model/AlphaDAOProviderInterface::checkTableExists()
Implementation of
|
public static
boolean
|
#
checkBOTableExists( string $BOClassName, boolean $checkHistoryTable = false )
(non-PHPdoc)
Parameters
- $BOClassName
string $BOClassName The name of the business object class we are checking.
- $checkHistoryTable
boolean $checkHistoryTable Set to true if you want to check for the existance of the
_history table for this DAO.
Returns
boolean
Throws
See
alpha/model/AlphaDAOProviderInterface::checkBOTableExists()
Implementation of
|
public
boolean
|
#
checkTableNeedsUpdate( )
(non-PHPdoc)
Returns
boolean
Throws
See
alpha/model/AlphaDAOProviderInterface::checkTableNeedsUpdate()
Implementation of
|
public
array
|
#
findMissingFields( )
(non-PHPdoc)
Returns
array An array of missing fields in the database table.
Throws
See
alpha/model/AlphaDAOProviderInterface::findMissingFields()
Implementation of
|
public
array
|
#
getIndexes( )
(non-PHPdoc)
Returns
array An array of database indexes on this table.
Throws
See
alpha/model/AlphaDAOProviderInterface::getIndexes()
Implementation of
|
private
|
#
checkIndexes( )
Checks to see if all of the indexes are in place for the BO's table, creates
those that are missing.
Checks to see if all of the indexes are in place for the BO's table, creates
those that are missing.
Since
1.2
|
public
|
#
createForeignIndex( string $attributeName, string $relatedClass, string $relatedClassAttribute )
Note that SQLite 3.6.19 is requrired for foreign key support.
Note that SQLite 3.6.19 is requrired for foreign key support.
(non-PHPdoc)
Parameters
- $attributeName
string $attributeName The name of the attribute to apply the index on.
- $relatedClass
string $relatedClass The name of the related class in the format "NameObject".
- $relatedClassAttribute
string $relatedClassAttribute The name of the field to relate to on the related class.
Throws
See
alpha/model/AlphaDAOProviderInterface::createForeignIndex()
Implementation of
|
public
|
#
createUniqueIndex( string $attribute1Name, string $attribute2Name = '', string $attribute3Name = '' )
(non-PHPdoc)
Parameters
- $attribute1Name
string $attribute1Name The first attribute to mark unique in the database.
- $attribute2Name
string $attribute2Name The second attribute to mark unique in the databse (optional,
use only for composite keys).
- $attribute3Name
string $attribute3Name The third attribute to mark unique in the databse (optional, use
only for composite keys).
Throws
See
alpha/model/AlphaDAOProviderInterface::createUniqueIndex()
Implementation of
|
public
|
#
reload( )
(non-PHPdoc)
Throws
See
alpha/model/AlphaDAOProviderInterface::reload()
Implementation of
|
public
boolean
|
#
checkRecordExists( integer $OID )
(non-PHPdoc)
Parameters
- $OID
integer $OID The Object ID of the object we want to see whether it exists or not.
Returns
boolean
Throws
See
alpha/model/AlphaDAOProviderInterface::checkRecordExists()
Implementation of
|
public
boolean
|
#
isTableOverloaded( )
(non-PHPdoc)
Returns
boolean
Throws
See
alpha/model/AlphaDAOProviderInterface::isTableOverloaded()
Implementation of
|
public static
|
#
begin( )
(non-PHPdoc)
Throws
See
alpha/model/AlphaDAOProviderInterface::begin()
Implementation of
|
public static
|
#
commit( )
(non-PHPdoc)
Throws
See
alpha/model/AlphaDAOProviderInterface::commit()
Implementation of
|
public static
|
#
rollback( )
(non-PHPdoc)
Throws
See
alpha/model/AlphaDAOProviderInterface::rollback()
Implementation of
|
public
|
#
setBO( AlphaDAO $BO )
(non-PHPdoc)
Parameters
See
alpha/model/AlphaDAOProviderInterface::setBO()
Implementation of
|