Skip to content

Commit e435350

Browse files
Merge pull request #310 from sqlkata/issue/305
fix safe order (SELECT 0 FROM DUAL)
2 parents c860a3d + b6076b0 commit e435350

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

QueryBuilder/Compilers/OracleCompiler.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ public override string CompileLimit(SqlResult ctx)
4848
}
4949

5050
var safeOrder = "";
51+
5152
if (!ctx.Query.HasComponent("order"))
5253
{
53-
safeOrder = "ORDER BY (SELECT 0) ";
54+
safeOrder = "ORDER BY (SELECT 0 FROM DUAL) ";
5455
}
5556

5657
if (limit == 0)
@@ -126,7 +127,7 @@ protected override string CompileBasicDateCondition(SqlResult ctx, BasicDateCond
126127
valueFormat = $"TO_DATE({value}, 'HH24:MI')";
127128
else // assume HH:MM:SS format
128129
valueFormat = $"TO_DATE({value}, 'HH24:MI:SS')";
129-
}
130+
}
130131
sql = $"TO_CHAR({column}, 'HH24:MI:SS') {condition.Operator} TO_CHAR({valueFormat}, 'HH24:MI:SS')";
131132
break;
132133
case "year":

0 commit comments

Comments
 (0)