diff --git a/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php b/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php index d4ac0a958..90b1928b2 100644 --- a/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php @@ -1449,16 +1449,6 @@ abstract class AbstractPlatform throw DBALException::notSupported(__METHOD__); } - public function getListFunctionsSql() - { - throw DBALException::notSupported(__METHOD__); - } - - public function getListTriggersSql($table = null) - { - throw DBALException::notSupported(__METHOD__); - } - public function getListSequencesSql($database) { throw DBALException::notSupported(__METHOD__); diff --git a/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php b/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php index 04ae02615..0ae1520ad 100644 --- a/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php @@ -154,20 +154,6 @@ class MySqlPlatform extends AbstractPlatform return 'SHOW DATABASES'; } - public function getListFunctionsSql() - { - return 'SELECT SPECIFIC_NAME FROM information_schema.ROUTINES'; - } - - public function getListSequencesSql($database) - { - $query = 'SHOW TABLES'; - if ( ! is_null($database)) { - $query .= ' FROM ' . $database; - } - return $query; - } - public function getListTableConstraintsSql($table) { return 'SHOW INDEX FROM ' . $table; @@ -178,20 +164,6 @@ class MySqlPlatform extends AbstractPlatform return 'SHOW INDEX FROM ' . $table; } - public function getListUsersSql() - { - return "SELECT * FROM mysql.user WHERE user != '' GROUP BY user"; - } - - public function getListTriggersSql($table = null) - { - $sql = "SELECT TRIGGER_NAME FROM information_schema.TRIGGERS"; - if($table !== null) { - $sql .= " WHERE EVENT_OBJECT_TABLE = '".$table."'"; - } - return $sql; - } - public function getListViewsSql($database) { return "SELECT * FROM information_schema.VIEWS WHERE TABLE_SCHEMA = '".$database."'"; diff --git a/lib/Doctrine/DBAL/Platforms/OraclePlatform.php b/lib/Doctrine/DBAL/Platforms/OraclePlatform.php index c360585f6..560fbb14e 100644 --- a/lib/Doctrine/DBAL/Platforms/OraclePlatform.php +++ b/lib/Doctrine/DBAL/Platforms/OraclePlatform.php @@ -258,11 +258,6 @@ class OraclePlatform extends AbstractPlatform return 'SELECT username FROM all_users'; } - public function getListFunctionsSql() - { - return "SELECT name FROM sys.user_source WHERE line = 1 AND type = 'FUNCTION'"; - } - public function getListSequencesSql($database) { return "SELECT sequence_name, min_value, increment_by FROM sys.all_sequences ". @@ -327,11 +322,6 @@ class OraclePlatform extends AbstractPlatform return 'SELECT * FROM sys.user_tables'; } - public function getListUsersSql() - { - return 'SELECT * FROM all_users'; - } - public function getListViewsSql($database) { return 'SELECT view_name, text FROM sys.user_views'; diff --git a/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php b/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php index fe7e4f908..ddddae8e8 100644 --- a/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php @@ -273,21 +273,6 @@ class PostgreSqlPlatform extends AbstractPlatform return 'SELECT datname FROM pg_database'; } - public function getListFunctionsSql() - { - return "SELECT - proname - FROM - pg_proc pr, pg_type tp - WHERE - tp.oid = pr.prorettype - AND pr.proisagg = FALSE - AND tp.typname <> 'trigger' - AND pr.pronamespace IN - (SELECT oid FROM pg_namespace - WHERE nspname NOT LIKE 'pg_%' AND nspname != 'information_schema')"; - } - public function getListSequencesSql($database) { return "SELECT @@ -322,25 +307,6 @@ class PostgreSqlPlatform extends AbstractPlatform return 'SELECT viewname, definition FROM pg_views'; } - public function getListTriggersSql($table = null) - { - $sql = 'SELECT trg.tgname AS trigger_name - FROM pg_trigger trg, - pg_class tbl - WHERE trg.tgrelid = tbl.oid'; - - if ( ! is_null($table)) { - $sql .= " AND tbl.relname = " . $table; - } - - return $sql; - } - - public function getListUsersSql() - { - return 'SELECT usename, passwd FROM pg_user'; - } - public function getListTableForeignKeysSql($table, $database = null) { return "SELECT r.conname, pg_catalog.pg_get_constraintdef(r.oid, true) as condef diff --git a/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php b/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php index 02808c65e..bf9134563 100644 --- a/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php @@ -102,8 +102,6 @@ abstract class AbstractSchemaManager } } - /* list*() Methods */ - /** * List the available databases for this connection * @@ -118,40 +116,6 @@ abstract class AbstractSchemaManager return $this->_getPortableDatabasesList($databases); } - /** - * List the names of available functions for this connection - * - * @example array( - * 'functionA', 'functionB', 'procedureA', - * ) - * @return array $functions - */ - public function listFunctions() - { - $sql = $this->_platform->getListFunctionsSql(); - - $functions = $this->_conn->fetchAll($sql); - - return $this->_getPortableFunctionsList($functions); - } - - /** - * List the names of available triggers for this connection - * - * @example array( - * 'triggerName1', 'triggerName2', - * ); - * @return array $triggers - */ - public function listTriggers() - { - $sql = $this->_platform->getListTriggersSql(); - - $triggers = $this->_conn->fetchAll($sql); - - return $this->_getPortableTriggersList($triggers); - } - /** * List the available sequences for this connection * @@ -262,20 +226,6 @@ abstract class AbstractSchemaManager return new Table($tableName, $columns, $indexes, $foreignKeys, $idGeneratorType, array()); } - /** - * List the users this connection has - * - * @return array $users - */ - public function listUsers() - { - $sql = $this->_platform->getListUsersSql(); - - $users = $this->_conn->fetchAll($sql); - - return $this->_getPortableUsersList($users); - } - /** * List the views this connection has * @@ -294,7 +244,7 @@ abstract class AbstractSchemaManager * List the foreign keys for the given table * * @param string $table The name of the table - * @return array $tableForeignKeys + * @return ForeignKeyConstraint[] */ public function listTableForeignKeys($table, $database = null) { @@ -314,7 +264,7 @@ abstract class AbstractSchemaManager * * NOTE: You can not drop the database this SchemaManager is currently connected to. * - * @param string $database The name of the database to drop + * @param string $database The name of the database to drop */ public function dropDatabase($database) { diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php index 2f212e9bf..94241d476 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php @@ -8,18 +8,5 @@ require_once __DIR__ . '/../../../TestInit.php'; class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase { - public function testListUsers() - { - $users = $this->_sm->listUsers(); - $this->assertEquals(true, is_array($users)); - $params = $this->_conn->getParams(); - $testUser = $params['user']; - $found = false; - foreach ($users as $user) { - if ($user['user'] == $testUser) { - $found = true; - } - } - $this->assertEquals(true, $found); - } + } \ No newline at end of file diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php index 1ef5f2063..afbd8a880 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php @@ -24,29 +24,6 @@ class OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase $conn->executeUpdate($query); } - /** - * @expectedException \Exception - */ - public function testListTriggers() - { - $this->_sm->listTriggers(); - } - - public function testListUsers() - { - $users = $this->_sm->listUsers(); - $this->assertEquals(true, is_array($users)); - $params = $this->_conn->getParams(); - $testUser = strtoupper($params['user']); - $found = false; - foreach ($users as $user) { - if ($user['user'] == $testUser) { - $found = true; - } - } - $this->assertEquals(true, $found); - } - public function testRenameTable() { $this->_sm->tryMethod('DropTable', 'list_tables_test'); diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php index efb17572c..967b0ccdc 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php @@ -8,18 +8,5 @@ require_once __DIR__ . '/../../../TestInit.php'; class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase { - public function testListUsers() - { - $users = $this->_sm->listUsers(); - $this->assertEquals(true, is_array($users)); - $params = $this->_conn->getParams(); - $testUser = $params['user']; - $found = false; - foreach ($users as $user) { - if ($user['user'] == $testUser) { - $found = true; - } - } - $this->assertEquals(true, $found); - } + } \ No newline at end of file diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php index 83845aaa2..899711749 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php @@ -57,20 +57,6 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest $this->assertEquals(10, $foundSequence->getInitialValue(), "Initial Value is expected to be 10."); } - public function testListFunctions() - { - $funcs = $this->_sm->listFunctions(); - $this->assertType('array', $funcs); - $this->assertTrue(count($funcs)>=0); - } - - public function testListTriggers() - { - $triggers = $this->_sm->listTriggers(); - $this->assertType('array', $triggers); - $this->assertTrue(count($triggers) >= 0); - } - public function testListDatabases() { $this->_sm->dropAndCreateDatabase('test_create_database'); diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php index 78d13c6d9..d819ff1b7 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php @@ -18,32 +18,6 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase $this->_sm->listDatabases(); } - /** - * SQLITE does not support databases. - * - * @expectedException \Exception - */ - public function testListFunctions() - { - $this->_sm->listFunctions(); - } - - /** - * @expectedException \Exception - */ - public function testListTriggers() - { - $this->_sm->listTriggers(); - } - - /** - * @expectedException \Exception - */ - public function testListUsers() - { - $this->_sm->listUsers(); - } - public function testCreateAndDropDatabase() { $path = dirname(__FILE__).'/test_create_and_drop_sqlite_database.sqlite';