我们可以在iOS应用中同时使用coredata和SQlite

时间:2022-12-14 20:47:57

I am currently using CoreData as data base in my app. Now I have a requirement to fetch data from a SQLite DB file and use that in my app. Now the questions are

我目前在我的应用程序中使用CoreData作为数据库。现在我需要从SQLite DB文件中获取数据并在我的应用程序中使用它。现在的问题是

1 - Can we use both SQLite and CoreData together in a single app.

1 - 我们可以在一个应用程序中同时使用SQLite和CoreData。

2 - If yes, will it cause any memory issues?

2 - 如果是,它会导致任何内存问题吗?

3 - Can we fetch data from multiple DB(SQLite DB) files in a single app.

3 - 我们可以从单个应用程序中的多个DB(SQLite DB)文件中获取数据。

1 个解决方案

#1


7  

  1. Yes
  2. Probably not.
  3. Yes.

SQLite is just a library that lets you read and write files in its own format using SQL statements. There are no special restrictions on accessing multiple files. You can even write queries that span multiple databases — see the ATTACH statement.

SQLite只是一个库,它允许您使用SQL语句以自己的格式读写文件。访问多个文件没有特殊限制。您甚至可以编写跨多个数据库的查询 - 请参阅ATTACH语句。

#1


7  

  1. Yes
  2. Probably not.
  3. Yes.

SQLite is just a library that lets you read and write files in its own format using SQL statements. There are no special restrictions on accessing multiple files. You can even write queries that span multiple databases — see the ATTACH statement.

SQLite只是一个库,它允许您使用SQL语句以自己的格式读写文件。访问多个文件没有特殊限制。您甚至可以编写跨多个数据库的查询 - 请参阅ATTACH语句。