Commit d08b11c7 authored by Benjamin Eberlei's avatar Benjamin Eberlei

Merge branch 'DBAL-752' into 2.4

parents acb5b9f2 36c4ddd6
...@@ -543,7 +543,6 @@ class SqlitePlatform extends AbstractPlatform ...@@ -543,7 +543,6 @@ class SqlitePlatform extends AbstractPlatform
'decimal' => 'decimal', 'decimal' => 'decimal',
'numeric' => 'decimal', 'numeric' => 'decimal',
'blob' => 'blob', 'blob' => 'blob',
'integer unsigned' => 'integer',
); );
} }
......
...@@ -244,16 +244,22 @@ class SqliteSchemaManager extends AbstractSchemaManager ...@@ -244,16 +244,22 @@ class SqliteSchemaManager extends AbstractSchemaManager
*/ */
protected function _getPortableTableColumnDefinition($tableColumn) protected function _getPortableTableColumnDefinition($tableColumn)
{ {
$e = explode('(', $tableColumn['type']); $parts = explode('(', $tableColumn['type']);
$tableColumn['type'] = $e[0]; $tableColumn['type'] = $parts[0];
if (isset($e[1])) { if (isset($parts[1])) {
$length = trim($e[1], ')'); $length = trim($parts[1], ')');
$tableColumn['length'] = $length; $tableColumn['length'] = $length;
} }
$dbType = strtolower($tableColumn['type']); $dbType = strtolower($tableColumn['type']);
$length = isset($tableColumn['length']) ? $tableColumn['length'] : null; $length = isset($tableColumn['length']) ? $tableColumn['length'] : null;
$unsigned = (boolean) isset($tableColumn['unsigned']) ? $tableColumn['unsigned'] : false; $unsigned = false;
if (strpos($dbType, ' unsigned') !== false) {
$dbType = str_replace(' unsigned', '', $dbType);
$unsigned = true;
}
$fixed = false; $fixed = false;
$type = $this->_platform->getDoctrineTypeMapping($dbType); $type = $this->_platform->getDoctrineTypeMapping($dbType);
$default = $tableColumn['dflt_value']; $default = $tableColumn['dflt_value'];
......
<?php
namespace Doctrine\Tests\DBAL\Functional\Ticket;
use Doctrine\DBAL\Schema\Table;
/**
* @group DBAL-752
*/
class DBAL752Test extends \Doctrine\Tests\DbalFunctionalTestCase
{
protected function setUp()
{
parent::setUp();
$platform = $this->_conn->getDatabasePlatform()->getName();
if (!in_array($platform, array('sqlite'))) {
$this->markTestSkipped('Related to SQLite only');
}
}
public function testUnsignedIntegerDetection()
{
$this->_conn->exec(<<<SQL
CREATE TABLE dbal752_unsigneds (
id BIGINT UNSIGNED,
flag SMALLINT UNSIGNED,
masks INTEGER UNSIGNED
);
SQL
);
$schemaManager = $this->_conn->getSchemaManager();
$fetchedTable = $schemaManager->listTableDetails('dbal752_unsigneds');
$this->assertEquals('bigint', $fetchedTable->getColumn('id')->getType()->getName());
$this->assertEquals('smallint', $fetchedTable->getColumn('flag')->getType()->getName());
$this->assertEquals('integer', $fetchedTable->getColumn('masks')->getType()->getName());
$this->assertTrue($fetchedTable->getColumn('id')->getUnsigned());
$this->assertTrue($fetchedTable->getColumn('flag')->getUnsigned());
$this->assertTrue($fetchedTable->getColumn('masks')->getUnsigned());
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment