Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: nicolas-grekas/dbal
...
head fork: nicolas-grekas/dbal
  • 15 commits
  • 30 files changed
  • 0 commit comments
  • 6 contributors
Showing with 210 additions and 57 deletions.
  1. +6 −1 composer.json
  2. +2 −2 lib/Doctrine/DBAL/Connection.php
  3. +1 −1  lib/Doctrine/DBAL/Driver/IBMDB2/DB2Driver.php
  4. +1 −1  lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php
  5. +1 −1  lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php
  6. +39 −14 lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php
  7. +1 −1  lib/Doctrine/DBAL/Driver/PDOIbm/Driver.php
  8. +1 −1  lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php
  9. +1 −1  lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
  10. +1 −1  lib/Doctrine/DBAL/Platforms/DB2Platform.php
  11. +2 −3 lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php
  12. +3 −3 lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
  13. +20 −5 lib/Doctrine/DBAL/Platforms/OraclePlatform.php
  14. +16 −6 lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
  15. +1 −1  lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
  16. +1 −1  lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
  17. +1 −1  lib/Doctrine/DBAL/Portability/Statement.php
  18. +1 −1  lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
  19. +1 −0  lib/Doctrine/DBAL/Schema/DB2SchemaManager.php
  20. +1 −1  lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
  21. +4 −4 lib/Doctrine/DBAL/Schema/Schema.php
  22. +1 −1  lib/Doctrine/DBAL/Schema/SchemaConfig.php
  23. +1 −0  lib/Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php
  24. +1 −1  lib/Doctrine/DBAL/Tools/Console/Command/ReservedWordsCommand.php
  25. +1 −1  lib/Doctrine/DBAL/Types/VarDateTimeType.php
  26. +1 −1  lib/vendor/doctrine-common
  27. +2 −2 tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php
  28. +31 −0 tests/Doctrine/Tests/DBAL/Functional/WriteTest.php
  29. +46 −1 tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php
  30. +21 −0 tests/Doctrine/Tests/DBAL/Schema/Platforms/MySQLSchemaTest.php
