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
6a02f3d3
Commit
6a02f3d3
authored
Dec 25, 2011
by
Kim Hemsø Rasmussen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added some more types and column definitions.
parent
05b48352
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
3 deletions
+32
-3
DrizzlePlatform.php
lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php
+25
-2
DrizzleSchemaManager.php
lib/Doctrine/DBAL/Schema/DrizzleSchemaManager.php
+7
-1
No files found.
lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php
View file @
6a02f3d3
...
...
@@ -98,6 +98,11 @@ class DrizzlePlatform extends AbstractPlatform
'boolean'
=>
'boolean'
,
'varchar'
=>
'string'
,
'integer'
=>
'integer'
,
'blob'
=>
'text'
,
'decimal'
=>
'decimal'
,
'datetime'
=>
'datetime'
,
'date'
=>
'date'
,
'time'
=>
'time'
,
);
}
...
...
@@ -147,7 +152,8 @@ class DrizzlePlatform extends AbstractPlatform
$database
=
'DATABASE()'
;
}
return
"SELECT COLUMN_NAME, COLUMN_TYPE, COLUMN_COMMENT, IS_NULLABLE, IS_AUTO_INCREMENT"
.
return
"SELECT COLUMN_NAME, COLUMN_TYPE, COLUMN_COMMENT, IS_NULLABLE, IS_AUTO_INCREMENT, CHARACTER_MAXIMUM_LENGTH, COLUMN_DEFAULT,"
.
" NUMERIC_PRECISION, NUMERIC_SCALE"
.
" FROM DATA_DICTIONARY.COLUMNS"
.
" WHERE TABLE_SCHEMA="
.
$database
.
" AND TABLE_NAME = '"
.
$table
.
"'"
;
}
...
...
@@ -173,7 +179,6 @@ class DrizzlePlatform extends AbstractPlatform
$database
=
'DATABASE()'
;
}
// INDEX_NAME AS 'key_name', COLUMN_NAME AS 'column_name', IS_USED_IN_PRIMARY AS 'primary', IS_UNIQUE=0 AS 'non_unique'
return
"SELECT INDEX_NAME AS 'key_name', COLUMN_NAME AS 'column_name', IS_USED_IN_PRIMARY AS 'primary', IS_UNIQUE=0 AS 'non_unique'"
.
" FROM DATA_DICTIONARY.INDEX_PARTS"
.
" WHERE TABLE_SCHEMA="
.
$database
.
" AND TABLE_NAME='"
.
$table
.
"'"
;
...
...
@@ -228,4 +233,22 @@ class DrizzlePlatform extends AbstractPlatform
return
'ALTER TABLE '
.
$table
.
' DROP PRIMARY KEY'
;
}
public
function
getDateTimeTypeDeclarationSQL
(
array
$fieldDeclaration
)
{
if
(
isset
(
$fieldDeclaration
[
'version'
])
&&
$fieldDeclaration
[
'version'
]
==
true
)
{
return
'TIMESTAMP'
;
}
else
{
return
'DATETIME'
;
}
}
public
function
getTimeTypeDeclarationSQL
(
array
$fieldDeclaration
)
{
return
'TIME'
;
}
public
function
getDateTypeDeclarationSQL
(
array
$fieldDeclaration
)
{
return
'DATE'
;
}
}
lib/Doctrine/DBAL/Schema/DrizzleSchemaManager.php
View file @
6a02f3d3
...
...
@@ -33,9 +33,15 @@ class DrizzleSchemaManager extends AbstractSchemaManager
$type
=
$this
->
_platform
->
getDoctrineTypeMapping
(
$dbType
);
$type
=
$this
->
extractDoctrineTypeFromComment
(
$tableColumn
[
'COLUMN_COMMENT'
],
$type
);
$tableColumn
[
'COLUMN_COMMENT'
]
=
$this
->
removeDoctrineTypeFromComment
(
$tableColumn
[
'COLUMN_COMMENT'
],
$type
);
$options
=
array
(
'autoincrement'
=>
(
boolean
)
$tableColumn
[
'IS_AUTO_INCREMENT'
],
'notnull'
=>
!
(
bool
)
$tableColumn
[
'IS_NULLABLE'
],
'length'
=>
(
int
)
$tableColumn
[
'CHARACTER_MAXIMUM_LENGTH'
],
'default'
=>
empty
(
$tableColumn
[
'COLUMN_DEFAULT'
])
?
null
:
$tableColumn
[
'COLUMN_DEFAULT'
],
'autoincrement'
=>
(
bool
)
$tableColumn
[
'IS_AUTO_INCREMENT'
],
'scale'
=>
(
int
)
$tableColumn
[
'NUMERIC_SCALE'
],
'precision'
=>
(
int
)
$tableColumn
[
'NUMERIC_PRECISION'
],
'comment'
=>
(
isset
(
$tableColumn
[
'COLUMN_COMMENT'
])
?
$tableColumn
[
'COLUMN_COMMENT'
]
:
null
),
);
...
...
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