Creating an SQLite3 database file through Objective-C

后端 未结 6 1649
攒了一身酷
攒了一身酷 2020-12-01 15:19

I\'m trying to create an SQLite3 database file through Objective-C at run time. I am trying to create a table called \"tblStore\". I want the field names to be called \"st

6条回答
  •  北荒
    北荒 (楼主)
    2020-12-01 15:58

    sqlite is a pain if you dont know what you're doing. I also had some problems with sqlite c functions but then i decided to use sqlite wrapper.

    FMDB and BWDB are good and easy to use sqlite wrappers for objective c. I suggest you use one of those .

    Note that BWDB is in a lynda.com tutorial (this one) and if you don't find it on the web...leave a comment and i'll upload it somewhere.

    edit: the only place you can write stuff in your app is in your documents directory...so..it plain terms...if the db is not in your documents directory..is read-only..also..when you read/write to your db..the OS copies the db in the documents directory..and does all the reading and writing there so you can have a db in your app bundle but you can't edit that one...so you'll end up with 2 db.I had the same problem myself..and i fixed it by merging the 2 db when i updated the app

    edit2: i uploaded BWDB final project ( you have your wrapper there and project to see how it works)

提交回复
热议问题