Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/BuildAndTestOnEveryPush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

UbuntuBuild:
name: Build on ubuntu-latest
runs-on: ubuntu-latest
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v1
Expand All @@ -21,7 +21,7 @@ jobs:
run: dotnet build

- name: Run SaveQueryToCsvTests
run: dotnet test --filter Frends.Community.SQL.Tests.SaveQueryToCsvTests
run: dotnet test --filter Frends.Community.SQL.Tests.SaveQueryToCSVTests

- name: Run TestBulkInsert
run: dotnet test --filter Frends.Community.SQL.Tests.TestBulkInsert
Expand All @@ -38,7 +38,7 @@ jobs:
run: dotnet build

- name: Test
run: dotnet test --filter Frends.Community.SQL.Tests.SQLTaskTest
run: dotnet test --filter Frends.Community.SQL.Tests.SQLTest

- name: Pack release version of task
run: dotnet pack --configuration Release --include-source
Expand Down
6 changes: 3 additions & 3 deletions Frends.Community.SQL.Tests/Frends.Community.SQL.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net471</TargetFramework>
<TargetFramework>net6.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CsvHelper" Version="30.0.1" />
<PackageReference Include="CsvHelper" Version="33.0.1" />
<PackageReference Include="Dapper" Version="2.0.123" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="nunit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1">
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
8 changes: 4 additions & 4 deletions Frends.Community.SQL.Tests/SaveQueryToCSVTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System.Data;
using System.Data.SqlClient;
using Microsoft.Data.SqlClient;
using System.Threading.Tasks;
using System.IO;
using NUnit.Framework;
Expand All @@ -27,7 +27,7 @@ winpty docker exec -it sql1 "bash"
[TestFixture]
class SaveQueryToCSVTests
{
private static readonly string _connString = "Server=127.0.0.1,1433;Database=Master;User Id=SA;Password=Salakala123!";
private static readonly string _connString = "Server=127.0.0.1,1433;Database=Master;User Id=SA;Password=Salakala123!;TrustServerCertificate=True";
private static readonly string _tableName = "TestTable";
private static readonly string _destination = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "../../../TestData/test.csv");

Expand Down Expand Up @@ -169,7 +169,7 @@ public async Task SaveQueryToCSV_WithImageDBType()

var output = File.ReadAllText(_destination);

Assert.AreEqual(BitConverter.ToString(File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(_destination), "Test_image.png"))), output.TrimEnd(Environment.NewLine.ToCharArray()));
Assert.AreEqual(BitConverter.ToString(File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(_destination), "Test_image.png"))), output.TrimEnd('\r', '\n'));
}

[Test]
Expand Down Expand Up @@ -202,7 +202,7 @@ public async Task SaveQueryToCSV_WithBinaryDBType()

var output = File.ReadAllText(_destination);

Assert.AreEqual(BitConverter.ToString(File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(_destination), "Test_Text.txt"))), output.TrimEnd(Environment.NewLine.ToCharArray()));
Assert.AreEqual(BitConverter.ToString(File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(_destination), "Test_text.txt"))), output.TrimEnd('\r', '\n'));
}

private static void InsertTestData(string commandText, SqlParameter[] parameters = null)
Expand Down
4 changes: 2 additions & 2 deletions Frends.Community.SQL.Tests/TestBulkInsert.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using Microsoft.Data.SqlClient;
using System.Data;
using System.Linq;
using System.Threading;
Expand Down Expand Up @@ -30,7 +30,7 @@ docker exec -it sql1 "bash"
GO
*/

private readonly string ConnectionString = "Server=127.0.0.1,1433;Database=Master;User Id=SA;Password=Salakala123!";
private readonly string ConnectionString = "Server=127.0.0.1,1433;Database=Master;User Id=SA;Password=Salakala123!;TrustServerCertificate=True";
// The test case creates and destroys an SQL table with this name.
// Ensure that this table does not already exist in the DB! Test aborts if it does.
private readonly string TableName = "FrendsTestTable";
Expand Down
4 changes: 2 additions & 2 deletions Frends.Community.SQL/Frends.Community.SQL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.ComponentModel;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using Microsoft.Data.SqlClient;
using System.Globalization;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -307,7 +307,7 @@ internal static int RowsCopiedCount(this SqlBulkCopy bulkCopy)
const string rowsCopiedFieldName = "_rowsCopied";
FieldInfo rowsCopiedField = typeof(SqlBulkCopy).GetField(rowsCopiedFieldName,
BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance);
return rowsCopiedField != null ? (int)rowsCopiedField.GetValue(bulkCopy) : 0;
return rowsCopiedField != null ? Convert.ToInt32(rowsCopiedField.GetValue(bulkCopy)) : 0;
}
}
}
11 changes: 5 additions & 6 deletions Frends.Community.SQL/Frends.Community.SQL.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net471</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net471;net6.0;net8.0</TargetFrameworks>
<authors>HiQ Finland</authors>
<copyright>HiQ Finland</copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/CommunityHiQ/Frends.Community.SQL</PackageProjectUrl>
<IncludeSource>true</IncludeSource>
<PackageTags>Frends</PackageTags>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Version>1.4.0</Version>
<Version>2.0.0</Version>
<AutoGenerateBindingRedirects></AutoGenerateBindingRedirects>
</PropertyGroup>

Expand All @@ -20,12 +20,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CsvHelper" Version="30.0.1" />
<PackageReference Include="CsvHelper" Version="33.0.1" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.2" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.7.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.1" />
</ItemGroup>

</Project>

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,4 @@ NOTE: Be sure to merge the latest from "upstream" before making a pull request!
| 1.2.0 | Added BulkInsertDataTable and related test. |
| 1.3.0 | Added parameter AddQuotesToStrings to SaveQueryToCSVOptions which if disabled will not add quotes to string typed fields. |
| 1.4.0 | Added result object SaveQueryToCSVResult with EntriesWritten, Path and FileName properties. Added option to pass custom field delimiter. Added support for binary datatypes. |
| 2.0.0 | Added targeting to .NET6 and .NET8. Updated the following packages: CsvHelper to v33.0.1 and System.Configuration.ConfigurationManager to 9.0.0. Replaced System.Data.SqlClient with Microsoft.Data.SqlClient, as the former is deprecated. Made small adjustments as required after package updates. |
Loading