Добавьте файлы проекта.
This commit is contained in:
18
SQLLinter/Infrastructure/Rules/TopWithoutOrderByRule.cs
Normal file
18
SQLLinter/Infrastructure/Rules/TopWithoutOrderByRule.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using Microsoft.SqlServer.TransactSql.ScriptDom;
|
||||
using SQLLinter.Common;
|
||||
|
||||
namespace SQLLinter.Infrastructure.Rules;
|
||||
|
||||
public class TopWithoutOrderByRule : BaseRuleVisitor
|
||||
{
|
||||
public override string Text => "TOP без ORDER BY может дать непредсказуемый результат";
|
||||
|
||||
public override void Visit(QuerySpecification node)
|
||||
{
|
||||
if (node.TopRowFilter != null && node.OrderByClause == null)
|
||||
{
|
||||
AddViolation(node.TopRowFilter);
|
||||
}
|
||||
base.Visit(node);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user