phpDocumentor GalleryCore
Storage
[ class tree: GalleryCore ] [ index: GalleryCore ] [ all elements ]

Class: GalleryStorageExtras

Source Location: /modules/core/classes/GalleryStorage/GalleryStorageExtras.class

Class GalleryStorageExtras

Method Summary
static array   parseSqlTemplate()   Parse the SQL template file and break it down by database and sql file type and return the results in an array. The best way to see how this is supposed to work is to look in the unit test.
GalleryStorageExtras   GalleryStorageExtras()  
void   acquireReadLock()  
void   acquireWriteLock()  
void   addMapEntry()  
void   cleanStore()  
void   configureStore()  
void   configureStoreCleanup()  
GalleryStatus   createSequence()   Create a sequence.
void   deleteEntity()  
array   describeEntity()   Describe the members, modules and parent of an entity
GalleryStatus   dropSequence()   Drop a sequence.
void   execute()  
void   executeSqlFile()  
void   getAffectedRows()  
array   getModuleSql()   Load up the table creation and alteration SQL files for the given module
void   getProfilingHtml()  
void   getUniqueId()  
void   isInstalled()  
void   loadEntities()  
void   moveIdsBetweenLocks()  
void   newEntity()  
void   newLockId()  
void   optimize()  
void   refreshEntity()  
void   refreshLocks()  
void   releaseLocks()  
void   removeAllMapEntries()  
void   removeIdsFromLock()  
void   removeMapEntry()  
void   saveEntity()  
void   unconfigureStore()  
void   validateConnection()  
GalleryStatus   _addMapEntries()   Add new entries to a map. This utility takes the values from entry array e.g., (parm1 => (p1val1, p1val2, p1val3), parm2 => (p2val1, p2val2, p2val3)) and inserts them into the map similar to the following: INSERT INTO ... (PARM1, PARM2) VALUES (p1val1, p2val1), (p1val2, p2val2) ...
void   _clearEntityAndMapCache()   Clear out the entity and map caches, which we should do any time we add or remove a table.
GalleryStatus   _dbInit()   Connect to database if needed and optionally guarantee db transaction.
GalleryStatus   _executeSql()   Execute a given SQL against the database. Prefix table and column names as necessary. Split multiple commands in the file into separate Execute() calls.
GalleryStatus   _expireLocks()   Delete all not-so-fresh locks.
GalleryStatus   _getLockClearance()   Internal function to get clearance to acquire locks
array   _getNonTransactionalDatabaseConnection()   Return a non transactional database connection.
array   _getTableInfo()   Load the Entities or Maps.inc file.
void   _getUniqueIdWithConnection()   Internal implementation of GalleryStorage::getUniqueId that additionally takes a database connection.
array   _identifyEntities()   Identify the type of entity associated with the id provided
void   _loadTableVersions()  
array   _metaTables()   Get a list of all database tables (not limited to our table-prefix)
GalleryStatus   _updateSchemaTableInfo()   Convenience function to update the Schema table with the creation SQL for a table.
void   _updateTableInfo()  

[ Top ]
Methods
static method parseSqlTemplate  [line 1194]

  static array parseSqlTemplate( array $sqlData, string $dbType  )

Parse the SQL template file and break it down by database and sql file type and return the results in an array. The best way to see how this is supposed to work is to look in the unit test.

Parameters:
array   $sqlData:  the raw template data
string   $dbType:  the database type

API Tags:
Return:  the parsed results


[ Top ]
Constructor GalleryStorageExtras  [line 39]

  GalleryStorageExtras GalleryStorageExtras( &$galleryStorage, GalleryStorage $galleryStorage  )

Parameters:
GalleryStorage   $galleryStorage:  the database storage instance
   &$galleryStorage: 


[ Top ]
acquireReadLock  [line 543]

  void acquireReadLock( $entityIds, $timeout  )

Parameters:
   $entityIds: 
   $timeout: 

API Tags:
See:  GalleryStorage::acquireReadLock


[ Top ]
acquireWriteLock  [line 659]

  void acquireWriteLock( $entityIds, $timeout  )

Parameters:
   $entityIds: 
   $timeout: 

API Tags:
See:  GalleryStorage::acquireWriteLock


[ Top ]
addMapEntry  [line 971]

  void addMapEntry( $mapName, $entry, [ $useNonTransactionalConnection = false]  )

Parameters:
   $mapName: 
   $entry: 
   $useNonTransactionalConnection: 

API Tags:
See:  GalleryStorage::addMapEntry


[ Top ]
cleanStore  [line 1754]

  void cleanStore( )


API Tags:
See:  GalleryStorage::cleanStore


[ Top ]
configureStore  [line 1243]

  void configureStore( $moduleId, [ $upgradeInfo = array()]  )

Parameters:
   $moduleId: 
   $upgradeInfo: 

API Tags:
See:  GalleryStorage::configureStore


[ Top ]
configureStoreCleanup  [line 1538]

  void configureStoreCleanup( $moduleId  )

Parameters:
   $moduleId: 

API Tags:
See:  GalleryStorage::configureStoreCleanup


