修改SQLHelper

This commit is contained in:
Mili 2023-01-29 21:31:00 +08:00
parent c82eafb294
commit ba270100fe
9 changed files with 96 additions and 189 deletions

View File

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Milimoe.FunGame.Core.Interface.Base;
using Milimoe.FunGame.Core.Library.Common.Network;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Core.Api.Data
{
public class SQLHelper : ISQLHelper
{
public string Script { get; set; } = "";
public EntityType EntityType { get; private set; } = EntityType.Empty;
public object Entity { get; private set; } = General.EntityInstance;
public SQLResult Result { get; private set; } = SQLResult.Success;
public SQLServerInfo ServerInfo { get; private set; } = new SQLServerInfo();
public int UpdateRows { get; private set; } = 0;
public SQLHelper Instance { get; private set; } = new SQLHelper();
public static SQLHelper GetHelper(EntityType type)
{
return new SQLHelper(type);
}
private SQLHelper(EntityType type)
{
this.EntityType = type;
}
private SQLHelper()
{
}
}
}

View File

@ -1,94 +0,0 @@
using Milimoe.FunGame.Core.Interface.Base;
using Milimoe.FunGame.Core.Library.Constant;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Milimoe.FunGame.Core.Api.Proxy
{
public class SQLProxy : ISQLProxy
{
public ProxyResult Execute()
{
throw new NotImplementedException();
}
public ProxyResult Execute(object[]? objs = null)
{
throw new NotImplementedException();
}
public ProxyResult Execute(StringBuilder script)
{
throw new NotImplementedException();
}
public int ExecuteRow()
{
throw new NotImplementedException();
}
public int ExecuteRow(object[]? objs = null)
{
throw new NotImplementedException();
}
public int ExecuteRow(StringBuilder script)
{
throw new NotImplementedException();
}
public DataSet GetData(EntityType type, object[]? objs = null)
{
throw new NotImplementedException();
}
public DataSet GetData(object[]? objs = null)
{
throw new NotImplementedException();
}
public DataSet GetData(StringBuilder script)
{
throw new NotImplementedException();
}
public DataRow GetDataRow(EntityType type, object[]? objs = null)
{
throw new NotImplementedException();
}
public DataRow GetDataRow(DataSet set, object[]? objs = null)
{
throw new NotImplementedException();
}
public DataRow GetDataRow(DataTable table, object[]? objs = null)
{
throw new NotImplementedException();
}
public DataRow GetDataRow(StringBuilder script)
{
throw new NotImplementedException();
}
public DataTable GetDataTable(EntityType type, object[]? objs = null)
{
throw new NotImplementedException();
}
public DataTable GetDataTable(object[]? objs = null)
{
throw new NotImplementedException();
}
public DataTable GetDataTable(StringBuilder script)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Core.Interface.Base
{
public interface ISQLHelper
{
public string Script { get; set; }
public EntityType EntityType { get; }
public object Entity { get; }
public SQLResult Result { get; }
int UpdateRows { get; }
public Library.Common.Network.SQLServerInfo ServerInfo { get; }
}
}

View File

@ -1,29 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Core.Interface.Base
{
public interface ISQLProxy
{
public ProxyResult Execute();
public ProxyResult Execute(object[]? objs = null);
public ProxyResult Execute(StringBuilder script);
public int ExecuteRow();
public int ExecuteRow(object[]? objs = null);
public int ExecuteRow(StringBuilder script);
public System.Data.DataSet GetData(EntityType type, object[]? objs = null);
public System.Data.DataSet GetData(object[]? objs = null);
public System.Data.DataSet GetData(StringBuilder script);
public System.Data.DataTable GetDataTable(EntityType type, object[]? objs = null);
public System.Data.DataTable GetDataTable(object[]? objs = null);
public System.Data.DataTable GetDataTable(StringBuilder script);
public System.Data.DataRow GetDataRow(EntityType type, object[]? objs = null);
public System.Data.DataRow GetDataRow(System.Data.DataSet set, object[]? objs = null);
public System.Data.DataRow GetDataRow(System.Data.DataTable table, object[]? objs = null);
public System.Data.DataRow GetDataRow(StringBuilder script);
}
}

View File

@ -9,24 +9,18 @@ namespace Milimoe.FunGame.Core.Interface.Base
{
internal interface ISQLService
{
internal ProxyResult Execute();
internal ProxyResult Execute(object[]? objs = null);
internal ProxyResult Execute(StringBuilder script);
internal int UpdateRow(object[]? objs = null);
internal int UpdateRow(StringBuilder script);
internal int DeleteRow(object[]? objs = null);
internal int DeleteRow(StringBuilder script);
internal int AddRow(object[]? objs = null);
internal int AddRow(StringBuilder script);
internal System.Data.DataSet GetData(EntityType type, object[]? objs = null);
internal System.Data.DataSet GetData(object[]? objs = null);
internal System.Data.DataSet GetData(StringBuilder script);
internal System.Data.DataTable GetDataTable(EntityType type, object[]? objs = null);
internal System.Data.DataTable GetDataTable(object[]? objs);
internal System.Data.DataTable GetDataTable(StringBuilder script);
internal System.Data.DataRow GetDataRow(EntityType type, object[]? objs = null);
internal System.Data.DataRow GetDataRow(System.Data.DataSet set, object[]? objs = null);
internal System.Data.DataRow GetDataRow(System.Data.DataTable table, object[]? objs = null);
internal System.Data.DataRow GetDataRow(StringBuilder script);
internal SQLResult Execute();
internal SQLResult Execute(StringBuilder sql);
internal SQLResult Execute(string sql);
internal int Update(StringBuilder sql, ref SQLResult result);
internal int Remove(StringBuilder sql, ref SQLResult result);
internal int Add(StringBuilder sql, ref SQLResult result);
internal int Update(string sql, ref SQLResult result);
internal int Remove(string sql, ref SQLResult result);
internal int Add(string sql, ref SQLResult result);
internal object Query(EntityType type, StringBuilder sql);
internal T Query<T>(StringBuilder sql);
internal object Query(EntityType type, string sql);
internal T Query<T>(string sql);
}
}

View File

@ -6,7 +6,8 @@ using System.Threading.Tasks;
namespace Milimoe.FunGame.Core.Library.Common.Network
{
public class SQLConnection
public class SQLServerInfo
{
}
}

View File

@ -37,10 +37,12 @@ namespace Milimoe.FunGame.Core.Library.Constant
FindServerFailed
}
public enum ProxyResult
public enum SQLResult
{
Success,
Fail,
NotFound
NotFound,
SQLError,
IsExist
}
}

