Fwd: Checking for SQL db each time...

1 view
Skip to first unread message

Mike Carter

unread,
Nov 18, 2009, 11:37:45 AM11/18/09
to iphone-appd...@googlegroups.com
Forwarded for Leandro..

Begin forwarded message:

From: Leandro Alves <lba...@gmail.com>
Date: November 18, 2009 5:25:16 AM PST
To: Mike Carter <avid...@me.com>
Subject: Re: Checking for SQL db each time...

Well, I understood it a little bit different...

I think Marcio's problem is caused by an old copy of the DB on the
Docs directory. So, any modification made to the .sqlite file in the
project, isn't replicated at the app, after rebuilding it.

If you would like the DB to be "refreshed", you can do it by two
different ways. Or remove the app from your simulator (this will clear
the Docs directory), and then, building it again, or calling a clear
function, that will delete the sqlite file and any other state
variable. I prefer the second approach with a boolean flag indicating
when should it erase the data. This is very usefull for debugging
purpose. But you need to set it to NO when generating the final
version. Otherwise, your app will always recreate the database.

Does anyone have another idea for doing this? I wonder if its possible
to detect that I'm running on "release" environment and then always
set this flag to NO, evitating the mistake of generating the final
version with YES.

On Nov 17, 3:41 pm, Mike Carter <avidfl...@me.com> wrote:
I think I get what you're saying...
When you build and launch your code in the simulator, it's going to be  
a "clean build" in the sim environment, which replaces files and the  
like.
To get a better idea of how the persistency performs, quit and launch  
the app only from within the simulator, not through the XCode menu.

On Nov 17, 2009, at 9:36 AM, marcio wrote:





no, i may have not explained myself.  when i run the app in the
simulator, it copies the db to the local Docs directory on my mac.
and when i go back into the DB to make changes, the simulator runs the
app fine, but it doesnt get a fresh copy because it already exists in
the local Docs directory.

On Nov 17, 8:29 am, Gw33do <michael.hol...@gmail.com> wrote:
Hey,

Assuming you've created the tables already in the database and its in
the doc directory, I would check to ensure you're telling the SQLite
database to commit the changes.

After the database is open and you've added stuff to it, make sure
you're calling sqlite3_step to execute and sqlite3_finalize to commit
your changes. This way you can keep data created while the  
application
is running.

Mike.

On Nov 16, 1:24 pm, marcio <quique...@gmail.com> wrote:

I have an app that checks to see if the local copy of a db exists in
the docs directory.  So when i modify it, the next time i run the
simulator the mods dont show up.  What would be the best way to  
avoid
this?  Check some property of the files themselves to see if they  
are
the same and if not, copy them?  Right now the files are not  
editable
via the app itself, i just modify the db directly on my mac, but
eventually they will be modifiable thru the app.

--

You received this message because you are subscribed to the Google  
Groups "iPhone Application Development Auditors" group.
To post to this group, send email to iphone-appd...@googlegroups.com
.
To unsubscribe from this group, send email to iphone-appdev-aud...@googlegroups.com
.
For more options, visit this group athttp://groups.google.com/group/iphone-appdev-auditors?hl=
.

 Michael Carter | avidfl...@me.com | 408.386.0288

 Michael Carter | avid...@me.com | 408.386.0288

Sadat Rahman

unread,
Nov 18, 2009, 11:40:59 AM11/18/09
to iphone-appd...@googlegroups.com
>> Does anyone have another idea for doing this? I wonder if its possible
>> to detect that I'm running on "release" environment and then always
>> set this flag to NO, evitating the mistake of generating the final
>> version with YES.


Conditional compilation would be the way to go ...

#ifdef RELEASE

#endif

Reply all
Reply to author
Forward
0 new messages