数据库在ListView中显示数据时被锁定
警告数据库已锁定为0:00:10.000000。确保在交易期间始终将事务对象用于数据库操作。
在屏幕上显示数据时,我收到了此错误。这花费了太长时间,所以我必须减少时间。
在FutureBuilder中,我称之为这样的方法:
future: Provider.of<AllMethodCallProvider>(context,listen: false).sendAllOfflineData(context, accessToken).
then((value) {Provider.of<StowDetailProvider>(context, listen: false).searchPOItem(accessToken:accessToken,po_id: widget.po_id!,selectedSiteId: widget.siteId!,poNumber:widget.searchPOText!, searchVendorPartNumber:widget.vendorPartName!,vendorName:widget.vendorName!,itemStatus:widget.item_status!,
context: context).then((value) {
Provider.of<StowDetailProvider>(context,listen: false).isSubmitted = false;
});
}),
我用于-loop在列表中添加API数据。我尝试了等待batch.commit();
,但没有得到预期的输出。
Warning database has been locked for 0:00:10.000000. Make sure you always use the transaction object for database operations during a transaction.
I received this error while showing data in screen. And it takes too long so I have to reduce time.
In Futurebuilder I called method like this :
future: Provider.of<AllMethodCallProvider>(context,listen: false).sendAllOfflineData(context, accessToken).
then((value) {Provider.of<StowDetailProvider>(context, listen: false).searchPOItem(accessToken:accessToken,po_id: widget.po_id!,selectedSiteId: widget.siteId!,poNumber:widget.searchPOText!, searchVendorPartNumber:widget.vendorPartName!,vendorName:widget.vendorName!,itemStatus:widget.item_status!,
context: context).then((value) {
Provider.of<StowDetailProvider>(context,listen: false).isSubmitted = false;
});
}),
I used for -loop to add API data in list. I tried await batch.commit();
but am not getting expected output.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它的僵局发生在所需的数据库中。您需要检查是否需要原子。
使用交易来确保您的需求是原子。
不仅僵局发生在所需的语法中。
也许我们中的数据库要求不合适,可能发生僵局。
检查您的所有要求不是同时的,如有必要,请使用交易以确保原子质。
Its deadlock occurred in the database required. You need to check if any require are atomic.
Use transaction to make sure your requires are atomic.
And not only deadlock occurs in the required syntax.
maybe our of you use of the database requirements is not suitable and could occur a deadlock.
Check all of your requirements are not at the same time, if necessary use transactions to make sure are atomic.