Fixes
This commit is contained in:
parent
a487a8dadf
commit
67202d27f7
3 changed files with 7 additions and 4 deletions
|
@ -8,6 +8,7 @@ public class MariaDBConnection(MySqlConnection conn) : IDisposable {
|
||||||
|
|
||||||
public async Task<int> RunCommand(string command, params MySqlParameter[] parameters) {
|
public async Task<int> RunCommand(string command, params MySqlParameter[] parameters) {
|
||||||
using MySqlCommand cmd = Connection.CreateCommand();
|
using MySqlCommand cmd = Connection.CreateCommand();
|
||||||
|
cmd.Parameters.Clear();
|
||||||
if(parameters?.Length > 0)
|
if(parameters?.Length > 0)
|
||||||
cmd.Parameters.AddRange(parameters);
|
cmd.Parameters.AddRange(parameters);
|
||||||
cmd.CommandText = command;
|
cmd.CommandText = command;
|
||||||
|
@ -16,6 +17,7 @@ public class MariaDBConnection(MySqlConnection conn) : IDisposable {
|
||||||
|
|
||||||
public async Task<MySqlDataReader?> RunQuery(string command, params MySqlParameter[] parameters) {
|
public async Task<MySqlDataReader?> RunQuery(string command, params MySqlParameter[] parameters) {
|
||||||
using MySqlCommand cmd = Connection.CreateCommand();
|
using MySqlCommand cmd = Connection.CreateCommand();
|
||||||
|
cmd.Parameters.Clear();
|
||||||
if(parameters?.Length > 0)
|
if(parameters?.Length > 0)
|
||||||
cmd.Parameters.AddRange(parameters);
|
cmd.Parameters.AddRange(parameters);
|
||||||
cmd.CommandText = command;
|
cmd.CommandText = command;
|
||||||
|
@ -25,6 +27,7 @@ public class MariaDBConnection(MySqlConnection conn) : IDisposable {
|
||||||
public async Task<T> RunQueryValue<T>(string command, params MySqlParameter[] parameters)
|
public async Task<T> RunQueryValue<T>(string command, params MySqlParameter[] parameters)
|
||||||
where T : struct {
|
where T : struct {
|
||||||
using MySqlCommand cmd = Connection.CreateCommand();
|
using MySqlCommand cmd = Connection.CreateCommand();
|
||||||
|
cmd.Parameters.Clear();
|
||||||
if(parameters?.Length > 0)
|
if(parameters?.Length > 0)
|
||||||
cmd.Parameters.AddRange(parameters);
|
cmd.Parameters.AddRange(parameters);
|
||||||
cmd.CommandText = command;
|
cmd.CommandText = command;
|
||||||
|
|
|
@ -9,6 +9,7 @@ public class SQLiteConnection(NativeSQLiteConnection conn) : IDisposable {
|
||||||
|
|
||||||
public async Task<int> RunCommand(string command, params SQLiteParameter[] parameters) {
|
public async Task<int> RunCommand(string command, params SQLiteParameter[] parameters) {
|
||||||
using SQLiteCommand cmd = Connection.CreateCommand();
|
using SQLiteCommand cmd = Connection.CreateCommand();
|
||||||
|
cmd.Parameters.Clear();
|
||||||
if(parameters?.Length > 0)
|
if(parameters?.Length > 0)
|
||||||
cmd.Parameters.AddRange(parameters);
|
cmd.Parameters.AddRange(parameters);
|
||||||
cmd.CommandText = command;
|
cmd.CommandText = command;
|
||||||
|
@ -17,6 +18,7 @@ public class SQLiteConnection(NativeSQLiteConnection conn) : IDisposable {
|
||||||
|
|
||||||
public async Task<DbDataReader?> RunQuery(string command, params SQLiteParameter[] parameters) {
|
public async Task<DbDataReader?> RunQuery(string command, params SQLiteParameter[] parameters) {
|
||||||
using SQLiteCommand cmd = Connection.CreateCommand();
|
using SQLiteCommand cmd = Connection.CreateCommand();
|
||||||
|
cmd.Parameters.Clear();
|
||||||
if(parameters?.Length > 0)
|
if(parameters?.Length > 0)
|
||||||
cmd.Parameters.AddRange(parameters);
|
cmd.Parameters.AddRange(parameters);
|
||||||
cmd.CommandText = command;
|
cmd.CommandText = command;
|
||||||
|
@ -26,6 +28,7 @@ public class SQLiteConnection(NativeSQLiteConnection conn) : IDisposable {
|
||||||
public async Task<T> RunQueryValue<T>(string command, params SQLiteParameter[] parameters)
|
public async Task<T> RunQueryValue<T>(string command, params SQLiteParameter[] parameters)
|
||||||
where T : struct {
|
where T : struct {
|
||||||
using SQLiteCommand cmd = Connection.CreateCommand();
|
using SQLiteCommand cmd = Connection.CreateCommand();
|
||||||
|
cmd.Parameters.Clear();
|
||||||
if(parameters?.Length > 0)
|
if(parameters?.Length > 0)
|
||||||
cmd.Parameters.AddRange(parameters);
|
cmd.Parameters.AddRange(parameters);
|
||||||
cmd.CommandText = command;
|
cmd.CommandText = command;
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using MySqlConnector;
|
|
||||||
using SharpChat;
|
using SharpChat;
|
||||||
using SharpChat.Configuration;
|
using SharpChat.Configuration;
|
||||||
using SharpChat.Flashii;
|
using SharpChat.Flashii;
|
||||||
using SharpChat.MariaDB;
|
using SharpChat.MariaDB;
|
||||||
using SharpChat.SQLite;
|
using SharpChat.SQLite;
|
||||||
using System.Data.SQLite;
|
|
||||||
using System.Reflection.PortableExecutable;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using ZLogger;
|
using ZLogger;
|
||||||
using ZLogger.Providers;
|
using ZLogger.Providers;
|
||||||
|
@ -157,7 +154,7 @@ if(cts.IsCancellationRequested) return;
|
||||||
if(args.Contains("--migrate-storage") || args.Contains("--convert-db")) {
|
if(args.Contains("--migrate-storage") || args.Contains("--convert-db")) {
|
||||||
MariaDBStorage mariadb = new(logFactory.CreateLogger("mariadb"), MariaDBStorage.BuildConnectionString(config.ScopeTo("mariadb")));
|
MariaDBStorage mariadb = new(logFactory.CreateLogger("mariadb"), MariaDBStorage.BuildConnectionString(config.ScopeTo("mariadb")));
|
||||||
using SQLiteStorage sqlite = new(logFactory.CreateLogger("sqlite"), SQLiteStorage.BuildConnectionString(config.ScopeTo("sqlite"), false));
|
using SQLiteStorage sqlite = new(logFactory.CreateLogger("sqlite"), SQLiteStorage.BuildConnectionString(config.ScopeTo("sqlite"), false));
|
||||||
await new StorageMigrator(logFactory.CreateLogger("migrate"), mariadb, sqlite).Migrate(cts.Token);
|
await new StorageMigrator(logFactory.CreateLogger("migrate"), sqlite, mariadb).Migrate(cts.Token);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue