[Rt-commit] r15749 - rt/3.8/trunk/etc/upgrade
ruz at bestpractical.com
ruz at bestpractical.com
Wed Sep 3 21:50:56 EDT 2008
Author: ruz
Date: Wed Sep 3 21:50:55 2008
New Revision: 15749
Modified:
rt/3.8/trunk/etc/upgrade/schema.mysql-4.0-4.1.pl
Log:
* if lengths are different then we have to count real byte length
to avoid problems with indexes
Modified: rt/3.8/trunk/etc/upgrade/schema.mysql-4.0-4.1.pl
==============================================================================
--- rt/3.8/trunk/etc/upgrade/schema.mysql-4.0-4.1.pl (original)
+++ rt/3.8/trunk/etc/upgrade/schema.mysql-4.0-4.1.pl Wed Sep 3 21:50:55 2008
@@ -353,14 +353,15 @@
sub column_byte_length {
my ($table, $column) = @_;
if ( $version >= 5.0 ) {
- return $dbh->selectrow_arrayref(
- "SELECT CHARACTER_OCTET_LENGTH FROM information_schema.COLUMNS WHERE"
+ my ($char, $octet) = @{ $dbh->selectrow_arrayref(
+ "SELECT CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH FROM information_schema.COLUMNS WHERE"
." TABLE_SCHEMA = ". $dbh->quote($db_name)
." AND TABLE_NAME = ". $dbh->quote($table)
." AND COLUMN_NAME = ". $dbh->quote($column)
- )->[0];
+ ) };
+ return $octet if $octet == $char;
}
- return $dbh->selectrow_arrayref("SELECT MAX(LENGTH(". $dbh->quote($column) .")) FROM $table")->[0];
+ return $dbh->selectrow_arrayref("SELECT MAX(LENGTH(". $dbh->quote_identifier($column) .")) FROM $table")->[0];
}
sub column_info {
More information about the Rt-commit
mailing list