#6539: DboSource->buildIndex() needs some help: single open quotes for key
names.
-----------------------------------------+----------------------------------
Reporter: oh4real | Type: Bug
Status: new | Priority: Medium
Milestone: 1.2.x.x | Component: Core Libs
Version: 1.2 Final | Severity: Normal
Keywords: dbosource buildIndex key | Php_version: PHP 5
Cake_version: |
-----------------------------------------+----------------------------------
Ran into large problems - somewhat of my own legacy making - while trying
to implemenent SimpleTest.
[[BR]][[BR]]
An old MySQL db uses UNIQUE Key names that are, in all honesty, 'reserved'
in MySQL and should never have been used - 'order' and 'unique'.
[[BR]][[BR]]
I bashed my head against the wall trying to get SimpleTest to work with
fixtures, until I realized that it was these poorly chosen key names mixed
with a less-than-forgiving DboSource->buildIndex() method.
[[BR]][[BR]]
I modified:
{{{
if (is_array($value['column'])) {
$out .= 'KEY '. $name .' (' . join(', ',
array_map(array(&$this, 'name'), $value['column'])) . ')';
} else {
$out .= 'KEY '. $name .' (' .
$this->name($value['column']) . ')';
}
}}}
by inserting single open quotes ( ` ) flanking the name of the KEY:
{{{
if (is_array($value['column'])) {
$out .= 'KEY `'. $name .'` (' . join(', ',
array_map(array(&$this, 'name'), $value['column'])) . ')';
} else {
$out .= 'KEY `'. $name .'` (' .
$this->name($value['column']) . ')';
}
}}}
Granted, I've since changed the unique key names so as not to conflict
with reserved - or should be - MySQL words. But having a more forgiving
buildIndex() that matches MySQL 'standards' formatting would have saved me
some grief.
[[BR]]
----
[[BR]]
Regards
--
Ticket URL: <https://trac.cakephp.org/ticket/6539>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC.
Our primary goal is to provide a structured framework that enables PHP users at
all levels to rapidly develop robust web applications, without any loss to
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"tickets cakephp" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---