0

i'd like to make some application that store data in device.

so i want to use some storage. but there are two ways i can store my data.

first one is saving them to file system by XML structure, and the other one is by using sqlLite library. but i have no idea. because i don't know the strength and weakness each of them. for example location of stored data, and which one is faster to get the data i want. i just store text data. so please recommand which one is better.

sorry for my english skill. thank you!

Paolo Stefan
  • 10,112
  • 5
  • 45
  • 64
  • 1
    sqlite is a database driven storage, so searching will in general be faster, while filesystem is more useful for less structured data... could you elaborate a bit moer (eg giving some more info about the data you are storing)? – Paolo Stefan Jan 24 '13 at 10:03
  • There is little point of going for XML if you need to handle a large amount of data in Mac OS X or iOS. XML is a must for Windows, not a must for Mac OS X and iOS. You can use XML if you know you have just hundreds or thousands of records. – El Tomato Jan 24 '13 at 13:02

4 Answers4

1

SQLite !!! No doubt about that.

For easy maintenance, querying capability and lot more.

SQLite has the basic features of a database engine, it's lightweight. Specially designed for mobile platform. So some features like regex in database etc is not included.

File and Database. Always preference goes to database.

alxx
  • 9,897
  • 4
  • 26
  • 41
Midhun MP
  • 103,496
  • 31
  • 153
  • 200
0

DATABASE ALWAYS...

As you said SQLite is one option, and you can use SQLite directly with iOS. But I hope you have heard about Core data, which is a higher level wrapper to make Database easier.

But there is no comparison between Database and files

Krishnabhadra
  • 34,169
  • 30
  • 118
  • 167
0

This would be Perfect answer for your question and for iOS I would suggest SQLite will be the best one as it has everything in one file, performance loss is lower than XML as cache gets bigger.

Community
  • 1
  • 1
iMash
  • 1,178
  • 1
  • 12
  • 33
0

It depends on the amount of data (and its structure and complexity) that you are going to store. For rather small amounts, not more than a handfull of records or two, I would use an NSDictionary and the load and save methods that come with it. Those persistant storage will be in XML, btw.

For more data or rather complex data, especially when you do not need to load all the data at the same time, then you should go for a database solution. That chould be sqlite. Or you may opt for core data which (per default) is based on sqlite.

I would suggest core data (unless you aim for portability such as android). You will have to invest in learning core data. Which may appear to be confusing from start. But once you have started with that you will certainly find core data quite convenient. It takes a lot of work from you that you have to care for manually when using native sqlite.

Hermann Klecker
  • 14,039
  • 5
  • 48
  • 71