源码疑问: 获取SQL的时候执行了一次 返回

SqlSugar 老数据
6 1026

image.png



当数量大于500的时候会调用Big, Big会执行一次SQL,

问下作者大大这个是为了啥考虑的..


不执行SQL

 db.Utilities.PageEach(entities, 300, datas =>
            {
                db.Insertable(datas).AddQueue();
            });

执行SQL

 db.Utilities.PageEach(entities, 800, datas =>
            {
                db.Insertable(datas).AddQueue();
            });

热忱回答(6)

  • 没有这个功能吧

    0 回复
  • 你是不是搞错了

    0 回复
  • db.Insertable(datas).AddQueue(); 这个是不执行SQL的,只有db.save才会执行

    0 回复
  • @fate sta:我也是这么想的, 


    直到我发现 这个语句执行了10来秒,


    db.Utilities.PageEach(entities, 800, datas =>
                {
                    db.Insertable(datas).AddQueue();
                });


    我就看了SqlSugar的源码,


    当插入数量大于500的时候 ( big的时候) 会 ExecuteCommand

    0 回复
  • update 则不会执行ExecuteCommand

    0 回复
  • image.png




    这个不是获取SQL吗, 为啥要执行一下...

    0 回复