[ticket/9892] Table prefix lengths influence index lengths in db_tools

PHPBB3-9892
This commit is contained in:
Nils Adermann 2011-06-12 04:10:51 +02:00
parent 8a5e3781d5
commit ef544ee095
2 changed files with 18 additions and 10 deletions

View file

@ -419,7 +419,7 @@ class phpbb_db_tools
if (isset($prepared_column['auto_increment']) && strlen($column_name) > 26) // "${column_name}_gen"
{
trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR);
trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum auto increment column length is 26 characters.", E_USER_ERROR);
}
// here we add the definition of the new column to the list of columns
@ -2056,9 +2056,11 @@ class phpbb_db_tools
{
$statements = array();
if (strlen($table_name . $index_name) > 30)
$table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config)
if (strlen($table_name . $index_name) - strlen($table_prefix) > 24)
{
trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR);
$max_length = $table_prefix + 24;
trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is $max_length characters.", E_USER_ERROR);
}
switch ($this->sql_layer)
@ -2091,9 +2093,11 @@ class phpbb_db_tools
{
$statements = array();
if (strlen($table_name . $index_name) > 30)
$table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config)
if (strlen($table_name . $index_name) - strlen($table_prefix) > 24)
{
trigger_error("Index name '${table_name}_$index_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR);
$max_length = $table_prefix + 24;
trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is $max_length characters.", E_USER_ERROR);
}
// remove index length unless MySQL4

View file

@ -2321,7 +2321,7 @@ class updater_db_tools
if (isset($prepared_column['auto_increment']) && strlen($column_name) > 26) // "${column_name}_gen"
{
trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR);
trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum auto increment column length is 26 characters.", E_USER_ERROR);
}
// here we add the definition of the new column to the list of columns
@ -3891,9 +3891,11 @@ class updater_db_tools
{
$statements = array();
if (strlen($table_name . $index_name) > 30)
$table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config)
if (strlen($table_name . $index_name) - strlen($table_prefix) > 24)
{
trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR);
$max_length = $table_prefix + 24;
trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is $max_length characters.", E_USER_ERROR);
}
switch ($this->sql_layer)
@ -3926,9 +3928,11 @@ class updater_db_tools
{
$statements = array();
if (strlen($table_name . $index_name) > 30)
$table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config)
if (strlen($table_name . $index_name) - strlen($table_prefix) > 24)
{
trigger_error("Index name '${table_name}_$index_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR);
$max_length = $table_prefix + 24;
trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is $max_length characters.", E_USER_ERROR);
}
// remove index length unless MySQL4