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

Class: GalleryStorage

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

Class GalleryStorage

Class Overview
Direct descendents
Child Class Description
Db2Storage IBM DB2 UDB (for Linux/UNIX/Windows) extension of the GalleryStorage class.
MSSqlStorage MSSQL extension of the GalleryStorage class.
OracleStorage Oracle extension of the GalleryStorage class.
PostgreSqlStorage PostgreSQL extension of the GalleryStorage class.
SQLiteStorage SQLite extension of the GalleryStorage class.
MySqlStorage MySQL extension of the GalleryStorage class.

[ Top ]
Property Summary
string   $_columnPrefix   A string to prepend to column names
string   $_database   Name of the database to use
ADOdb   $_db   Internal pointer to ADOdb database object
array   $_entityInfoCache   A cache of member info that we've discovered about various classes
DatabaseStorageExtras   $_extras   Internal pointer to our DatabaseStorageExtras object
string   $_hostname   Host the database runs on
boolean   $_isEmptyAllowedForNotNullColumn   Whether this storage accepts empty (string) values for NOT NULL columns. Some DBMS implicitly converts empty values to NULL on INSERT/UPDATE and then the value would violate a NOT NULL condition.
boolean   $_isTransactional   Are we attempting to be transactional?
ADOdb   $_nonTransactionalDb   Internal pointer to a non-transactional ADOdb database object
string   $_password   Password for the database user
string   $_schema   Database schema to use (not used by all db types)
string   $_tablePrefix   A string to prepend to table names
string   $_type   Database type (ADOdb driver name)
boolean   $_usePersistentConnections   Whether or not we should use persistent database connections
string   $_username   Name of the database user

