Skip to content

Commit

Permalink
Replace MySql.Data with MySqlConnector
Browse files Browse the repository at this point in the history
  • Loading branch information
NetDwarf authored Oct 31, 2021
2 parents b090e23 + a93ec13 commit dcc95de
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DOLDatabase/DOLDatabase.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<ItemGroup>
<PackageReference Include="log4net" Version="2.0.12" PrivateAssets="all" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="5.0.11" />
<PackageReference Include="MySql.Data" Version="8.0.26" PrivateAssets="all" />
<PackageReference Include="MySqlConnector" Version="1.3.14" PrivateAssets="all" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>
2 changes: 1 addition & 1 deletion DOLDatabase/Handlers/MySQLObjectDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
using System.Data;
using System.Data.Common;

using MySql.Data.MySqlClient;
using MySqlConnector;

using DOL.Database.Connection;

Expand Down
2 changes: 1 addition & 1 deletion Net5/DOLDatabase/DOLDatabase.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<ItemGroup>
<PackageReference Include="log4net" Version="2.0.12" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="5.0.11" />
<PackageReference Include="MySql.Data" Version="8.0.26" />
<PackageReference Include="MySqlConnector" Version="1.3.14" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\DOLDatabase\**\*.cs" />
Expand Down
35 changes: 35 additions & 0 deletions Tests/IntegrationTests/Database/DatabaseTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1157,5 +1157,40 @@ public void TestTableRelationWithPrecacheAndPrimaryRemote()

Assert.IsNull(relretrieve.Entry, "Relations Test With Precache and Primary should return null value for null local field relation...");
}

[Test]
public void SelectObject_TestFieldContainsSpecialISO88591signs_TestfieldIsUnaltered()
{
Database.RegisterDataObject(typeof(TestTable));
var dataObject = new TestTable();
dataObject.TestField = "¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ";

AddOrReplaceObject(dataObject);

var actual = Database.FindObjectByKey<TestTable>(dataObject.ObjectId).TestField;
var expected = dataObject.TestField;
Assert.AreEqual(expected, actual);
}

[Test]
public void SelectObject_TestFieldContainsSpecialCp1252signs_TestfieldIsUnaltered()
{
Database.RegisterDataObject(typeof(TestTable));
var dataObject = new TestTable();
dataObject.TestField = "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ";

AddOrReplaceObject(dataObject);

var actual = Database.FindObjectByKey<TestTable>(dataObject.ObjectId).TestField;
var expected = dataObject.TestField;
Assert.AreEqual(expected, actual);
}

private void AddOrReplaceObject<T>(T dataObject) where T : DataObject
{
var dataObjectFromDatabase = Database.FindObjectByKey<T>(dataObject.ObjectId);
if (dataObjectFromDatabase != null) Database.DeleteObject(dataObject);
Database.AddObject(dataObject);
}
}
}
2 changes: 1 addition & 1 deletion Tests/IntegrationTests/Database/MySQLDBSetUp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

namespace DOL.Integration.Database.MySQL
{
[SetUpFixture]
[SetUpFixture, Explicit]
public class MySQLDBSetUp
{
public MySQLDBSetUp()
Expand Down

0 comments on commit dcc95de

Please sign in to comment.