简体   繁体   中英

MySQL data to objective-c object

I'm wondering how to take data from a remote MySQL database and parse it into an objective-c object. For example, if I have a list of food in my database, and each food item has certain properties, like a name, price, description, how would I parse each item in the database to a food object class in objective c.

I usually parse XML which iterates over each food item, so that I can do things like food.description to get the food's description...

Currently I can acquire my data using php and storing it in JSON. I the use the JSONtouch library to parse it. How could I use a similar structure but taking the data above and translating it into an object?

Thanks!

Take a look at GNUstep's GDL2 library, to see whether it will work for you (and whether the license is acceptable). It's an ORM library that supports MySQL among other data sources.

Otherwise, you could wrap the MySQL client library in an NSIncrementalStore subclass to use it via Core Data.

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