Public Member Functions | |
__construct (DatabaseInfo $database, $name) | |
__sleep () | |
This "magic" method is invoked upon serialize(). | |
__wakeup () | |
This "magic" method is invoked upon unserialize(). | |
getPrimaryKey () | |
Get parimary key in this table. | |
getColumn ($name) | |
Get the ColumnInfo object for specified column. | |
hasColumn ($name) | |
Return whether table contains specified column. | |
getColumns () | |
Get array of columns for this table. | |
getForeignKey ($name) | |
Get specified fk for this table. | |
getForeignKeys () | |
Get all foreign keys. | |
getIndex ($name) | |
Gets the IndexInfo object for a specified index. | |
getIndexes () | |
Get array of IndexInfo objects for this table. | |
getIndices () | |
Alias for getIndexes() method. | |
getName () | |
Get table name. | |
toString () | |
foreignKeysLoaded () | |
Have foreign keys been loaded? | |
primaryKeyLoaded () | |
Has primary key info been loaded? | |
columnsLoaded () | |
Have columns been loaded? | |
indexesLoaded () | |
Has index information been loaded? | |
getVendorSpecificInfo () | |
Get vendor specific optional information for this table. | |
addColumn (ColumnInfo $column) | |
Adds a column to this table. | |
getDatabase () | |
Get the parent DatabaseInfo object. | |
Protected Member Functions | |
initColumns () | |
Loads the columns. | |
initPrimaryKey () | |
Loads the primary key information for this table. | |
initForeignKeys () | |
Loads the foreign keys for this table. | |
initIndexes () | |
Loads the indexes information for this table. | |
initVendorSpecificInfo () | |
Loads the vendor specific information for this table. | |
Protected Attributes | |
$name | |
$columns = array() | |
$foreignKeys = array() | |
$indexes = array() | |
$primaryKey | |
$pkLoaded = false | |
$fksLoaded = false | |
$indexesLoaded = false | |
$colsLoaded = false | |
$vendorLoaded = false | |
$vendorSpecificInfo = array() | |
$conn | |
$database | |
$dblink | |
Shortcut to db resource link id (needed by drivers for queries). | |
$dbname | |
Shortcut to db name (needed by many drivers for queries). |
Definition at line 30 of file TableInfo.php.
TableInfo::__construct | ( | DatabaseInfo $ | database, | |
$ | name | |||
) |
string | $table The table name. | |
string | $database The database name. | |
resource | $dblink The db connection resource. |
Definition at line 73 of file TableInfo.php.
References $name, DatabaseInfo::getConnection(), and DatabaseInfo::getName().
00073 { 00074 $this->database = $database; 00075 $this->name = $name; 00076 $this->conn = $database->getConnection(); // shortcut because all drivers need this for the queries 00077 $this->dblink = $this->conn->getResource(); 00078 $this->dbname = $database->getName(); 00079 }
TableInfo::__sleep | ( | ) |
This "magic" 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 TableInfo.php.
TableInfo::__wakeup | ( | ) |
This "magic" method is invoked upon unserialize().
This method re-hydrates the object and restores the recursive hierarchy.
Definition at line 96 of file TableInfo.php.
00097 { 00098 // restore chaining 00099 foreach($this->columns as $col) { 00100 $col->table = $this; 00101 } 00102 }
TableInfo::addColumn | ( | ColumnInfo $ | column | ) |
Adds a column to this table.
Definition at line 295 of file TableInfo.php.
References ColumnInfo::getName().
TableInfo::columnsLoaded | ( | ) |
TableInfo::foreignKeysLoaded | ( | ) |
TableInfo::getColumn | ( | $ | name | ) |
Get the ColumnInfo object for specified column.
string | $name The column name. |
SQLException | - if column does not exist for this table. |
Definition at line 154 of file TableInfo.php.
References $name, and initColumns().
00155 { 00156 if(!$this->colsLoaded) $this->initColumns(); 00157 if (!isset($this->columns[$name])) { 00158 throw new SQLException("Table `".$this->name."` has no column `".$name."`"); 00159 } 00160 return $this->columns[$name]; 00161 }
TableInfo::getColumns | ( | ) |
Get array of columns for this table.
Definition at line 178 of file TableInfo.php.
References initColumns().
00179 { 00180 if(!$this->colsLoaded) $this->initColumns(); 00181 return array_values($this->columns); // re-key numerically 00182 }
TableInfo::getDatabase | ( | ) |
TableInfo::getForeignKey | ( | $ | name | ) |
Get specified fk for this table.
string | $name The foreign key name to retrieve. |
SQLException | - if fkey does not exist for this table. |
Definition at line 190 of file TableInfo.php.
References $name, and initForeignKeys().
00191 { 00192 if(!$this->fksLoaded) $this->initForeignKeys(); 00193 if (!isset($this->foreignKeys[$name])) { 00194 throw new SQLException("Table `".$this->name."` has no foreign key `".$name."`"); 00195 } 00196 return $this->foreignKeys[$name]; 00197 }
TableInfo::getForeignKeys | ( | ) |
Get all foreign keys.
Definition at line 203 of file TableInfo.php.
References initForeignKeys().
00204 { 00205 if(!$this->fksLoaded) $this->initForeignKeys(); 00206 return array_values($this->foreignKeys); 00207 }
TableInfo::getIndex | ( | $ | name | ) |
Gets the IndexInfo object for a specified index.
string | $name The index name to retrieve. |
SQLException | - if index does not exist for this table. |
Definition at line 215 of file TableInfo.php.
References $name, indexesLoaded(), and initIndexes().
00216 { 00217 if(!$this->indexesLoaded) $this->initIndexes(); 00218 if (!isset($this->indexes[$name])) { 00219 throw new SQLException("Table `".$this->name."` has no index `".$name."`"); 00220 } 00221 return $this->indexes[$name]; 00222 }
TableInfo::getIndexes | ( | ) |
Get array of IndexInfo objects for this table.
Definition at line 228 of file TableInfo.php.
References indexesLoaded(), and initIndexes().
Referenced by getIndices().
00229 { 00230 if(!$this->indexesLoaded) $this->initIndexes(); 00231 return array_values($this->indexes); 00232 }
TableInfo::getIndices | ( | ) |
Alias for getIndexes() method.
Definition at line 238 of file TableInfo.php.
References getIndexes().
00239 { 00240 return $this->getIndexes(); 00241 }
TableInfo::getName | ( | ) |
Get table name.
Definition at line 247 of file TableInfo.php.
Referenced by DatabaseInfo::addTable().
TableInfo::getPrimaryKey | ( | ) |
Get parimary key in this table.
Exception | - if foreign keys are unsupported by DB. |
Definition at line 142 of file TableInfo.php.
References initPrimaryKey().
00143 { 00144 if(!$this->pkLoaded) $this->initPrimaryKey(); 00145 return $this->primaryKey; 00146 }
TableInfo::getVendorSpecificInfo | ( | ) |
Get vendor specific optional information for this table.
Definition at line 288 of file TableInfo.php.
References initVendorSpecificInfo().
00289 { 00290 if(!$this->vendorLoaded) $this->initVendorSpecificInfo(); 00291 return $this->vendorSpecificInfo; 00292 }
TableInfo::hasColumn | ( | $ | name | ) |
Return whether table contains specified column.
string | $name The column name. |
Definition at line 168 of file TableInfo.php.
References $name, and initColumns().
00169 { 00170 if(!$this->colsLoaded) $this->initColumns(); 00171 return isset($this->columns[$name]); 00172 }
TableInfo::indexesLoaded | ( | ) |
Has index information been loaded?
Definition at line 279 of file TableInfo.php.
Referenced by getIndex(), getIndexes(), SQLiteTableInfo::initIndexes(), PgSQLTableInfo::initIndexes(), OCI8TableInfo::initIndexes(), MySQLiTableInfo::initIndexes(), MySQLTableInfo::initIndexes(), and MSSQLTableInfo::initIndexes().
00280 { 00281 return $this->indexesLoaded; 00282 }
TableInfo::initColumns | ( | ) | [abstract, protected] |
Loads the columns.
Reimplemented in MSSQLTableInfo, MySQLTableInfo, MySQLiTableInfo, ODBCTableInfo, OCI8TableInfo, PgSQLTableInfo, and SQLiteTableInfo.
Referenced by getColumn(), getColumns(), and hasColumn().
TableInfo::initForeignKeys | ( | ) | [abstract, protected] |
Loads the foreign keys for this table.
Reimplemented in MSSQLTableInfo, MySQLTableInfo, MySQLiTableInfo, ODBCTableInfo, OCI8TableInfo, PgSQLTableInfo, and SQLiteTableInfo.
Referenced by getForeignKey(), and getForeignKeys().
TableInfo::initIndexes | ( | ) | [abstract, protected] |
Loads the indexes information for this table.
Reimplemented in MSSQLTableInfo, MySQLTableInfo, MySQLiTableInfo, ODBCTableInfo, OCI8TableInfo, PgSQLTableInfo, and SQLiteTableInfo.
Referenced by getIndex(), and getIndexes().
TableInfo::initPrimaryKey | ( | ) | [abstract, protected] |
Loads the primary key information for this table.
Reimplemented in MSSQLTableInfo, MySQLTableInfo, MySQLiTableInfo, ODBCTableInfo, OCI8TableInfo, PgSQLTableInfo, and SQLiteTableInfo.
Referenced by getPrimaryKey().
TableInfo::initVendorSpecificInfo | ( | ) | [protected] |
Loads the vendor specific information for this table.
Reimplemented in MySQLTableInfo.
Definition at line 135 of file TableInfo.php.
Referenced by getVendorSpecificInfo().
TableInfo::primaryKeyLoaded | ( | ) |
TableInfo::toString | ( | ) |
TableInfo::$colsLoaded = false [protected] |
Definition at line 41 of file TableInfo.php.
TableInfo::$columns = array() [protected] |
Definition at line 33 of file TableInfo.php.
TableInfo::$conn [protected] |
Definition at line 54 of file TableInfo.php.
TableInfo::$database [protected] |
Definition at line 60 of file TableInfo.php.
TableInfo::$dblink [protected] |
Shortcut to db resource link id (needed by drivers for queries).
Definition at line 63 of file TableInfo.php.
TableInfo::$dbname [protected] |
Shortcut to db name (needed by many drivers for queries).
Definition at line 66 of file TableInfo.php.
TableInfo::$fksLoaded = false [protected] |
Definition at line 39 of file TableInfo.php.
TableInfo::$foreignKeys = array() [protected] |
Definition at line 34 of file TableInfo.php.
TableInfo::$indexes = array() [protected] |
Definition at line 35 of file TableInfo.php.
TableInfo::$indexesLoaded = false [protected] |
Definition at line 40 of file TableInfo.php.
TableInfo::$name [protected] |
Definition at line 32 of file TableInfo.php.
Referenced by __construct(), PgSQLTableInfo::__construct(), OCI8TableInfo::__construct(), getColumn(), getForeignKey(), getIndex(), hasColumn(), SQLiteTableInfo::initColumns(), PgSQLTableInfo::initColumns(), ODBCTableInfo::initColumns(), MySQLiTableInfo::initColumns(), MySQLTableInfo::initColumns(), MSSQLTableInfo::initColumns(), PgSQLTableInfo::initForeignKeys(), OCI8TableInfo::initForeignKeys(), ODBCTableInfo::initForeignKeys(), MySQLTableInfo::initForeignKeys(), MSSQLTableInfo::initForeignKeys(), SQLiteTableInfo::initIndexes(), PgSQLTableInfo::initIndexes(), OCI8TableInfo::initIndexes(), MySQLiTableInfo::initIndexes(), MySQLTableInfo::initIndexes(), MSSQLTableInfo::initIndexes(), OCI8TableInfo::initPrimaryKey(), ODBCTableInfo::initPrimaryKey(), MySQLiTableInfo::initPrimaryKey(), MySQLTableInfo::initPrimaryKey(), and MSSQLTableInfo::initPrimaryKey().
TableInfo::$pkLoaded = false [protected] |
Definition at line 38 of file TableInfo.php.
TableInfo::$primaryKey [protected] |
Definition at line 36 of file TableInfo.php.
TableInfo::$vendorLoaded = false [protected] |
Definition at line 42 of file TableInfo.php.
TableInfo::$vendorSpecificInfo = array() [protected] |
Definition at line 48 of file TableInfo.php.