[ Top ]
Method Summary
GalleryStorage   GalleryStorage()  
array   acquireReadLock()   Acquire read locks on the given items
array   acquireWriteLock()   Acquire write locks on the given items
GalleryStatus   addMapEntry()   Add a new entry to a map
GalleryStatus   beginTransaction()   Begin a new transaction, if the storage layer supports them.
GalleryStatus   checkPoint()   Mark a storage checkpoint, which will commit pending transactions and perform any future tied-tasks
GalleryStatus   cleanStore()   Clean out and reset the persistent store for this strategy.
GalleryStatus   commitTransaction()   Commit our transaction, if the storage layer supports them.
GalleryStatus   configureStore()   Configure the persistent store for this strategy, for the given module.
GalleryStatus   configureStoreCleanup()   Perform any cleanup necessary after installing or upgrading the given module.
int   convertBitsToInt()   Convert value from a database bit column into an integer
mixed   convertIntToBits()   Convert an integer into something that the database will accept into a bit column
binary   decodeBlob()   Decode a blob of binary data into a form that's safe for a varchar column
GalleryStatus   deleteEntity()   Delete the GalleryEntity
array   describeEntity()   Describe the members, modules and parent of an entity
array   describeMap()   Describe all the members of a map
database   encodeBlob()   Encode a blob of binary data into a form that's safe for a varchar column
GalleryStatus   execute()   Execute a database statement
array   extractClasses()   Extracts the class names from a given query
string   getAdoDbType()   Return the type of this database (ADOdb driver name)
array   getAffectedRows()   Return the number of rows that were affected by the last UPDATE/DELETE. Note that MySQL treats this a little differently than other databases; if you do an UPDATE operation and nothing is actually changed (eg. in the situation where the SET clauses in your UPDATE match the existing values) then mysql will return 0 affected rows.
A   getDatabaseExporter()   This method gets a Gallery Database Exporter object.
A   getDatabaseImporter()   This method gets a Gallery Database Importer object.
array   getFunctionSql()   Return a customized function for this database platform
array   getMapEntry()   Get entries in a map that match a criteria and return selected fields
string   getProfilingHtml()   Return storage profiling information in HTML format
array   getTableVersions()   Examine the schema table and return the version of all the Gallery tables
array   getUniqueId()   Get a new, unique id
array   isInstalled()   Return true if enough of this storage system is installed that there'll be a conflict if you try to do another install.
boolean   isTransactional()   Is the database transactional?
array   loadEntities()   Load the GalleryEntities with the ids specified
GalleryStatus   moveIdsBetweenLocks()   Move ids between locks.
GalleryStatus   newEntity()   Create a new GalleryEntity
array   newLockId()   Generate a new lock id.
GalleryStatus   optimize()   Optimize the database.
array   refreshEntity()   Refresh a GalleryEntity from the database if it has changed
GalleryStatus   refreshLocks()   Refresh all the locks that we hold so that they aren't accidentally considered expired
GalleryStatus   releaseLocks()   Release the given locks.
GalleryStatus   removeAllMapEntries()   Remove ALL entries from a map. Use with caution!
GalleryStatus   removeIdsFromLock()   Remove ids from a lock.
GalleryStatus   removeMapEntry()   Remove entries from a map
GalleryStatus   rollbackTransaction()   Rollback our transaction, if the storage layer supports them.
GalleryStatus   saveEntity()   Save the changes to the GalleryEntity
array   search()   Search the persistent store for the target values matching the given criteria
void   setDebug()   Set Adodb debug mode.
GalleryStatus   unconfigureStore()   Uninstall the database schema for the given module
GalleryStatus   updateMapEntry()   Update entries in a map
GalleryStatus   updateTableInfo()   Load the Maps.inc and Entities.inc into the schema table for the specified module
GalleryStatus   validateConnection()   Test whether the current connection and non transactional connection are still valid. If the connections are not valid then reconnect the connection.
GalleryStatus   _executeSqlFile()   Execute a given SQL file against the database. Prefix table and column names as necessary.
array   _getConnection()   Connect to the database
array   _getEntityOrMapInfo()   Retrieve the entity or map information from the Schema table. If tryAllModules is false then only consider plugins that are active.
GalleryStorageExtras   &_getExtras()   Get the reference to our GalleryStorageExtras instance where we put less frequently used code (most code that's used to modify the database).
array(string   _getOptimizeStatements()   Get sql to optimize a table
array   _getSqlReplacements()   Return database specific syntax to replace in schema SQL
void   _getWhereSql()   Accepts a $mapInfo pair and $match value to add match information to supplied array.
GalleryStatus   _guaranteeTransaction()   Begin transaction if not already in one.
mixed   _normalizeValue()   Cast the value to the proper member type when interacting with the database. Optionally also perform a UTF-8-safe truncation for strings.
GalleryStatus   _setConnectionSettings()   Set runtime settings for the given database connection.
void   _traceStart()   Start tracing. If Gallery is in debug, this method will begin storing all output and routing it into Gallery's debug system.
void   _traceStop()   Stop tracing. If Gallery is in debug, this will method will stop tracing.
string   _translateColumnName()   Translate a potentially unsafe column name into a safe one
string   _translateQuery()   Translate all table and column names from [Entity::member] notation to table.column notation.
array   _translateTableName()   Translate a potentially unsafe table name into a safe one by adding a prefix or suffix to avoid conflicting with a reserved word.
the   _truncateString()   Perform a UTF-8-safe truncation of the string to a size

[ Top ]
Properties
string   $_columnPrefix [line 161]

A string to prepend to column names

API Tags:
Access:  protected


[ Top ]
string   $_database [line 126]

Name of the database to use

API Tags:
Access:  protected


[ Top ]
ADOdb   $_db [line 84]

Internal pointer to ADOdb database object

API Tags:
Access:  protected


[ Top ]
array   $_entityInfoCache [line 168]

A cache of member info that we've discovered about various classes

API Tags:
Access:  protected


[ Top ]
DatabaseStorageExtras   $_extras [line 98]

Internal pointer to our DatabaseStorageExtras object

API Tags:
Access:  protected


[ Top ]
string   $_hostname [line 133]

Host the database runs on

API Tags:
Access:  protected


[ Top ]
boolean   $_isEmptyAllowedForNotNullColumn [line 184]

Whether this storage accepts empty (string) values for NOT NULL columns. Some DBMS implicitly converts empty values to NULL on INSERT/UPDATE and then the value would violate a NOT NULL condition.

API Tags:
Access:  protected


[ Top ]
boolean   $_isTransactional [line 140]

Are we attempting to be transactional?

API Tags:
Access:  protected


[ Top ]
ADOdb   $_nonTransactionalDb [line 91]

Internal pointer to a non-transactional ADOdb database object

API Tags:
Access:  protected


[ Top ]
string   $_password [line 119]

Password for the database user

API Tags:
Access:  protected


[ Top ]
string   $_schema [line 147]

Database schema to use (not used by all db types)

API Tags:
Access:  protected


[ Top ]
string   $_tablePrefix [line 154]

A string to prepend to table names

API Tags:
Access:  protected


[ Top ]
string   $_type [line 105]

Database type (ADOdb driver name)

API Tags:
Access:  protected


[ Top ]
boolean   $_usePersistentConnections [line 175]

Whether or not we should use persistent database connections

API Tags:
Access:  protected


[ Top ]
string   $_username [line 112]

Name of the database user

API Tags:
Access:  protected


[ Top ]
Methods
Constructor GalleryStorage  [line 190]

  GalleryStorage GalleryStorage( array $config  )

Parameters:
array   $config:  database configuration values


[ Top ]
acquireReadLock  [line 390]

  array acquireReadLock( mixed $entityIds, int $timeout  )

Acquire read locks on the given items

Parameters:
mixed   $entityIds:  array of ids or single int id
int   $timeout:  timeout before giving up on the lock

API Tags:
Return:  GalleryStatus a status code array lock data


[ Top ]
acquireWriteLock  [line 403]

  array acquireWriteLock( mixed $entityIds, int $timeout  )

Acquire write locks on the given items

Parameters:
mixed   $entityIds:  array of ids or single int id
int   $timeout:  timeout before giving up on the lock

API Tags:
Return:  GalleryStatus a status code array lock data


[ Top ]
addMapEntry  [line 528]

  GalleryStatus addMapEntry( string $mapName, array $entry, [boolean $useNonTransactionalConnection = false]  )

Add a new entry to a map

Parameters:
string   $mapName:  the map we're working on
array   $entry:  an associative array of data about the entry
boolean   $useNonTransactionalConnection:  (optional) set to true if we should use a new non transactional database connection for this operation. Default is false.

API Tags:
Return:  a status code


[ Top ]
beginTransaction  [line 816]

  GalleryStatus beginTransaction( )

Begin a new transaction, if the storage layer supports them.


API Tags:
Return:  a status code


[ Top ]
checkPoint  [line 879]

  GalleryStatus checkPoint( )

Mark a storage checkpoint, which will commit pending transactions and perform any future tied-tasks


API Tags:
Return:  a status code


[ Top ]
cleanStore  [line 806]

  GalleryStatus cleanStore( )

Clean out and reset the persistent store for this strategy.


API Tags:
Return:  a status code


Redefined in descendants as:

[ Top ]
commitTransaction  [line 842]

  GalleryStatus commitTransaction( )

Commit our transaction, if the storage layer supports them.


API Tags:
Return:  a status code


[ Top ]
configureStore  [line 775]

  GalleryStatus configureStore( string $moduleId, [array $upgradeInfo = array()]  )

Configure the persistent store for this strategy, for the given module.

Parameters:
string   $moduleId: 
array   $upgradeInfo:  (optional) of (classname => old schema version)

API Tags:
Return:  a status code


Redefined in descendants as:

[ Top ]
configureStoreCleanup  [line 786]

  GalleryStatus configureStoreCleanup( string $moduleId  )

Perform any cleanup necessary after installing or upgrading the given module.

Parameters:
string   $moduleId: 

API Tags:
Return:  a status code


[ Top ]
convertBitsToInt  [line 961]

  int convertBitsToInt( mixed $bitsVal  )

Convert value from a database bit column into an integer

Parameters:
mixed   $bitsVal:  bit value

API Tags:
Return:  integer value


Redefined in descendants as:

[ Top ]
convertIntToBits  [line 951]

  mixed convertIntToBits( int $intVal  )

Convert an integer into something that the database will accept into a bit column

Parameters:
int   $intVal:  integer value

API Tags:
Return:  bit value


Redefined in descendants as:

[ Top ]
decodeBlob  [line 1327]

  binary decodeBlob( string $blob  )

Decode a blob of binary data into a form that's safe for a varchar column

Parameters:
string   $blob:  database safe string

API Tags:
Return:  data


Redefined in descendants as:

[ Top ]
deleteEntity  [line 342]

  GalleryStatus deleteEntity( &$entity, GalleryEntity $entity  )

Delete the GalleryEntity

Parameters:
GalleryEntity   $entity:  the GalleryEntity to delete
   &$entity: 

API Tags:
Return:  a status code


[ Top ]
describeEntity  [line 1102]

  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


[ Top ]
describeMap  [line 1234]

  array describeMap( string $mapName, [boolean $tryAllModules = false]  )

Describe all the members of a map

Parameters:
string   $mapName:  a map name
boolean   $tryAllModules:  try all modules, not just active ones

API Tags:
Return:  GalleryStatus a status code, array member name => member type


[ Top ]
encodeBlob  [line 1317]

  database encodeBlob( string $blob  )

Encode a blob of binary data into a form that's safe for a varchar column

Parameters:
string   $blob:  binary data

API Tags:
Return:  safe string


Redefined in descendants as:

[ Top ]
execute  [line 514]

  GalleryStatus execute( string $statement, [array $data = array()]  )

Execute a database statement

Parameters:
string   $statement:  the SQL statement
array   $data:  any explicit data values required by the query

API Tags:
Return:  a status code,


[ Top ]
extractClasses  [line 1037]

  array extractClasses( string $query  )

Extracts the class names from a given query

Query should be something like '[GalleryItem::id] = ? AND [GalleryPhotoItem::id] = ?' Results would be: array('[GalleryItem]', '[GalleryPhotoItem]')

Parameters:
string   $query: 

API Tags:
Return:  GalleryStatus a status code array strings table names


[ Top ]
getAdoDbType  [line 271]

  string getAdoDbType( )

Return the type of this database (ADOdb driver name)



[ Top ]
getAffectedRows  [line 1089]

  array getAffectedRows( [boolean $useNonTransactionalConnection = false]  )

Return the number of rows that were affected by the last UPDATE/DELETE. Note that MySQL treats this a little differently than other databases; if you do an UPDATE operation and nothing is actually changed (eg. in the situation where the SET clauses in your UPDATE match the existing values) then mysql will return 0 affected rows.

Parameters:
boolean   $useNonTransactionalConnection:  (optional) set to true if we should check the non transactional database connection for this operation. Default is false.

API Tags:
Return:  GalleryStatus a status code int the number of affected rows


[ Top ]
getDatabaseExporter  [line 1450]

  A getDatabaseExporter( )

This method gets a Gallery Database Exporter object.


API Tags:
Return:  GalleryDatabaseExport object.


[ Top ]
getDatabaseImporter  [line 1460]

  A getDatabaseImporter( )

This method gets a Gallery Database Importer object.


API Tags:
Return:  GalleryDatabaseImport object.


[ Top ]
getFunctionSql  [line 1022]

  array getFunctionSql( string $functionName, array $args  )

Return a customized function for this database platform

Available functions:

  • AS: Column alias Syntax, e.g. SELECT foo $as somename FROM BAR;
  • AVG(statement): Aggregate function to average the values of the selected rows.
  • BITAND($a, $b): Binary AND operation on two bit-sequences (or integers)
  • BIT_OR(columnName): Binary OR operation of multiple bit-sequences (aggregate function) e.g. SELECT [::foo], BIT_OR([::bar]) FROM [BAZ] GROUP BY [::foo]; WARNING: Not all backends support BIT_OR. Check the returned status for ERROR_UNSUPPORTED_OPERATION and implement fallback code in PHP.
  • CASE($condition0, $value0, $condition1, $value1, ..., $elseValue): Conditional selection of a value, condition value (condition value)* else-value.
  • CONCAT($string0, $string1, ...): Concatenate two or more strings
  • LIKE(columnName, $string): SQL LIKE operator with SQL LIKE wildcards '_' and '%'.
  • LIMIT($count, $query): Returns the same query with an intrinsic limit on the returned rows. WARNING: This code is suboptimal for some backends (e.g. Oracle). Instead use $gallery->search($query, $data, array('limit' => array('count' => $count));
  • MULTI_INSERT(tableName, $columnList, $rowCount): Generates the SQL to insert multiple rows with a single query.
  • RAND($seed): Returns a random identifier that can be used for ORDER BY RAND(). Most DBMS return a float in the range of 0.0 and 1.0, but some return an integer or even a database-specific uniqueidentifier. WARNING: $seed is optional and is not supported by all backends.
  • RANDOM_INTEGER(): Returns a random integer between 0 and 2^31-1 (2147483647)
  • SUBSTRING($str, $pos, $len): Returns a substring of $string starting from position $pos. $len is optional and limits the string to the specified length.
  • UNIX_TIMESTAMP('2007-11-30 10:30:19'): Converts a database specific timestamp to a unix timestamp

Parameters:
string   $functionName: 
array   $args:  mixed the function arguments

API Tags:
Return:  GalleryStatus a status code string the function SQL


Redefined in descendants as:

[ Top ]
getMapEntry  [line 571]

  array getMapEntry( string $mapName, array $select, [array $match = array()], [array $optional = array()]  )

Get entries in a map that match a criteria and return selected fields

Parameters:
string   $mapName:  the map we're working on
array   $select:  the columns to return
array   $match:  the entries to match
array   $optional:  optional arguments (eg. limit, orderBy) array('limit' => array('count' => #, 'offset' => #), 'orderBy' => array(columnName => ORDER_ASCENDING|ORDER_DESCENDING, ...))

API Tags:
Return:  GalleryStatus a status code GallerySearchResults the results


[ Top ]
getProfilingHtml  [line 1050]

  string getProfilingHtml( )

Return storage profiling information in HTML format


API Tags:
Return:  HTML


[ Top ]
getTableVersions  [line 1471]

  array getTableVersions( )

Examine the schema table and return the version of all the Gallery tables


API Tags:
Return:  GalleryStatus a status code array (name => (major, minor))


[ Top ]
getUniqueId  [line 365]

  array getUniqueId( [string $sequence = DATABASE_SEQUENCE_ID]  )

Get a new, unique id

Parameters:
string   $sequence:  An optional sequence name, DATABASE_SEQUENCE_ID by default.

API Tags:
Return:  GalleryStatus a status code int an id


Redefined in descendants as:

[ Top ]
isInstalled  [line 1062]

  array isInstalled( )

Return true if enough of this storage system is installed that there'll be a conflict if you try to do another install.


API Tags:
Return:  GalleryStatus a status code boolean true if the tables are installed


[ Top ]
isTransactional  [line 309]

  boolean isTransactional( )

Is the database transactional?


API Tags:
Return:  true if transactional


[ Top ]
loadEntities  [line 320]

  array loadEntities( mixed $ids  )

Load the GalleryEntities with the ids specified

Parameters:
mixed   $ids:  array of ids of the GalleryEntities to load or a single int id

API Tags:
Return:  GalleryStatus a status code, mixed one GalleryEntity or an array of GalleryEntities


[ Top ]
moveIdsBetweenLocks  [line 451]

  GalleryStatus moveIdsBetweenLocks( array $relock, int $newLockId, int $lockType  )

Move ids between locks.

Parameters:
array   $relock:  of lockId => object ids
int   $newLockId:  the new lockId
int   $lockType:  LOCK_READ or LOCK_WRITE

API Tags:
Return:  a status code


[ Top ]
newEntity  [line 353]

  GalleryStatus newEntity( &$entity, GalleryEntity $entity  )

Create a new GalleryEntity

Parameters:
GalleryEntity   $entity:  the GalleryEntity to put the data in
   &$entity: 

API Tags:
Return:  a status code


[ Top ]
newLockId  [line 462]

  array newLockId( )

Generate a new lock id.


API Tags:
Return:  GalleryStatus a status code int lock id


[ Top ]
optimize  [line 1073]

  GalleryStatus optimize( [array $tableNames = null]  )

Optimize the database.

Parameters:
array   $tableNames:  (optional) of string tableName 1, tableName 2. Leave null to optimize all tables.

API Tags:
Return:  a status code


[ Top ]
refreshEntity  [line 377]

  array refreshEntity( GalleryEntity $entity  )

Refresh a GalleryEntity from the database if it has changed

Parameters:
GalleryEntity   $entity:  the object to refresh

API Tags:
Return:  GalleryStatus a status code, GalleryEntity the fresh entity


[ Top ]
refreshLocks  [line 415]

  GalleryStatus refreshLocks( array $lockIds, int $freshUntil  )

Refresh all the locks that we hold so that they aren't accidentally considered expired

Parameters:
array   $lockIds:  the lock ids
int   $freshUntil:  the new "fresh until" timestamp

API Tags:
Return:  a status code


[ Top ]
releaseLocks  [line 426]

  GalleryStatus releaseLocks( mixed $lockIds  )

Release the given locks.

Parameters:
mixed   $lockIds:  array of lock ids or single id

API Tags:
Return:  a status code


[ Top ]
removeAllMapEntries  [line 554]

  GalleryStatus removeAllMapEntries( string $mapName, [bool $useNonTransactionalConnection = false]  )

Remove ALL entries from a map. Use with caution!

Parameters:
string   $mapName:  the map we're working on
bool   $useNonTransactionalConnection:  (optional) set to true if we should do this operation outside of a transaction (which will let some databases use the TRUNCATE statement).

API Tags:
Return:  a status code


Redefined in descendants as:

[ Top ]
removeIdsFromLock  [line 438]

  GalleryStatus removeIdsFromLock( array $lock, array $ids  )

Remove ids from a lock.

Parameters:
array   $lock:  lock data
array   $ids:  ids to remove

API Tags:
Return:  a status code


[ Top ]
removeMapEntry  [line 540]

  GalleryStatus removeMapEntry( string $mapName, array $entry  )

Remove entries from a map

Parameters:
string   $mapName:  the map we're working on
array   $entry:  an associative array of data about the entries to match

API Tags:
Return:  a status code


[ Top ]
rollbackTransaction  [line 897]

  GalleryStatus rollbackTransaction( )

Rollback our transaction, if the storage layer supports them.


API Tags:
Return:  a status code


[ Top ]
saveEntity  [line 331]

  GalleryStatus saveEntity( &$entity, GalleryEntity $entity  )

Save the changes to the GalleryEntity

Parameters:
GalleryEntity   $entity:  the GalleryEntity to save
   &$entity: 

API Tags:
Return:  a status code


[ Top ]
search  [line 476]

  array search( string $query, [array $data = array()], [array $optional = array()]  )

Search the persistent store for the target values matching the given criteria

Parameters:
string   $query:  the search query
array   $data:  any explicit data values required by the query
array   $optional:  optional arguments (eg. limits)

API Tags:
Return:  GalleryStatus a status code, GallerySearchResults the result values


[ Top ]
setDebug  [line 1360]

  void setDebug( bool $debug  )

Set Adodb debug mode.

Parameters:
bool   $debug: 


[ Top ]
unconfigureStore  [line 796]

  GalleryStatus unconfigureStore( $moduleId  )

Uninstall the database schema for the given module

Parameters:
   $moduleId: 

API Tags:
Return:  a status code


[ Top ]
updateMapEntry  [line 664]

  GalleryStatus updateMapEntry( string $mapName, array $match, array $change, [boolean $useNonTransactionalConnection = false]  )

Update entries in a map

Parameters:
string   $mapName:  the map we're working on
array   $match:  the entries to match
array   $change:  the values to change
boolean   $useNonTransactionalConnection:  (optional) set to true if we should use a new non transactional database connection for this operation. Default is false.

API Tags:
Return:  a status code


[ Top ]
updateTableInfo  [line 1481]

  GalleryStatus updateTableInfo( string $moduleId  )

Load the Maps.inc and Entities.inc into the schema table for the specified module

Parameters:
string   $moduleId: 

API Tags:
Return:  a status code


[ Top ]
validateConnection  [line 1491]

  GalleryStatus validateConnection( )

Test whether the current connection and non transactional connection are still valid. If the connections are not valid then reconnect the connection.



[ Top ]
_executeSqlFile  [line 1115]

  GalleryStatus _executeSqlFile( string $fileName  )

Execute a given SQL file against the database. Prefix table and column names as necessary.

Split multiple commands in the file into separate Execute() calls.

Parameters:
string   $fileName:  absolute path of the sql file

API Tags:
Return:  a status code
Access:  protected


[ Top ]
_getConnection  [line 218]

  array _getConnection( [ $forceNew = false]  )

Connect to the database

Parameters:
   $forceNew: 

API Tags:
Return:  GalleryStatus a status code object a database resource
Access:  protected


[ Top ]
_getEntityOrMapInfo  [line 1280]

  array _getEntityOrMapInfo( string $type, boolean $tryAllModules  )

Retrieve the entity or map information from the Schema table. If tryAllModules is false then only consider plugins that are active.

Parameters:
string   $type:  type of table to retrieve (map | entity)
boolean   $tryAllModules:  try all modules, not just active ones

API Tags:
Return:  GalleryStatus a status code, array member name => member type
Access:  protected


[ Top ]
_getExtras  [line 294]

  GalleryStorageExtras &_getExtras( )

Get the reference to our GalleryStorageExtras instance where we put less frequently used code (most code that's used to modify the database).


API Tags:
Access:  protected


[ Top ]
_getOptimizeStatements  [line 981]

  array(string _getOptimizeStatements( )

Get sql to optimize a table


API Tags:
Return:  sql statement with %s token for table name, ...)
Access:  protected


Redefined in descendants as:

[ Top ]
_getSqlReplacements  [line 971]

  array _getSqlReplacements( )

Return database specific syntax to replace in schema SQL


API Tags:
Return:  (string => replacement)
Access:  protected


Redefined in descendants as:

[ Top ]
_getWhereSql  [line 742]

  void _getWhereSql( string $memberName, array $memberData, mixed $matchValue, &$where, &$wheredata, array $where, array $wheredata  )

Accepts a $mapInfo pair and $match value to add match information to supplied array.

Parameters:
string   $memberName:  Name of map field
array   $memberData:  Data about map field
mixed   $matchValue:  Values that the map should match on
array   $where:  All match keys
array   $wheredata:  All match values
   &$where: 
   &$wheredata: 


[ Top ]
_guaranteeTransaction  [line 934]

  GalleryStatus _guaranteeTransaction( )

Begin transaction if not already in one.


API Tags:
Return:  a status code
Access:  protected


[ Top ]
_normalizeValue  [line 1382]

  mixed _normalizeValue( mixed $value, array $memberData, [boolean $fromDb = false]  )

Cast the value to the proper member type when interacting with the database. Optionally also perform a UTF-8-safe truncation for strings.

Parameters:
mixed   $value:  the value
array   $memberData:  ('type' => STORAGE_TYPE_XXX constant, 'size' => STORAGE_SIZE_XXX constant)
boolean   $fromDb:  (optional) false if value is for SQL, true if value is from the DB

API Tags:
Return:  correctly typed value
Access:  protected

Information Tags:
Todo:  CAST empty to NULL ? values from DB too?

Redefined in descendants as:

[ Top ]
_setConnectionSettings  [line 283]

  GalleryStatus _setConnectionSettings( &$db, object adodb $db  )

Set runtime settings for the given database connection.

Set the connection/client/server encoding and other parameters

Parameters:
object adodb   $db:  database handle
   &$db: 

API Tags:
Return:  a status code
Access:  protected


Redefined in descendants as:

[ Top ]
_traceStart  [line 1336]

  void _traceStart( )

Start tracing. If Gallery is in debug, this method will begin storing all output and routing it into Gallery's debug system.


API Tags:
Access:  protected


[ Top ]
_traceStop  [line 1347]

  void _traceStop( )

Stop tracing. If Gallery is in debug, this will method will stop tracing.


API Tags:
Access:  protected


[ Top ]
_translateColumnName  [line 1170]

  string _translateColumnName( string $columnName  )

Translate a potentially unsafe column name into a safe one

Parameters:
string   $columnName:  the name of a column

API Tags:
Return:  a safe column name
Access:  protected


[ Top ]
_translateQuery  [line 1127]

  string _translateQuery( string $query  )

Translate all table and column names from [Entity::member] notation to table.column notation.

Parameters:
string   $query:  the raw query

API Tags:
Return:  the translated query
Access:  protected


[ Top ]
_translateTableName  [line 1188]

  array _translateTableName( string $tableName  )

Translate a potentially unsafe table name into a safe one by adding a prefix or suffix to avoid conflicting with a reserved word.

eg: Comment => array(g2_Comment, null, Comment) Comment=1 => array(g2_Comment, C0, Comment)

Parameters:
string   $tableName:  the name of a table

API Tags:
Return:  string a safe table name an alias for this table the unsafe, but translated, table name
Access:  protected


[ Top ]
_truncateString  [line 1425]

  the _truncateString( string $value, int $size, [bool $lengthInBytes = false]  )

Perform a UTF-8-safe truncation of the string to a size

Parameters:
string   $value:  the value
int   $size:  (as a STORAGE_SIZE_XXX constant)
bool   $lengthInBytes:  (optional) whether to interpret the size in bytes or in characters

API Tags:
Return:  truncated string


Redefined in descendants as:

[ Top ]

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