在 Windows Mobile 上使用 SQL Compact 时,是否将 sdf 文件存储在存储卡上?

发布于 2024-08-30 14:54:56 字数 350 浏览 5 评论 0原文

过去曾遇到过一些 Sql Compact 数据库损坏问题,并经历了 关于这些的文章,我发现将数据库 sdf 文件存储在存储卡上会显着增加由于数据库损坏而导致数据丢失的风险。

您是否将 sdf 文件存储在存储卡上?您是否遇到过由此引起的任何问题?在推荐特定品牌或型号的 SD 卡时,考虑到与 SQL Compact 一起使用的稳定性和安全性,我应该注意什么?

Having had some Sql Compact db corruption issues in the past and gone through the article on these, I got the idea that storing the database sdf file on a storage card significantly increases the risk of data loss due to db corruption.

Do you store the sdf file on a storage card? Have you had any issues caused by it? What should I pay attention to when recommending a particular brand or model of an SD card wrt the stability and security for use with SQL Compact?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

断桥再见 2024-09-06 14:54:56

将数据库放在持久存储卷(无论是卡还是内部闪存)上会增加损坏的可能性,而且几乎总是由于睡眠唤醒周期造成的。当设备挂起时,通常会卸载存储,当设备恢复时,会重新安装。根据 OEM 实现的不同,连接可能会或可能不会在拆卸和建立良好过程中幸存下来(我见过在睡眠/唤醒周期中保持连接的设备总是会失败,尽管并不总是出现损坏)。

对于在运行时进入挂起/睡眠状态的设备,我的典型方法是在每次与数据库进行“事务”后始终关闭数据库。是的,这会减慢速度,但它大大减少了损坏和连接失效。

我什至通过观察 DAL 中的电源管理器事件并让它放弃并重试在电源状态更改期间正在处理的任何数据操作来将其发挥到更极端。

Having the database on a persistent storage volume (whether it's a card or internal Flash) increases the potential for corruption, and it's almost always due to the sleep wake cycle. When the device is suspended, the store is typically unmounted and when it resumes, it is re-mounted. Depending on the OEM implementation, connections may or may not survive that tear-down and build up well (I've seen devices where it a connection held through a sleep/wake cycle would always fail, though not always with corruption).

My typical methodology fo devices where the device going into suspend/sleep while running is to always close the database after every "transaction" with the database. Yes, this slows things down, but it greatly reduces both corruption and connection invalidation.

I've even taken it to further extremes by watching for power manager events in the DAL and having it abandon and retry any data action it's working on during a power state change.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文