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
0541b30a
Commit
0541b30a
authored
Dec 25, 2011
by
Kim Hemsø Rasmussen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for foreign keys
parent
7b19e5df
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
1 deletion
+36
-1
DrizzlePlatform.php
lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php
+9
-1
DrizzleSchemaManager.php
lib/Doctrine/DBAL/Schema/DrizzleSchemaManager.php
+27
-0
No files found.
lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php
View file @
0541b30a
...
...
@@ -154,7 +154,15 @@ class DrizzlePlatform extends AbstractPlatform
public
function
getListTableForeignKeysSQL
(
$table
,
$database
=
null
)
{
return
"SELECT * FROM DATA_DICTIONARY.FOREIGN_KEYS"
;
if
(
$database
)
{
$database
=
"'"
.
$database
.
"'"
;
}
else
{
$database
=
'DATABASE()'
;
}
return
"SELECT CONSTRAINT_NAME, CONSTRAINT_COLUMNS, REFERENCED_TABLE_NAME, REFERENCED_TABLE_COLUMNS, UPDATE_RULE, DELETE_RULE"
.
" FROM DATA_DICTIONARY.FOREIGN_KEYS"
.
" WHERE CONSTRAINT_SCHEMA="
.
$database
.
" AND CONSTRAINT_TABLE='"
.
$table
.
"'"
;
}
public
function
getListTableIndexesSQL
(
$table
,
$database
=
null
)
...
...
lib/Doctrine/DBAL/Schema/DrizzleSchemaManager.php
View file @
0541b30a
...
...
@@ -50,5 +50,32 @@ class DrizzleSchemaManager extends AbstractSchemaManager
{
return
$table
[
'TABLE_NAME'
];
}
public
function
_getPortableTableForeignKeyDefinition
(
$tableForeignKey
)
{
$columns
=
array
();
foreach
(
explode
(
','
,
$tableForeignKey
[
'CONSTRAINT_COLUMNS'
])
as
$value
)
{
$columns
[]
=
trim
(
$value
,
'`'
);
}
$ref_columns
=
array
();
foreach
(
explode
(
','
,
$tableForeignKey
[
'REFERENCED_TABLE_COLUMNS'
])
as
$value
)
{
$ref_columns
[]
=
trim
(
$value
,
'`'
);
}
return
new
ForeignKeyConstraint
(
$columns
,
$tableForeignKey
[
'REFERENCED_TABLE_NAME'
],
$ref_columns
,
$tableForeignKey
[
'CONSTRAINT_NAME'
]
.
array
(
'onUpdate'
=>
$tableForeignKey
[
'UPDATE_RULE'
],
'onDelete'
=>
$tableForeignKey
[
'DELETE_RULE'
],
)
);
}
}
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