Class PostgresDatabase
Database adapter class for PostgreSQL
Located in /class.postgresdatabase.php (line 25)
Database | --PostgresDatabase
Stores information about our database schema discovered through our query processing
Inherited Variables
Inherited from Database
Database::$aConnections
Database::$aDefaultProfile
Database::$aJoinTypes
Database::$aProfiles
The constructor sets up a new connection to the PostgreSQL database. This method is protected, and can only be called from within the class, normally through the GetConnection() method. This helps support the singleton methodology.
- array $aProfile: The database profile array containing connection information
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.
- Database::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.
Attempting to cache schemas without properly setting the cache directory using SetCacheDirectory(). If caching is attempted without setting the directory, an exception will be thrown.
Schema caching is primarily used by the CRUD object, which analyzes database schemas to automate database operations.
- boolean $bEnable: Toggles whether or not to cache discovered database schemas
- Database::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.
- Database::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
- Database::CountFromResult()
- Returns the number of results from the last query performed on the specified database resource object.
Gets the current value of the specified sequence.
This method does not alter the current value of the sequence.
This method will only work if the value of the sequence has already been altered during the current database transaction; meaning that you must call NextVal() or SerialNextVal() prior to using this method.
- string $sSequenceName: The name of the database sequence to get the current value of
Returns a database-safe formatted representation of the supplied data, based on the supplied data type.
- If the supplied data is empty and does not equal zero, this method returns NULL.
- If the data type is of text, varchar, timestamp, or bool, this method returns that value surrounded in single quotes.
- string $sType: The data type of the supplied value
- string $sValue: The value to be formatted into a database-safe representation
- Database::FormatData()
- Returns a database-safe formatted representation of the supplied data, based on the supplied data type.
Returns the name of the column at the specified position from the specified table.
This method is primarily interally as, in the PostgreSQL catalog, table references, indexes, etc, are stored by column number in the catalog tables.
- string $sTableName: The name of the table that the desired column belongs to
- int $iColumnNumber: The column number from the table (from the PostgreSQL catalog)
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
- Database::GetColumnType()
- Returns the data type of the specified column in the specified table.
This method returns all databases on the database server.
- Database::GetDatabases()
- This method returns all databases on the database server.
Returns the last PostgreSQL database error, if any.
- Database::GetLastError()
- Returns the last database error, if any.
Returns the native PHP database resource
- Database::GetResource()
- Returns the PHP native database connection resource.
Collects all fields/columns in the specified database table, as well as data type and key information.
- $sTableName
- Database::GetSchema()
- Collects information about the schema for the specified table, including information on columns (name, datatype), primary keys and foreign keys (relationships to other tables).
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
- Database::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
- Database::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 hte table for the requested primary key
- Database::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.
- Database::GetTables()
- This method returns all tables for the database the class is currently connected to.
Returns the version of the database server.
- Database::GetVersion()
- Returns the version of the database server.
This method determines if the specified tables primary key (or a single column from a compound primary key) references another table.
- string $sTableName: The name of the table that the key exists on
- string $sColumnName: The column that is, or is part of, the primary key for the table
Advances the value of the supplied sequence and returns the new value.
- string $sSequenceName: The name of the database sequence to advance and get the current value of
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
- Database::PullNextResult()
- Pulls the next record from specified database resource and returns it as an object.
Queries the PostgreSQL database using the supplied SQL query.
- string $sSQL: The PostgreSQL query to execute
- Database::Query()
- Queries the 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
- Database::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.
- Database::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.
Gets the current value of the specified sequence by the name of the table and the name of the database column. This will only work if a sequence is defined as the default value of a table column.
This method does not alter the current value of the sequence.
This method will only work if the value of the sequence has already been altered during the current database transaction; meaning that you must call NextVal() or SerialNextVal() prior to using this method.
- string $sTableName,: The name of the database table that holds the column with the sequence as a default value
- string $sColumnName: The name of the database table column with the sequence as a default value
- $sTableName
Advances the value of the supplied sequence and returns the new value by the name of the table and the name of the column. This will only work if a sequence is defined as the default value of a table column.
- string $sTableName: The name of the database table that holds the column with the sequence as a default value
- string $sColumnName: The name of the database table column with the sequence as a default value
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().
Schema caching is primarily used by the CRUD object, which analyzes database schemas to automate database operations.
- string $sDirectoryName: The absolute path to the directory in the system to store and read cached database schema files
- Database::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. Setting the cache directory is useless unless schema caching is turned on using CacheSchemas().
Determines whether the specified table exists in the current database.
This method first determines whether or not the table exists in the schemas array. If not, it attempts to find the table in the PostgreSQL catalog.
- string $sTableName: The name of the table to determine existence
- Database::TableExists()
- Determines whether the specified table exists in the current database.
Inherited Methods
Inherited From Database
Database::AddProfile()
Database::Begin()
Database::CacheSchemas()
Database::Commit()
Database::CountFromResult()
Database::FormatData()
Database::GetColumnType()
Database::GetConnection()
Database::GetDatabases()
Database::GetLastError()
Database::GetResource()
Database::GetSchema()
Database::GetTableColumns()
Database::GetTableForeignKeys()
Database::GetTablePrimaryKey()
Database::GetTables()
Database::GetVersion()
Database::PullNextResult()
Database::Query()
Database::ResetResult()
Database::Rollback()
Database::SetCacheDirectory()
Database::SetDefaultProfile()
Database::TableExists()
Documentation generated on Thu, 25 Feb 2010 15:59:41 -0500 by phpDocumentor 1.4.3

