Monday, 18 June 2012

Problem in storing data with Core Data & retrieving it using SQLite


Last week i was working on an application in which i stored my data using CoreData.
Afterwards i was told to retrieve data using SQLite queries.
I thought it is a simple job since CoreData internally stores whole data into a sqlite file.
So i fired my complex queries on database, but i failed. So i tried simple queries thinking of  my queries must be wrong. But no luck, i tried whole day implementing many codes. I checked my Table name, column name and the were correct. I tried everything but was not successful.
Finally my senior (Nilesh Jinde) asked me to open my database into SQLieManger & i was totally surprised, CoreData changed every table name of my database with a name prepending a "z", so my table name Contacts changed to ZContacts and so changed my column names in similar manner.
And finally i came to know where i was going wrong thanks to Nilesh Jinde.

I will advice you all, while working with databases do use a SQLiteManager, it really helps us in exploring database, fire queries so we can implement them in our Objective C code.

No comments:

Post a Comment