我试图在我的 sqlite 数据库中插入一些值。db 已经是手机上的 doc 文件夹了。我无法弄清楚出了什么问题。我设置了跟踪执行,但数据库告诉我它没有任何错误。有人能帮我吗?
if([[TRSharedLocalDatabase openDatabase] executeUpdateWithFormat:@"INSERT INTO event (title,date,address,latitude,longitude,location,facebookID,picPath,description) VALUES (%@,%@,%@,%@,%@,%@,%@,%@,%@)",event.title ,event.date, event.address, [NSNumber numberWithDouble:event.geoPoint.longitude], [NSNumber numberWithDouble:event.geoPoint.latitude], event.location.objectId, event.facebookID ,picPath ,event.description]) {
NSLog(@"Ok");
} else {
NSLog(@"Not Ok");
}
+(FMDatabase *)openDatabase {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *writableDBPath = [documentsDirectory stringByAppendingPathComponent:@"4PartyLocalSystem.sqlite"];
**FMDatabase *database = [FMDatabase databaseWithPath:writableDBPath];**
[database open];
[database setTraceExecution:YES];
return database;
}
2013-08-06 13:21:42.499 4Party[13018:907] 执行更新:插入事件(标题、日期、地址、纬度、经度、位置、facebookID、picPath、描述)值(?,?,?,?, ?, @ ,?,?,?)