PDA

View Full Version : using sqlite3 on iphone app




jguru
Jul 2, 2008, 07:40 PM
Hi,

I am trying to use sqlite with my iphone application.. now i do get to initialize it properly *i think* but i am trouble figuring out how to query the database and how to be able to access the data from different views. Do i have to create database handler in every view?

any help?

thanks



tacoman667
Jul 2, 2008, 08:31 PM
Are you instantiating the database object in a class or a view delegate? You would probably need to instantiate it in any delegate or controller that manages the group of views so as you can pass it to each view from a central storage area. If not, then you need to instantiate it in the new currentView and dealloc the old instance so as to free up memory resources and not leak.

admanimal
Jul 2, 2008, 09:03 PM
I would recommend looking at the SQLite books sample. It does pretty much everything you would need to do with sqlite.

sujithkrishnan
Jul 3, 2008, 01:57 AM
I would recommend looking at the SQLite books sample. It does pretty much everything you would need to do with sqlite.

Hi...

As you mentioned the sample codes above, i would like to ask a query...

I tried detaching a thread using NSThread, but its giving me a message :

Releasing with no autoreleasepool -object of class CFFont just leaking

I tried with the "EARTHQUAKE" (which is example for multithreading) sample also... for that also its giving the same leaking message.. what i want to do?

Being beginner, we used to refer and follow whatever in sample codes, hoping that those are perfect ones, moreover we used to go through the documentations also, but sample codes expalins us more (obviously)...

What extra care i want to take while detaching a new thread?

Also if i detach two threads.. [NSThread exit]; will terminate which thread ??


Also i am using some property inside my thread method..

llike i craeted a property of UIActivityIndiactor class, starting inside the thread, while main will parse the files.. After that in main, after parsing i will stop the activityIndicator.

So i cant declare activityIndicator locally inside thread method, as i want to stop it in main...

Moreover my thread method is just to start the activityIndicator...

cleverapps
Aug 2, 2008, 02:05 AM
Hi,

I am trying to use sqlite with my iphone application.. now i do get to initialize it properly *i think* but i am trouble figuring out how to query the database and how to be able to access the data from different views. Do i have to create database handler in every view?

any help?

thanks

Hi, using this wrapper makes the development much easier: http://code.google.com/p/entropydb/