From 6a40059e0d0cc22bec6fa659fda859796ad41bb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sun, 28 Oct 2018 09:12:30 +0100 Subject: [PATCH] Version 18.8.15 --- swad_account.c | 77 ++++++++++-------------------- swad_agenda.c | 17 ++----- swad_announcement.c | 21 +++------ swad_assignment.c | 56 +++++++++------------- swad_attendance.c | 112 ++++++++++++++++---------------------------- swad_changelog.h | 3 +- 6 files changed, 101 insertions(+), 185 deletions(-) diff --git a/swad_account.c b/swad_account.c index d93e2b685..81373c02d 100644 --- a/swad_account.c +++ b/swad_account.c @@ -1003,7 +1003,6 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat, extern const char *Txt_Briefcase_of_THE_USER_X_has_been_removed; extern const char *Txt_Photo_of_THE_USER_X_has_been_removed; extern const char *Txt_Record_card_of_THE_USER_X_has_been_removed; - char *Query; bool PhotoRemoved = false; /***** Remove the works zones of the user in all courses *****/ @@ -1022,19 +1021,16 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat, Grp_RemUsrFromAllGrps (UsrDat->UsrCod); /***** Remove user's requests for inscription *****/ - if (asprintf (&Query,"DELETE FROM crs_usr_requests WHERE UsrCod=%ld", - UsrDat->UsrCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove user's requests for inscription"); + DB_BuildQuery ("DELETE FROM crs_usr_requests WHERE UsrCod=%ld", + UsrDat->UsrCod); + DB_QueryDELETE_new ("can not remove user's requests for inscription"); /***** Remove user from possible duplicate users *****/ Dup_RemoveUsrFromDuplicated (UsrDat->UsrCod); /***** Remove user from the table of courses and users *****/ - if (asprintf (&Query,"DELETE FROM crs_usr WHERE UsrCod=%ld", - UsrDat->UsrCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove a user from all courses"); + DB_BuildQuery ("DELETE FROM crs_usr WHERE UsrCod=%ld",UsrDat->UsrCod); + DB_QueryDELETE_new ("can not remove a user from all courses"); if (QuietOrVerbose == Cns_VERBOSE) { @@ -1045,10 +1041,9 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat, } /***** Remove user as administrator of any degree *****/ - if (asprintf (&Query,"DELETE FROM admin WHERE UsrCod=%ld", - UsrDat->UsrCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove a user as administrator"); + DB_BuildQuery ("DELETE FROM admin WHERE UsrCod=%ld", + UsrDat->UsrCod); + DB_QueryDELETE_new ("can not remove a user as administrator"); if (QuietOrVerbose == Cns_VERBOSE) { @@ -1102,16 +1097,12 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat, Ann_RemoveUsrFromSeenAnnouncements (UsrDat->UsrCod); /***** Remove user from table of connected users *****/ - if (asprintf (&Query,"DELETE FROM connected WHERE UsrCod=%ld", - UsrDat->UsrCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove a user from table of connected users"); + DB_BuildQuery ("DELETE FROM connected WHERE UsrCod=%ld",UsrDat->UsrCod); + DB_QueryDELETE_new ("can not remove a user from table of connected users"); /***** Remove all sessions of this user *****/ - if (asprintf (&Query,"DELETE FROM sessions WHERE UsrCod=%ld", - UsrDat->UsrCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove sessions of a user"); + DB_BuildQuery ("DELETE FROM sessions WHERE UsrCod=%ld",UsrDat->UsrCod); + DB_QueryDELETE_new ("can not remove sessions of a user"); /***** Remove social content associated to the user *****/ Soc_RemoveUsrSocialContent (UsrDat->UsrCod); @@ -1171,48 +1162,32 @@ static void Acc_RemoveUsrBriefcase (struct UsrData *UsrDat) static void Acc_RemoveUsr (struct UsrData *UsrDat) { - char *Query; - /***** Remove user's webs / social networks *****/ - if (asprintf (&Query,"DELETE FROM usr_webs WHERE UsrCod=%ld", - UsrDat->UsrCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove user's webs / social networks"); + DB_BuildQuery ("DELETE FROM usr_webs WHERE UsrCod=%ld",UsrDat->UsrCod); + DB_QueryDELETE_new ("can not remove user's webs / social networks"); /***** Remove user's nicknames *****/ - if (asprintf (&Query,"DELETE FROM usr_nicknames WHERE UsrCod=%ld", - UsrDat->UsrCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove user's nicknames"); + DB_BuildQuery ("DELETE FROM usr_nicknames WHERE UsrCod=%ld",UsrDat->UsrCod); + DB_QueryDELETE_new ("can not remove user's nicknames"); /***** Remove user's emails *****/ - if (asprintf (&Query,"DELETE FROM pending_emails WHERE UsrCod=%ld", - UsrDat->UsrCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove pending user's emails"); + DB_BuildQuery ("DELETE FROM pending_emails WHERE UsrCod=%ld",UsrDat->UsrCod); + DB_QueryDELETE_new ("can not remove pending user's emails"); - if (asprintf (&Query,"DELETE FROM usr_emails WHERE UsrCod=%ld", - UsrDat->UsrCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove user's emails"); + DB_BuildQuery ("DELETE FROM usr_emails WHERE UsrCod=%ld",UsrDat->UsrCod); + DB_QueryDELETE_new ("can not remove user's emails"); /***** Remove user's IDs *****/ - if (asprintf (&Query,"DELETE FROM usr_IDs WHERE UsrCod=%ld", - UsrDat->UsrCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove user's IDs"); + DB_BuildQuery ("DELETE FROM usr_IDs WHERE UsrCod=%ld",UsrDat->UsrCod); + DB_QueryDELETE_new ("can not remove user's IDs"); /***** Remove user's last data *****/ - if (asprintf (&Query,"DELETE FROM usr_last WHERE UsrCod=%ld", - UsrDat->UsrCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove user's last data"); + DB_BuildQuery ("DELETE FROM usr_last WHERE UsrCod=%ld",UsrDat->UsrCod); + DB_QueryDELETE_new ("can not remove user's last data"); /***** Remove user's data *****/ - if (asprintf (&Query,"DELETE FROM usr_data WHERE UsrCod=%ld", - UsrDat->UsrCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove user's data"); + DB_BuildQuery ("DELETE FROM usr_data WHERE UsrCod=%ld",UsrDat->UsrCod); + DB_QueryDELETE_new ("can not remove user's data"); } /*****************************************************************************/ diff --git a/swad_agenda.c b/swad_agenda.c index d6bc68633..dbe168d8f 100644 --- a/swad_agenda.c +++ b/swad_agenda.c @@ -1324,7 +1324,6 @@ void Agd_AskRemEvent (void) void Agd_RemoveEvent (void) { extern const char *Txt_Event_X_removed; - char *Query; struct AgendaEvent AgdEvent; /***** Get event code *****/ @@ -1336,11 +1335,9 @@ void Agd_RemoveEvent (void) Agd_GetDataOfEventByCod (&AgdEvent); /***** Remove event *****/ - if (asprintf (&Query,"DELETE FROM agendas" - " WHERE AgdCod=%ld AND UsrCod=%ld", - AgdEvent.AgdCod,AgdEvent.UsrCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove event"); + DB_BuildQuery ("DELETE FROM agendas WHERE AgdCod=%ld AND UsrCod=%ld", + AgdEvent.AgdCod,AgdEvent.UsrCod); + DB_QueryDELETE_new ("can not remove event"); /***** Write message to show the change made *****/ snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), @@ -1746,13 +1743,9 @@ static void Agd_UpdateEvent (struct AgendaEvent *AgdEvent,const char *Txt) void Agd_RemoveUsrEvents (long UsrCod) { - char *Query; - /***** Remove events *****/ - if (asprintf (&Query,"DELETE FROM agendas WHERE UsrCod=%ld", - UsrCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove all the events of a user"); + DB_BuildQuery ("DELETE FROM agendas WHERE UsrCod=%ld",UsrCod); + DB_QueryDELETE_new ("can not remove all the events of a user"); } /*****************************************************************************/ diff --git a/swad_announcement.c b/swad_announcement.c index 5f6fb5ecc..6a43dee45 100644 --- a/swad_announcement.c +++ b/swad_announcement.c @@ -564,23 +564,18 @@ void Ann_RevealHiddenAnnouncement (void) void Ann_RemoveAnnouncement (void) { extern const char *Txt_Announcement_removed; - char *Query; long AnnCod; /***** Get the code of the global announcement *****/ AnnCod = Ann_GetParamAnnCod (); /***** Remove announcement *****/ - if (asprintf (&Query,"DELETE FROM announcements WHERE AnnCod=%ld", - AnnCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove announcement"); + DB_BuildQuery ("DELETE FROM announcements WHERE AnnCod=%ld",AnnCod); + DB_QueryDELETE_new ("can not remove announcement"); /***** Remove users who have seen the announcement *****/ - if (asprintf (&Query,"DELETE FROM ann_seen WHERE AnnCod=%ld", - AnnCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove announcement"); + DB_BuildQuery ("DELETE FROM ann_seen WHERE AnnCod=%ld",AnnCod); + DB_QueryDELETE_new ("can not remove announcement"); /***** Write message of success *****/ Ale_ShowAlert (Ale_SUCCESS,Txt_Announcement_removed); @@ -618,11 +613,7 @@ void Ann_MarkAnnouncementAsSeen (void) void Ann_RemoveUsrFromSeenAnnouncements (long UsrCod) { - char *Query; - /***** Remove user from seen announcements *****/ - if (asprintf (&Query,"DELETE FROM ann_seen WHERE UsrCod=%ld", - UsrCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove user from seen announcements"); + DB_BuildQuery ("DELETE FROM ann_seen WHERE UsrCod=%ld",UsrCod); + DB_QueryDELETE_new ("can not remove user from seen announcements"); } diff --git a/swad_assignment.c b/swad_assignment.c index d55654373..15e982748 100644 --- a/swad_assignment.c +++ b/swad_assignment.c @@ -986,7 +986,6 @@ void Asg_ReqRemAssignment (void) void Asg_RemoveAssignment (void) { extern const char *Txt_Assignment_X_removed; - char *Query; struct Assignment Asg; /***** Get assignment code *****/ @@ -1004,11 +1003,9 @@ void Asg_RemoveAssignment (void) Asg_RemoveAllTheGrpsAssociatedToAnAssignment (Asg.AsgCod); /***** Remove assignment *****/ - if (asprintf (&Query,"DELETE FROM assignments" - " WHERE AsgCod=%ld AND CrsCod=%ld", - Asg.AsgCod,Gbl.CurrentCrs.Crs.CrsCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove assignment"); + DB_BuildQuery ("DELETE FROM assignments WHERE AsgCod=%ld AND CrsCod=%ld", + Asg.AsgCod,Gbl.CurrentCrs.Crs.CrsCod); + DB_QueryDELETE_new ("can not remove assignment"); /***** Mark possible notifications as removed *****/ Ntf_MarkNotifAsRemoved (Ntf_EVENT_ASSIGNMENT,Asg.AsgCod); @@ -1553,12 +1550,9 @@ bool Asg_CheckIfAsgIsAssociatedToGrp (long AsgCod,long GrpCod) static void Asg_RemoveAllTheGrpsAssociatedToAnAssignment (long AsgCod) { - char *Query; - /***** Remove groups of the assignment *****/ - if (asprintf (&Query,"DELETE FROM asg_grp WHERE AsgCod=%ld",AsgCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove the groups associated to an assignment"); + DB_BuildQuery ("DELETE FROM asg_grp WHERE AsgCod=%ld",AsgCod); + DB_QueryDELETE_new ("can not remove the groups associated to an assignment"); } /*****************************************************************************/ @@ -1567,12 +1561,10 @@ static void Asg_RemoveAllTheGrpsAssociatedToAnAssignment (long AsgCod) void Asg_RemoveGroup (long GrpCod) { - char *Query; - /***** Remove group from all the assignments *****/ - if (asprintf (&Query,"DELETE FROM asg_grp WHERE GrpCod=%ld",GrpCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove group from the associations between assignments and groups"); + DB_BuildQuery ("DELETE FROM asg_grp WHERE GrpCod=%ld",GrpCod); + DB_QueryDELETE_new ("can not remove group from the associations" + " between assignments and groups"); } /*****************************************************************************/ @@ -1581,15 +1573,13 @@ void Asg_RemoveGroup (long GrpCod) void Asg_RemoveGroupsOfType (long GrpTypCod) { - char *Query; - /***** Remove group from all the assignments *****/ - if (asprintf (&Query,"DELETE FROM asg_grp USING crs_grp,asg_grp" - " WHERE crs_grp.GrpTypCod=%ld" - " AND crs_grp.GrpCod=asg_grp.GrpCod", - GrpTypCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove groups of a type from the associations between assignments and groups"); + DB_BuildQuery ("DELETE FROM asg_grp USING crs_grp,asg_grp" + " WHERE crs_grp.GrpTypCod=%ld" + " AND crs_grp.GrpCod=asg_grp.GrpCod", + GrpTypCod); + DB_QueryDELETE_new ("can not remove groups of a type from the associations" + " between assignments and groups"); } /*****************************************************************************/ @@ -1687,20 +1677,16 @@ static void Asg_GetAndWriteNamesOfGrpsAssociatedToAsg (struct Assignment *Asg) void Asg_RemoveCrsAssignments (long CrsCod) { - char *Query; - /***** Remove groups *****/ - if (asprintf (&Query,"DELETE FROM asg_grp USING assignments,asg_grp" - " WHERE assignments.CrsCod=%ld" - " AND assignments.AsgCod=asg_grp.AsgCod", - CrsCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove all the groups associated to assignments of a course"); + DB_BuildQuery ("DELETE FROM asg_grp USING assignments,asg_grp" + " WHERE assignments.CrsCod=%ld" + " AND assignments.AsgCod=asg_grp.AsgCod", + CrsCod); + DB_QueryDELETE_new ("can not remove all the groups associated to assignments of a course"); /***** Remove assignments *****/ - if (asprintf (&Query,"DELETE FROM assignments WHERE CrsCod=%ld",CrsCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove all the assignments of a course"); + DB_BuildQuery ("DELETE FROM assignments WHERE CrsCod=%ld",CrsCod); + DB_QueryDELETE_new ("can not remove all the assignments of a course"); } /*****************************************************************************/ diff --git a/swad_attendance.c b/swad_attendance.c index 9c07460de..06e842d7f 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -1431,12 +1431,9 @@ bool Att_CheckIfAttEventIsAssociatedToGrp (long AttCod,long GrpCod) static void Att_RemoveAllTheGrpsAssociatedToAnAttEvent (long AttCod) { - char *Query; - /***** Remove groups of the attendance event *****/ - if (asprintf (&Query,"DELETE FROM att_grp WHERE AttCod=%ld",AttCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove the groups associated to an attendance event"); + DB_BuildQuery ("DELETE FROM att_grp WHERE AttCod=%ld",AttCod); + DB_QueryDELETE_new ("can not remove the groups associated to an attendance event"); } /*****************************************************************************/ @@ -1445,12 +1442,9 @@ static void Att_RemoveAllTheGrpsAssociatedToAnAttEvent (long AttCod) void Att_RemoveGroup (long GrpCod) { - char *Query; - /***** Remove group from all the attendance events *****/ - if (asprintf (&Query,"DELETE FROM att_grp WHERE GrpCod=%ld",GrpCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove group from the associations between attendance events and groups"); + DB_BuildQuery ("DELETE FROM att_grp WHERE GrpCod=%ld",GrpCod); + DB_QueryDELETE_new ("can not remove group from the associations between attendance events and groups"); } /*****************************************************************************/ @@ -1459,15 +1453,12 @@ void Att_RemoveGroup (long GrpCod) void Att_RemoveGroupsOfType (long GrpTypCod) { - char *Query; - /***** Remove group from all the attendance events *****/ - if (asprintf (&Query,"DELETE FROM att_grp USING crs_grp,att_grp" - " WHERE crs_grp.GrpTypCod=%ld" - " AND crs_grp.GrpCod=att_grp.GrpCod", - GrpTypCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove groups of a type from the associations between attendance events and groups"); + DB_BuildQuery ("DELETE FROM att_grp USING crs_grp,att_grp" + " WHERE crs_grp.GrpTypCod=%ld" + " AND crs_grp.GrpCod=att_grp.GrpCod", + GrpTypCod); + DB_QueryDELETE_new ("can not remove groups of a type from the associations between attendance events and groups"); } /*****************************************************************************/ @@ -1565,11 +1556,8 @@ static void Att_GetAndWriteNamesOfGrpsAssociatedToAttEvent (struct AttendanceEve static void Att_RemoveAllUsrsFromAnAttEvent (long AttCod) { - char *Query; - - if (asprintf (&Query,"DELETE FROM att_usr WHERE AttCod=%ld",AttCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove attendance event"); + DB_BuildQuery ("DELETE FROM att_usr WHERE AttCod=%ld",AttCod); + DB_QueryDELETE_new ("can not remove attendance event"); } /*****************************************************************************/ @@ -1578,12 +1566,9 @@ static void Att_RemoveAllUsrsFromAnAttEvent (long AttCod) void Att_RemoveUsrFromAllAttEvents (long UsrCod) { - char *Query; - /***** Remove group from all the attendance events *****/ - if (asprintf (&Query,"DELETE FROM att_usr WHERE UsrCod=%ld",UsrCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove user from all attendance events"); + DB_BuildQuery ("DELETE FROM att_usr WHERE UsrCod=%ld",UsrCod); + DB_QueryDELETE_new ("can not remove user from all attendance events"); } /*****************************************************************************/ @@ -1592,16 +1577,13 @@ void Att_RemoveUsrFromAllAttEvents (long UsrCod) void Att_RemoveUsrFromCrsAttEvents (long UsrCod,long CrsCod) { - char *Query; - /***** Remove group from all the attendance events *****/ - if (asprintf (&Query,"DELETE FROM att_usr USING att_events,att_usr" - " WHERE att_events.CrsCod=%ld" - " AND att_events.AttCod=att_usr.AttCod" - " AND att_usr.UsrCod=%ld", - CrsCod,UsrCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove user from attendance events of a course"); + DB_BuildQuery ("DELETE FROM att_usr USING att_events,att_usr" + " WHERE att_events.CrsCod=%ld" + " AND att_events.AttCod=att_usr.AttCod" + " AND att_usr.UsrCod=%ld", + CrsCod,UsrCod); + DB_QueryDELETE_new ("can not remove user from attendance events of a course"); } /*****************************************************************************/ @@ -1610,13 +1592,10 @@ void Att_RemoveUsrFromCrsAttEvents (long UsrCod,long CrsCod) static void Att_RemoveAttEventFromCurrentCrs (long AttCod) { - char *Query; - - if (asprintf (&Query,"DELETE FROM att_events" - " WHERE AttCod=%ld AND CrsCod=%ld", - AttCod,Gbl.CurrentCrs.Crs.CrsCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove attendance event"); + DB_BuildQuery ("DELETE FROM att_events" + " WHERE AttCod=%ld AND CrsCod=%ld", + AttCod,Gbl.CurrentCrs.Crs.CrsCod); + DB_QueryDELETE_new ("can not remove attendance event"); } /*****************************************************************************/ @@ -1625,29 +1604,23 @@ static void Att_RemoveAttEventFromCurrentCrs (long AttCod) void Att_RemoveCrsAttEvents (long CrsCod) { - char *Query; - /***** Remove students *****/ - if (asprintf (&Query,"DELETE FROM att_usr USING att_events,att_usr" - " WHERE att_events.CrsCod=%ld" - " AND att_events.AttCod=att_usr.AttCod", - CrsCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove all the students registered in events of a course"); + DB_BuildQuery ("DELETE FROM att_usr USING att_events,att_usr" + " WHERE att_events.CrsCod=%ld" + " AND att_events.AttCod=att_usr.AttCod", + CrsCod); + DB_QueryDELETE_new ("can not remove all the students registered in events of a course"); /***** Remove groups *****/ - if (asprintf (&Query,"DELETE FROM att_grp USING att_events,att_grp" - " WHERE att_events.CrsCod=%ld" - " AND att_events.AttCod=att_grp.AttCod", - CrsCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove all the groups associated to attendance events of a course"); + DB_BuildQuery ("DELETE FROM att_grp USING att_events,att_grp" + " WHERE att_events.CrsCod=%ld" + " AND att_events.AttCod=att_grp.AttCod", + CrsCod); + DB_QueryDELETE_new ("can not remove all the groups associated to attendance events of a course"); /***** Remove attendance events *****/ - if (asprintf (&Query,"DELETE FROM att_events WHERE CrsCod=%ld", - CrsCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove all the attendance events of a course"); + DB_BuildQuery ("DELETE FROM att_events WHERE CrsCod=%ld",CrsCod); + DB_QueryDELETE_new ("can not remove all the attendance events of a course"); } /*****************************************************************************/ @@ -2634,16 +2607,13 @@ static void Att_RemoveUsrFromAttEvent (long AttCod,long UsrCod) void Att_RemoveUsrsAbsentWithoutCommentsFromAttEvent (long AttCod) { - char *Query; - /***** Clean table att_usr *****/ - if (asprintf (&Query,"DELETE FROM att_usr" - " WHERE AttCod=%ld AND Present='N'" - " AND CommentStd='' AND CommentTch=''", - AttCod) < 0) - Lay_NotEnoughMemoryExit (); - DB_QueryDELETE_free (Query,"can not remove users absent" - " without comments from an event"); + DB_BuildQuery ("DELETE FROM att_usr" + " WHERE AttCod=%ld AND Present='N'" + " AND CommentStd='' AND CommentTch=''", + AttCod); + DB_QueryDELETE_new ("can not remove users absent" + " without comments from an event"); } /*****************************************************************************/ diff --git a/swad_changelog.h b/swad_changelog.h index 3336058a6..c9c085f21 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -355,10 +355,11 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.8.14 (2018-10-28)" +#define Log_PLATFORM_VERSION "SWAD 18.8.15 (2018-10-28)" #define CSS_FILE "swad18.4.css" #define JS_FILE "swad17.17.1.js" /* + Version 18.8.15: Oct 28, 2018 Some asprintf for database queries changed by internal function. (236425 lines) Version 18.8.14: Oct 28, 2018 Some asprintf for database queries changed by internal function. (236493 lines) Version 18.8.13: Oct 27, 2018 Some asprintf for database queries changed by internal function. (236661 lines) Version 18.8.12: Oct 27, 2018 Some asprintf for database queries changed by internal function. (236870 lines)