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