我不断收到错误,遗憾的是我看不出我做错了什么。tripname
我想要一个带有插入, timestamp
, lat
, longi
, accuracy
, and的语句speed
。已经建好数据库但是不能写成功的SQL语句,请帮忙
这是我的代码:
-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
NSString *databaseDir;
NSArray *dirPath;
//get the documents path
dirPath= NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
databaseDir =[dirPath objectAtIndex:0];
databasePath=[[NSString alloc]initWithString: [databaseDir stringByAppendingPathComponent:
@"deathTrail.db" ]];
sqlite3_stmt *statement;
const char *dbpath=[databasePath UTF8String];
if (sqlite3_open(dbpath, &deathTrail)==SQLITE_OK){
NSString *sql_stmt1=[[NSString alloc] initWithFormat:@"INSERT VALUES INTO LOCATION_POINTS (LATITUDE, LONGITUDE) VALUES (\"%d\", \"%d\")", newLocation.coordinate.latitude, newLocation.coordinate.longitude];
const char *insertstmt=[sql_stmt1 UTF8String];
sqlite3_prepare_v2(deathTrail, insertstmt, -1, &statement,NULL);
if(sqlite3_step(statement)==SQLITE_DONE) {
status.text=@"it worked";
} else {
status.text=@"it failed";
}
sqlite3_finalize(statement);
sqlite3_close(deathTrail);
}
}