View
7 composer.json
@@ -13,9 +13,14 @@
],
"require": {
"php": ">=5.3.2",
- "doctrine/common": "2.*"
+ "doctrine/common": "2.3.*"
},
"autoload": {
"psr-0": { "Doctrine\\DBAL": "lib/" }
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.3.x-dev"
+ }
}
}
View
4 lib/Doctrine/DBAL/Connection.php
@@ -105,7 +105,7 @@ class Connection implements DriverConnection
protected $_eventManager;
/**
- * @var \Doctrine\DBAL\Query\ExpressionBuilder
+ * @var \Doctrine\DBAL\Query\Expression\ExpressionBuilder
*/
protected $_expr;
@@ -983,7 +983,7 @@ public function commit()
*
* @throws ConnectionException If the rollback operation failed.
*/
- public function rollback()
+ public function rollBack()
{
if ($this->_transactionNestingLevel == 0) {
throw ConnectionException::noActiveTransaction();
View
2  lib/Doctrine/DBAL/Driver/IBMDB2/DB2Driver.php
@@ -80,7 +80,7 @@ public function getDatabasePlatform()
* database schema of the platform this driver connects to.
*
* @param \Doctrine\DBAL\Connection $conn
- * @return \Doctrine\DBAL\SchemaManager
+ * @return \Doctrine\DBAL\Schema\DB2SchemaManager
*/
public function getSchemaManager(Connection $conn)
{
View
2  lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php
@@ -51,7 +51,7 @@ public function __construct(array $params, $username, $password, array $driverOp
*
* Could be used if part of your application is not using DBAL
*
- * @return mysqli
+ * @return \mysqli
*/
public function getWrappedResourceHandle()
{
View
2  lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php
@@ -196,7 +196,7 @@ private function _bindValues($values)
}
/**
- * @return null|false|array
+ * @return boolean|array
*/
private function _fetch()
{
View
53 lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php
@@ -19,6 +19,8 @@
namespace Doctrine\DBAL\Driver\OCI8;
+use Doctrine\DBAL\Platforms\OraclePlatform;
+
/**
* OCI8 implementation of the Connection interface.
*
@@ -26,9 +28,15 @@
*/
class OCI8Connection implements \Doctrine\DBAL\Driver\Connection
{
- protected $_dbh;
+ /**
+ * @var resource
+ */
+ protected $dbh;
- protected $_executeMode = OCI_COMMIT_ON_SUCCESS;
+ /**
+ * @var int
+ */
+ protected $executeMode = OCI_COMMIT_ON_SUCCESS;
/**
* Create a Connection to an Oracle Database using oci8 extension.
@@ -43,11 +51,11 @@ public function __construct($username, $password, $db, $charset = null, $session
define('OCI_NO_AUTO_COMMIT', 0);
}
- $this->_dbh = $persistent
+ $this->dbh = $persistent
? @oci_pconnect($username, $password, $db, $charset, $sessionMode)
: @oci_connect($username, $password, $db, $charset, $sessionMode);
- if ( ! $this->_dbh) {
+ if ( ! $this->dbh) {
throw OCI8Exception::fromErrorInfo(oci_error());
}
}
@@ -60,7 +68,7 @@ public function __construct($username, $password, $db, $charset = null, $session
*/
public function prepare($prepareString)
{
- return new OCI8Statement($this->_dbh, $prepareString, $this);
+ return new OCI8Statement($this->dbh, $prepareString, $this);
}
/**
@@ -105,9 +113,26 @@ public function exec($statement)
return $stmt->rowCount();
}
+ /**
+ * {@inheritDoc}
+ */
public function lastInsertId($name = null)
{
- //TODO: throw exception or support sequences?
+ if ($name === null) {
+ return false;
+ }
+
+ OraclePlatform::assertValidIdentifier($name);
+
+ $sql = 'SELECT ' . $name . '.CURRVAL FROM DUAL';
+ $stmt = $this->query($sql);
+ $result = $stmt->fetch(\PDO::FETCH_ASSOC);
+
+ if ($result === false || !isset($result['CURRVAL'])) {
+ throw new OCI8Exception("lastInsertId failed: Query was executed but no result was returned.");
+ }
+
+ return (int) $result['CURRVAL'];
}
/**
@@ -115,7 +140,7 @@ public function lastInsertId($name = null)
*/
public function getExecuteMode()
{
- return $this->_executeMode;
+ return $this->executeMode;
}
/**
@@ -129,7 +154,7 @@ public function getExecuteMode()
*/
public function beginTransaction()
{
- $this->_executeMode = OCI_NO_AUTO_COMMIT;
+ $this->executeMode = OCI_NO_AUTO_COMMIT;
return true;
}
@@ -139,10 +164,10 @@ public function beginTransaction()
*/
public function commit()
{
- if (!oci_commit($this->_dbh)) {
+ if (!oci_commit($this->dbh)) {
throw OCI8Exception::fromErrorInfo($this->errorInfo());
}
- $this->_executeMode = OCI_COMMIT_ON_SUCCESS;
+ $this->executeMode = OCI_COMMIT_ON_SUCCESS;
return true;
}
@@ -152,16 +177,16 @@ public function commit()
*/
public function rollBack()
{
- if (!oci_rollback($this->_dbh)) {
+ if (!oci_rollback($this->dbh)) {
throw OCI8Exception::fromErrorInfo($this->errorInfo());
}
- $this->_executeMode = OCI_COMMIT_ON_SUCCESS;
+ $this->executeMode = OCI_COMMIT_ON_SUCCESS;
return true;
}
public function errorCode()
{
- $error = oci_error($this->_dbh);
+ $error = oci_error($this->dbh);
if ($error !== false) {
$error = $error['code'];
}
@@ -170,6 +195,6 @@ public function errorCode()
public function errorInfo()
{
- return oci_error($this->_dbh);
+ return oci_error($this->dbh);
}
}
View
2  lib/Doctrine/DBAL/Driver/PDOIbm/Driver.php
@@ -95,7 +95,7 @@ public function getDatabasePlatform()
* database schema of the platform this driver connects to.
*
* @param \Doctrine\DBAL\Connection $conn
- * @return \Doctrine\DBAL\SchemaManager
+ * @return \Doctrine\DBAL\Schema\DB2SchemaManager
*/
public function getSchemaManager(Connection $conn)
{
View
2  lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php
@@ -42,7 +42,7 @@ class Driver implements \Doctrine\DBAL\Driver
* @param string $username
* @param string $password
* @param array $driverOptions
- * @return Connection
+ * @return \Doctrine\DBAL\Driver\PDOConnection
*/
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
{
View
2  lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
@@ -2678,7 +2678,7 @@ public function rollbackSavePoint($savepoint)
* Throws exception if no keyword list is specified.
*
* @throws DBALException
- * @return KeywordList
+ * @return \Doctrine\DBAL\Platforms\Keywords\KeywordList
*/
final public function getReservedKeywordsList()
{
View
2  lib/Doctrine/DBAL/Platforms/DB2Platform.php
@@ -397,7 +397,7 @@ public function getAlterTableSQL(TableDiff $diff)
continue;
}
- /* @var $columnDiff Doctrine\DBAL\Schema\ColumnDiff */
+ /* @var $columnDiff \Doctrine\DBAL\Schema\ColumnDiff */
$column = $columnDiff->column;
$queryParts[] = 'ALTER ' . ($columnDiff->oldColumnName) . ' '
. $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
View
5 lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php
@@ -291,7 +291,7 @@ public function getDateTypeDeclarationSQL(array $fieldDeclaration)
* C/P from mysql platform
*
* @param TableDiff $diff
- * @return type
+ * @return string
*/
public function getAlterTableSQL(TableDiff $diff)
{
@@ -325,7 +325,7 @@ public function getAlterTableSQL(TableDiff $diff)
continue;
}
- /* @var $columnDiff Doctrine\DBAL\Schema\ColumnDiff */
+ /* @var $columnDiff \Doctrine\DBAL\Schema\ColumnDiff */
$column = $columnDiff->column;
$columnArray = $column->toArray();
$columnArray['comment'] = $this->getColumnComment($column);
@@ -386,7 +386,6 @@ public function convertBooleans($item)
}
}
return $item;
- return $item;
}
public function getLocateExpression($str, $substr, $startPos = false)
View
6 lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
@@ -380,7 +380,7 @@ public function getDropDatabaseSQL($name)
* )
* );
*
- * @return void
+ * @return string
* @override
*/
protected function _getCreateTableSQL($tableName, array $columns, array $options = array())
@@ -480,7 +480,7 @@ public function getAlterTableSQL(TableDiff $diff)
continue;
}
- /* @var $columnDiff Doctrine\DBAL\Schema\ColumnDiff */
+ /* @var $columnDiff \Doctrine\DBAL\Schema\ColumnDiff */
$column = $columnDiff->column;
$columnArray = $column->toArray();
$columnArray['comment'] = $this->getColumnComment($column);
@@ -633,7 +633,7 @@ protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef)
* Return the FOREIGN KEY query section dealing with non-standard options
* as MATCH, INITIALLY DEFERRED, ON UPDATE, ...
*
- * @param ForeignKeyConstraint $foreignKey
+ * @param \Doctrine\DBAL\Schema\ForeignKeyConstraint $foreignKey
* @return string
* @override
*/
View
25 lib/Doctrine/DBAL/Platforms/OraclePlatform.php
@@ -20,6 +20,7 @@
namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Schema\TableDiff;
+use Doctrine\DBAL\DBALException;
/**
* OraclePlatform.
@@ -32,6 +33,20 @@
class OraclePlatform extends AbstractPlatform
{
/**
+ * Assertion for Oracle identifiers
+ *
+ * @link http://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements008.htm
+ * @param string
+ * @throws DBALException
+ */
+ static public function assertValidIdentifier($identifier)
+ {
+ if ( ! preg_match('(^(([a-zA-Z]{1}[a-zA-Z0-9_$#]{0,})|("[^"]+"))$)', $identifier)) {
+ throw new DBALException("Invalid Oracle identifier");
+ }
+ }
+
+ /**
* return string to call a function to get a substring inside an SQL statement
*
* Note: Not SQL92, but common functionality.
@@ -107,9 +122,9 @@ public function getGuidExpression()
* them to the difference in days. This is obviously a restriction of the original functionality, but we
* need to make this a portable function.
*
- * @param type $date1
- * @param type $date2
- * @return type
+ * @param string $date1
+ * @param string $date2
+ * @return string
*/
public function getDateDiffExpression($date1, $date2)
{
@@ -527,8 +542,8 @@ public function getDropSequenceSQL($sequence)
}
/**
- * @param ForeignKeyConstraint|string $foreignKey
- * @param Table|string $table
+ * @param \Doctrine\DBAL\Schema\ForeignKeyConstraint|string $foreignKey
+ * @param \Doctrine\DBAL\Schema\Table|string $table
* @return string
*/
public function getDropForeignKeySQL($foreignKey, $table)
View
22 lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
@@ -316,8 +316,7 @@ public function getListTableColumnsSQL($table, $database = null)
* create a new database
*
* @param string $name name of the database that should be created
- * @throws PDOException
- * @return void
+ * @return string
* @override
*/
public function getCreateDatabaseSQL($name)
@@ -329,7 +328,6 @@ public function getCreateDatabaseSQL($name)
* drop an existing database
*
* @param string $name name of the database that should be dropped
- * @throws PDOException
* @access public
*/
public function getDropDatabaseSQL($name)
@@ -502,7 +500,7 @@ public function getDropSequenceSQL($sequence)
}
/**
- * @param ForeignKeyConstraint|string $foreignKey
+ * @param \Doctrine\DBAL\Schema\ForeignKeyConstraint|string $foreignKey
* @param Table|string $table
* @return string
*/
@@ -514,10 +512,10 @@ public function getDropForeignKeySQL($foreignKey, $table)
/**
* Gets the SQL used to create a table.
*
- * @param unknown_type $tableName
+ * @param string $tableName
* @param array $columns
* @param array $options
- * @return unknown
+ * @return string
*/
protected function _getCreateTableSQL($tableName, array $columns, array $options = array())
{
@@ -620,6 +618,17 @@ public function getSmallIntTypeDeclarationSQL(array $field)
}
/**
+ * Decleration for a UUID field in PostgreSQL
+ *
+ * @param array $field
+ * @return string
+ */
+ public function getGuidTypeDeclartionSQL(array $field)
+ {
+ return 'UUID';
+ }
+
+ /**
* @override
*/
public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
@@ -768,6 +777,7 @@ protected function initializeDoctrineTypeMappings()
'money' => 'decimal',
'numeric' => 'decimal',
'year' => 'date',
+ 'uuid' => 'guid',
'bytea' => 'blob',
);
}
View
2  lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
@@ -342,7 +342,7 @@ public function getAlterTableSQL(TableDiff $diff)
continue;
}
- /* @var $columnDiff Doctrine\DBAL\Schema\ColumnDiff */
+ /* @var $columnDiff \Doctrine\DBAL\Schema\ColumnDiff */
$column = $columnDiff->column;
$queryParts[] = 'ALTER COLUMN ' .
$this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
View
2  lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
@@ -283,7 +283,7 @@ protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef)
* );
* @param array $options An associative array of table options:
*
- * @return void
+ * @return string
* @override
*/
protected function _getCreateTableSQL($name, array $columns, array $options = array())
View
2  lib/Doctrine/DBAL/Portability/Statement.php
@@ -39,7 +39,7 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
private $portability;
/**
- * @var Doctrine\DBAL\Driver\Statement
+ * @var \Doctrine\DBAL\Driver\Statement
*/
private $stmt;
View
2  lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
@@ -403,7 +403,7 @@ public function createTable(Table $table)
* Create a new sequence
*
* @param Sequence $sequence
- * @throws Doctrine\DBAL\ConnectionException if something fails at database level
+ * @throws \Doctrine\DBAL\ConnectionException if something fails at database level
*/
public function createSequence($sequence)
{
View
1  lib/Doctrine/DBAL/Schema/DB2SchemaManager.php
@@ -22,6 +22,7 @@
namespace Doctrine\DBAL\Schema;
use Doctrine\DBAL\Event\SchemaIndexDefinitionEventArgs;
+use Doctrine\DBAL\Events;
/**
* IBM Db2 Schema Manager
View
2  lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
@@ -84,7 +84,7 @@ public function getExistingSchemaSearchPaths()
*
* This is a PostgreSQL only function.
*
- * @return type
+ * @return void
*/
public function determineExistingSchemaSearchPaths()
{
View
8 lib/Doctrine/DBAL/Schema/Schema.php
@@ -293,7 +293,7 @@ public function dropSequence($sequenceName)
/**
* Return an array of necessary sql queries to create the schema on the given platform.
*
- * @param AbstractPlatform $platform
+ * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
* @return array
*/
public function toSql(\Doctrine\DBAL\Platforms\AbstractPlatform $platform)
@@ -307,7 +307,7 @@ public function toSql(\Doctrine\DBAL\Platforms\AbstractPlatform $platform)
/**
* Return an array of necessary sql queries to drop the schema on the given platform.
*
- * @param AbstractPlatform $platform
+ * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
* @return array
*/
public function toDropSql(\Doctrine\DBAL\Platforms\AbstractPlatform $platform)
@@ -320,7 +320,7 @@ public function toDropSql(\Doctrine\DBAL\Platforms\AbstractPlatform $platform)
/**
* @param Schema $toSchema
- * @param AbstractPlatform $platform
+ * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
*/
public function getMigrateToSql(Schema $toSchema, \Doctrine\DBAL\Platforms\AbstractPlatform $platform)
{
@@ -331,7 +331,7 @@ public function getMigrateToSql(Schema $toSchema, \Doctrine\DBAL\Platforms\Abstr
/**
* @param Schema $fromSchema
- * @param AbstractPlatform $platform
+ * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
*/
public function getMigrateFromSql(Schema $fromSchema, \Doctrine\DBAL\Platforms\AbstractPlatform $platform)
{
View
2  lib/Doctrine/DBAL/Schema/SchemaConfig.php
@@ -94,7 +94,7 @@ public function getName()
/**
* set default namespace name of schema objects.
*
- * @param _name the value to set.
+ * @param string $name the value to set.
*/
public function setName($name)
{
View
1  lib/Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php
@@ -28,6 +28,7 @@
Doctrine\DBAL\Schema\ForeignKeyConstraint,
Doctrine\DBAL\Schema\Constraint,
Doctrine\DBAL\Schema\Sequence,
+ Doctrine\DBAL\Schema\SchemaException,
Doctrine\DBAL\Schema\Index;
/**
View
2  lib/Doctrine/DBAL/Tools/Console/Command/ReservedWordsCommand.php
@@ -93,7 +93,7 @@ protected function configure()
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
- /* @var $conn Doctrine\DBAL\Connection */
+ /* @var $conn \Doctrine\DBAL\Connection */
$conn = $this->getHelper('db')->getConnection();
$keywordLists = (array)$input->getOption('list');
View
2  lib/Doctrine/DBAL/Types/VarDateTimeType.php
@@ -43,7 +43,7 @@ class VarDateTimeType extends DateTimeType
* @throws ConversionException
* @param string $value
* @param AbstractPlatform $platform
- * @return DateTime
+ * @return \DateTime
*/
public function convertToPHPValue($value, AbstractPlatform $platform)
{
2  lib/vendor/doctrine-common
@@ -1 +1 @@
-Subproject commit 1c9d2ab329746637d1c6c058523ec1ee769da31c
+Subproject commit 17e774007b98beb2e253e645260e0f9c32f4c936
View
4 tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php
@@ -202,11 +202,11 @@ public function testFilterSchemaExpression()
$column = $testTable->addColumn('id', 'integer');
$this->_sm->createTable($testTable);
- $this->_conn->getConfiguration()->setFilterSchemaAssetsExpression('^dbal204_');
+ $this->_conn->getConfiguration()->setFilterSchemaAssetsExpression('#^dbal204_#');
$names = $this->_sm->listTableNames();
$this->assertEquals(2, count($names));
- $this->_conn->getConfiguration()->setFilterSchemaAssetsExpression('^dbal204_test');
+ $this->_conn->getConfiguration()->setFilterSchemaAssetsExpression('#^dbal204_test#');
$names = $this->_sm->listTableNames();
$this->assertEquals(1, count($names));
}
View
31 tests/Doctrine/Tests/DBAL/Functional/WriteTest.php
@@ -146,4 +146,35 @@ public function testLastInsertId()
$this->assertNotNull($num, "LastInsertId() should not be null.");
$this->assertTrue($num > 0, "LastInsertId() should be non-negative number.");
}
+
+ public function testLastInsertIdSequence()
+ {
+ if ( ! $this->_conn->getDatabasePlatform()->supportsSequences()) {
+ $this->markTestSkipped('Test only works on platforms with sequences.');
+ }
+
+ $sequence = new \Doctrine\DBAL\Schema\Sequence('write_table_seq');
+ try {
+ $this->_conn->getSchemaManager()->dropSequence($sequence);
+ } catch(\Exception $e) {}
+ $this->_conn->getSchemaManager()->createSequence($sequence);
+
+ $stmt = $this->_conn->query($this->_conn->getDatabasePlatform()->getSequenceNextValSQL('write_table_seq'));
+ $nextSequenceVal = $stmt->fetchColumn();
+
+ $lastInsertId = $this->_conn->lastInsertId('write_table_seq');
+
+ $this->assertTrue($lastInsertId > 0);
+ $this->assertEquals($nextSequenceVal, $lastInsertId);
+ }
+
+ public function testLastInsertIdNoSequenceGiven()
+ {
+ if ( ! $this->_conn->getDatabasePlatform()->supportsSequences()) {
+ $this->markTestSkipped('Test only works on platforms with sequences.');
+ }
+
+ $this->assertFalse($this->_conn->lastInsertId( null ));
+
+ }
}
View
47 tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php
@@ -9,6 +9,51 @@
class OraclePlatformTest extends AbstractPlatformTestCase
{
+ static public function dataValidIdentifiers()
+ {
+ return array(
+ array('a'),
+ array('foo'),
+ array('Foo'),
+ array('Foo123'),
+ array('Foo#bar_baz$'),
+ array('"a"'),
+ array('"1"'),
+ array('"foo_bar"'),
+ array('"@$%&!"'),
+ );
+ }
+
+ /**
+ * @dataProvider dataValidIdentifiers
+ */
+ public function testValidIdentifiers($identifier)
+ {
+ $platform = $this->createPlatform();
+ $platform->assertValidIdentifier($identifier);
+ }
+
+ static public function dataInvalidIdentifiers()
+ {
+ return array(
+ array('1'),
+ array('abc&'),
+ array('abc-def'),
+ array('"'),
+ array('"foo"bar"'),
+ );
+ }
+
+ /**
+ * @dataProvider dataInvalidIdentifiers
+ */
+ public function testInvalidIdentifiers($identifier)
+ {
+ $this->setExpectedException('Doctrine\DBAL\DBALException');
+ $platform = $this->createPlatform();
+ $platform->assertValidIdentifier($identifier);
+ }
+
public function createPlatform()
{
return new OraclePlatform;
@@ -224,4 +269,4 @@ public function getBitOrComparisonExpressionSql($value1, $value2)
$this->getBitAndComparisonExpressionSql($value1, $value2)
. '+' . $value2 . ')';
}
-}
+}
View
21 tests/Doctrine/Tests/DBAL/Schema/Platforms/MySQLSchemaTest.php
@@ -64,4 +64,25 @@ public function testGenerateForeignKeySQL()
$this->assertEquals(array("ALTER TABLE test ADD CONSTRAINT FK_D87F7E0C8E48560F FOREIGN KEY (foo_id) REFERENCES test_foreign (foo_id)"), $sqls);
}
+
+ /**
+ * @group DDC-1737
+ */
+ public function testClobNoAlterTable()
+ {
+ $tableOld = new Table("test");
+ $tableOld->addColumn('id', 'integer');
+ $tableOld->addColumn('description', 'string', array('length' => 65536));
+ $tableNew = clone $tableOld;
+
+ $tableNew->setPrimaryKey(array('id'));
+
+ $diff = $this->comparator->diffTable($tableOld, $tableNew);
+ $sql = $this->platform->getAlterTableSQL($diff);
+
+ $this->assertEquals(
+ array('ALTER TABLE test ADD PRIMARY KEY (id)'),
+ $sql
+ );
+ }
}

No commit comments for this range

Something went wrong with that request. Please try again.