简体   繁体   中英

How to generate objective-c classes from sqlite file

I have this little issue with creating my objective-c models from an sqlite database file, I have already tried Vertabelo but it's limited to 100 tables in the free account (I do have more tables 147), and it seems like 'Objective-C Query Builder' ORM is not working anymore.

Does anyone have any solution or proposition, thanks in advance.

Ok, this is how you can wrap sql to Objective-C Objects .

Take a look at this solution. Useful for me.

SQLiteManager is a simple Class "wrapper" to use SQLite3 within iOS SDK. It provides methods to:

  • connect/create a database in your documents app folder
  • do a simple query
  • get rows in NSDictionary format
  • close the connection
  • dump your data in sql dump format

After that use NSDictionaries to create the models/classes you want to achieve.

You could generate model classes based on your SQLite 3 database's tables and views using my LabQLite Model Generator .

Then, simply setup my LabQLite library in your Xcode project to give life to those generated model classes. Your model classes will have an Active Record pattern feel to them with full CRUD control... and there are a bunch of tricks that you can do at the high and low levels... and anywhere in-between.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM