It is a new morning. Same problem.
Here is my code:
NSArray *paths =
NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory
stringByAppendingPathComponent:@"whatsfresh.sql"];
int cntv = 0;
int cntf = 0;
ProduceItem *item=nil;
if (sqlite3_open([path UTF8String], &database) == SQLITE_OK) {
// Get the primary key for all books.
const char *sql = "SELECT type, subtype, name, id FROM
ProduceItem ORDER BY name";
sqlite3_stmt *statement;
if (sqlite3_prepare_v2(database, sql, -1, &statement, NULL) ==
SQLITE_OK) {
It does get to the second If statement so it did find the database.
But then evidently it is not SQLITE_OK on my device in regards to that
last if.
These so simple things always take the most time. 1000s of lines of
code only to be stuck on this little database.
Thanks for all the help so far as I have eliminated some bad practices
and even cleaned up some memory leaks.
Now to just get this to work on my device.
Thanks
James
On Feb 26, 2009, at 11:34 PM, Bill Bumgarner wrote:
On Feb 26, 2009, at 8:50 PM, James Cicenia wrote:
That is helping immensely. I have isolated it to the sqlite area. I
can't believe
I didn't know you could debug on the device itself.. THANKS!
Though it works very bizarrely ... seems to step backwards
sometimes?!
That'll most likely be because of the optimizer. If the compiler
determines that statement B after statement A has no impact on A and
would be faster to execute before A, it'll emit code that does
exactly that [very simplistic example].
Anyway, onto reading more about sqlite in the device itself. It
doesn't seem to
return any rows. Do I have to do something special to get the data
filled database
into the phone? It is in my resources group.
Did you make sure that the database is on the device where you
expect it and really there (say, again, via NSFileManager's
fileExistsAtPath:)?
b.bum
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com