From 1735b4f2073168b83ceb312d928f2c72494a01fc Mon Sep 17 00:00:00 2001 From: Riku Virtanen Date: Mon, 2 Jan 2023 14:21:16 +0200 Subject: [PATCH 1/4] Changed connection Close methods to async --- .../ExecuteQueryTests.cs | 184 +++++++++--------- .../ExecuteQuery.cs | 44 ++--- .../Frends.PostgreSQL.ExecuteQuery.csproj | 2 +- 3 files changed, 115 insertions(+), 115 deletions(-) diff --git a/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery.Tests/ExecuteQueryTests.cs b/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery.Tests/ExecuteQueryTests.cs index e2dad4f..23868d3 100644 --- a/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery.Tests/ExecuteQueryTests.cs +++ b/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery.Tests/ExecuteQueryTests.cs @@ -1,34 +1,34 @@ using Frends.PostgreSQL.ExecuteQuery.Definitions; -using Npgsql; +using Npgsql; using NUnit.Framework; using System; -using System.Threading; -using System.Threading.Tasks; - -namespace Frends.PostgreSQL.ExecuteQuery.Tests; - -[TestFixture] -public class ExecuteQueryTests +using System.Threading; +using System.Threading.Tasks; + +namespace Frends.PostgreSQL.ExecuteQuery.Tests; + +[TestFixture] +public class ExecuteQueryTests { - /// - /// These test requires local postgres database, create it e.g. with - /// - /// docker run -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword -d postgres - /// - /// + /// + /// These test requires local postgres database, create it e.g. with + /// + /// docker run -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword -d postgres + /// + /// + + private readonly string _connection = "Host=localhost;Database=postgres;Port=5432;User Id=postgres;Password=mysecretpassword;"; - private readonly string _connection = "Host=localhost;Database=postgres;Port=5432;User Id=postgres;Password=mysecretpassword;"; - private readonly Options _options = new() { CommandTimeoutSeconds = 10, SqlTransactionIsolationLevel = TransactionIsolationLevel.Default - }; - - [OneTimeSetUp] - public void TestSetup() - { + }; + + [OneTimeSetUp] + public void TestSetup() + { using var conn = new NpgsqlConnection(_connection); conn.Open(); @@ -39,80 +39,80 @@ public void TestSetup() using (var cmd = new NpgsqlCommand(@"INSERT INTO ""lista"" (Id, Selite) VALUES (1, 'Ensimmäinen'), (2, 'foobar'), (3, ''), (4, null)", conn)) { cmd.ExecuteNonQuery(); - } - conn.Close(); - } - - [OneTimeTearDown] - public void OneTimeTearDown() - { + } + conn.Close(); + } + + [OneTimeTearDown] + public void OneTimeTearDown() + { using var conn = new NpgsqlConnection(_connection); conn.Open(); using var cmd = new NpgsqlCommand(@"DROP TABLE ""lista""", conn); cmd.ExecuteNonQuery(); conn.Close(); - } - - /// - /// Check that returned id values are 1,2,3. - /// - /// - [Test] - public async Task QuerydataThreeRows() - { - var input = new Input - { - Query = "SELECT * FROM lista", - Parameters = null, - ConnectionString = _connection - }; - - var result = await PostgreSQL.ExecuteQuery(input, _options, new CancellationToken()); - - Console.WriteLine(result.QueryResult); - - Assert.AreEqual(1, (int)result.QueryResult[0]["id"]); - Assert.AreEqual(2, (int)result.QueryResult[1]["id"]); - Assert.AreEqual(3, (int)result.QueryResult[2]["id"]); - } - - /// - /// Check that returns no rows with wrong id. - /// - [Test] - public async Task QuerydataNoRows() - { - var input = new Input - { - Query = "SELECT * from lista WHERE id=:ehto", - Parameters = new[] { new Parameter { Name = "ehto", Value = 0 } }, - ConnectionString = _connection - }; - - - var result = await PostgreSQL.ExecuteQuery(input, _options, new CancellationToken()); - Assert.AreEqual(0, result.QueryResult.Count); - } - - /// - /// Test non-query operation. - /// - [Test] - public async Task TestInsertQuery() - { - var input = new Input - { - Query = @"INSERT INTO ""lista"" (Id, Selite) VALUES (5, 'Viides')", - Parameters = null, - ConnectionString = _connection - }; - - var result = await PostgreSQL.ExecuteQuery(input, _options, new CancellationToken()); - Assert.AreEqual(1, (int)result.QueryResult["AffectedRows"]); - - input.Query = "SELECT * from lista WHERE id=5"; - result = await PostgreSQL.ExecuteQuery(input, _options, new CancellationToken()); - Assert.AreEqual("Viides", (string)result.QueryResult[0]["selite"]); - } -} + } + + /// + /// Check that returned id values are 1,2,3. + /// + /// + [Test] + public async Task QuerydataThreeRows() + { + var input = new Input + { + Query = "SELECT * FROM lista", + Parameters = null, + ConnectionString = _connection + }; + + var result = await PostgreSQL.ExecuteQuery(input, _options, new CancellationToken()); + + Console.WriteLine(result.QueryResult); + + Assert.AreEqual(1, (int)result.QueryResult[0]["id"]); + Assert.AreEqual(2, (int)result.QueryResult[1]["id"]); + Assert.AreEqual(3, (int)result.QueryResult[2]["id"]); + } + + /// + /// Check that returns no rows with wrong id. + /// + [Test] + public async Task QuerydataNoRows() + { + var input = new Input + { + Query = "SELECT * from lista WHERE id=:ehto", + Parameters = new[] { new Parameter { Name = "ehto", Value = 0 } }, + ConnectionString = _connection + }; + + + var result = await PostgreSQL.ExecuteQuery(input, _options, new CancellationToken()); + Assert.AreEqual(0, result.QueryResult.Count); + } + + /// + /// Test non-query operation. + /// + [Test] + public async Task TestInsertQuery() + { + var input = new Input + { + Query = @"INSERT INTO ""lista"" (Id, Selite) VALUES (5, 'Viides')", + Parameters = null, + ConnectionString = _connection + }; + + var result = await PostgreSQL.ExecuteQuery(input, _options, new CancellationToken()); + Assert.AreEqual(1, (int)result.QueryResult["AffectedRows"]); + + input.Query = "SELECT * from lista WHERE id=5"; + result = await PostgreSQL.ExecuteQuery(input, _options, new CancellationToken()); + Assert.AreEqual("Viides", (string)result.QueryResult[0]["selite"]); + } +} diff --git a/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/ExecuteQuery.cs b/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/ExecuteQuery.cs index 28274ab..b927e0b 100644 --- a/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/ExecuteQuery.cs +++ b/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/ExecuteQuery.cs @@ -1,26 +1,26 @@ -using System.Globalization; +using System.Globalization; using Frends.PostgreSQL.ExecuteQuery.Definitions; using Newtonsoft.Json.Linq; -using Npgsql; -using System.Data; -using System.ComponentModel; +using Npgsql; +using System.Data; +using System.ComponentModel; -namespace Frends.PostgreSQL.ExecuteQuery; +namespace Frends.PostgreSQL.ExecuteQuery; /// /// Task class. /// -public static class PostgreSQL -{ - /// - /// Query data using PostgreSQL. [Documentation](https://tasks.frends.com/tasks/frends-tasks/Frends.PostgreSQL.ExecuteQuery) - /// - /// Query, parameters and connection string. - /// Set timeout and isolation level. - /// Automatically generated and passed by Frends. - /// Result of the query. JToken QueryResult - public static async Task ExecuteQuery([PropertyTab] Input input, [PropertyTab] Options options, CancellationToken cancellationToken) - { +public static class PostgreSQL +{ + /// + /// Query data using PostgreSQL. [Documentation](https://tasks.frends.com/tasks/frends-tasks/Frends.PostgreSQL.ExecuteQuery) + /// + /// Query, parameters and connection string. + /// Set timeout and isolation level. + /// Automatically generated and passed by Frends. + /// Result of the query. JToken QueryResult + public static async Task ExecuteQuery([PropertyTab] Input input, [PropertyTab] Options options, CancellationToken cancellationToken) + { using var conn = new NpgsqlConnection(input.ConnectionString); await conn.OpenAsync(cancellationToken); var transaction = conn.BeginTransaction(GetIsolationLevel(options.SqlTransactionIsolationLevel)); @@ -49,20 +49,20 @@ public static async Task ExecuteQuery([PropertyTab] Input input, [Proper { var reader = await cmd.ExecuteReaderAsync(cancellationToken); var result = reader.ToJson(cancellationToken); - conn.Close(); + await conn.CloseAsync(); return new Result(result); } else { var rows = await cmd.ExecuteNonQueryAsync(cancellationToken); transaction.Commit(); - conn.Close(); + await conn.CloseAsync(); return new Result(JToken.FromObject(new { AffectedRows = rows })); } } - #region HelperMethods - + #region HelperMethods + // Extension method for NpgsqlDataReader to read the data and return it as JToken. private static JToken ToJson(this NpgsqlDataReader reader, CancellationToken cancellationToken) { @@ -115,5 +115,5 @@ private static IsolationLevel GetIsolationLevel(TransactionIsolationLevel level) }; } - #endregion -} + #endregion +} diff --git a/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery.csproj b/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery.csproj index a07398f..1c79590 100644 --- a/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery.csproj +++ b/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery.csproj @@ -7,7 +7,7 @@ true Frends.PostgreSQL.ExecuteQuery Frends.PostgreSQL.ExecuteQuery - 1.0.0 + 1.0.1 Frends Frends Frends From 9b6b89215738cf664ed2c05b23bb8e72d76f910f Mon Sep 17 00:00:00 2001 From: Riku Virtanen Date: Thu, 2 Feb 2023 13:20:01 +0200 Subject: [PATCH 2/4] Fixed mem leak and cleanup issue --- .../ExecuteQuery.cs | 21 ++++-- .../Frends.PostgreSQL.ExecuteQuery.csproj | 74 +++++++++---------- 2 files changed, 50 insertions(+), 45 deletions(-) diff --git a/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/ExecuteQuery.cs b/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/ExecuteQuery.cs index b927e0b..712c940 100644 --- a/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/ExecuteQuery.cs +++ b/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/ExecuteQuery.cs @@ -21,12 +21,13 @@ public static class PostgreSQL /// Result of the query. JToken QueryResult public static async Task ExecuteQuery([PropertyTab] Input input, [PropertyTab] Options options, CancellationToken cancellationToken) { + Result result; + using var conn = new NpgsqlConnection(input.ConnectionString); await conn.OpenAsync(cancellationToken); - var transaction = conn.BeginTransaction(GetIsolationLevel(options.SqlTransactionIsolationLevel)); + using var cmd = new NpgsqlCommand(input.Query, conn); cmd.CommandTimeout = options.CommandTimeoutSeconds; - cmd.Transaction = transaction; // Add parameters to command, if any were given. if (input.Parameters != null && input.Parameters.Length > 0) @@ -48,17 +49,21 @@ public static async Task ExecuteQuery([PropertyTab] Input input, [Proper if (input.Query.ToLower().Contains("select")) { var reader = await cmd.ExecuteReaderAsync(cancellationToken); - var result = reader.ToJson(cancellationToken); - await conn.CloseAsync(); - return new Result(result); + result = new Result(reader.ToJson(cancellationToken)); } else { + var transaction = conn.BeginTransaction(GetIsolationLevel(options.SqlTransactionIsolationLevel)); + cmd.Transaction = transaction; var rows = await cmd.ExecuteNonQueryAsync(cancellationToken); - transaction.Commit(); - await conn.CloseAsync(); - return new Result(JToken.FromObject(new { AffectedRows = rows })); + await transaction.CommitAsync(cancellationToken); + transaction.Dispose(); + result = new Result(JToken.FromObject(new { AffectedRows = rows })); } + + await conn.CloseAsync(); + + return result; } #region HelperMethods diff --git a/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery.csproj b/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery.csproj index 1c79590..9b743c4 100644 --- a/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery.csproj +++ b/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery.csproj @@ -1,37 +1,37 @@ - - - - net6.0 - latest - enable - true - Frends.PostgreSQL.ExecuteQuery - Frends.PostgreSQL.ExecuteQuery - 1.0.1 - Frends - Frends - Frends - Frends - Frends - MIT - true - Execute queries or non-queries to PostgreSQL database. - https://frends.com/ - https://github.com/FrendsPlatform/Frends.PostgreSQL/tree/main/Frends.PostgreSQL.ExecuteQuery - - - - - PreserveNewest - - - - - - - - - - - - + + + + net6.0 + latest + enable + true + Frends.PostgreSQL.ExecuteQuery + Frends.PostgreSQL.ExecuteQuery + 1.0.2 + Frends + Frends + Frends + Frends + Frends + MIT + true + Execute queries or non-queries to PostgreSQL database. + https://frends.com/ + https://github.com/FrendsPlatform/Frends.PostgreSQL/tree/main/Frends.PostgreSQL.ExecuteQuery + + + + + PreserveNewest + + + + + + + + + + + + From ef433ff183d478e99780f6fa8b3c7b2d70a1eca8 Mon Sep 17 00:00:00 2001 From: Riku Virtanen Date: Thu, 2 Feb 2023 13:37:10 +0200 Subject: [PATCH 3/4] Updated version number and changelog --- Frends.PostgreSQL.ExecuteQuery/CHANGELOG.md | 12 ++- .../Frends.PostgreSQL.ExecuteQuery.sln | 75 ++++++++++--------- .../ExecuteQuery.cs | 18 +++++ .../Frends.PostgreSQL.ExecuteQuery.csproj | 2 +- 4 files changed, 65 insertions(+), 42 deletions(-) diff --git a/Frends.PostgreSQL.ExecuteQuery/CHANGELOG.md b/Frends.PostgreSQL.ExecuteQuery/CHANGELOG.md index 535635f..bcec829 100644 --- a/Frends.PostgreSQL.ExecuteQuery/CHANGELOG.md +++ b/Frends.PostgreSQL.ExecuteQuery/CHANGELOG.md @@ -1,5 +1,9 @@ -# Changelog - -## [1.0.0] - 2022-10-13 -### Added +# Changelog + +## [1.0.1] - 2023-02-02 +### Fixed +- Fixed memory leak issue by adding cleanup method to the main class. + +## [1.0.0] - 2022-10-13 +### Added - Initial implementation \ No newline at end of file diff --git a/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery.sln b/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery.sln index 809e9d7..2351a9f 100644 --- a/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery.sln +++ b/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery.sln @@ -1,37 +1,38 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29613.14 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Frends.PostgreSQL.ExecuteQuery", "Frends.PostgreSQL.ExecuteQuery\Frends.PostgreSQL.ExecuteQuery.csproj", "{35C305C0-8108-4A98-BB1D-AFE5C926239E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Frends.PostgreSQL.ExecuteQuery.Tests", "Frends.PostgreSQL.ExecuteQuery.Tests\Frends.PostgreSQL.ExecuteQuery.Tests.csproj", "{8CA92187-8E4F-4414-803B-EC899479022E}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{78F7F22E-6E20-4BCE-8362-0C558568B729}" - ProjectSection(SolutionItems) = preProject - .gitignore = .gitignore - README.md = README.md - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {35C305C0-8108-4A98-BB1D-AFE5C926239E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {35C305C0-8108-4A98-BB1D-AFE5C926239E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {35C305C0-8108-4A98-BB1D-AFE5C926239E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {35C305C0-8108-4A98-BB1D-AFE5C926239E}.Release|Any CPU.Build.0 = Release|Any CPU - {8CA92187-8E4F-4414-803B-EC899479022E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8CA92187-8E4F-4414-803B-EC899479022E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8CA92187-8E4F-4414-803B-EC899479022E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8CA92187-8E4F-4414-803B-EC899479022E}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {55BC6629-85C9-48D8-8CA2-B0046AF1AF4B} - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29613.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Frends.PostgreSQL.ExecuteQuery", "Frends.PostgreSQL.ExecuteQuery\Frends.PostgreSQL.ExecuteQuery.csproj", "{35C305C0-8108-4A98-BB1D-AFE5C926239E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Frends.PostgreSQL.ExecuteQuery.Tests", "Frends.PostgreSQL.ExecuteQuery.Tests\Frends.PostgreSQL.ExecuteQuery.Tests.csproj", "{8CA92187-8E4F-4414-803B-EC899479022E}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{78F7F22E-6E20-4BCE-8362-0C558568B729}" + ProjectSection(SolutionItems) = preProject + .gitignore = .gitignore + README.md = README.md + CHANGELOG.md = CHANGELOG.md + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {35C305C0-8108-4A98-BB1D-AFE5C926239E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {35C305C0-8108-4A98-BB1D-AFE5C926239E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {35C305C0-8108-4A98-BB1D-AFE5C926239E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {35C305C0-8108-4A98-BB1D-AFE5C926239E}.Release|Any CPU.Build.0 = Release|Any CPU + {8CA92187-8E4F-4414-803B-EC899479022E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8CA92187-8E4F-4414-803B-EC899479022E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8CA92187-8E4F-4414-803B-EC899479022E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8CA92187-8E4F-4414-803B-EC899479022E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {55BC6629-85C9-48D8-8CA2-B0046AF1AF4B} + EndGlobalSection +EndGlobal diff --git a/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/ExecuteQuery.cs b/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/ExecuteQuery.cs index 712c940..df37098 100644 --- a/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/ExecuteQuery.cs +++ b/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/ExecuteQuery.cs @@ -4,6 +4,9 @@ using Npgsql; using System.Data; using System.ComponentModel; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.Loader; namespace Frends.PostgreSQL.ExecuteQuery; @@ -12,6 +15,16 @@ namespace Frends.PostgreSQL.ExecuteQuery; /// public static class PostgreSQL { + + // For memory cleanup. + static PostgreSQL() + { + var currentAssembly = Assembly.GetExecutingAssembly(); + var currentContext = AssemblyLoadContext.GetLoadContext(currentAssembly); + if (currentContext != null) + currentContext.Unloading += OnPluginUnloadingRequested; + } + /// /// Query data using PostgreSQL. [Documentation](https://tasks.frends.com/tasks/frends-tasks/Frends.PostgreSQL.ExecuteQuery) /// @@ -121,4 +134,9 @@ private static IsolationLevel GetIsolationLevel(TransactionIsolationLevel level) } #endregion + + private static void OnPluginUnloadingRequested(AssemblyLoadContext obj) + { + obj.Unloading -= OnPluginUnloadingRequested; + } } diff --git a/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery.csproj b/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery.csproj index 9b743c4..cd8e6a8 100644 --- a/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery.csproj +++ b/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery.csproj @@ -7,7 +7,7 @@ true Frends.PostgreSQL.ExecuteQuery Frends.PostgreSQL.ExecuteQuery - 1.0.2 + 1.0.1 Frends Frends Frends From 31791f12068520b85cc48d74f6096e06d985327a Mon Sep 17 00:00:00 2001 From: Riku Virtanen Date: Tue, 7 Feb 2023 08:56:14 +0200 Subject: [PATCH 4/4] PR review changes --- .../Frends.PostgreSQL.ExecuteQuery.Tests/ExecuteQueryTests.cs | 2 -- .../Frends.PostgreSQL.ExecuteQuery/ExecuteQuery.cs | 1 - 2 files changed, 3 deletions(-) diff --git a/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery.Tests/ExecuteQueryTests.cs b/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery.Tests/ExecuteQueryTests.cs index 23868d3..89139c0 100644 --- a/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery.Tests/ExecuteQueryTests.cs +++ b/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery.Tests/ExecuteQueryTests.cs @@ -70,8 +70,6 @@ public async Task QuerydataThreeRows() var result = await PostgreSQL.ExecuteQuery(input, _options, new CancellationToken()); - Console.WriteLine(result.QueryResult); - Assert.AreEqual(1, (int)result.QueryResult[0]["id"]); Assert.AreEqual(2, (int)result.QueryResult[1]["id"]); Assert.AreEqual(3, (int)result.QueryResult[2]["id"]); diff --git a/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/ExecuteQuery.cs b/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/ExecuteQuery.cs index df37098..b0be284 100644 --- a/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/ExecuteQuery.cs +++ b/Frends.PostgreSQL.ExecuteQuery/Frends.PostgreSQL.ExecuteQuery/ExecuteQuery.cs @@ -5,7 +5,6 @@ using System.Data; using System.ComponentModel; using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.Loader; namespace Frends.PostgreSQL.ExecuteQuery;