Switch to Microsoft.Data.Sqlite for arm64

There is a slight change the the way QueryResult works in order to satisfy the variances in the new library.
Disposing of the command with the reader appears to solve this, and hopefully, with minimal impact to plugins.
This commit is contained in:
Luke 2022-03-27 21:38:58 +10:00
parent 699047d119
commit c063aabbc0
4 changed files with 26 additions and 14 deletions

View file

@ -28,7 +28,6 @@ using System.Linq;
using System.Net;
using System.Reflection;
using MaxMind;
using System.Data.SQLite;
using MySql.Data.MySqlClient;
using Newtonsoft.Json;
using Rests;
@ -261,7 +260,7 @@ namespace TShockAPI
};
// if sqlite.interop cannot be found, try and search the runtimes folder. this usually happens when debugging tsapi
// since it does not have the dependency installed directly
NativeLibrary.SetDllImportResolver(typeof(SQLiteConnection).Assembly, ResolveNativeDep);
NativeLibrary.SetDllImportResolver(typeof(Microsoft.Data.Sqlite.SqliteConnection).Assembly, ResolveNativeDep);
Main.SettingsUnlock_WorldEvil = true;
@ -322,7 +321,7 @@ namespace TShockAPI
{
string sql = Path.Combine(SavePath, Config.Settings.SqliteDBPath);
Directory.CreateDirectory(Path.GetDirectoryName(sql));
DB = new SQLiteConnection(string.Format("Data Source={0},Version=3", sql));
DB = new Microsoft.Data.Sqlite.SqliteConnection(string.Format("Data Source={0}", sql));
}
else if (Config.Settings.StorageType.ToLower() == "mysql")
{
@ -441,8 +440,16 @@ namespace TShockAPI
}
catch (Exception ex)
{
Log.ConsoleError("Fatal Startup Exception");
Log.ConsoleError(ex.ToString());
if (Log is not null)
{
Log.ConsoleError("Fatal Startup Exception");
Log.ConsoleError(ex.ToString());
}
else
{
Console.WriteLine("Fatal Startup Exception");
Console.WriteLine(ex.ToString());
}
Environment.Exit(1);
}
}