[ Top ]
createSequence  [line 2180]

  GalleryStatus createSequence( string $sequenceId, [integer $startId = 1]  )

Create a sequence.

Parameters:
string   $sequenceId:  Name of the sequence to create.
integer   $startId:  (optional) The number to initialize the sequence to. (default 1)


[ Top ]
deleteEntity  [line 391]

  void deleteEntity( &$entity  )

Parameters:
   &$entity: 

API Tags:
See:  GalleryStorage::deleteEntity


[ Top ]
describeEntity  [line 2079]

  array describeEntity( string $entityName, [boolean $tryAllModules = false]  )

Describe the members, modules and parent of an entity

Parameters:
string   $entityName:  a class name
boolean   $tryAllModules:  true if we should scan all modules, not just the active ones

API Tags:
Return:  GalleryStatus a status code entity associative array
Access:  protected


[ Top ]
dropSequence  [line 2196]

  GalleryStatus dropSequence( string $sequenceId  )

Drop a sequence.

Parameters:
string   $sequenceId:  Name of the sequence to drop.


[ Top ]
execute  [line 949]

  void execute( $statement, [ $data = array()]  )

Parameters:
   $statement: 
   $data: 

API Tags:
See:  GalleryStorage::execute


[ Top ]
executeSqlFile  [line 1724]

  void executeSqlFile( $fileName  )

Parameters:
   $fileName: 

API Tags:
See:  GalleryStorage::executeSqlFile


[ Top ]
getAffectedRows  [line 1890]

  void getAffectedRows( $useNonTransactionalConnection  )

Parameters:
   $useNonTransactionalConnection: 

API Tags:
See:  GalleryStorage::getAffectedRows


[ Top ]
getModuleSql  [line 1167]

  array getModuleSql( string $moduleId  )

Load up the table creation and alteration SQL files for the given module

Parameters:
string   $moduleId:  The id of the module of interest.

API Tags:
Return:  ('table' => array(), 'alter' => array(), 'remove' => array(), 'test' => array())


[ Top ]
getProfilingHtml  [line 1805]

  void getProfilingHtml( )


API Tags:
See:  GalleryStorage::getProfilingHtml


[ Top ]
getUniqueId  [line 467]

  void getUniqueId( [ $sequence = DATABASE_SEQUENCE_ID]  )

Parameters:
   $sequence: 

API Tags:
See:  GalleryStorage::getUniqueId


[ Top ]
isInstalled  [line 1820]

  void isInstalled( )


API Tags:
See:  GalleryStorage::isInstalled


[ Top ]
loadEntities  [line 92]

  void loadEntities( $ids  )

Parameters:
   $ids: 

API Tags:
See:  GalleryStorage::loadEntities


[ Top ]
moveIdsBetweenLocks  [line 902]

  void moveIdsBetweenLocks( $relock, $newLockId, $lockType  )

Parameters:
   $relock: 
   $newLockId: 
   $lockType: 

API Tags:
See:  GalleryStorage::moveIdsBetweenLocks


[ Top ]
newEntity  [line 446]

  void newEntity( &$entity  )

Parameters:
   &$entity: 

API Tags:
See:  GalleryStorage::newEntity


[ Top ]
newLockId  [line 927]

  void newLockId( )


API Tags:
See:  GalleryStorage::newLockId


[ Top ]
optimize  [line 1840]

  void optimize( [ $tableNames = null]  )

Parameters:
   $tableNames: 

API Tags:
See:  GalleryStorage::optimize


[ Top ]
refreshEntity  [line 514]

  void refreshEntity( $entity  )

Parameters:
   $entity: 

API Tags:
See:  GalleryStorage::refreshEntity


[ Top ]
refreshLocks  [line 779]

  void refreshLocks( $lockIds, $freshUntil  )

Parameters:
   $lockIds: 
   $freshUntil: 

API Tags:
See:  GalleryStorage::refreshLocks


[ Top ]
releaseLocks  [line 842]

  void releaseLocks( $lockIds  )

Parameters:
   $lockIds: 

API Tags:
See:  GalleryStorage::releaseLocks


[ Top ]
removeAllMapEntries  [line 1128]

  void removeAllMapEntries( $mapName, [ $useNonTransactionalConnection = false], [ $useTruncate = false]  )

Parameters:
   $mapName: 
   $useNonTransactionalConnection: 
   $useTruncate: 

API Tags:
See:  GalleryStorage::removeAllMapEntries


[ Top ]
removeIdsFromLock  [line 876]

  void removeIdsFromLock( $lock, $ids  )

Parameters:
   $lock: 
   $ids: 

API Tags:
See:  GalleryStorage::removeIdsFromLock


[ Top ]
removeMapEntry  [line 1067]

  void removeMapEntry( $mapName, $match  )

Parameters:
   $mapName: 
   $match: 

API Tags:
See:  GalleryStorage::removeMapEntry


[ Top ]
saveEntity  [line 225]

  void saveEntity( &$entity  )

Parameters:
   &$entity: 

API Tags:
See:  GalleryStorage::saveEntity


