i hava a data base, this is in my proyect how a file localDB.db I want update some information of a table in this since my aplication`s code the method i use is the follow:
-(void)establecePerfil:(int)idPerfil{
while ([Utilidades consultaCargandoDatosDB]) {
[NSThread sleepForTimeInterval:1.0];
}
[Utilidades cargandoDatos:YES];
//perfil = [Perfil getInstance];
[self cargarBaseDeDatos];
NSLog(@"entre en establecer perfik");
sqlite3 *dataBase;
sqlite3_stmt *sentencia;
if(sqlite3_open([self.dataBasePath UTF8String], &dataBase)==SQLITE_OK){
NSLog(@"entre en establecer perfik 2");
NSString *sql = [NSString stringWithFormat:@"UPDATE perfiles SET \"seleccionado\"= 1, \"completado\"=0 WHERE \"id\"= %d", idPerfil];
if(sqlite3_prepare_v2(dataBase, [sql UTF8String], -1, &sentencia, NULL)==SQLITE_OK){
sqlite3_reset(sentencia);
if(sqlite3_step(sentencia)==SQLITE_OK){
NSLog(@"set profile OK");
}
else{
// NSAssert1(0, @"Error while selecting. '%s'", sqlite3_errmsg(dataBase));
NSLog( @"Save Error: %s", sqlite3_errmsg(dataBase) );
NSLog(@"%i", sqlite3_extended_errcode(dataBase));
NSLog(@"%i",sqlite3_errcode(dataBase));
}
}
sqlite3_finalize(sentencia);
}else{
NSLog(@"No se ha abierto la base de datos");
}
sqlite3_close(dataBase);
[Utilidades cargandoDatos:NO];
}
I think, i have the problem in sqlite3_step(sentencia) because code error that appear after of else condition is 101 referencing to SQLITE_DONE so i don`t know that means this. I ho pe some help, thanks.
Aucun commentaire:
Enregistrer un commentaire