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