backquotes for foreign keys
This commit is contained in:
@@ -7,6 +7,9 @@ $Source$
|
|||||||
|
|
||||||
2003-10-31 Marc Delisle <lem9@users.sourceforge.net>
|
2003-10-31 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
* lang/romanian: Updated, thanks to Valics Lehel.
|
* lang/romanian: Updated, thanks to Valics Lehel.
|
||||||
|
* tbl_relation.php3: add backquotes around table and field names
|
||||||
|
in queries for InnoDB foreign keys; however, in current MySQL 4.0.16
|
||||||
|
version, a blank character in a field name is not accepted by InnoDB
|
||||||
|
|
||||||
2003-10-27 Marc Delisle <lem9@users.sourceforge.net>
|
2003-10-27 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
* querywindow.php3: bug 825668: js errors in SQL-history,
|
* querywindow.php3: bug 825668: js errors in SQL-history,
|
||||||
|
@@ -121,10 +121,10 @@ if ($cfgRelation['relwork']
|
|||||||
// could be put in an include file
|
// could be put in an include file
|
||||||
$upd_query = 'ALTER TABLE ' . $table
|
$upd_query = 'ALTER TABLE ' . $table
|
||||||
. ' ADD FOREIGN KEY ('
|
. ' ADD FOREIGN KEY ('
|
||||||
. PMA_sqlAddslashes($master_field) . ')'
|
. PMA_backquote(PMA_sqlAddslashes($master_field)) . ')'
|
||||||
. ' REFERENCES '
|
. ' REFERENCES '
|
||||||
. PMA_sqlAddslashes($foreign_table) . '('
|
. PMA_backquote(PMA_sqlAddslashes($foreign_table)) . '('
|
||||||
. PMA_sqlAddslashes($foreign_field) . ')';
|
. PMA_backquote(PMA_sqlAddslashes($foreign_field)) . ')';
|
||||||
|
|
||||||
if (${$master_field . '_on_delete'} != 'nix') {
|
if (${$master_field . '_on_delete'} != 'nix') {
|
||||||
$upd_query .= ' ON DELETE ' . $options_array[${$master_field . '_on_delete'}];
|
$upd_query .= ' ON DELETE ' . $options_array[${$master_field . '_on_delete'}];
|
||||||
@@ -147,7 +147,7 @@ if ($cfgRelation['relwork']
|
|||||||
if (PMA_MYSQL_INT_VERSION >= 40013) {
|
if (PMA_MYSQL_INT_VERSION >= 40013) {
|
||||||
$upd_query = 'ALTER TABLE ' . $table
|
$upd_query = 'ALTER TABLE ' . $table
|
||||||
. ' DROP FOREIGN KEY '
|
. ' DROP FOREIGN KEY '
|
||||||
. $existrel_innodb[$master_field]['constraint'];
|
. PMA_backquote($existrel_innodb[$master_field]['constraint']);
|
||||||
|
|
||||||
// I tried to send both in one query but it failed
|
// I tried to send both in one query but it failed
|
||||||
$upd_rs = PMA_mysql_query($upd_query);
|
$upd_rs = PMA_mysql_query($upd_query);
|
||||||
@@ -156,10 +156,10 @@ if ($cfgRelation['relwork']
|
|||||||
// add another
|
// add another
|
||||||
$upd_query = 'ALTER TABLE ' . $table
|
$upd_query = 'ALTER TABLE ' . $table
|
||||||
. ' ADD FOREIGN KEY ('
|
. ' ADD FOREIGN KEY ('
|
||||||
. PMA_sqlAddslashes($master_field) . ')'
|
. PMA_backquote(PMA_sqlAddslashes($master_field)) . ')'
|
||||||
. ' REFERENCES '
|
. ' REFERENCES '
|
||||||
. PMA_sqlAddslashes($foreign_table) . '('
|
. PMA_backquote(PMA_sqlAddslashes($foreign_table)) . '('
|
||||||
. PMA_sqlAddslashes($foreign_field) . ')';
|
. PMA_backquote(PMA_sqlAddslashes($foreign_field)) . ')';
|
||||||
|
|
||||||
if (${$master_field . '_on_delete'} != 'nix') {
|
if (${$master_field . '_on_delete'} != 'nix') {
|
||||||
$upd_query .= ' ON DELETE ' . $options_array[${$master_field . '_on_delete'}];
|
$upd_query .= ' ON DELETE ' . $options_array[${$master_field . '_on_delete'}];
|
||||||
@@ -173,7 +173,7 @@ if ($cfgRelation['relwork']
|
|||||||
if (PMA_MYSQL_INT_VERSION >= 40013) {
|
if (PMA_MYSQL_INT_VERSION >= 40013) {
|
||||||
$upd_query = 'ALTER TABLE ' . $table
|
$upd_query = 'ALTER TABLE ' . $table
|
||||||
. ' DROP FOREIGN KEY '
|
. ' DROP FOREIGN KEY '
|
||||||
. $existrel_innodb[$master_field]['constraint'];
|
. PMA_backquote($existrel_innodb[$master_field]['constraint']);
|
||||||
}
|
}
|
||||||
} // end if... else....
|
} // end if... else....
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user