| @@ 405-420 (lines=16) @@ | ||
| 402 | $query, [$tableOID, '(' . $this->name . '%', '("' . $this->name . '%',] |
|
| 403 | ); |
|
| 404 | ||
| 405 | foreach ($constraints as $constraint) { |
|
| 406 | if (preg_match('/ARRAY\[([^\]]+)\]/', $constraint['consrc'], $matches)) { |
|
| 407 | $enumValues = explode(',', $matches[1]); |
|
| 408 | foreach ($enumValues as &$value) { |
|
| 409 | if (preg_match("/^'?(.*?)'?::(.+)/", trim($value), $matches)) { |
|
| 410 | //In database: 'value'::TYPE |
|
| 411 | $value = $matches[1]; |
|
| 412 | } |
|
| 413 | ||
| 414 | unset($value); |
|
| 415 | } |
|
| 416 | ||
| 417 | $this->enumValues = $enumValues; |
|
| 418 | $this->enumConstraint = $constraint['conname']; |
|
| 419 | } |
|
| 420 | } |
|
| 421 | } |
|
| 422 | } |
|
| @@ 152-167 (lines=16) @@ | ||
| 149 | ||
| 150 | if ($this->type == 'enum') { |
|
| 151 | $name = $this->getName(true); |
|
| 152 | foreach ($schema['tableStatement'] as $column) { |
|
| 153 | if (preg_match("/$name +enum.*?CHECK *\\($name in \\((.*?)\\)\\)/i", trim($column), |
|
| 154 | $matches)) { |
|
| 155 | $enumValues = explode(',', $matches[1]); |
|
| 156 | foreach ($enumValues as &$value) { |
|
| 157 | if (preg_match("/^'?(.*?)'?$/", trim($value), $matches)) { |
|
| 158 | //In database: 'value' |
|
| 159 | $value = $matches[1]; |
|
| 160 | } |
|
| 161 | ||
| 162 | unset($value); |
|
| 163 | } |
|
| 164 | ||
| 165 | $this->enumValues = $enumValues; |
|
| 166 | } |
|
| 167 | } |
|
| 168 | } |
|
| 169 | ||
| 170 | $options = array_map(function ($value) { |
|