mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-23 04:23:47 +08:00
Add SqlExecuteCount
This commit is contained in:
@@ -39,6 +39,10 @@ namespace SqlSugar
|
|||||||
internal bool OldClearParameters { get; set; }
|
internal bool OldClearParameters { get; set; }
|
||||||
public IDataParameterCollection DataReaderParameters { get; set; }
|
public IDataParameterCollection DataReaderParameters { get; set; }
|
||||||
public TimeSpan SqlExecutionTime { get { return AfterTime - BeforeTime; } }
|
public TimeSpan SqlExecutionTime { get { return AfterTime - BeforeTime; } }
|
||||||
|
/// <summary>
|
||||||
|
/// Add, delete and modify: the number of affected items;
|
||||||
|
/// </summary>
|
||||||
|
public int SqlExecuteCount { get; private set; } = 0;
|
||||||
public StackTraceInfo SqlStackTrace { get { return UtilMethods.GetStackTrace(); } }
|
public StackTraceInfo SqlStackTrace { get { return UtilMethods.GetStackTrace(); } }
|
||||||
public bool IsDisableMasterSlaveSeparation { get; set; }
|
public bool IsDisableMasterSlaveSeparation { get; set; }
|
||||||
internal DateTime BeforeTime = DateTime.MinValue;
|
internal DateTime BeforeTime = DateTime.MinValue;
|
||||||
@@ -428,6 +432,8 @@ namespace SqlSugar
|
|||||||
int count = sqlCommand.ExecuteNonQuery();
|
int count = sqlCommand.ExecuteNonQuery();
|
||||||
if (this.IsClearParameters)
|
if (this.IsClearParameters)
|
||||||
sqlCommand.Parameters.Clear();
|
sqlCommand.Parameters.Clear();
|
||||||
|
// 影响条数
|
||||||
|
this.SqlExecuteCount = count;
|
||||||
ExecuteAfter(sql, parameters);
|
ExecuteAfter(sql, parameters);
|
||||||
sqlCommand.Dispose();
|
sqlCommand.Dispose();
|
||||||
return count;
|
return count;
|
||||||
|
@@ -31,6 +31,7 @@ namespace SqlSugar
|
|||||||
bool IsClearParameters { get; set; }
|
bool IsClearParameters { get; set; }
|
||||||
int CommandTimeOut { get; set; }
|
int CommandTimeOut { get; set; }
|
||||||
TimeSpan SqlExecutionTime { get; }
|
TimeSpan SqlExecutionTime { get; }
|
||||||
|
int SqlExecuteCount { get; }
|
||||||
IDbBind DbBind { get; }
|
IDbBind DbBind { get; }
|
||||||
void SetCommandToAdapter(IDataAdapter adapter, DbCommand command);
|
void SetCommandToAdapter(IDataAdapter adapter, DbCommand command);
|
||||||
IDataAdapter GetAdapter();
|
IDataAdapter GetAdapter();
|
||||||
|
Reference in New Issue
Block a user