BUG Normalize index specs to avoid false positives on schema regen

This commit is contained in:
Ingo Schommer 2012-12-11 14:40:49 +01:00
parent 36f15a52b4
commit 069ed7ff52
1 changed files with 10 additions and 1 deletions

View File

@ -538,7 +538,16 @@ class SQLite3Database extends SS_Database {
foreach(DB::query('PRAGMA index_info("' . $index["name"] . '")') as $details) $list[] = $details['name'];
$indexList[$index["name"]] = implode(',', $list);
}
foreach($indexList as $name => $val) $indexList[$name] = "\"$val\"";
foreach($indexList as $name => $val) {
// Normalize quoting to avoid false positives when checking for index changes
// during schema generation
$valParts = preg_split('/\s*,\s*/', $val);
foreach($valParts as $i => $valPart) {
$valParts[$i] = preg_replace('/^"?(.*)"?$/', '$1', $valPart);
}
$indexList[$name] = '"' . implode('","', $valParts) . '"';
}
return $indexList;
}