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

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

问题描述

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

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

因此core-data不提供使用SQL查询的方式。

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

所以core-data在后台有sqlite db。

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模式时使用的模式不同。所以你必须创建核心数据模型,然后反向工程你自己的模式,以进行直接的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天全站免登陆