Source of file Metadata.php
Size: 5,862 Bytes - Last Modified: 2014-03-12T23:21:18+01:00
/home/theseer/Downloads/ZendFramework-2.3.0/library/Zend/Db/Metadata/Metadata.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 | <?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace Zend\Db\Metadata; use Zend\Db\Adapter\Adapter; class Metadata implements MetadataInterface { /** * Adapter * * @var Adapter */ protected $adapter = null; /** * @var MetadataInterface */ protected $source = null; /** * Constructor * * @param Adapter $adapter */ public function __construct(Adapter $adapter) { $this->adapter = $adapter; $this->source = $this->createSourceFromAdapter($adapter); } /** * Create source from adapter * * @param Adapter $adapter * @return Source\AbstractSource */ protected function createSourceFromAdapter(Adapter $adapter) { switch ($adapter->getPlatform()->getName()) { case 'MySQL': return new Source\MysqlMetadata($adapter); case 'SQLServer': return new Source\SqlServerMetadata($adapter); case 'SQLite': return new Source\SqliteMetadata($adapter); case 'PostgreSQL': return new Source\PostgresqlMetadata($adapter); case 'Oracle': return new Source\OracleMetadata($adapter); } throw new \Exception('cannot create source from adapter'); } // @todo methods /** * Get base tables and views * * @param string $schema * @param bool $includeViews * @return Object\TableObject[] */ public function getTables($schema = null, $includeViews = false) { return $this->source->getTables($schema, $includeViews); } /** * Get base tables and views * * @param string $schema * @return Object\TableObject[] */ public function getViews($schema = null) { return $this->source->getViews($schema); } /** * Get triggers * * @param string $schema * @return array */ public function getTriggers($schema = null) { return $this->source->getTriggers($schema); } /** * Get constraints * * @param string $table * @param string $schema * @return array */ public function getConstraints($table, $schema = null) { return $this->source->getConstraints($table, $schema); } /** * Get columns * * @param string $table * @param string $schema * @return array */ public function getColumns($table, $schema = null) { return $this->source->getColumns($table, $schema); } /** * Get constraint keys * * @param string $constraint * @param string $table * @param string $schema * @return array */ public function getConstraintKeys($constraint, $table, $schema = null) { return $this->source->getConstraintKeys($constraint, $table, $schema); } /** * Get constraints * * @param string $constraintName * @param string $table * @param string $schema * @return Object\ConstraintObject */ public function getConstraint($constraintName, $table, $schema = null) { return $this->source->getConstraint($constraintName, $table, $schema); } /** * Get schemas */ public function getSchemas() { return $this->source->getSchemas(); } /** * Get table names * * @param string $schema * @param bool $includeViews * @return array */ public function getTableNames($schema = null, $includeViews = false) { return $this->source->getTableNames($schema, $includeViews); } /** * Get table * * @param string $tableName * @param string $schema * @return Object\TableObject */ public function getTable($tableName, $schema = null) { return $this->source->getTable($tableName, $schema); } /** * Get views names * * @param string $schema * @return \Zend\Db\Metadata\Object\TableObject */ public function getViewNames($schema = null) { return $this->source->getTable($schema); } /** * Get view * * @param string $viewName * @param string $schema * @return \Zend\Db\Metadata\Object\TableObject */ public function getView($viewName, $schema = null) { return $this->source->getView($viewName, $schema); } /** * Get trigger names * * @param string $schema * @return array */ public function getTriggerNames($schema = null) { return $this->source->getTriggerNames($schema); } /** * Get trigger * * @param string $triggerName * @param string $schema * @return \Zend\Db\Metadata\Object\TriggerObject */ public function getTrigger($triggerName, $schema = null) { return $this->source->getTrigger($triggerName, $schema); } /** * Get column names * * @param string $table * @param string $schema * @return array */ public function getColumnNames($table, $schema = null) { return $this->source->getColumnNames($table, $schema); } /** * Get column * * @param string $columnName * @param string $table * @param string $schema * @return \Zend\Db\Metadata\Object\ColumnObject */ public function getColumn($columnName, $table, $schema = null) { return $this->source->getColumn($columnName, $table, $schema); } } |