|
@@ -1469,6 +1469,7 @@ Type
|
|
|
|
|
|
TSQLCaseExpression = Class(TSQLExpression)
|
|
TSQLCaseExpression = Class(TSQLExpression)
|
|
private
|
|
private
|
|
|
|
+ FSelector: TSQLExpression;
|
|
FBranches: array of TSQLCaseExpressionBranch;
|
|
FBranches: array of TSQLCaseExpressionBranch;
|
|
FElseBranch: TSQLExpression;
|
|
FElseBranch: TSQLExpression;
|
|
function GetBranch(Index: Integer): TSQLCaseExpressionBranch;
|
|
function GetBranch(Index: Integer): TSQLCaseExpressionBranch;
|
|
@@ -1477,6 +1478,7 @@ Type
|
|
Destructor Destroy; override;
|
|
Destructor Destroy; override;
|
|
Function GetAsSQL(Options : TSQLFormatOptions; AIndent : Integer = 0): TSQLStringType; override;
|
|
Function GetAsSQL(Options : TSQLFormatOptions; AIndent : Integer = 0): TSQLStringType; override;
|
|
|
|
|
|
|
|
+ Property Selector: TSQLExpression Read FSelector Write FSelector;
|
|
Property BranchCount: Integer Read GetBranchCount;
|
|
Property BranchCount: Integer Read GetBranchCount;
|
|
Procedure AddBranch(ABranch: TSQLCaseExpressionBranch);
|
|
Procedure AddBranch(ABranch: TSQLCaseExpressionBranch);
|
|
Procedure ClearBranches;
|
|
Procedure ClearBranches;
|
|
@@ -2137,6 +2139,7 @@ destructor TSQLCaseExpression.Destroy;
|
|
begin
|
|
begin
|
|
ClearBranches;
|
|
ClearBranches;
|
|
FreeAndNil(FElseBranch);
|
|
FreeAndNil(FElseBranch);
|
|
|
|
+ FreeAndNil(FSelector);
|
|
inherited Destroy;
|
|
inherited Destroy;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -2145,6 +2148,8 @@ var
|
|
B: TSQLCaseExpressionBranch;
|
|
B: TSQLCaseExpressionBranch;
|
|
begin
|
|
begin
|
|
Result:=SQLKeyWord('CASE',Options)+' ';
|
|
Result:=SQLKeyWord('CASE',Options)+' ';
|
|
|
|
+ if Assigned(Selector) then
|
|
|
|
+ Result:=Result+Selector.GetAsSQL(Options,AIndent)+' ';
|
|
for B in FBranches do
|
|
for B in FBranches do
|
|
Result:=Result+
|
|
Result:=Result+
|
|
SQLKeyWord('WHEN ',Options)+B.Condition.GetAsSQL(Options, AIndent)+' '+
|
|
SQLKeyWord('WHEN ',Options)+B.Condition.GetAsSQL(Options, AIndent)+' '+
|