|
@@ 1222-1234 (lines=13) @@
|
| 1219 |
|
* |
| 1220 |
|
* @return string The SQL. |
| 1221 |
|
*/ |
| 1222 |
|
public function walkGeneralCaseExpression(AST\GeneralCaseExpression $generalCaseExpression) |
| 1223 |
|
{ |
| 1224 |
|
$sql = 'CASE'; |
| 1225 |
|
|
| 1226 |
|
foreach ($generalCaseExpression->whenClauses as $whenClause) { |
| 1227 |
|
$sql .= ' WHEN ' . $this->walkConditionalExpression($whenClause->caseConditionExpression); |
| 1228 |
|
$sql .= ' THEN ' . $this->walkSimpleArithmeticExpression($whenClause->thenScalarExpression); |
| 1229 |
|
} |
| 1230 |
|
|
| 1231 |
|
$sql .= ' ELSE ' . $this->walkSimpleArithmeticExpression($generalCaseExpression->elseScalarExpression) . ' END'; |
| 1232 |
|
|
| 1233 |
|
return $sql; |
| 1234 |
|
} |
| 1235 |
|
|
| 1236 |
|
/** |
| 1237 |
|
* Walks down a SimpleCaseExpression AST node and generates the corresponding SQL. |
|
@@ 1243-1255 (lines=13) @@
|
| 1240 |
|
* |
| 1241 |
|
* @return string The SQL. |
| 1242 |
|
*/ |
| 1243 |
|
public function walkSimpleCaseExpression($simpleCaseExpression) |
| 1244 |
|
{ |
| 1245 |
|
$sql = 'CASE ' . $this->walkStateFieldPathExpression($simpleCaseExpression->caseOperand); |
| 1246 |
|
|
| 1247 |
|
foreach ($simpleCaseExpression->simpleWhenClauses as $simpleWhenClause) { |
| 1248 |
|
$sql .= ' WHEN ' . $this->walkSimpleArithmeticExpression($simpleWhenClause->caseScalarExpression); |
| 1249 |
|
$sql .= ' THEN ' . $this->walkSimpleArithmeticExpression($simpleWhenClause->thenScalarExpression); |
| 1250 |
|
} |
| 1251 |
|
|
| 1252 |
|
$sql .= ' ELSE ' . $this->walkSimpleArithmeticExpression($simpleCaseExpression->elseScalarExpression) . ' END'; |
| 1253 |
|
|
| 1254 |
|
return $sql; |
| 1255 |
|
} |
| 1256 |
|
|
| 1257 |
|
/** |
| 1258 |
|
* {@inheritdoc} |