Class Database
Database interaction abstract class definition
Located in /class.database.php (line 23)
| Class | Description |
|---|---|
| PostgresDatabase | Database adapter class for PostgreSQL |
Stores an a list of existing database connections
Stores information about the default database profile
self::JoinTypeInner => "INNER JOIN",
self::JoinTypeLeft => "LEFT JOIN"
) (line 34)
Defines the syntax for the join type constants
Stores a list of known database profiles
Adds a database profile to the list of known database profiles. These profiles contain connection information for the database, including driver, host, name, user and password.
- array $aProfile: The profile array with database connection information
As the constructor of the Database class and all derived database drivers is protected, the database class cannot be instantiated directly. Instead, the GetConnection() method must be called, afterwhich a database driver object is returned.
A database profile array may be specified to control which database is connected to, and with what driver. If no profile is passed to this method, it first checks to see if there is a default database profile set up. If so, it uses that, if not, it then checks to see if there is only one profile stored. If so, that profile is used. If none of these conditions are met, an exception is thrown.
- array $aProfile: Optional; The profile array with database connection information. If not supplied, and a profile is already loaded, that profile will be used. If no profile is supplied and more than one profile has been loaded, an exception is thrown.
Sets the default database connection profile to the one specified in the first argument.
The default profile is used to create or return a database connection by GetConnection() when no connection is specified to that method.
- string $sProfile: The name of the profile to be used as the default database profile
The Begin() method begins a database transaction which persists until either Commit() or Rollback() is called, or the request ends. If Commit() is not called before the end of the request, the database transaction will automatically roll back.
- PostgresDatabase::Begin() : The Begin() method begins a database transaction which persists until either Commit() or Rollback() is called, or the request ends. If Commit() is not called before the end of the request, the database transaction will automatically roll back.
The CacheSchemas() method toggles whether or not database schemas discovered through the GetSchema(), GetTableColumns(), GetTableForeignKeys() and GetTablePrimaryKey() methods should be cached, and also whether or not those methods will pull their information from a cache, if available.
- boolean $bEnable: Toggles whether or not to cache discovered database schemas
- PostgresDatabase::CacheSchemas() : The CacheSchemas() method toggles whether or not database schemas discovered through the GetSchema(), GetTableColumns(), GetTableForeignKeys() and GetTablePrimaryKey() methods should be cached, and also whether or not those methods will pull their information from a cache, if available.
The Commit() method commits a database transaction (assuming one was started with Begin()). If Commit() is not called before the end of the request, the database transaction will automatically roll back.
- PostgresDatabase::Commit() : The Commit() method commits a database transaction (assuming one was started with Begin()). If Commit() is not called before the end of the request, the database transaction will automatically roll back.
Returns the number of results from the last query performed on the specified database resource object.
- resource $rResult: The database connection resource
- &$rResult
- PostgresDatabase::CountFromResult() : Returns the number of results from the last query performed on the specified database resource object.
Returns a database-safe formatted representation of the supplied data, based on the supplied data type.
- string $sType: The data type of the supplied value.
- string $sValue: The value to be formatted into a database-safe representation.
- PostgresDatabase::FormatData() : Returns a database-safe formatted representation of the supplied data, based on the supplied data type.
Returns the data type of the specified column in the specified table.
- string $sTableName: The name of the table that the desired column belongs to
- string $sFieldName: The name of the column that is desired to know the type of
- PostgresDatabase::GetColumnType() : Returns the data type of the specified column in the specified table.
This method returns all databases on the database server.
- PostgresDatabase::GetDatabases() : This method returns all databases on the database server.
Returns the last database error, if any.
- PostgresDatabase::GetLastError() : Returns the last PostgreSQL database error, if any.
Returns the PHP native database connection resource.
- PostgresDatabase::GetResource() : Returns the native PHP database resource
Collects information about the schema for the specified table, including information on columns (name, datatype), primary keys and foreign keys (relationships to other tables).
This method stores its information the static variable $aSchemas so that if the data is required again, the database does not have to be consoluted.
If schema caching is on, this method can pull data from a schema cache.
- string $sTableName: The name of the table for the requested schema
- PostgresDatabase::GetSchema() : Collects all fields/columns in the specified database table, as well as data type and key information.
Returns an array of columns that belong to the specified table.
This method stores its information the static variable $aSchemas so that if the data is required again, the database does not have to be consoluted.
If schema caching is on, this method can pull data from a schema cache.
- string $sTableName: The name of the table for the requested columns
- PostgresDatabase::GetTableColumns() : Returns an array of columns that belong to the specified table.
Returns an array of relationships (foreign keys) for the specified table.
This method stores its information the static variable $aSchemas so that if the data is required again, the database does not have to be consoluted.
If schema caching is on, this method can pull data from a schema cache.
- string $sTableName: The name of the table for the requested relationships
- PostgresDatabase::GetTableForeignKeys() : Returns an array of relationships (foreign keys) for the specified table.
Returns an array of columns that belong to the primary key for the specified table.
This method stores its information the static variable $aSchemas so that if the data is required again, the database does not have to be consoluted.
If schema caching is on, this method can pull data from a schema cache.
- string $sTableName: The name of the table for the requested primary key
- PostgresDatabase::GetTablePrimaryKey() : Returns an array of columns that belong to the primary key for the specified table.
This method returns all tables for the database the class is currently connected to.
- PostgresDatabase::GetTables() : This method returns all tables for the database the class is currently connected to.
Returns the version of the database server.
- PostgresDatabase::GetVersion() : Returns the version of the database server.
Pulls the next record from specified database resource and returns it as an object.
- resource $rResult: The database connection resource to pull the next record from
- &$rResult
- PostgresDatabase::PullNextResult() : Pulls the next record from specified database resource and returns it as an object.
Queries the database using the supplied SQL query.
- string $sSQL: The SQL query to execute
- PostgresDatabase::Query() : Queries the PostgreSQL database using the supplied SQL query.
Attempts to return the internal pointer of the specified database resource to the first row.
- resource $rResult: The database connection resource to pull the next record from
- &$rResult
- PostgresDatabase::ResetResult() : Attempts to return the internal pointer of the specified database resource to the first row.
The Rollback() method rolls back a database transaction (assuming one was started with Begin()). The database transaction is automatically rolled back if Commit() is not called.
- PostgresDatabase::Rollback() : The Rollback() method rolls back a database transaction (assuming one was started with Begin()). The database transaction is automatically rolled back if Commit() is not called.
The SetCacheDirectory() method stores which directory should be used to load and store database schema cache files. If the directory does not exist, an exception will be thrown. Setting the cache directory is useless unless schema caching is turned on using CacheSchemas().
- string $sDirectoryName: The absolute path to the directory in the system to store and read cached database schema files.
- PostgresDatabase::SetCacheDirectory() : The SetCacheDirectory() method stores which directory should be used to load and store database schema cache files. If the directory does not exist, an exception will be thrown.
Determines whether the specified table exists in the current database.
- string $sTableName: The name of the table to determine existence
- PostgresDatabase::TableExists() : Determines whether the specified table exists in the current database.
Documentation generated on Thu, 25 Feb 2010 15:59:40 -0500 by phpDocumentor 1.4.3

