BUGFIX: Made MSSQLDatabase::EnumValuesFromConstraint more robust

This commit is contained in:
Sam Minnee 2009-06-10 01:21:15 +00:00
parent 7a1d6d7bcf
commit cedc941410

View File

@ -394,10 +394,10 @@ class MSSQLDatabase extends Database {
* Get the actual enum fields from the constraint value: * Get the actual enum fields from the constraint value:
*/ */
private function EnumValuesFromConstraint($constraint){ private function EnumValuesFromConstraint($constraint){
$segments=explode(' OR [', $constraint); $segments=preg_split('/ +OR *\[/i', $constraint);
$constraints=Array(); $constraints=Array();
foreach($segments as $this_segment){ foreach($segments as $this_segment){
$bits=explode(' = ', $this_segment); $bits=preg_split('/ *= */', $this_segment);
for($i=1; $i<sizeof($bits); $i+=2) for($i=1; $i<sizeof($bits); $i+=2)
array_unshift($constraints, substr(rtrim($bits[$i], ')'), 1, -1)); array_unshift($constraints, substr(rtrim($bits[$i], ')'), 1, -1));