|
@@ 1240-1252 (lines=13) @@
|
| 1237 |
|
* |
| 1238 |
|
* @return string The SQL. |
| 1239 |
|
*/ |
| 1240 |
|
public function walkGeneralCaseExpression(AST\GeneralCaseExpression $generalCaseExpression) |
| 1241 |
|
{ |
| 1242 |
|
$sql = 'CASE'; |
| 1243 |
|
|
| 1244 |
|
foreach ($generalCaseExpression->whenClauses as $whenClause) { |
| 1245 |
|
$sql .= ' WHEN ' . $this->walkConditionalExpression($whenClause->caseConditionExpression); |
| 1246 |
|
$sql .= ' THEN ' . $this->walkSimpleArithmeticExpression($whenClause->thenScalarExpression); |
| 1247 |
|
} |
| 1248 |
|
|
| 1249 |
|
$sql .= ' ELSE ' . $this->walkSimpleArithmeticExpression($generalCaseExpression->elseScalarExpression) . ' END'; |
| 1250 |
|
|
| 1251 |
|
return $sql; |
| 1252 |
|
} |
| 1253 |
|
|
| 1254 |
|
/** |
| 1255 |
|
* Walks down a SimpleCaseExpression AST node and generates the corresponding SQL. |
|
@@ 1261-1273 (lines=13) @@
|
| 1258 |
|
* |
| 1259 |
|
* @return string The SQL. |
| 1260 |
|
*/ |
| 1261 |
|
public function walkSimpleCaseExpression($simpleCaseExpression) |
| 1262 |
|
{ |
| 1263 |
|
$sql = 'CASE ' . $this->walkStateFieldPathExpression($simpleCaseExpression->caseOperand); |
| 1264 |
|
|
| 1265 |
|
foreach ($simpleCaseExpression->simpleWhenClauses as $simpleWhenClause) { |
| 1266 |
|
$sql .= ' WHEN ' . $this->walkSimpleArithmeticExpression($simpleWhenClause->caseScalarExpression); |
| 1267 |
|
$sql .= ' THEN ' . $this->walkSimpleArithmeticExpression($simpleWhenClause->thenScalarExpression); |
| 1268 |
|
} |
| 1269 |
|
|
| 1270 |
|
$sql .= ' ELSE ' . $this->walkSimpleArithmeticExpression($simpleCaseExpression->elseScalarExpression) . ' END'; |
| 1271 |
|
|
| 1272 |
|
return $sql; |
| 1273 |
|
} |
| 1274 |
|
|
| 1275 |
|
/** |
| 1276 |
|
* {@inheritdoc} |