diff --git a/src/Dapper.AOT.Analyzers/CodeAnalysis/DapperInterceptorGenerator.cs b/src/Dapper.AOT.Analyzers/CodeAnalysis/DapperInterceptorGenerator.cs index e3066cde..abb13ec7 100644 --- a/src/Dapper.AOT.Analyzers/CodeAnalysis/DapperInterceptorGenerator.cs +++ b/src/Dapper.AOT.Analyzers/CodeAnalysis/DapperInterceptorGenerator.cs @@ -467,6 +467,8 @@ static string BuildParameterMap(in GeneratorSyntaxContext ctx, IInvocationOperat SqlAnalysis.TSqlProcessor.ModeFlags modeFlags = SqlAnalysis.TSqlProcessor.ModeFlags.None; if (caseSensitive) modeFlags |= SqlAnalysis.TSqlProcessor.ModeFlags.CaseSensitive; if ((flags & OperationFlags.BindResultsByName) != 0) modeFlags |= SqlAnalysis.TSqlProcessor.ModeFlags.ValidateSelectNames; + if ((flags & OperationFlags.SingleRow) != 0) modeFlags |= SqlAnalysis.TSqlProcessor.ModeFlags.SingleRow; + if ((flags & OperationFlags.AtMostOne) != 0) modeFlags |= SqlAnalysis.TSqlProcessor.ModeFlags.AtMostOne; var proc = new DiagnosticTSqlProcessor(parameterType, modeFlags, diagnostics, loc, sqlSyntax); try diff --git a/src/Dapper.AOT.Analyzers/CodeAnalysis/Diagnostics.cs b/src/Dapper.AOT.Analyzers/CodeAnalysis/Diagnostics.cs index 774ba3be..1f1e41c6 100644 --- a/src/Dapper.AOT.Analyzers/CodeAnalysis/Diagnostics.cs +++ b/src/Dapper.AOT.Analyzers/CodeAnalysis/Diagnostics.cs @@ -1,6 +1,6 @@ using Microsoft.CodeAnalysis; -using System.Collections.Generic; using System; +using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Reflection; @@ -144,8 +144,21 @@ internal static readonly DiagnosticDescriptor "SELECT statement assigns variable and performs reads (L{0} C{1})", Category.Sql, DiagnosticSeverity.Warning, true), DeleteWithoutWhere = new("DAP223", "DELETE without WHERE", "DELETE statement lacks WHERE clause (L{0} C{1})", Category.Sql, DiagnosticSeverity.Warning, true), - UpdateWithoutWhere = new ("DAP224", "UPDATE without WHERE", - "UPDATE statement lacks WHERE clause (L{0} C{1})", Category.Sql, DiagnosticSeverity.Warning, true); + UpdateWithoutWhere = new("DAP224", "UPDATE without WHERE", + "UPDATE statement lacks WHERE clause (L{0} C{1})", Category.Sql, DiagnosticSeverity.Warning, true), + + FromMultiTableMissingAlias = new("DAP225", "UPDATE without WHERE", + "FROM expressions with multiple elements should use aliases (L{0} C{1})", Category.Sql, DiagnosticSeverity.Warning, true), + NonIntegerTop = new("DAP226", "UPDATE without WHERE", + "TOP literals should be integers (L{0} C{1})", Category.Sql, DiagnosticSeverity.Error, true), + NonPositiveTop = new("DAP227", "UPDATE without WHERE", + "TOP literals should be positive (L{0} C{1})", Category.Sql, DiagnosticSeverity.Error, true), + SelectFirstTopError = new("DAP228", "UPDATE without WHERE", + "SELECT for First* should use TOP 1 (L{0} C{1})", Category.Sql, DiagnosticSeverity.Warning, true), + SelectSingleTopError = new("DAP229", "UPDATE without WHERE", + "SELECT for Single* should use TOP 2; if you do not need to test over-read, use First* (L{0} C{1})", Category.Sql, DiagnosticSeverity.Warning, true), + SelectSingleRowWithoutWhere = new("DAP230", "UPDATE without WHERE", + "SELECT for single row without WHERE or (TOP and ORDER BY) (L{0} C{1})", Category.Sql, DiagnosticSeverity.Warning, true); // be careful moving this because of static field initialization order diff --git a/src/Dapper.AOT.Analyzers/Internal/DiagnosticTSqlProcessor.cs b/src/Dapper.AOT.Analyzers/Internal/DiagnosticTSqlProcessor.cs index bea3f025..9a82eaf8 100644 --- a/src/Dapper.AOT.Analyzers/Internal/DiagnosticTSqlProcessor.cs +++ b/src/Dapper.AOT.Analyzers/Internal/DiagnosticTSqlProcessor.cs @@ -6,6 +6,7 @@ using Microsoft.SqlServer.TransactSql.ScriptDom; using System; using System.Data; +using System.Diagnostics; using static Dapper.SqlAnalysis.TSqlProcessor; namespace Dapper.Internal; @@ -46,14 +47,15 @@ public DiagnosticTSqlProcessor(ITypeSymbol? parameterType, ModeFlags flags, obje return _location; } - - private void AddDiagnostic(DiagnosticDescriptor diagnostic, in Location location, params object?[]? args) { Diagnostics.Add(ref _diagnostics, Diagnostic.Create(diagnostic, GetLocation(location), args)); } protected override void OnError(string error, in Location location) - => AddDiagnostic(Diagnostics.SqlError, location, error, location.Line, location.Column); + { + Debug.Fail("unhandled error: " + error); + AddDiagnostic(Diagnostics.SqlError, location, error, location.Line, location.Column); + } protected override void OnAdditionalBatch(Location location) => AddDiagnostic(Diagnostics.MultipleBatches, location, location.Line, location.Column); @@ -115,6 +117,19 @@ protected override void OnUpdateWithoutWhere(Location location) protected override void OnDeleteWithoutWhere(Location location) => AddDiagnostic(Diagnostics.DeleteWithoutWhere, location, location.Line, location.Column); + protected override void OnFromMultiTableMissingAlias(Location location) + => AddDiagnostic(Diagnostics.FromMultiTableMissingAlias, location, location.Line, location.Column); + protected override void OnNonIntegerTop(Location location) + => AddDiagnostic(Diagnostics.NonIntegerTop, location, location.Line, location.Column); + protected override void OnNonPositiveTop(Location location) + => AddDiagnostic(Diagnostics.NonPositiveTop, location, location.Line, location.Column); + protected override void OnSelectFirstTopError(Location location) + => AddDiagnostic(Diagnostics.SelectFirstTopError, location, location.Line, location.Column); + protected override void OnSelectSingleRowWithoutWhere(Location location) + => AddDiagnostic(Diagnostics.SelectSingleRowWithoutWhere, location, location.Line, location.Column); + protected override void OnSelectSingleTopError(Location location) + => AddDiagnostic(Diagnostics.SelectSingleTopError, location, location.Line, location.Column); + protected override bool TryGetParameter(string name, out ParameterDirection direction) { // we have knowledge of the type system; use it diff --git a/src/Dapper.AOT.Analyzers/SqlAnalysis/TSqlProcessor.cs b/src/Dapper.AOT.Analyzers/SqlAnalysis/TSqlProcessor.cs index 6385c49e..a0e47ddf 100644 --- a/src/Dapper.AOT.Analyzers/SqlAnalysis/TSqlProcessor.cs +++ b/src/Dapper.AOT.Analyzers/SqlAnalysis/TSqlProcessor.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Collections.Immutable; using System.Data; +using System.Globalization; using System.IO; using System.Linq; using System.Text.RegularExpressions; @@ -20,6 +21,8 @@ internal enum ModeFlags None = 0, CaseSensitive = 1 << 0, ValidateSelectNames = 1 << 1, + SingleRow = 1 << 2, + AtMostOne = 1 << 3, } [Flags] internal enum VariableFlags @@ -184,6 +187,19 @@ protected virtual void OnDeleteWithoutWhere(Location location) protected virtual void OnUpdateWithoutWhere(Location location) => OnError($"UPDATE statement without WHERE clause", location); + protected virtual void OnSelectSingleTopError(Location location) + => OnError($"SELECT for Single* should use TOP 2; if you do not need to test over-read, use First*", location); + protected virtual void OnSelectFirstTopError(Location location) + => OnError($"SELECT for First* should use TOP 1", location); + protected virtual void OnSelectSingleRowWithoutWhere(Location location) + => OnError($"SELECT for single row without WHERE or (TOP and ORDER BY)", location); + protected virtual void OnNonPositiveTop(Location location) + => OnError($"TOP literals should be positive", location); + protected virtual void OnNonIntegerTop(Location location) + => OnError($"TOP literals should be integers", location); + protected virtual void OnFromMultiTableMissingAlias(Location location) + => OnError($"FROM expressions with multiple elements should use aliases", location); + internal readonly struct Location { @@ -327,6 +343,8 @@ public VariableTrackingVisitor(ModeFlags flags, TSqlProcessor parser) public bool CaseSensitive => (_flags & ModeFlags.CaseSensitive) != 0; public bool ValidateSelectNames => (_flags & ModeFlags.ValidateSelectNames) != 0; + public bool SingleRow => (_flags & ModeFlags.SingleRow) != 0; + public bool AtMostOne => (_flags & ModeFlags.AtMostOne) != 0; private readonly Dictionary variables; private int batchCount; @@ -505,17 +523,18 @@ public override void Visit(ExecuteStatement node) base.Visit(node); } - private void AddQuery() + private bool AddQuery() // returns true if the first { switch (parser.Flags & (ParseFlags.Query | ParseFlags.Queries)) { case ParseFlags.None: parser.Flags |= ParseFlags.Query; - break; + return true; case ParseFlags.Query: parser.Flags |= ParseFlags.Queries; break; } + return false; } public override void Visit(SelectStatement node) { @@ -548,7 +567,7 @@ public override void Visit(SelectStatement node) if (name is null && scalar.Expression is ColumnReferenceExpression col) { var ids = col.MultiPartIdentifier.Identifiers; - if(ids.Count != 0) + if (ids.Count != 0) { name = ids[ids.Count - 1].Value; } @@ -572,11 +591,44 @@ public override void Visit(SelectStatement node) } if (reads != 0) { - AddQuery(); if (sets != 0) { parser.OnSelectAssignAndRead(new(spec)); } + bool firstQuery = AddQuery(); + if (firstQuery && SingleRow) + { + bool haveTop = false; + if (spec.TopRowFilter is { Percent: false, Expression: IntegerLiteral top } + && ParseInt32(top, out int i)) + { + haveTop = true; + if (AtMostOne) // Single[OrDefault][Async] + { + if (i != 2) + { + parser.OnSelectSingleTopError(new(node)); + } + } + else // First[OrDefault][Async] + { + if (i != 1) + { + parser.OnSelectFirstTopError(new(node)); + } + } + } + + // we want *either* a WHERE (which we will allow with/without a TOP), + // or a TOP + ORDER BY + if (!IsUnfiltered(spec.FromClause, spec.WhereClause)) { } // fine + else if (haveTop && spec.OrderByClause is not null) { } // fine + else + { + parser.OnSelectSingleRowWithoutWhere(new(node)); + } + } + } } @@ -584,15 +636,74 @@ public override void Visit(SelectStatement node) base.Visit(node); } + static bool ParseInt32(IntegerLiteral node, out int value) => int.TryParse(node.Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out value); + static bool ParseNumeric(NumericLiteral node, out decimal value) => decimal.TryParse(node.Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out value); + public override void Visit(TopRowFilter node) + { + if (node.Expression is IntegerLiteral iLit && ParseInt32(iLit, out var i) && i <= 0) + { + parser.OnNonPositiveTop(new(node)); + } + else if (node.Expression is NumericLiteral nLit) + { + if (!node.Percent) + { + parser.OnNonIntegerTop(new(node)); + } + if (ParseNumeric(nLit, out var n) && n <= 0) + { // don't expect to see this; parser rejects them + parser.OnNonPositiveTop(new(node)); + } + } + base.Visit(node); + } + public override void Visit(OutputClause node) { AddQuery(); // works like a query base.Visit(node); } + private bool IsUnfiltered(FromClause from, WhereClause where) + { + if (where is not null) return false; + return !IsMultiTable(from); // treat multi-table as filtered + } + private bool IsMultiTable(FromClause? from) + { + var tables = from?.TableReferences; + // treat multiple tables as filtered (let's not discuss outer joins etc) + if (tables is null || tables.Count == 0) return false; + return tables.Count > 1 || tables[0] is JoinTableReference; + } + + private bool _fromDemandAlias; + public override void ExplicitVisit(FromClause node) + { + bool oldDemandAlias = _fromDemandAlias; + try + { + // set ambient state so we can complain more as we walk the nodes + _fromDemandAlias = IsMultiTable(node); + base.ExplicitVisit(node); + } + finally + { + _fromDemandAlias = oldDemandAlias; + } + } + public override void Visit(TableReferenceWithAlias node) + { + if (_fromDemandAlias && string.IsNullOrWhiteSpace(node.Alias?.Value)) + { + parser.OnFromMultiTableMissingAlias(new(node)); + } + base.Visit(node); + } + public override void Visit(DeleteSpecification node) { - if (node.WhereClause is null) + if (IsUnfiltered(node.FromClause, node.WhereClause)) { parser.OnDeleteWithoutWhere(new(node)); } @@ -601,7 +712,7 @@ public override void Visit(DeleteSpecification node) public override void Visit(UpdateSpecification node) { - if (node.WhereClause is null) + if (IsUnfiltered(node.FromClause, node.WhereClause)) { parser.OnUpdateWithoutWhere(new(node)); } diff --git a/test/Dapper.AOT.Test/Interceptors/QueryDetection.output.netfx.txt b/test/Dapper.AOT.Test/Interceptors/QueryDetection.output.netfx.txt index f627847b..9704dfa9 100644 --- a/test/Dapper.AOT.Test/Interceptors/QueryDetection.output.netfx.txt +++ b/test/Dapper.AOT.Test/Interceptors/QueryDetection.output.netfx.txt @@ -1,4 +1,4 @@ -Generator produced 5 diagnostics: +Generator produced 6 diagnostics: Hidden DAP000 L1 C1 Dapper.AOT handled 11 of 11 enabled call-sites using 7 interceptors, 1 commands and 1 readers @@ -6,6 +6,9 @@ Dapper.AOT handled 11 of 11 enabled call-sites using 7 interceptors, 1 commands Warning DAP025 Interceptors/QueryDetection.input.cs L12 C12 The command has a query that will be ignored +Warning DAP230 Interceptors/QueryDetection.input.cs L17 C35 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + Warning DAP219 Interceptors/QueryDetection.input.cs L17 C42 SELECT columns should be specified explicitly (L1 C8) diff --git a/test/Dapper.AOT.Test/Interceptors/QueryDetection.output.txt b/test/Dapper.AOT.Test/Interceptors/QueryDetection.output.txt index f627847b..9704dfa9 100644 --- a/test/Dapper.AOT.Test/Interceptors/QueryDetection.output.txt +++ b/test/Dapper.AOT.Test/Interceptors/QueryDetection.output.txt @@ -1,4 +1,4 @@ -Generator produced 5 diagnostics: +Generator produced 6 diagnostics: Hidden DAP000 L1 C1 Dapper.AOT handled 11 of 11 enabled call-sites using 7 interceptors, 1 commands and 1 readers @@ -6,6 +6,9 @@ Dapper.AOT handled 11 of 11 enabled call-sites using 7 interceptors, 1 commands Warning DAP025 Interceptors/QueryDetection.input.cs L12 C12 The command has a query that will be ignored +Warning DAP230 Interceptors/QueryDetection.input.cs L17 C35 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + Warning DAP219 Interceptors/QueryDetection.input.cs L17 C42 SELECT columns should be specified explicitly (L1 C8) diff --git a/test/Dapper.AOT.Test/Interceptors/TsqlTips.input.cs b/test/Dapper.AOT.Test/Interceptors/TsqlTips.input.cs index aa703c3c..eac1ec51 100644 --- a/test/Dapper.AOT.Test/Interceptors/TsqlTips.input.cs +++ b/test/Dapper.AOT.Test/Interceptors/TsqlTips.input.cs @@ -3,6 +3,47 @@ [module: DapperAot] public class Foo { + public void TopChecks(System.Data.SqlClient.SqlConnection connection) + { + // fine + connection.Query("select A, B from SomeTable"); + connection.Query("select TOP 10 A, B from SomeTable"); + // non-positive top + connection.Query("select TOP 0 A, B from SomeTable"); + // non integer top + connection.Query("select TOP 5.0 A, B from SomeTable"); + // non integer percent top (fine) + connection.Query("select TOP 5.0 PERCENT A, B from SomeTable"); + connection.Query("select TOP 5.1 PERCENT A, B from SomeTable"); + // non integer negative percent top (not fine) + connection.Query("select TOP -5.1 PERCENT A, B from SomeTable"); + + // first/single with where: fine + connection.QueryFirst("select A, B from SomeTable where Id=42"); + connection.QuerySingle("select A, B from SomeTable where Id=42"); + // first/single with top and order-by: fine + connection.QueryFirst("select top 1 A, B from SomeTable order by B"); + connection.QuerySingle("select top 2 A, B from SomeTable order by B"); + // first/single with wrong top + connection.QueryFirst("select top 2 A, B from SomeTable order by B"); + connection.QuerySingle("select top 1 A, B from SomeTable order by B"); + // first/single with nothing + connection.QueryFirst("select A, B from SomeTable"); + connection.QuerySingle("select A, B from SomeTable"); + // first/single with order-by but no top, or top but no order-by + connection.QueryFirst("select A, B from SomeTable order by B"); + connection.QuerySingle("select A, B from SomeTable order by B"); + connection.QueryFirst("select top 1 A, B from SomeTable"); + connection.QuerySingle("select top 2 A, B from SomeTable"); + + // first/single with join; we'll allow join to function as a filter + connection.QueryFirst("select A, B from SomeTable x inner join Foo y on x.Id = y.Id"); + + // check for aliases + connection.QueryFirst("select A, B from SomeTable x inner join Foo on x.Id = FromSomewhere"); + + } + public void Things(System.Data.SqlClient.SqlConnection connection) { var args = new { a = 123, b = "abc" }; @@ -104,10 +145,22 @@ update SomeTable // delete/update with filter: fine connection.Execute("delete from Customers where Id=12"); connection.Execute("update Customers set Name='New name' where Id=12"); + // allow join to function like filter + connection.Execute("delete c from Customers c inner join Foo y on y.Id = c.Id"); // delete/update without filter: warn connection.Execute("delete from Customers"); connection.Execute("update Customers set Name='New name'"); + // allow join to function like filter + connection.Execute("update c set c.Name='New name' from Customers c inner join Foo y on y.Id = c.Id"); + + connection.QuerySingle("select Id from Customers where Id=42"); + connection.QuerySingle("select top 1 Id from Customers"); + connection.QuerySingle("select top 2 Id from Customers"); + // > 2 is bad for Single etc (2 makes sense to check for dups) + connection.QuerySingle("select top 3 Id from Customers"); + // no where + connection.QuerySingle("select Id from Customers"); } public class Customer diff --git a/test/Dapper.AOT.Test/Interceptors/TsqlTips.output.cs b/test/Dapper.AOT.Test/Interceptors/TsqlTips.output.cs index 84fd8375..52a35c66 100644 --- a/test/Dapper.AOT.Test/Interceptors/TsqlTips.output.cs +++ b/test/Dapper.AOT.Test/Interceptors/TsqlTips.output.cs @@ -1,28 +1,60 @@ #nullable enable file static class DapperGeneratedInterceptors { + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 9, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 10, 20)] [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 12, 20)] [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 14, 20)] [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 16, 20)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 18, 20)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 20, 20)] - internal static int Execute0(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 17, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 19, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 79, 24)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 82, 24)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 83, 24)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 86, 24)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 89, 24)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 96, 24)] + internal static global::System.Collections.Generic.IEnumerable Query0(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, bool buffered, int? commandTimeout, global::System.Data.CommandType? commandType) { - // Execute, HasParameters, Text - // takes parameter: - // parameter map: a b + // Query, Buffered, Text, BindResultsByName global::System.Diagnostics.Debug.Assert(!string.IsNullOrWhiteSpace(sql)); global::System.Diagnostics.Debug.Assert((commandType ?? global::Dapper.DapperAotExtensions.GetCommandType(sql)) == global::System.Data.CommandType.Text); - global::System.Diagnostics.Debug.Assert(param is not null); + global::System.Diagnostics.Debug.Assert(buffered is true); + global::System.Diagnostics.Debug.Assert(param is null); - return global::Dapper.DapperAotExtensions.Command(cnn, transaction, sql, global::System.Data.CommandType.Text, commandTimeout.GetValueOrDefault(), CommandFactory0.Instance).Execute(param); + return global::Dapper.DapperAotExtensions.Command(cnn, transaction, sql, global::System.Data.CommandType.Text, commandTimeout.GetValueOrDefault(), DefaultCommandFactory).QueryBuffered(param, global::Dapper.RowFactory.Inbuilt.Dynamic); } - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 23, 24)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 26, 24)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 29, 24)] - internal static dynamic QuerySingle1(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 22, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 25, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 28, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 31, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 34, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 36, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 40, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 43, 20)] + internal static dynamic QueryFirst1(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) + { + // Query, SingleRow, Text, AtLeastOne, BindResultsByName + global::System.Diagnostics.Debug.Assert(!string.IsNullOrWhiteSpace(sql)); + global::System.Diagnostics.Debug.Assert((commandType ?? global::Dapper.DapperAotExtensions.GetCommandType(sql)) == global::System.Data.CommandType.Text); + global::System.Diagnostics.Debug.Assert(param is null); + + return global::Dapper.DapperAotExtensions.Command(cnn, transaction, sql, global::System.Data.CommandType.Text, commandTimeout.GetValueOrDefault(), DefaultCommandFactory).QueryFirst(param, global::Dapper.RowFactory.Inbuilt.Dynamic); + + } + + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 23, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 26, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 29, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 32, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 35, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 37, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 64, 24)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 67, 24)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 70, 24)] + internal static dynamic QuerySingle2(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) { // Query, SingleRow, Text, AtLeastOne, AtMostOne, BindResultsByName global::System.Diagnostics.Debug.Assert(!string.IsNullOrWhiteSpace(sql)); @@ -33,54 +65,54 @@ internal static dynamic QuerySingle1(this global::System.Data.IDbConnection cnn, } - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 32, 24)] - internal static dynamic QuerySingle2(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 53, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 55, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 57, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 59, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 61, 20)] + internal static int Execute3(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) { - // Query, HasParameters, SingleRow, Text, AtLeastOne, AtMostOne, BindResultsByName - // takes parameter: - // parameter map: ids + // Execute, HasParameters, Text + // takes parameter: + // parameter map: a b global::System.Diagnostics.Debug.Assert(!string.IsNullOrWhiteSpace(sql)); global::System.Diagnostics.Debug.Assert((commandType ?? global::Dapper.DapperAotExtensions.GetCommandType(sql)) == global::System.Data.CommandType.Text); global::System.Diagnostics.Debug.Assert(param is not null); - return global::Dapper.DapperAotExtensions.Command(cnn, transaction, sql, global::System.Data.CommandType.Text, commandTimeout.GetValueOrDefault(), CommandFactory1.Instance).QuerySingle(param, global::Dapper.RowFactory.Inbuilt.Dynamic); + return global::Dapper.DapperAotExtensions.Command(cnn, transaction, sql, global::System.Data.CommandType.Text, commandTimeout.GetValueOrDefault(), CommandFactory0.Instance).Execute(param); } - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 35, 24)] - internal static dynamic QuerySingle3(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 73, 24)] + internal static dynamic QuerySingle4(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) { // Query, HasParameters, SingleRow, Text, AtLeastOne, AtMostOne, BindResultsByName - // takes parameter: - // parameter map: a + // takes parameter: + // parameter map: ids global::System.Diagnostics.Debug.Assert(!string.IsNullOrWhiteSpace(sql)); global::System.Diagnostics.Debug.Assert((commandType ?? global::Dapper.DapperAotExtensions.GetCommandType(sql)) == global::System.Data.CommandType.Text); global::System.Diagnostics.Debug.Assert(param is not null); - return global::Dapper.DapperAotExtensions.Command(cnn, transaction, sql, global::System.Data.CommandType.Text, commandTimeout.GetValueOrDefault(), CommandFactory2.Instance).QuerySingle(param, global::Dapper.RowFactory.Inbuilt.Dynamic); + return global::Dapper.DapperAotExtensions.Command(cnn, transaction, sql, global::System.Data.CommandType.Text, commandTimeout.GetValueOrDefault(), CommandFactory1.Instance).QuerySingle(param, global::Dapper.RowFactory.Inbuilt.Dynamic); } - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 38, 24)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 41, 24)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 42, 24)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 45, 24)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 48, 24)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 55, 24)] - internal static global::System.Collections.Generic.IEnumerable Query4(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, bool buffered, int? commandTimeout, global::System.Data.CommandType? commandType) + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 76, 24)] + internal static dynamic QuerySingle5(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) { - // Query, Buffered, Text, BindResultsByName + // Query, HasParameters, SingleRow, Text, AtLeastOne, AtMostOne, BindResultsByName + // takes parameter: + // parameter map: a global::System.Diagnostics.Debug.Assert(!string.IsNullOrWhiteSpace(sql)); global::System.Diagnostics.Debug.Assert((commandType ?? global::Dapper.DapperAotExtensions.GetCommandType(sql)) == global::System.Data.CommandType.Text); - global::System.Diagnostics.Debug.Assert(buffered is true); - global::System.Diagnostics.Debug.Assert(param is null); + global::System.Diagnostics.Debug.Assert(param is not null); - return global::Dapper.DapperAotExtensions.Command(cnn, transaction, sql, global::System.Data.CommandType.Text, commandTimeout.GetValueOrDefault(), DefaultCommandFactory).QueryBuffered(param, global::Dapper.RowFactory.Inbuilt.Dynamic); + return global::Dapper.DapperAotExtensions.Command(cnn, transaction, sql, global::System.Data.CommandType.Text, commandTimeout.GetValueOrDefault(), CommandFactory2.Instance).QuerySingle(param, global::Dapper.RowFactory.Inbuilt.Dynamic); } - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 62, 24)] - internal static global::Foo.Customer QueryFirst5(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 103, 24)] + internal static global::Foo.Customer QueryFirst6(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) { // Query, TypedResult, SingleRow, Text, AtLeastOne, BindResultsByName // returns data: global::Foo.Customer @@ -92,8 +124,8 @@ internal static dynamic QuerySingle3(this global::System.Data.IDbConnection cnn, } - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 64, 24)] - internal static int QueryFirst6(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 105, 24)] + internal static int QueryFirst7(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) { // Query, TypedResult, SingleRow, Text, AtLeastOne // returns data: int @@ -105,13 +137,15 @@ internal static int QueryFirst6(this global::System.Data.IDbConnection cnn, stri } - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 82, 20)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 92, 20)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 105, 20)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 106, 20)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 109, 20)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 110, 20)] - internal static int Execute7(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 123, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 133, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 146, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 147, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 149, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 152, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 153, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 155, 20)] + internal static int Execute8(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) { // Execute, Text global::System.Diagnostics.Debug.Assert(!string.IsNullOrWhiteSpace(sql)); @@ -122,6 +156,23 @@ internal static int Execute7(this global::System.Data.IDbConnection cnn, string } + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 157, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 158, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 159, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 161, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 163, 20)] + internal static global::Foo.Customer QuerySingle9(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) + { + // Query, TypedResult, SingleRow, Text, AtLeastOne, AtMostOne, BindResultsByName + // returns data: global::Foo.Customer + global::System.Diagnostics.Debug.Assert(!string.IsNullOrWhiteSpace(sql)); + global::System.Diagnostics.Debug.Assert((commandType ?? global::Dapper.DapperAotExtensions.GetCommandType(sql)) == global::System.Data.CommandType.Text); + global::System.Diagnostics.Debug.Assert(param is null); + + return global::Dapper.DapperAotExtensions.Command(cnn, transaction, sql, global::System.Data.CommandType.Text, commandTimeout.GetValueOrDefault(), DefaultCommandFactory).QuerySingle(param, RowFactory0.Instance); + + } + private class CommonCommandFactory : global::Dapper.CommandFactory { public override global::System.Data.Common.DbCommand GetCommand(global::System.Data.Common.DbConnection connection, string sql, global::System.Data.CommandType commandType, T args) diff --git a/test/Dapper.AOT.Test/Interceptors/TsqlTips.output.netfx.cs b/test/Dapper.AOT.Test/Interceptors/TsqlTips.output.netfx.cs index 84fd8375..52a35c66 100644 --- a/test/Dapper.AOT.Test/Interceptors/TsqlTips.output.netfx.cs +++ b/test/Dapper.AOT.Test/Interceptors/TsqlTips.output.netfx.cs @@ -1,28 +1,60 @@ #nullable enable file static class DapperGeneratedInterceptors { + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 9, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 10, 20)] [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 12, 20)] [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 14, 20)] [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 16, 20)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 18, 20)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 20, 20)] - internal static int Execute0(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 17, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 19, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 79, 24)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 82, 24)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 83, 24)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 86, 24)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 89, 24)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 96, 24)] + internal static global::System.Collections.Generic.IEnumerable Query0(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, bool buffered, int? commandTimeout, global::System.Data.CommandType? commandType) { - // Execute, HasParameters, Text - // takes parameter: - // parameter map: a b + // Query, Buffered, Text, BindResultsByName global::System.Diagnostics.Debug.Assert(!string.IsNullOrWhiteSpace(sql)); global::System.Diagnostics.Debug.Assert((commandType ?? global::Dapper.DapperAotExtensions.GetCommandType(sql)) == global::System.Data.CommandType.Text); - global::System.Diagnostics.Debug.Assert(param is not null); + global::System.Diagnostics.Debug.Assert(buffered is true); + global::System.Diagnostics.Debug.Assert(param is null); - return global::Dapper.DapperAotExtensions.Command(cnn, transaction, sql, global::System.Data.CommandType.Text, commandTimeout.GetValueOrDefault(), CommandFactory0.Instance).Execute(param); + return global::Dapper.DapperAotExtensions.Command(cnn, transaction, sql, global::System.Data.CommandType.Text, commandTimeout.GetValueOrDefault(), DefaultCommandFactory).QueryBuffered(param, global::Dapper.RowFactory.Inbuilt.Dynamic); } - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 23, 24)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 26, 24)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 29, 24)] - internal static dynamic QuerySingle1(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 22, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 25, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 28, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 31, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 34, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 36, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 40, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 43, 20)] + internal static dynamic QueryFirst1(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) + { + // Query, SingleRow, Text, AtLeastOne, BindResultsByName + global::System.Diagnostics.Debug.Assert(!string.IsNullOrWhiteSpace(sql)); + global::System.Diagnostics.Debug.Assert((commandType ?? global::Dapper.DapperAotExtensions.GetCommandType(sql)) == global::System.Data.CommandType.Text); + global::System.Diagnostics.Debug.Assert(param is null); + + return global::Dapper.DapperAotExtensions.Command(cnn, transaction, sql, global::System.Data.CommandType.Text, commandTimeout.GetValueOrDefault(), DefaultCommandFactory).QueryFirst(param, global::Dapper.RowFactory.Inbuilt.Dynamic); + + } + + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 23, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 26, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 29, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 32, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 35, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 37, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 64, 24)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 67, 24)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 70, 24)] + internal static dynamic QuerySingle2(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) { // Query, SingleRow, Text, AtLeastOne, AtMostOne, BindResultsByName global::System.Diagnostics.Debug.Assert(!string.IsNullOrWhiteSpace(sql)); @@ -33,54 +65,54 @@ internal static dynamic QuerySingle1(this global::System.Data.IDbConnection cnn, } - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 32, 24)] - internal static dynamic QuerySingle2(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 53, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 55, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 57, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 59, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 61, 20)] + internal static int Execute3(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) { - // Query, HasParameters, SingleRow, Text, AtLeastOne, AtMostOne, BindResultsByName - // takes parameter: - // parameter map: ids + // Execute, HasParameters, Text + // takes parameter: + // parameter map: a b global::System.Diagnostics.Debug.Assert(!string.IsNullOrWhiteSpace(sql)); global::System.Diagnostics.Debug.Assert((commandType ?? global::Dapper.DapperAotExtensions.GetCommandType(sql)) == global::System.Data.CommandType.Text); global::System.Diagnostics.Debug.Assert(param is not null); - return global::Dapper.DapperAotExtensions.Command(cnn, transaction, sql, global::System.Data.CommandType.Text, commandTimeout.GetValueOrDefault(), CommandFactory1.Instance).QuerySingle(param, global::Dapper.RowFactory.Inbuilt.Dynamic); + return global::Dapper.DapperAotExtensions.Command(cnn, transaction, sql, global::System.Data.CommandType.Text, commandTimeout.GetValueOrDefault(), CommandFactory0.Instance).Execute(param); } - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 35, 24)] - internal static dynamic QuerySingle3(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 73, 24)] + internal static dynamic QuerySingle4(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) { // Query, HasParameters, SingleRow, Text, AtLeastOne, AtMostOne, BindResultsByName - // takes parameter: - // parameter map: a + // takes parameter: + // parameter map: ids global::System.Diagnostics.Debug.Assert(!string.IsNullOrWhiteSpace(sql)); global::System.Diagnostics.Debug.Assert((commandType ?? global::Dapper.DapperAotExtensions.GetCommandType(sql)) == global::System.Data.CommandType.Text); global::System.Diagnostics.Debug.Assert(param is not null); - return global::Dapper.DapperAotExtensions.Command(cnn, transaction, sql, global::System.Data.CommandType.Text, commandTimeout.GetValueOrDefault(), CommandFactory2.Instance).QuerySingle(param, global::Dapper.RowFactory.Inbuilt.Dynamic); + return global::Dapper.DapperAotExtensions.Command(cnn, transaction, sql, global::System.Data.CommandType.Text, commandTimeout.GetValueOrDefault(), CommandFactory1.Instance).QuerySingle(param, global::Dapper.RowFactory.Inbuilt.Dynamic); } - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 38, 24)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 41, 24)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 42, 24)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 45, 24)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 48, 24)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 55, 24)] - internal static global::System.Collections.Generic.IEnumerable Query4(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, bool buffered, int? commandTimeout, global::System.Data.CommandType? commandType) + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 76, 24)] + internal static dynamic QuerySingle5(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) { - // Query, Buffered, Text, BindResultsByName + // Query, HasParameters, SingleRow, Text, AtLeastOne, AtMostOne, BindResultsByName + // takes parameter: + // parameter map: a global::System.Diagnostics.Debug.Assert(!string.IsNullOrWhiteSpace(sql)); global::System.Diagnostics.Debug.Assert((commandType ?? global::Dapper.DapperAotExtensions.GetCommandType(sql)) == global::System.Data.CommandType.Text); - global::System.Diagnostics.Debug.Assert(buffered is true); - global::System.Diagnostics.Debug.Assert(param is null); + global::System.Diagnostics.Debug.Assert(param is not null); - return global::Dapper.DapperAotExtensions.Command(cnn, transaction, sql, global::System.Data.CommandType.Text, commandTimeout.GetValueOrDefault(), DefaultCommandFactory).QueryBuffered(param, global::Dapper.RowFactory.Inbuilt.Dynamic); + return global::Dapper.DapperAotExtensions.Command(cnn, transaction, sql, global::System.Data.CommandType.Text, commandTimeout.GetValueOrDefault(), CommandFactory2.Instance).QuerySingle(param, global::Dapper.RowFactory.Inbuilt.Dynamic); } - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 62, 24)] - internal static global::Foo.Customer QueryFirst5(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 103, 24)] + internal static global::Foo.Customer QueryFirst6(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) { // Query, TypedResult, SingleRow, Text, AtLeastOne, BindResultsByName // returns data: global::Foo.Customer @@ -92,8 +124,8 @@ internal static dynamic QuerySingle3(this global::System.Data.IDbConnection cnn, } - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 64, 24)] - internal static int QueryFirst6(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 105, 24)] + internal static int QueryFirst7(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) { // Query, TypedResult, SingleRow, Text, AtLeastOne // returns data: int @@ -105,13 +137,15 @@ internal static int QueryFirst6(this global::System.Data.IDbConnection cnn, stri } - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 82, 20)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 92, 20)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 105, 20)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 106, 20)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 109, 20)] - [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 110, 20)] - internal static int Execute7(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 123, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 133, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 146, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 147, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 149, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 152, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 153, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 155, 20)] + internal static int Execute8(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) { // Execute, Text global::System.Diagnostics.Debug.Assert(!string.IsNullOrWhiteSpace(sql)); @@ -122,6 +156,23 @@ internal static int Execute7(this global::System.Data.IDbConnection cnn, string } + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 157, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 158, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 159, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 161, 20)] + [global::System.Runtime.CompilerServices.InterceptsLocationAttribute("Interceptors\\TsqlTips.input.cs", 163, 20)] + internal static global::Foo.Customer QuerySingle9(this global::System.Data.IDbConnection cnn, string sql, object? param, global::System.Data.IDbTransaction? transaction, int? commandTimeout, global::System.Data.CommandType? commandType) + { + // Query, TypedResult, SingleRow, Text, AtLeastOne, AtMostOne, BindResultsByName + // returns data: global::Foo.Customer + global::System.Diagnostics.Debug.Assert(!string.IsNullOrWhiteSpace(sql)); + global::System.Diagnostics.Debug.Assert((commandType ?? global::Dapper.DapperAotExtensions.GetCommandType(sql)) == global::System.Data.CommandType.Text); + global::System.Diagnostics.Debug.Assert(param is null); + + return global::Dapper.DapperAotExtensions.Command(cnn, transaction, sql, global::System.Data.CommandType.Text, commandTimeout.GetValueOrDefault(), DefaultCommandFactory).QuerySingle(param, RowFactory0.Instance); + + } + private class CommonCommandFactory : global::Dapper.CommandFactory { public override global::System.Data.Common.DbCommand GetCommand(global::System.Data.Common.DbConnection connection, string sql, global::System.Data.CommandType commandType, T args) diff --git a/test/Dapper.AOT.Test/Interceptors/TsqlTips.output.netfx.txt b/test/Dapper.AOT.Test/Interceptors/TsqlTips.output.netfx.txt index 95dfaace..62433292 100644 --- a/test/Dapper.AOT.Test/Interceptors/TsqlTips.output.netfx.txt +++ b/test/Dapper.AOT.Test/Interceptors/TsqlTips.output.netfx.txt @@ -1,49 +1,124 @@ -Generator produced 16 diagnostics: +Generator produced 41 diagnostics: Hidden DAP000 L1 C1 -Dapper.AOT handled 24 of 26 enabled call-sites using 8 interceptors, 3 commands and 1 readers +Dapper.AOT handled 52 of 54 enabled call-sites using 10 interceptors, 3 commands and 1 readers -Warning DAP216 Interceptors/TsqlTips.input.cs L12 C29 +Error DAP227 Interceptors/TsqlTips.input.cs L12 C34 +TOP literals should be positive (L1 C8) + +Error DAP226 Interceptors/TsqlTips.input.cs L14 C34 +TOP literals should be integers (L1 C8) + +Error DAP206 Interceptors/TsqlTips.input.cs L19 C38 +Incorrect syntax near -. (#46010 L1 C12) + +Warning DAP228 Interceptors/TsqlTips.input.cs L28 C32 +SELECT for First* should use TOP 1 (L1 C1) + +Warning DAP229 Interceptors/TsqlTips.input.cs L29 C33 +SELECT for Single* should use TOP 2; if you do not need to test over-read, use First* (L1 C1) + +Warning DAP230 Interceptors/TsqlTips.input.cs L31 C32 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP230 Interceptors/TsqlTips.input.cs L32 C33 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP230 Interceptors/TsqlTips.input.cs L34 C32 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP230 Interceptors/TsqlTips.input.cs L35 C33 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP230 Interceptors/TsqlTips.input.cs L36 C32 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP230 Interceptors/TsqlTips.input.cs L37 C33 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP225 Interceptors/TsqlTips.input.cs L43 C72 +FROM expressions with multiple elements should use aliases (L1 C41) + +Warning DAP216 Interceptors/TsqlTips.input.cs L53 C29 INSERT should explicitly specify target columns (L1 C1) -Error DAP217 Interceptors/TsqlTips.input.cs L16 C56 +Error DAP217 Interceptors/TsqlTips.input.cs L57 C56 The INSERT values do not match the target columns (L1 C28) -Error DAP218 Interceptors/TsqlTips.input.cs L18 C53 +Error DAP218 Interceptors/TsqlTips.input.cs L59 C53 The INSERT rows have different widths (L1 C25) -Warning DAP219 Interceptors/TsqlTips.input.cs L23 C44 +Warning DAP230 Interceptors/TsqlTips.input.cs L64 C37 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP219 Interceptors/TsqlTips.input.cs L64 C44 SELECT columns should be specified explicitly (L1 C8) -Warning DAP219 Interceptors/TsqlTips.input.cs L26 C44 +Warning DAP230 Interceptors/TsqlTips.input.cs L67 C37 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP219 Interceptors/TsqlTips.input.cs L67 C44 SELECT columns should be specified explicitly (L1 C8) -Warning DAP220 Interceptors/TsqlTips.input.cs L38 C38 +Warning DAP230 Interceptors/TsqlTips.input.cs L70 C37 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP220 Interceptors/TsqlTips.input.cs L79 C38 SELECT column name is missing: 0 (L1 C8) -Warning DAP221 Interceptors/TsqlTips.input.cs L45 C47 +Warning DAP221 Interceptors/TsqlTips.input.cs L86 C47 SELECT column name is duplicated: 'Balance' (L1 C17) -Warning DAP222 Interceptors/TsqlTips.input.cs L57 C13 +Warning DAP222 Interceptors/TsqlTips.input.cs L98 C13 SELECT statement assigns variable and performs reads (L2 C1) -Warning DAP220 Interceptors/TsqlTips.input.cs L62 C53 +Warning DAP230 Interceptors/TsqlTips.input.cs L103 C46 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP220 Interceptors/TsqlTips.input.cs L103 C53 SELECT column name is missing: 0 (L1 C8) -Info DAP013 Interceptors/TsqlTips.input.cs L70 C24 +Warning DAP230 Interceptors/TsqlTips.input.cs L105 C41 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Info DAP013 Interceptors/TsqlTips.input.cs L111 C24 Tuple-type results are not currently supported -Warning DAP220 Interceptors/TsqlTips.input.cs L70 C59 +Warning DAP230 Interceptors/TsqlTips.input.cs L111 C52 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP220 Interceptors/TsqlTips.input.cs L111 C59 SELECT column name is missing: 0 (L1 C8) -Info DAP013 Interceptors/TsqlTips.input.cs L76 C24 +Info DAP013 Interceptors/TsqlTips.input.cs L117 C24 Tuple-type results are not currently supported -Warning DAP025 Interceptors/TsqlTips.input.cs L82 C20 +Warning DAP230 Interceptors/TsqlTips.input.cs L117 C48 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP025 Interceptors/TsqlTips.input.cs L123 C20 The command has a query that will be ignored -Warning DAP223 Interceptors/TsqlTips.input.cs L109 C29 +Warning DAP223 Interceptors/TsqlTips.input.cs L152 C29 DELETE statement lacks WHERE clause (L1 C1) -Warning DAP224 Interceptors/TsqlTips.input.cs L110 C29 +Warning DAP224 Interceptors/TsqlTips.input.cs L153 C29 UPDATE statement lacks WHERE clause (L1 C1) + +Warning DAP229 Interceptors/TsqlTips.input.cs L158 C43 +SELECT for Single* should use TOP 2; if you do not need to test over-read, use First* (L1 C1) + +Warning DAP230 Interceptors/TsqlTips.input.cs L158 C43 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP230 Interceptors/TsqlTips.input.cs L159 C43 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP229 Interceptors/TsqlTips.input.cs L161 C43 +SELECT for Single* should use TOP 2; if you do not need to test over-read, use First* (L1 C1) + +Warning DAP230 Interceptors/TsqlTips.input.cs L161 C43 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP230 Interceptors/TsqlTips.input.cs L163 C43 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) diff --git a/test/Dapper.AOT.Test/Interceptors/TsqlTips.output.txt b/test/Dapper.AOT.Test/Interceptors/TsqlTips.output.txt index 95dfaace..62433292 100644 --- a/test/Dapper.AOT.Test/Interceptors/TsqlTips.output.txt +++ b/test/Dapper.AOT.Test/Interceptors/TsqlTips.output.txt @@ -1,49 +1,124 @@ -Generator produced 16 diagnostics: +Generator produced 41 diagnostics: Hidden DAP000 L1 C1 -Dapper.AOT handled 24 of 26 enabled call-sites using 8 interceptors, 3 commands and 1 readers +Dapper.AOT handled 52 of 54 enabled call-sites using 10 interceptors, 3 commands and 1 readers -Warning DAP216 Interceptors/TsqlTips.input.cs L12 C29 +Error DAP227 Interceptors/TsqlTips.input.cs L12 C34 +TOP literals should be positive (L1 C8) + +Error DAP226 Interceptors/TsqlTips.input.cs L14 C34 +TOP literals should be integers (L1 C8) + +Error DAP206 Interceptors/TsqlTips.input.cs L19 C38 +Incorrect syntax near -. (#46010 L1 C12) + +Warning DAP228 Interceptors/TsqlTips.input.cs L28 C32 +SELECT for First* should use TOP 1 (L1 C1) + +Warning DAP229 Interceptors/TsqlTips.input.cs L29 C33 +SELECT for Single* should use TOP 2; if you do not need to test over-read, use First* (L1 C1) + +Warning DAP230 Interceptors/TsqlTips.input.cs L31 C32 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP230 Interceptors/TsqlTips.input.cs L32 C33 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP230 Interceptors/TsqlTips.input.cs L34 C32 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP230 Interceptors/TsqlTips.input.cs L35 C33 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP230 Interceptors/TsqlTips.input.cs L36 C32 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP230 Interceptors/TsqlTips.input.cs L37 C33 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP225 Interceptors/TsqlTips.input.cs L43 C72 +FROM expressions with multiple elements should use aliases (L1 C41) + +Warning DAP216 Interceptors/TsqlTips.input.cs L53 C29 INSERT should explicitly specify target columns (L1 C1) -Error DAP217 Interceptors/TsqlTips.input.cs L16 C56 +Error DAP217 Interceptors/TsqlTips.input.cs L57 C56 The INSERT values do not match the target columns (L1 C28) -Error DAP218 Interceptors/TsqlTips.input.cs L18 C53 +Error DAP218 Interceptors/TsqlTips.input.cs L59 C53 The INSERT rows have different widths (L1 C25) -Warning DAP219 Interceptors/TsqlTips.input.cs L23 C44 +Warning DAP230 Interceptors/TsqlTips.input.cs L64 C37 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP219 Interceptors/TsqlTips.input.cs L64 C44 SELECT columns should be specified explicitly (L1 C8) -Warning DAP219 Interceptors/TsqlTips.input.cs L26 C44 +Warning DAP230 Interceptors/TsqlTips.input.cs L67 C37 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP219 Interceptors/TsqlTips.input.cs L67 C44 SELECT columns should be specified explicitly (L1 C8) -Warning DAP220 Interceptors/TsqlTips.input.cs L38 C38 +Warning DAP230 Interceptors/TsqlTips.input.cs L70 C37 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP220 Interceptors/TsqlTips.input.cs L79 C38 SELECT column name is missing: 0 (L1 C8) -Warning DAP221 Interceptors/TsqlTips.input.cs L45 C47 +Warning DAP221 Interceptors/TsqlTips.input.cs L86 C47 SELECT column name is duplicated: 'Balance' (L1 C17) -Warning DAP222 Interceptors/TsqlTips.input.cs L57 C13 +Warning DAP222 Interceptors/TsqlTips.input.cs L98 C13 SELECT statement assigns variable and performs reads (L2 C1) -Warning DAP220 Interceptors/TsqlTips.input.cs L62 C53 +Warning DAP230 Interceptors/TsqlTips.input.cs L103 C46 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP220 Interceptors/TsqlTips.input.cs L103 C53 SELECT column name is missing: 0 (L1 C8) -Info DAP013 Interceptors/TsqlTips.input.cs L70 C24 +Warning DAP230 Interceptors/TsqlTips.input.cs L105 C41 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Info DAP013 Interceptors/TsqlTips.input.cs L111 C24 Tuple-type results are not currently supported -Warning DAP220 Interceptors/TsqlTips.input.cs L70 C59 +Warning DAP230 Interceptors/TsqlTips.input.cs L111 C52 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP220 Interceptors/TsqlTips.input.cs L111 C59 SELECT column name is missing: 0 (L1 C8) -Info DAP013 Interceptors/TsqlTips.input.cs L76 C24 +Info DAP013 Interceptors/TsqlTips.input.cs L117 C24 Tuple-type results are not currently supported -Warning DAP025 Interceptors/TsqlTips.input.cs L82 C20 +Warning DAP230 Interceptors/TsqlTips.input.cs L117 C48 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP025 Interceptors/TsqlTips.input.cs L123 C20 The command has a query that will be ignored -Warning DAP223 Interceptors/TsqlTips.input.cs L109 C29 +Warning DAP223 Interceptors/TsqlTips.input.cs L152 C29 DELETE statement lacks WHERE clause (L1 C1) -Warning DAP224 Interceptors/TsqlTips.input.cs L110 C29 +Warning DAP224 Interceptors/TsqlTips.input.cs L153 C29 UPDATE statement lacks WHERE clause (L1 C1) + +Warning DAP229 Interceptors/TsqlTips.input.cs L158 C43 +SELECT for Single* should use TOP 2; if you do not need to test over-read, use First* (L1 C1) + +Warning DAP230 Interceptors/TsqlTips.input.cs L158 C43 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP230 Interceptors/TsqlTips.input.cs L159 C43 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP229 Interceptors/TsqlTips.input.cs L161 C43 +SELECT for Single* should use TOP 2; if you do not need to test over-read, use First* (L1 C1) + +Warning DAP230 Interceptors/TsqlTips.input.cs L161 C43 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1) + +Warning DAP230 Interceptors/TsqlTips.input.cs L163 C43 +SELECT for single row without WHERE or (TOP and ORDER BY) (L1 C1)