sqlite表更新时有什么方法可以通知吗? [英] Is there any way to be notified when sqlite tables update?

查看:197
本文介绍了sqlite表更新时有什么方法可以通知吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在借助 FMDB 开发一个使用sqlite数据库的iOS应用。我曾经使用 Core Data ,但是每次插入5000个项目的速度非常慢。 FMDB 与事务使这种插入更快得多!

I am developing an iOS app that uses sqlite database with the help of FMDB. I used to work with Core Data, but it was very slow with 5000 items insert at a time. FMDB with transactions make such inserts much more faster!

此外,我还需要一些机制可以在何时通知我的视图控制器sqlite表中的某些项目已更新。 NSFetchedResultsController 是我的解决方案,但是由于我使用了 FMDB ,因此我无法再使用 NSFetchedResultsController

Also I need some mechanism that can notify my view controllers when some items from sqlite table are updated. NSFetchedResultsController was my solution, but since I use FMDB I can no longer use NSFetchedResultsController.

sqlite表更新时是否有任何通知方式?

Is there any way to be notified when sqlite tables update?

推荐答案

我已经搜索了一段时间,找到了解决方案。我想知道为什么我以前没有找到它。

I have been searching for a while and found a solution. I wonder why I haven't found it earlier.

我现在的选择是 YapDatabase 。我不知道它的弱点,但是这个库有很多很棒的东西:

My choice now is YapDatabase. I don't know about its weaknesses but there are so many great things about this library:


  • 定期更新 。超过1000次提交!哇!

  • 这是一个键/值存储。我只是保存我的NSDictionaries。没有更多的数据模型和麻烦了。

  • 性能很棒。我已经将Core Data的删除和插入速度进行了比较。

  • 最棒的是 视图

  • Regularly updated. Has more then 1000 commits! Wow!
  • It's a key/value store. I'm just saving my NSDictionaries. No more data models and headaches.
  • Perfomance is great. I have compared to Core Data delete + insert speed.
  • And the most great thing is "Views":

视图可让您对列表进行排序,分组和过滤数据。非常适合
tableViews,collectionViews等。他们甚至还提供
NSFetchedResultsController样式更新,以使对表Views / collectionViews中的
更改进行动画处理变得容易。

Views allow you Sort, Group & Filter your data. Perfect for tableViews, collectionViews, and more. And they even provide NSFetchedResultsController style updates to make it easy to animate changes to your tableViews/collectionViews.

这篇关于sqlite表更新时有什么方法可以通知吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