Public Member Functions | |
__construct (Connection $conn, $vendorInfo=array()) | |
getName () | |
Get name of database. | |
__sleep () | |
This method is invoked upon serialize(). | |
__wakeup () | |
This method is invoked upon unserialize(). | |
getConnection () | |
Returns Connection being used. | |
getTable ($name) | |
Get the TableInfo object for specified table name. | |
hasTable ($name) | |
Return whether database contains specified table. | |
getTables () | |
Gets array of TableInfo objects. | |
addTable (TableInfo $table) | |
Adds a table to this db. | |
isSequence ($key) | |
getSequences () | |
Gets array of ? objects. | |
getVendorSpecificInfo () | |
Get vendor specific optional information for this primary key. | |
Protected Member Functions | |
initTables () | |
initSequences () | |
Protected Attributes | |
$tables = array() | |
$sequences = array() | |
$tablesLoaded = false | |
have tables been loaded | |
$seqsLoaded = false | |
have sequences been loaded | |
$conn | |
$dbname | |
Database name. | |
$dblink | |
Private Attributes | |
$vendorSpecificInfo = array() | |
additional vendor specific information |
Definition at line 30 of file DatabaseInfo.php.
DatabaseInfo::__construct | ( | Connection $ | conn, | |
$ | vendorInfo = array() | |||
) |
Connection | $dbh |
Definition at line 63 of file DatabaseInfo.php.
References Connection::getDSN(), and Connection::getResource().
00064 { 00065 $this->conn = $conn; 00066 $this->dblink = $conn->getResource(); 00067 $dsn = $conn->getDSN(); 00068 $this->dbname = $dsn['database']; 00069 $this->vendorSpecificInfo = $vendorInfo; 00070 }
DatabaseInfo::__sleep | ( | ) |
This method is invoked upon serialize().
Because the Info class hierarchy is recursive, we must handle the serialization and unserialization of this object.
Definition at line 87 of file DatabaseInfo.php.
DatabaseInfo::__wakeup | ( | ) |
This method is invoked upon unserialize().
This method re-hydrates the object and restores the recursive hierarchy.
Definition at line 96 of file DatabaseInfo.php.
00097 { 00098 // Re-init vars from serialized connection 00099 $this->dbname = $conn->database; 00100 $this->dblink = $conn->connection; 00101 00102 // restore chaining 00103 foreach($this->tables as $tbl) { 00104 $tbl->database = $this; 00105 $tbl->dbname = $this->dbname; 00106 $tbl->dblink = $this->dblink; 00107 $tbl->schema = $this->schema; 00108 } 00109 }
DatabaseInfo::addTable | ( | TableInfo $ | table | ) |
Adds a table to this db.
Table name is case-insensitive.
TableInfo | $table |
Definition at line 160 of file DatabaseInfo.php.
References TableInfo::getName().
DatabaseInfo::getConnection | ( | ) |
Returns Connection being used.
Definition at line 115 of file DatabaseInfo.php.
Referenced by TableInfo::__construct().
DatabaseInfo::getName | ( | ) |
Get name of database.
Definition at line 76 of file DatabaseInfo.php.
Referenced by TableInfo::__construct().
DatabaseInfo::getSequences | ( | ) |
Gets array of ? objects.
Definition at line 191 of file DatabaseInfo.php.
References initSequences().
00192 { 00193 if(!$this->seqsLoaded) $this->initSequences(); 00194 return array_values($this->sequences); //re-key [numerically] 00195 }
DatabaseInfo::getTable | ( | $ | name | ) |
Get the TableInfo object for specified table name.
string | $name The name of the table to retrieve. |
SQLException | - if table does not exist in this db. |
Definition at line 126 of file DatabaseInfo.php.
References initTables().
00127 { 00128 if(!$this->tablesLoaded) $this->initTables(); 00129 if (!isset($this->tables[strtoupper($name)])) { 00130 throw new SQLException("Database `".$this->dbname."` has no table `".$name."`"); 00131 } 00132 return $this->tables[ strtoupper($name) ]; 00133 }
DatabaseInfo::getTables | ( | ) |
Gets array of TableInfo objects.
Definition at line 149 of file DatabaseInfo.php.
References initTables().
00150 { 00151 if(!$this->tablesLoaded) $this->initTables(); 00152 return array_values($this->tables); //re-key [numerically] 00153 }
DatabaseInfo::getVendorSpecificInfo | ( | ) |
Get vendor specific optional information for this primary key.
Definition at line 201 of file DatabaseInfo.php.
DatabaseInfo::hasTable | ( | $ | name | ) |
Return whether database contains specified table.
string | $name The table name. |
Definition at line 140 of file DatabaseInfo.php.
DatabaseInfo::initSequences | ( | ) | [abstract, protected] |
SQLException |
Reimplemented in MSSQLDatabaseInfo, MySQLDatabaseInfo, MySQLiDatabaseInfo, ODBCDatabaseInfo, OCI8DatabaseInfo, PgSQLDatabaseInfo, and SQLiteDatabaseInfo.
Referenced by getSequences(), and isSequence().
DatabaseInfo::initTables | ( | ) | [abstract, protected] |
SQLException |
Reimplemented in MSSQLDatabaseInfo, MySQLDatabaseInfo, MySQLiDatabaseInfo, ODBCDatabaseInfo, OCI8DatabaseInfo, PgSQLDatabaseInfo, and SQLiteDatabaseInfo.
Referenced by getTable(), and getTables().
DatabaseInfo::isSequence | ( | $ | key | ) |
SQLException |
Definition at line 181 of file DatabaseInfo.php.
References initSequences().
00182 { 00183 if(!$this->seqsLoaded) $this->initSequences(); 00184 return isset($this->sequences[ strtoupper($key) ]); 00185 }
DatabaseInfo::$conn [protected] |
Definition at line 49 of file DatabaseInfo.php.
DatabaseInfo::$dblink [protected] |
Definition at line 58 of file DatabaseInfo.php.
DatabaseInfo::$dbname [protected] |
DatabaseInfo::$seqsLoaded = false [protected] |
DatabaseInfo::$sequences = array() [protected] |
Definition at line 34 of file DatabaseInfo.php.
DatabaseInfo::$tables = array() [protected] |
Definition at line 32 of file DatabaseInfo.php.
DatabaseInfo::$tablesLoaded = false [protected] |
DatabaseInfo::$vendorSpecificInfo = array() [private] |