/**
* Returns table information for table in the database connection.
* @param TDbConnection database connection
* @param string table name
* @return TDbTableInfo table details.
*/
public function getTableInfo(TDbConnection $connection, $tableName)
{
$connStr = $connection->getConnectionString();
$key = $connStr . $tableName;
if (!isset($this->_tables[$key])) {
//call this first to ensure that unserializing the cache
//will find the correct driver dependent classes.
if (!isset($this->_meta[$connStr])) {
$this->_meta[$connStr] = TDbMetaData::getInstance($connection);
}
$tableInfo = null;
if (($cache = $this->getManager()->getCache()) !== null) {
$tableInfo = $cache->get($key);
}
if (empty($tableInfo)) {
$tableInfo = $this->_meta[$connStr]->getTableInfo($tableName);
if ($cache !== null) {
$cache->set($key, $tableInfo);
}
}
$this->_tables[$key] = $tableInfo;
}
return $this->_tables[$key];
}