开发者

xcode EGODatabase update

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


Thanks for the pointers. I was still attempting to work with the file in the bundle and not the file that was copied.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