forked from extern/egroupware
"shorten index names longer or equal to 64 chars for all db types"
This commit is contained in:
parent
d4544daf94
commit
17b8868698
@ -56,13 +56,14 @@
|
|||||||
*/
|
*/
|
||||||
var $debug = 0;
|
var $debug = 0;
|
||||||
/**
|
/**
|
||||||
* Arry with db => max. length of indexes pairs (if there is a considerable low limit for a db)
|
* Array with db => max. length of indexes pairs (if there is a considerable low limit for a db)
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
var $max_index_length=array(
|
var $max_index_length=array(
|
||||||
'maxdb' => 32,
|
'maxdb' => 32,
|
||||||
'oracle' => 30,
|
'oracle' => 30,
|
||||||
|
'mysql' => 122,
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
* type of the database, set by the the constructor: 'mysql','pgsql','mssql','maxdb'
|
* type of the database, set by the the constructor: 'mysql','pgsql','mssql','maxdb'
|
||||||
@ -917,11 +918,11 @@
|
|||||||
$name = $sTableName.'_'.(is_array($aColumnNames) ? implode('_',$aColumnNames) : $aColumnNames);
|
$name = $sTableName.'_'.(is_array($aColumnNames) ? implode('_',$aColumnNames) : $aColumnNames);
|
||||||
|
|
||||||
// this code creates a fixed short index-names (30 chars) from the long and unique name, eg. for MaxDB or Oracle
|
// this code creates a fixed short index-names (30 chars) from the long and unique name, eg. for MaxDB or Oracle
|
||||||
if (isset($this->max_index_length[$this->sType]) && $this->max_index_length[$this->sType] <= 32 && strlen($name) > 30)
|
if (isset($this->max_index_length[$this->sType]) && $this->max_index_length[$this->sType] <= 32 && strlen($name) > 30 ||
|
||||||
|
strlen($name) >= 64) // even mysql has a limit here ;-)
|
||||||
{
|
{
|
||||||
$name = "i".substr(hash ('md5', $name),0,29);
|
$name = "i".substr(hash ('md5', $name),0,29);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $name;
|
return $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user