mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 00:29:38 +01:00
allow to limit size of index by appending it in brackets after the column name, eg. "column(32)", which is already supported by ADOdb, by was broken by our fix to always quote names, to allow column names which are reserved words, eg. "timestamp" in phpfreechat
This commit is contained in:
parent
1e79225a29
commit
1e9695dbc9
@ -238,10 +238,20 @@ class ADODB_DataDict {
|
||||
return $quote . $matches[1] . $quote;
|
||||
}
|
||||
|
||||
// if name contains special characters, quote it
|
||||
/*$regex = ($allowBrackets) ? $this->nameRegexBrackets : $this->nameRegex;
|
||||
// if brackets are allowed, quote only the rest,
|
||||
// to allow to limit indexes on colums, eg "column(32)"
|
||||
if ($allowBrackets && preg_match('/^(.*) *(\(\d+\))$/',$name,$matches)) {
|
||||
return $quote . $matches[1] . $quote . ' '. $matches[2];
|
||||
}
|
||||
return $quote . $name . $quote;
|
||||
|
||||
if ( !preg_match('/^[' . $regex . ']+$/', $name) )*/ {
|
||||
// not used stock ADOdb code, which only quotes names with special chars,
|
||||
// which does not help with column names using reserved words, eg. "timestamp" in phpfreechat
|
||||
|
||||
// if name contains special characters, quote it
|
||||
$regex = ($allowBrackets) ? $this->nameRegexBrackets : $this->nameRegex;
|
||||
|
||||
if ( !preg_match('/^[' . $regex . ']+$/', $name) ) {
|
||||
return $quote . $name . $quote;
|
||||
}
|
||||
|
||||
|
@ -918,6 +918,8 @@ class schema_proc
|
||||
$aColumnNames = str_replace($remove,'',$aColumnNames);
|
||||
|
||||
$name = $sTableName.'_'.(is_array($aColumnNames) ? implode('_',$aColumnNames) : $aColumnNames);
|
||||
// remove length limits from column names
|
||||
$name = preg_replace('/ *\(\d+\)/','',$name);
|
||||
|
||||
// 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 ||
|
||||
|
Loading…
Reference in New Issue
Block a user