Skip to content

Commit

Permalink
DBAL-197 - Add blob to registered mapping types and test on all platf…
Browse files Browse the repository at this point in the history
…orms.
  • Loading branch information
beberlei committed Jan 9, 2012
1 parent 3257459 commit 854a67d
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
Expand Up @@ -764,7 +764,7 @@ protected function initializeDoctrineTypeMappings()
'nvarchar' => 'string',
'ntext' => 'text',
'binary' => 'text',
'varbinary' => 'text',
'varbinary' => 'blob',
'image' => 'text',
);
}
Expand Down
4 changes: 4 additions & 0 deletions lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
Expand Up @@ -679,6 +679,10 @@ protected function initializeDoctrineTypeMappings()
'decimal' => 'decimal',
'numeric' => 'decimal',
'year' => 'date',
'longblob' => 'blob',
'blob' => 'blob',
'mediumblob' => 'blob',
'tinyblob' => 'blob',
);
}

Expand Down
1 change: 1 addition & 0 deletions lib/Doctrine/DBAL/Platforms/OraclePlatform.php
Expand Up @@ -811,6 +811,7 @@ protected function initializeDoctrineTypeMappings()
'long raw' => 'text',
'rowid' => 'string',
'urowid' => 'string',
'blob' => 'blob',
);
}

Expand Down
1 change: 1 addition & 0 deletions lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
Expand Up @@ -767,6 +767,7 @@ protected function initializeDoctrineTypeMappings()
'money' => 'decimal',
'numeric' => 'decimal',
'year' => 'date',
'bytea' => 'blob',
);
}

Expand Down
1 change: 1 addition & 0 deletions lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
Expand Up @@ -479,6 +479,7 @@ protected function initializeDoctrineTypeMappings()
'real' => 'float',
'decimal' => 'decimal',
'numeric' => 'decimal',
'blob' => 'blob',
);
}

Expand Down
5 changes: 2 additions & 3 deletions lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
Expand Up @@ -276,9 +276,8 @@ protected function _getPortableTableColumnDefinition($tableColumn)
$precision = null;
$scale = null;

if ($this->_platform->hasDoctrineTypeMappingFor($tableColumn['type'])) {
$dbType = strtolower($tableColumn['type']);
} else {
$dbType = strtolower($tableColumn['type']);
if (strlen($tableColumn['domain_type'])) {
$dbType = strtolower($tableColumn['domain_type']);
$tableColumn['complete_type'] = $tableColumn['domain_complete_type'];
}
Expand Down
Expand Up @@ -547,6 +547,20 @@ public function testAutomaticallyAppendCommentOnMarkedColumns()
$this->assertInstanceOf('Doctrine\DBAL\Types\ArrayType', $columns['arr']->getType(), "The Doctrine2 should be detected from comment hint.");
}

/**
* @group DBAL-197
*/
public function testListTableWithBlob()
{
$table = new \Doctrine\DBAL\Schema\Table('test_blob_table');
$table->addColumn('id', 'integer', array('comment' => 'This is a comment'));
$table->addColumn('binarydata', 'blob', array());
$table->setPrimaryKey(array('id'));

$this->_sm->createTable($table);
$blobTable = $this->_sm->listTableDetails('test_blob_table');
}

/**
* @param string $name
* @param array $data
Expand Down

0 comments on commit 854a67d

Please sign in to comment.