1
0
mirror of synced 2024-12-12 22:36:02 +03:00

[2.0] DDC-169 - Fix build, Postgres, Oracle and Sqlite made some minor troubles with regards to sequences.

This commit is contained in:
beberlei 2009-11-30 21:16:29 +00:00
parent af48974a75
commit 31be2519f6
5 changed files with 9 additions and 17 deletions

View File

@ -263,7 +263,8 @@ class OraclePlatform extends AbstractPlatform
public function getListSequencesSql($database)
{
return 'SELECT sequence_name, min_value, increment_by FROM sys.user_sequences';
return "SELECT sequence_name, min_value, increment_by FROM sys.all_sequences ".
"WHERE SEQUENCE_OWNER = '".strtoupper($database)."'";
}
public function getCreateTableSql($table, array $columns, array $options = array())

View File

@ -444,6 +444,11 @@ class SqlitePlatform extends AbstractPlatform
return false;
}
public function supportsSequences()
{
return false;
}
/**
* Get the platform name for this instance
*

View File

@ -153,7 +153,8 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
protected function _getPortableSequenceDefinition($sequence)
{
return $sequence['relname'];
$data = $this->_conn->fetchAll('SELECT start_value, increment_by FROM '.$sequence['relname']);
return new Sequence($sequence['relname'], $data[0]['increment_by'], $data[0]['start_value']);
}
protected function _getPortableTableConstraintDefinition($tableConstraint)

View File

@ -8,13 +8,6 @@ require_once __DIR__ . '/../../../TestInit.php';
class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
{
public function testListSequences()
{
$this->createTestTable('list_sequences_test');
$sequences = $this->_sm->listSequences();
$this->assertEquals(true, in_array('list_sequences_test_id_seq', $sequences));
}
public function testListTableConstraints()
{
$this->createTestTable('list_table_constraints_test');

View File

@ -36,14 +36,6 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase
$this->_sm->listTriggers();
}
public function testListSequences()
{
$this->createTestTable('list_sequences_test');
$sequences = $this->_sm->listSequences();
$this->assertEquals('list_sequences_test', $sequences[0]['name']);
$this->assertEquals('sqlite_sequence', $sequences[1]['name']);
}
public function testListTableConstraints()
{
// TODO: Implement support for constraints/foreign keys to be specified