Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
451aec6d
Commit
451aec6d
authored
Feb 10, 2013
by
Alexander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move magic numbers to constants
parent
6c2f83bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
MySqlPlatform.php
lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
+14
-6
No files found.
lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
View file @
451aec6d
...
@@ -36,6 +36,14 @@ use Doctrine\DBAL\DBALException,
...
@@ -36,6 +36,14 @@ use Doctrine\DBAL\DBALException,
*/
*/
class
MySqlPlatform
extends
AbstractPlatform
class
MySqlPlatform
extends
AbstractPlatform
{
{
const
LENGTH_LIMIT_TINYTEXT
=
255
;
const
LENGTH_LIMIT_TEXT
=
65535
;
const
LENGTH_LIMIT_MEDIUMTEXT
=
16777215
;
const
LENGTH_LIMIT_TINYBLOB
=
255
;
const
LENGTH_LIMIT_BLOB
=
65535
;
const
LENGTH_LIMIT_MEDIUMBLOB
=
16777215
;
/**
/**
* {@inheritDoc}
* {@inheritDoc}
*/
*/
...
@@ -208,15 +216,15 @@ class MySqlPlatform extends AbstractPlatform
...
@@ -208,15 +216,15 @@ class MySqlPlatform extends AbstractPlatform
if
(
!
empty
(
$field
[
'length'
])
&&
is_numeric
(
$field
[
'length'
]))
{
if
(
!
empty
(
$field
[
'length'
])
&&
is_numeric
(
$field
[
'length'
]))
{
$length
=
$field
[
'length'
];
$length
=
$field
[
'length'
];
if
(
$length
<=
255
)
{
if
(
$length
<=
static
::
LENGTH_LIMIT_TINYTEXT
)
{
return
'TINYTEXT'
;
return
'TINYTEXT'
;
}
}
if
(
$length
<=
65535
)
{
if
(
$length
<=
static
::
LENGTH_LIMIT_TEXT
)
{
return
'TEXT'
;
return
'TEXT'
;
}
}
if
(
$length
<=
16777215
)
{
if
(
$length
<=
static
::
LENGTH_LIMIT_MEDIUMTEXT
)
{
return
'MEDIUMTEXT'
;
return
'MEDIUMTEXT'
;
}
}
}
}
...
@@ -725,15 +733,15 @@ class MySqlPlatform extends AbstractPlatform
...
@@ -725,15 +733,15 @@ class MySqlPlatform extends AbstractPlatform
if
(
!
empty
(
$field
[
'length'
])
&&
is_numeric
(
$field
[
'length'
]))
{
if
(
!
empty
(
$field
[
'length'
])
&&
is_numeric
(
$field
[
'length'
]))
{
$length
=
$field
[
'length'
];
$length
=
$field
[
'length'
];
if
(
$length
<=
255
)
{
if
(
$length
<=
static
::
LENGTH_LIMIT_TINYBLOB
)
{
return
'TINYBLOB'
;
return
'TINYBLOB'
;
}
}
if
(
$length
<=
65535
)
{
if
(
$length
<=
static
::
LENGTH_LIMIT_BLOB
)
{
return
'BLOB'
;
return
'BLOB'
;
}
}
if
(
$length
<=
16777215
)
{
if
(
$length
<=
static
::
LENGTH_LIMIT_MEDIUMBLOB
)
{
return
'MEDIUMBLOB'
;
return
'MEDIUMBLOB'
;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment