tags:

views:

6

answers:

0

Hi

I am trying to do a simple update to a sqlite database using EGODatabase and although the code runs the update does not occur?

 NSArray *params = [NSArray arrayWithObjects:@"TEST", nil];

 EGODatabase *database = [EGODatabase databaseWithPath:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"db_USBV1.sqlite3"]];

 [database executeQuery:@"update users set locked = 0 where UID = ?" parameters:params ]; 

I saw on previous post that must copy the db to the users directory which i am doing as below;

 NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"db_USBV1.sqlite3"];
 NSFileManager *fileManager = [[NSFileManager alloc] init];
 if (![fileManager fileExistsAtPath:filePath]) {
  NSError *error = nil;
  [fileManager copyItemAtPath:[[NSBundle mainBundle] pathForResource:@"db_USBV1" ofType:@"sqlite3"] toPath:filePath error:&error];
 }
 [fileManager release];

But update is not occurring.

Any help much appreciated.

Thanks, Mike