如何创建Prepopulated SQLite数据库文件?

时间:2022-09-14 09:28:16

So, I'm planning on creating an app with a prepopulated database. And I'm planning to use this library. However, I would be needing the prepopulated database file. And I don't know how to create one.

所以,我打算用预先填充的数据库创建一个应用程序。我打算使用这个库。但是,我需要预先填充的数据库文件。我不知道如何创建一个。

Will the process be similar to creating a MySQL database in phpMyAdmin? Like, I can create my database there using GUI and just copy the file thru import and export.

该过程是否类似于在phpMyAdmin中创建MySQL数据库?就像,我可以使用GUI在那里创建我的数据库,只需通过导入和导出复制文件。

I believe there are many ways of doing this. But how would you do it? I'm a newbie to this Android Database concept. I'm so sorry.

我相信有很多方法可以做到这一点。但是你会怎么做?我是这个Android数据库概念的新手。我很抱歉。

1 个解决方案

#1


0  

Start with creating a prepopulated database. You can do this on your laptop using an sqlite tool, such as SQLite Expert Personal.

首先创建一个预先填充的数据库。您可以使用sqlite工具在笔记本电脑上执行此操作,例如SQLite Expert Personal。

Then put the database file in the application assets directory. From there, you can create code to read it and then write it to a location where you want the db to live. Once copied, open it using your library and use it.

然后将数据库文件放在应用程序资产目录中。从那里,您可以创建代码来读取它,然后将其写入您希望数据库生存的位置。复制后,使用您的库打开它并使用它。

#1


0  

Start with creating a prepopulated database. You can do this on your laptop using an sqlite tool, such as SQLite Expert Personal.

首先创建一个预先填充的数据库。您可以使用sqlite工具在笔记本电脑上执行此操作,例如SQLite Expert Personal。

Then put the database file in the application assets directory. From there, you can create code to read it and then write it to a location where you want the db to live. Once copied, open it using your library and use it.

然后将数据库文件放在应用程序资产目录中。从那里,您可以创建代码来读取它,然后将其写入您希望数据库生存的位置。复制后,使用您的库打开它并使用它。