PEAR::Translation2 bug with MySQL when adding new language.
| From: | AJ Tarachanowicz | Date: | Wed, 22 Feb 2006 14:21:26 +0000 |
| Subject: | PEAR::Translation2 bug with MySQL when adding new language. | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-23088@lists.php.net to get a copy of this message | ||
Hi Lorenzo,
When I add a new language using the PEAR::DB container I get this error
CREATE UNIQUE INDEX translation_en_iso_8859_15_translation_id_index ON
translation_en_iso_8859_15 (translation_id) [nativecode=1170 **
BLOB/TEXT column 'translation_id' used in key specification without a
key length]
I'm using MySQL 4.1.13 on SuSE linux. According to MySQL's manual when
creating a unique index on a column with the type 'TEXT' you need to
specify a length. So the query for MySQL should be
CREATE UNIQUE INDEX translation_en_iso_8859_15_translation_id_index ON
translation_en_iso_8859_15 (translation_id(255)) <-- notice the (255)
Please correct me I'm wrong. I'm also very keen to providing a patch for
this since we need this fixed ASAP to get the next stable version of
Seagull out the door.
The idea I had to remedy the problem is to store the driver (mysql,
pgsql, etc) in $this->options when
Translation2_Container_db::_setDefaultOptions is called by init() and
then modify Translation2_Admin_Container_db to look like this.
$mysqlClause = ($this->options['driver'] == 'mysql') ? '(255)' :
'';
$queries[] = sprintf('CREATE UNIQUE INDEX %s_%s_index ON %s (%s%
s)',
$langData['table_name'],
$this->options['string_id_col'],
$langData['table_name'],
$this->options['string_id_col'],
$mysqlClause
);
I'd also of course provide a patch for MDB and MDB2. If this isn't in
your opinion the best approach please let me know.
Best Regards,
--
AJ Tarachanowicz II
Developer
Seagull Framework
Coming to a webserver near you - http://seagull.phpkitchen.com