Skip to content

Commit 07acfc2

Browse files
committed
Comment out check for SqlVariant
This lead to full expression in, for instance, ORDER BY clause like all other RDBMS
1 parent 8cab212 commit 07acfc2

1 file changed

Lines changed: 15 additions & 16 deletions

File tree

Orm/Xtensive.Orm/Orm/Providers/Expressions/ExpressionProcessor.cs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -323,28 +323,27 @@ protected override SqlExpression VisitConditional(ConditionalExpression expressi
323323
var check = Visit(expression.Test);
324324
var ifTrue = Visit(expression.IfTrue);
325325
var ifFalse = Visit(expression.IfFalse);
326-
SqlContainer container = ifTrue as SqlContainer;
327-
if (container!=null)
328-
ifTrue = TryUnwrapEnum(container);
329-
container = ifFalse as SqlContainer;
330-
if (container!=null)
331-
ifFalse = TryUnwrapEnum(container);
326+
327+
if (ifTrue is SqlContainer ifTrueContainer)
328+
ifTrue = TryUnwrapEnum(ifTrueContainer);
329+
if (ifFalse is SqlContainer ifFalseContainer)
330+
ifFalse = TryUnwrapEnum(ifFalseContainer);
331+
332332
var boolCheck = fixBooleanExpressions
333333
? booleanExpressionConverter.BooleanToInt(check)
334334
: check;
335-
var varCheck = boolCheck as SqlVariant;
336-
if (!varCheck.IsNullReference())
337-
return SqlDml.Variant(varCheck.Id, ifFalse, ifTrue);
335+
//var varCheck = boolCheck as SqlVariant;
336+
//if (!varCheck.IsNullReference())
337+
// return SqlDml.Variant(varCheck.Id, ifFalse, ifTrue);
338+
var @case = SqlDml.Case();
338339
if (fixBooleanExpressions && IsBooleanExpression(expression)) {
339-
var c = SqlDml.Case();
340-
c[check] = booleanExpressionConverter.BooleanToInt(ifTrue);
341-
c.Else = booleanExpressionConverter.BooleanToInt(ifFalse);
342-
return booleanExpressionConverter.IntToBoolean(c);
340+
@case[check] = booleanExpressionConverter.BooleanToInt(ifTrue);
341+
@case.Else = booleanExpressionConverter.BooleanToInt(ifFalse);
342+
return booleanExpressionConverter.IntToBoolean(@case);
343343
}
344344
else {
345-
var c = SqlDml.Case();
346-
c[check] = ifTrue;
347-
c.Else = ifFalse;
345+
@case[check] = ifTrue;
346+
@case.Else = ifFalse;
348347
return c;
349348
}
350349
}

0 commit comments

Comments
 (0)