Class SS_Database
Abstract database connectivity class. Sub-classes of this implement the actual database connection libraries
Direct known subclasses
Methods summary
abstract public
|
|
abstract public
integer
|
|
abstract public
boolean
|
|
abstract public
boolean
|
#
createDatabase( )
Create the database and connect to it. This can be called if the initial database connection is not successful because the database does not exist. |
abstract public
string
|
|
abstract public
The
|
#
createTable( mixed $table, mixed $fields = null, mixed $indexes = null, mixed $options = null, mixed $advancedOptions = null )
Create a new table. |
abstract public
|
#
alterTable( mixed $table, mixed $newFields = null, mixed $newIndexes = null, mixed $alteredFields = null, mixed $alteredIndexes = null, mixed $alteredOptions = null, mixed $advancedOptions = null )
Alter a table's schema. |
abstract public
|
|
abstract public
|
|
abstract public
|
#
renameField( string $tableName, string $oldName, string $newName )
Change the database column name of the given field. |
abstract protected
array
|
|
abstract protected
array
|
|
abstract public
|
|
abstract public
|
#
enumValuesForField( mixed $tableName, mixed $fieldName )
Returns the enum values available on the given field |
public
|
#
beginSchemaUpdate( )
Start a schema-updating transaction. All calls to requireTable/Field/Index will keep track of the changes requested, but not actually do anything. Once |
public
|
|
public
|
|
public
|
#
doesSchemaNeedUpdating( )
Returns true if schema modifications were requested after a beginSchemaUpdate() call. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
protected
|
#
transInitTable( mixed $table )
Handler for the other transXXX methods - mark the given table as being altered if it doesn't already exist |
public
|
#
requireTable( string $table, string $fieldSchema = null, string $indexSchema = null, array $hasAutoIncPK = true, mixed $options = Array(), mixed $extensions = false )
Generate the following table in the database, modifying whatever already exists as necessary. |
public
|
#
dontRequireTable( string $table )
If the given table exists, move it out of the way by renaming it to _obsolete_(tablename). |
public
|
#
requireIndex( string $table, string $index, string|boolean $spec )
Generate the given index in the database, modifying whatever already exists as necessary. |
public
|
#
requireField( string $table, string $field, array|string $spec )
Generate the given field on the table, modifying whatever already exists as necessary. |
public
|
#
dontRequireField( string $table, string $fieldName )
If the given field exists, move it out of the way by renaming it to _obsolete_(fieldname). |
public
|
#
manipulate( array $manipulation )
Execute a complex manipulation on the database. A manipulation is an array of insert / or update sequences. The keys of the array are table names, and the values are map containing 'command' and 'fields'. Command should be 'insert' or 'update', and fields should be a map of field names to field values, including quotes. The field value can also be a SQL function or similar. |
public static
|
#
replace_with_null( string & $array )
Replaces "\'\'" with "null", recursively walks through the given array. |
public
|
#
databaseError( string $msg, integer $errorLevel = E_USER_ERROR )
Error handler for database errors. All database errors will call this function to report the error. It isn't a static function; it will be called on the object itself and as such can be overridden in a subclass. |
public
|
|
public
|
|
public
|
|
abstract public
string
|
#
formattedDatetimeClause( string $date, string $format )
Function to return an SQL datetime expression that can be used with the adapter in use used for querying a datetime in a certain format |
abstract public
string
|
#
datetimeIntervalClause( string $date, string $interval )
Function to return an SQL datetime expression that can be used with the adapter in use used for querying a datetime addition |
abstract public
string
|
#
datetimeDifferenceClause( string $date1, string $date2 )
Function to return an SQL datetime expression that can be used with the adapter in use used for querying a datetime substraction |
Magic methods summary
Properties summary
public static
mixed
|
$globalConn |
#
Connection object to the database. |
protected
boolean
|
$supressOutput |
#
If this is false, then information about database operations will be displayed, eg creation of tables. |
protected
array
|
$tableList |
#
The table list, generated by the tableList() function. Used by the requireTable() function. |
protected
array
|
$fieldList |
#
The field list, generated by the fieldList() function. An array of maps of field name => field spec, indexed by table name. |
protected
array
|
$indexList |
#
The index list for each table, generated by the indexList() function. An map from table name to an array of index names. |
protected
mixed
|
$schemaUpdateTransaction |
#
Large array structure that represents a schema update transaction |