在同一数据库上同时使用基于核心数据和基于sqlite C的api [英] Use core-data and sqlite c based api simultaneously on same db

查看:85
本文介绍了在同一数据库上同时使用基于核心数据和基于sqlite C的api的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以将AFAIK CoreData配置为在持久性存储中使用sqlite.

AFAIK CoreData can be configured to use sqlite in the persistent store.

因此核心数据无法提供使用SQL进行查询的方式.

so as core-data not provides way to query using SQL.

因此核心数据在后台具有sqlite数据库.

So core-data has sqlite db in background.

使用Core-Data和基于Sqlite c的api同时访问同一数据库是否安全?

Is it safe to access same db using Core-Data and Sqlite c based api same time?

它将导致任何数据损坏,sqllite或任何线程问题.

Will it lead to any data corruption is sqllite or any threading issues.

我为什么要使用诸如FMDB或基于C的API之类的任何包装的原因是使用sql查询来查询复杂数据

the reason why am I going to use any wrappers such as FMDB or C based API is to query complex data using sql query

推荐答案

这可能是安全的,但它仍然是一个非常糟糕的主意. Core Data定义了自己的架构,该架构未记录,并且与设计SQL架构时所使用的架构不同.因此,您必须创建Core Data模型,然后对自己的架构进行反向工程以进行直接SQL调用.

It's probably safe but it's still a really bad idea. Core Data defines its own schema, which is undocumented and which is different from what you would use if you designed a SQL schema. So you'd have to create the Core Data model and then reverse-engineer your own schema to make direct SQL calls.

当然,要在完全不同的呼叫方式中保持更改同步,这绝对是一个痛苦.

Also, of course, it's going to be an absolute pain in the ass to keep changes in sync across completely different calling styles.

这是一个坏主意,即使它不会破坏您的数据.您会后悔使用这种方法.

This is a bad idea, even if it doesn't corrupt your data. You will regret using this approach.

这篇关于在同一数据库上同时使用基于核心数据和基于sqlite C的api的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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