iPhone create SQLite database at runtime?

前端 未结 3 2081
独厮守ぢ
独厮守ぢ 2021-01-04 12:59

Most sqlite examples I\'ve found talk about creating a db file from the commandline first and then adding that to your app. For my project, I\'d like to be able to create m

3条回答
  •  一个人的身影
    2021-01-04 13:28

    You can check for the file (as usual) when the application starts up. If the file does not exist, instead of copying the pre-created file, simply:

    1. Open the file as usual using sqlite3_open()
    2. Run your creation commands (i.e., create your tables, views, etc.)

    That's really all there is to it.

提交回复
热议问题