[ Top ]
unconfigureStore  [line 1598]

  void unconfigureStore( $moduleId  )

Parameters:
   $moduleId: 

API Tags:
See:  GalleryStorage::unconfigureStore


[ Top ]
validateConnection  [line 2209]

  void validateConnection( )


API Tags:
See:  GalleryStorage::validateConnection


[ Top ]
_addMapEntries  [line 1033]

  GalleryStatus _addMapEntries( array $mapInfo, string $tableName, array $entry, ADOdb $db  )

Add new entries to a map. This utility takes the values from entry array e.g., (parm1 => (p1val1, p1val2, p1val3), parm2 => (p2val1, p2val2, p2val3)) and inserts them into the map similar to the following: INSERT INTO ... (PARM1, PARM2) VALUES (p1val1, p2val1), (p1val2, p2val2) ...

Parameters:
array   $mapInfo:  map we're working on
string   $tableName:  the translated table name
array   $entry:  an associative array of data about the entry each data element is an array of values
ADOdb   $db:  the database connection to use

API Tags:
Return:  a status code
Access:  private


[ Top ]
_clearEntityAndMapCache  [line 2140]

  void _clearEntityAndMapCache( )

Clear out the entity and map caches, which we should do any time we add or remove a table.



[ Top ]
_dbInit  [line 73]

  GalleryStatus _dbInit( [ $transaction = false]  )

Connect to database if needed and optionally guarantee db transaction.

Parameters:
   $transaction: 

API Tags:
Return:  a status code
Access:  private


[ Top ]
_executeSql  [line 1694]

  GalleryStatus _executeSql( $buffer  )

Execute a given SQL against the database. Prefix table and column names as necessary. Split multiple commands in the file into separate Execute() calls.

Parameters:
   $buffer: 

API Tags:
Return:  a status code
Access:  protected


[ Top ]
_expireLocks  [line 816]

  GalleryStatus _expireLocks( )

Delete all not-so-fresh locks.


API Tags:
Return:  a status code
Access:  private


[ Top ]
_getLockClearance  [line 1919]

  GalleryStatus _getLockClearance( int $cutoffTime  )

Internal function to get clearance to acquire locks

Request clearance to acquire locks and then wait until it's our turn.

Parameters:
int   $cutoffTime:  the time to stop trying to get clearance

API Tags:
Return:  a status code


[ Top ]
_getNonTransactionalDatabaseConnection  [line 50]

  array _getNonTransactionalDatabaseConnection( )

Return a non transactional database connection.

On occasion we'll need a non-transactional connection to do things like locking and sequence handling, since they have to be consistent across may concurrent requests.


API Tags:
Return:  GalleryStatus a status code ADOdb a database connection


[ Top ]
_getTableInfo  [line 1420]

  array _getTableInfo( string $moduleId, string $type  )

Load the Entities or Maps.inc file.

Parameters:
string   $moduleId:  The module for which to retrieve the table information for.
string   $type:  String to describe the file to load. ('map' | 'entity')

API Tags:
Return:  An array describing either the maps or entities for the module
Access:  private


[ Top ]
_getUniqueIdWithConnection  [line 488]

  void _getUniqueIdWithConnection( $dbConn, string $sequence  )

Internal implementation of GalleryStorage::getUniqueId that additionally takes a database connection.

Parameters:
string   $sequence:  A sequence name
   $dbConn: 

API Tags:
See:  GalleryStorage::getUniqueId


[ Top ]
_identifyEntities  [line 1999]

  array _identifyEntities( mixed $ids  )

Identify the type of entity associated with the id provided

Parameters:
mixed   $ids:  array of ids or single int id

API Tags:
Return:  a GalleryStatus and a string class name


[ Top ]
_loadTableVersions  [line 1655]

  void _loadTableVersions( [ $ignoreCache = true]  )

Parameters:
   $ignoreCache: 

API Tags:
See:  GalleryStorage::getTableVersions


[ Top ]
_metaTables  [line 2153]

  array _metaTables( )

Get a list of all database tables (not limited to our table-prefix)


API Tags:
Return:  GalleryStatus array of table names in lower-case


[ Top ]
_updateSchemaTableInfo  [line 1445]

  GalleryStatus _updateSchemaTableInfo( string $tableNameInSchema, string $tableSql, string $moduleId, [string $type = null], [string $info = null], [bool $canStoreTableInfo = true]  )

Convenience function to update the Schema table with the creation SQL for a table.

Parameters:
string   $tableNameInSchema:  The name of the table in the schema.
string   $tableSql:  The sql that is used to create the table.
string   $moduleId: 
string   $type:  (optional) An indicator for table type ('map' | 'entity').
string   $info:  The serialized description of the map or entity.
bool   $canStoreTableInfo:  (optional)


[ Top ]
_updateTableInfo  [line 1474]

  void _updateTableInfo( $moduleId  )

Parameters:
   $moduleId: 

API Tags:
See:  GalleryStorage::updateTableInfo


[ Top ]

Documentation generated on Fri, 08 Oct 2010 05:04:49 -0700 by phpDocumentor 1.3.0RC6