View File

@ -11,97 +11,67 @@ namespace Milimoe.FunGame.Core.Service
{
internal class SQLManager : ISQLService
{
int ISQLService.AddRow(object[]? objs)
int ISQLService.Add(StringBuilder sql, ref SQLResult result)
{
throw new NotImplementedException();
}
int ISQLService.AddRow(StringBuilder script)
int ISQLService.Add(string sql, ref SQLResult result)
{
throw new NotImplementedException();
}
int ISQLService.DeleteRow(object[]? objs)
SQLResult ISQLService.Execute()
{
throw new NotImplementedException();
}
int ISQLService.DeleteRow(StringBuilder script)
SQLResult ISQLService.Execute(StringBuilder sql)
{
throw new NotImplementedException();
}
ProxyResult ISQLService.Execute()
SQLResult ISQLService.Execute(string sql)
{
throw new NotImplementedException();
}
ProxyResult ISQLService.Execute(object[]? objs)
object ISQLService.Query(EntityType type, StringBuilder sql)
{
throw new NotImplementedException();
}
ProxyResult ISQLService.Execute(StringBuilder script)
T ISQLService.Query<T>(StringBuilder sql)
{
throw new NotImplementedException();
}
DataSet ISQLService.GetData(EntityType type, object[]? objs)
object ISQLService.Query(EntityType type, string sql)
{
throw new NotImplementedException();
}
DataSet ISQLService.GetData(object[]? objs)
T ISQLService.Query<T>(string sql)
{
throw new NotImplementedException();
}
DataSet ISQLService.GetData(StringBuilder script)
int ISQLService.Remove(StringBuilder sql, ref SQLResult result)
{
throw new NotImplementedException();
}
DataRow ISQLService.GetDataRow(EntityType type, object[]? objs)
int ISQLService.Remove(string sql, ref SQLResult result)
{
throw new NotImplementedException();
}
DataRow ISQLService.GetDataRow(DataSet set, object[]? objs)
int ISQLService.Update(StringBuilder sql, ref SQLResult result)
{
throw new NotImplementedException();
}
DataRow ISQLService.GetDataRow(DataTable table, object[]? objs)
{
throw new NotImplementedException();
}
DataRow ISQLService.GetDataRow(StringBuilder script)
{
throw new NotImplementedException();
}
DataTable ISQLService.GetDataTable(EntityType type, object[]? objs)
{
throw new NotImplementedException();
}
DataTable ISQLService.GetDataTable(object[]? objs)
{
throw new NotImplementedException();
}
DataTable ISQLService.GetDataTable(StringBuilder script)
{
throw new NotImplementedException();
}
int ISQLService.UpdateRow(object[]? objs)
{
throw new NotImplementedException();
}
int ISQLService.UpdateRow(StringBuilder script)
int ISQLService.Update(string sql, ref SQLResult result)
{
throw new NotImplementedException();
}