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