Update Queue BUG

This commit is contained in:
610262374@qq.com 2019-06-09 20:14:39 +08:00
parent b8b6bff078
commit cff0df9c11
7 changed files with 109 additions and 35 deletions

View File

@ -78,6 +78,7 @@
<Compile Include="Models\TestTree.cs" />
<Compile Include="Models\Tree.cs" />
<Compile Include="Models\ViewOrder.cs" />
<Compile Include="UnitTest\UQueue.cs" />
<Compile Include="_OldTests\Demos\1_Query.cs" />
<Compile Include="_OldTests\Demos\2_Update.cs" />
<Compile Include="_OldTests\Demos\3_Insert.cs" />

View File

@ -31,6 +31,7 @@ namespace OrmTest
}
public static void Init()
{
Queue();
CodeFirst();
Updateable();
Json();

View File

@ -0,0 +1,41 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OrmTest
{
public partial class NewUnitTest
{
public static void Queue()
{
test1();
test2();
}
private static void test2()
{
var db = Db;
db.AddQueue("select 11");
db.Queryable<Order>().Where(it => false).AddQueue();
db.AddQueue("select 12");
var list = db.SaveQueuesAsync<int, Order, int>();
list.Wait();
UValidate.Check(list.Result.Item1[0], "11", "Queue");
UValidate.Check(list.Result.Item2.Count(), 0, "Queue");
UValidate.Check(list.Result.Item3[0], "12", "Queue");
}
private static void test1()
{
var db = Db;
db.AddQueue("select 11");
db.Queryable<Order>().Where(it => false).AddQueue();
db.AddQueue("select 12");
var list = db.SaveQueues<int, Order, int>();
UValidate.Check(list.Item1[0], "11", "Queue");
UValidate.Check(list.Item2.Count(), 0, "Queue");
UValidate.Check(list.Item3[0], "12", "Queue");
}
}
}

View File

@ -76,6 +76,7 @@
<Compile Include="Models\OrderItem.cs" />
<Compile Include="Demo\Demo0_SqlSugarClient.cs" />
<Compile Include="Models\ViewOrder.cs" />
<Compile Include="UnitTest\UQueue.cs" />
<Compile Include="_OldTest\BugTest\Bug2.cs" />
<Compile Include="_OldTest\BugTest\BugModels\AccountsModel.cs" />
<Compile Include="_OldTest\BugTest\BugModels\ClientsModel.cs" />

View File

@ -31,6 +31,7 @@ namespace OrmTest
}
public static void Init()
{
Queue();
CodeFirst();
Updateable();
Json();

View File

@ -0,0 +1,41 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OrmTest
{
public partial class NewUnitTest
{
public static void Queue()
{
test1();
test2();
}
private static void test2()
{
var db = Db;
db.AddQueue("select 11");
db.Queryable<Order>().Where(it => false).AddQueue();
db.AddQueue("select 12");
var list = db.SaveQueuesAsync<int, Order, int>();
list.Wait();
UValidate.Check(list.Result.Item1[0], "11", "Queue");
UValidate.Check(list.Result.Item2.Count(), 0, "Queue");
UValidate.Check(list.Result.Item3[0], "12", "Queue");
}
private static void test1()
{
var db = Db;
db.AddQueue("select 11");
db.Queryable<Order>().Where(it => false).AddQueue();
db.AddQueue("select 12");
var list = db.SaveQueues<int, Order, int>();
UValidate.Check(list.Item1[0], "11", "Queue");
UValidate.Check(list.Item2.Count(), 0, "Queue");
UValidate.Check(list.Item3[0], "12", "Queue");
}
}
}

View File

@ -777,45 +777,39 @@ namespace SqlSugar
result = GetData<T>(typeof(T), dataReader);
}
List<T2> result2 = null;
if (DbReader.HasRows)
if (dataReader.NextResult())
{
this.Context.InitMappingInfo<T2>();
NextResult(dataReader);
result2 = GetData<T2>(typeof(T2), dataReader);
}
List<T3> result3 = null;
if (DbReader.HasRows)
if (dataReader.NextResult())
{
this.Context.InitMappingInfo<T3>();
NextResult(dataReader);
result3 = GetData<T3>(typeof(T3), dataReader);
}
List<T4> result4 = null;
if (DbReader.HasRows)
if (dataReader.NextResult())
{
this.Context.InitMappingInfo<T4>();
NextResult(dataReader);
result4 = GetData<T4>(typeof(T4), dataReader);
}
List<T5> result5 = null;
if (DbReader.HasRows)
if (dataReader.NextResult())
{
this.Context.InitMappingInfo<T5>();
NextResult(dataReader);
result5 = GetData<T5>(typeof(T5), dataReader);
}
List<T6> result6 = null;
if (DbReader.HasRows)
if (dataReader.NextResult())
{
this.Context.InitMappingInfo<T6>();
NextResult(dataReader);
result6 = GetData<T6>(typeof(T6), dataReader);
}
List<T7> result7 = null;
if (DbReader.HasRows)
if (dataReader.NextResult())
{
this.Context.InitMappingInfo<T7>();
NextResult(dataReader);
result7 = GetData<T7>(typeof(T7), dataReader);
}
builder.SqlQueryBuilder.Clear();
@ -898,45 +892,39 @@ namespace SqlSugar
result =await GetDataAsync<T>(typeof(T), dataReader);
}
List<T2> result2 = null;
if (DbReader.HasRows)
if (dataReader.NextResult())
{
this.Context.InitMappingInfo<T2>();
NextResult(dataReader);
result2 = await GetDataAsync<T2>(typeof(T2), dataReader);
}
List<T3> result3 = null;
if (DbReader.HasRows)
if (dataReader.NextResult())
{
this.Context.InitMappingInfo<T3>();
NextResult(dataReader);
result3 = await GetDataAsync<T3>(typeof(T3), dataReader);
}
List<T4> result4 = null;
if (DbReader.HasRows)
if (dataReader.NextResult())
{
this.Context.InitMappingInfo<T4>();
NextResult(dataReader);
result4 = await GetDataAsync<T4>(typeof(T4), dataReader);
}
List<T5> result5 = null;
if (DbReader.HasRows)
if (dataReader.NextResult())
{
this.Context.InitMappingInfo<T5>();
NextResult(dataReader);
result5 = await GetDataAsync<T5>(typeof(T5), dataReader);
}
List<T6> result6 = null;
if (DbReader.HasRows)
if (dataReader.NextResult())
{
this.Context.InitMappingInfo<T6>();
NextResult(dataReader);
result6 = await GetDataAsync<T6>(typeof(T6), dataReader);
}
List<T7> result7 = null;
if (DbReader.HasRows)
if (dataReader.NextResult())
{
this.Context.InitMappingInfo<T7>();
NextResult(dataReader);
result7 = await GetDataAsync<T7>(typeof(T7), dataReader);
}
builder.SqlQueryBuilder.Clear();
@ -1165,17 +1153,17 @@ namespace SqlSugar
#endregion
#region Helper
private static void NextResult(IDataReader dataReader)
{
try
{
dataReader.NextResult();
}
catch
{
// Check.Exception(true, ErrorMessage.GetThrowMessage("Please reduce the number of T. Save Queue Changes queries don't have so many results", "请减少T的数量SaveQueueChanges 查询没有这么多结果"));
}
}
//private static void NextResult(IDataReader dataReader)
//{
// try
// {
// dataReader.NextResult();
// }
// catch
// {
// // Check.Exception(true, ErrorMessage.GetThrowMessage("Please reduce the number of T. Save Queue Changes queries don't have so many results", "请减少T的数量SaveQueueChanges 查询没有这么多结果"));
// }
//}
private void ExecuteProcessingSQL(ref string sql, SugarParameter[] parameters)
{
var result = this.ProcessingEventStartingSQL(sql, parameters);