New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce BinaryType #452
Introduce BinaryType #452
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,22 @@ | |
|
||
class DB2Platform extends AbstractPlatform | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getBinaryMaxLength() | ||
{ | ||
return 32704; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getBinaryDefaultLength() | ||
{ | ||
return 1; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
|
@@ -47,6 +63,8 @@ public function initializeDoctrineTypeMappings() | |
'date' => 'date', | ||
'varchar' => 'string', | ||
'character' => 'string', | ||
'varbinary' => 'binary', | ||
'binary' => 'binary', | ||
'clob' => 'text', | ||
'blob' => 'blob', | ||
'decimal' => 'decimal', | ||
|
@@ -65,6 +83,14 @@ protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed) | |
: ($length ? 'VARCHAR(' . $length . ')' : 'VARCHAR(255)'); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed) | ||
{ | ||
return $fixed ? 'BINARY(' . ($length ?: 255) . ')' : 'VARBINARY(' . ($length ?: 255) . ')'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should you use the defaults instead of hardcoding There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reasoning is discussed in PR description. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See the description. I wanted to do that but dropped the "right" implementation in favour of behaving as similar as possible with varchar implementation of the platform. Sounds weird I know but didn't know how to do it otherwise. |
||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deeky666 can we add a comment on why this is 4000?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol awesome picture ;). I don't know why this is the default in
AbstractPlatform
guess it's legacy. It's wrongly used throughout the platforms (adopted it from varchar implementation). 4000 is the default for Oracle maybe that's the reason ^^