//NOTA : appDelegate.total es la fecha_actualizada con el nuevo valor del campo fechadiario.
//la consulta se realiza con una captura de comillas ya que para realizar una consulta donde se juntan objetive C y sqlite hay que hacerlo de esa manera.
NSString *state444=[NSString stringWithFormat:@"update bitacorabd set fechadiario=?, titulodiario=?, textodiario=?, id=?, califica_db=?, animo_db=?, imagenanimo_db=?, tipo_letra=?, color_letra=?, color_fondo=?, fontletradb=?, imagenfoto2_db=? where fechadiario=\""];
sqlite3 *data2;
NSString *mensajecaja;
// _imagenanimo.hidden=NO;
// appDelegate.hora_texto_actualizada=appDelegate.total;
sqlite3_stmt *compiledstatement233;
NSString *consulta_total=[state444 stringByAppendingString:appDelegate.fecha_base2];
NSString *cadena_cierre_comillas=[consulta_total stringByAppendingString:@"\""];
if (sqlite3_open([appDelegate.databasepath UTF8String],&data2) == SQLITE_OK) {
if (sqlite3_prepare_v2(data2,[cadena_cierre_comillas UTF8String],-1, &compiledstatement233,NULL)==SQLITE_OK){
sqlite3_bind_text(compiledstatement233,1,[appDelegate.total UTF8String],-1, SQLITE_TRANSIENT );
sqlite3_bind_text(compiledstatement233,2,[_titulodia.text UTF8String],-1,SQLITE_TRANSIENT) ;
sqlite3_bind_text(compiledstatement233,3,[_textodia.text UTF8String],-1,SQLITE_TRANSIENT);
int z=appDelegate.x3;
sqlite3_bind_int(compiledstatement233,4,z );
sqlite3_bind_text(compiledstatement233,5,[_calificastedia.text UTF8String],-1,SQLITE_TRANSIENT) ;
sqlite3_bind_text(compiledstatement233,6,[_estadodeanimo.text UTF8String],-1, SQLITE_TRANSIENT );
sqlite3_bind_text(compiledstatement233,7,[appDelegate.datostring UTF8String],-1,SQLITE_TRANSIENT) ;
// sqlite3_bind_text(compiledstatement2,10,[appDelegate.letra UTF8String],-1,SQLITE_TRANSIENT) ;
sqlite3_bind_text(compiledstatement233, 8,[appDelegate.fuente_actual UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(compiledstatement233,9,[appDelegate.colorletra_espanol UTF8String],-1,SQLITE_TRANSIENT) ;
sqlite3_bind_text(compiledstatement233,10,[appDelegate.colorfomndoespanol UTF8String],-1,SQLITE_TRANSIENT) ;
sqlite3_bind_text(compiledstatement233,11,[appDelegate.fuente_actual UTF8String],-1,SQLITE_TRANSIENT) ;
sqlite3_bind_text(compiledstatement233,12,[appDelegate.imagen_final UTF8String],-1,SQLITE_TRANSIENT) ;
appDelegate.x=2;
appDelegate.y=2;
if (sqlite3_step(compiledstatement233)!= SQLITE_DONE){
UIAlertController *alertcontroller = [UIAlertController alertControllerWithTitle:@"Atencion.. " message:@" error al grabar..." preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil];
[alertcontroller addAction:ok];
[self presentViewController:alertcontroller animated:YES completion:nil];
// _mensaje.text= [NSString stringWithFormat:@"%s", sqlite3_errmsg(data2)];
sqlite3_step(compiledstatement233);
sqlite3_finalize(compiledstatement233);
sqlite3_close(data2);
return ;
}else{
mensajecaja=[@"Se ha actualizado correctamente el dia de la bitacora 666" stringByAppendingString:appDelegate.total];
UIAlertController *alertcontroller = [UIAlertController alertControllerWithTitle:@"Atencion..." message:mensajecaja preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil];
[alertcontroller addAction:ok];
[self presentViewController:alertcontroller animated:YES completion:nil];
// appDelegate.paso_por_entrada3=1;
sqlite3_step(compiledstatement233);
sqlite3_finalize(compiledstatement233);
sqlite3_close(data2);
}
}