mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2025-12-05 16:16:33 +00:00
修改SQL工具类
This commit is contained in:
parent
df8ea4a8cc
commit
f679c1884e
@ -8,7 +8,7 @@ namespace Milimoe.FunGame.Core.Api.Data
|
||||
/// 需要在Server中继承此类实现。
|
||||
/// Milimoe.FunGame.Core.Service.SQLManager也是
|
||||
/// </summary>
|
||||
public class SQLHelper : ISQLHelper
|
||||
public abstract class SQLHelper : ISQLHelper
|
||||
{
|
||||
public string Script { get; set; } = "";
|
||||
|
||||
@ -18,24 +18,10 @@ namespace Milimoe.FunGame.Core.Api.Data
|
||||
|
||||
public SQLResult Result { get; }
|
||||
|
||||
public SQLServerInfo ServerInfo { get; }
|
||||
public abstract SQLServerInfo ServerInfo { get; }
|
||||
|
||||
public int UpdateRows { get; }
|
||||
|
||||
public static SQLHelper GetHelper(EntityType type)
|
||||
{
|
||||
return new SQLHelper(type);
|
||||
}
|
||||
|
||||
private SQLHelper(EntityType type = EntityType.Empty, SQLServerInfo? info = null, SQLResult result = SQLResult.Success, int rows = 0)
|
||||
{
|
||||
this.EntityType = type;
|
||||
if (info == null) this.ServerInfo = SQLServerInfo.Create();
|
||||
else this.ServerInfo = info;
|
||||
this.Result = result;
|
||||
this.UpdateRows = rows;
|
||||
}
|
||||
|
||||
public virtual SQLResult Execute()
|
||||
{
|
||||
return SQLResult.NotFound;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using Milimoe.FunGame.Core.Library.Common.Network;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Interface.Base
|
||||
{
|
||||
@ -9,6 +10,6 @@ namespace Milimoe.FunGame.Core.Interface.Base
|
||||
public object Entity { get; }
|
||||
public SQLResult Result { get; }
|
||||
int UpdateRows { get; }
|
||||
public Library.Common.Network.SQLServerInfo ServerInfo { get; }
|
||||
public SQLServerInfo ServerInfo { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,84 +1,41 @@
|
||||
using Milimoe.FunGame.Core.Api.Data;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
using Milimoe.FunGame.Core.Api.Data;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// 需要在Server中继承此类实现
|
||||
/// </summary>
|
||||
public class SQLManager
|
||||
public abstract class SQLManager
|
||||
{
|
||||
internal SQLHelper SQLHelper { get; }
|
||||
public SQLHelper? SQLHelper { get; }
|
||||
|
||||
internal SQLManager(SQLHelper SQLHelper)
|
||||
{
|
||||
this.SQLHelper = SQLHelper;
|
||||
}
|
||||
public abstract int Add(StringBuilder sql, ref SQLResult result);
|
||||
|
||||
protected virtual int Add(StringBuilder sql, ref SQLResult result)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
public abstract int Add(string sql, ref SQLResult result);
|
||||
|
||||
protected virtual int Add(string sql, ref SQLResult result)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
public abstract SQLResult Execute();
|
||||
|
||||
protected virtual SQLResult Execute()
|
||||
{
|
||||
return SQLResult.NotFound;
|
||||
}
|
||||
public abstract SQLResult Execute(StringBuilder sql);
|
||||
|
||||
protected virtual SQLResult Execute(StringBuilder sql)
|
||||
{
|
||||
return SQLResult.NotFound;
|
||||
}
|
||||
public abstract SQLResult Execute(string sql);
|
||||
|
||||
protected virtual SQLResult Execute(string sql)
|
||||
{
|
||||
return SQLResult.NotFound;
|
||||
}
|
||||
public abstract DataSet ExecuteDataSet(StringBuilder sql);
|
||||
|
||||
protected virtual object Query(EntityType type, StringBuilder sql)
|
||||
{
|
||||
return General.EntityInstance;
|
||||
}
|
||||
public abstract DataSet ExecuteDataSet(string sql);
|
||||
|
||||
protected virtual T? Query<T>(StringBuilder sql)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
public abstract object Query(EntityType type, StringBuilder sql);
|
||||
|
||||
protected virtual object Query(EntityType type, string sql)
|
||||
{
|
||||
return General.EntityInstance;
|
||||
}
|
||||
public abstract object Query(EntityType type, string sql);
|
||||
|
||||
protected virtual T? Query<T>(string sql)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
public abstract int Remove(StringBuilder sql, ref SQLResult result);
|
||||
|
||||
protected virtual int Remove(StringBuilder sql, ref SQLResult result)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
public abstract int Remove(string sql, ref SQLResult result);
|
||||
|
||||
protected virtual int Remove(string sql, ref SQLResult result)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
public abstract int Update(StringBuilder sql, ref SQLResult result);
|
||||
|
||||
protected virtual int Update(StringBuilder sql, ref SQLResult result)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected virtual int Update(string sql, ref SQLResult result)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
public abstract int Update(string sql, ref SQLResult result);
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,24 +9,12 @@ namespace Milimoe.FunGame.Core.Service
|
||||
/// <summary>
|
||||
/// 客户端专用Socket
|
||||
/// </summary>
|
||||
internal static Socket? Socket
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Socket;
|
||||
}
|
||||
}
|
||||
internal static Socket? Socket => _Socket;
|
||||
|
||||
/// <summary>
|
||||
/// 服务器端专用Socket
|
||||
/// </summary>
|
||||
internal static Socket? ServerSocket
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ServerSocket;
|
||||
}
|
||||
}
|
||||
internal static Socket? ServerSocket => _ServerSocket;
|
||||
|
||||
private static Socket? _Socket = null;
|
||||
private static Socket? _ServerSocket = null;
|
||||
|
||||
@ -34,13 +34,7 @@ namespace Milimoe.FunGame.Core.Service
|
||||
/// </summary>
|
||||
/// <param name="name">Thread的Key</param>
|
||||
/// <returns>Thread对象</returns>
|
||||
internal BaseModel this[string name]
|
||||
{
|
||||
get
|
||||
{
|
||||
return Threads[name];
|
||||
}
|
||||
}
|
||||
internal BaseModel this[string name] => Threads[name];
|
||||
|
||||
/// <summary>
|
||||
/// 向线程管理器中添加Thread
|
||||
|
||||
@ -329,7 +329,6 @@ namespace Milimoe.FunGame.Desktop.Model
|
||||
Main.OnFailedConnectEvent(new GeneralEventArgs());
|
||||
Close();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user