diff --git a/swad_changelog.h b/swad_changelog.h index bd16ca4a1..e5c346174 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -600,13 +600,14 @@ TODO: Salvador Romero Cort TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria. */ -#define Log_PLATFORM_VERSION "SWAD 20.56 (2021-04-04)" +#define Log_PLATFORM_VERSION "SWAD 20.56.1 (2021-04-04)" #define CSS_FILE "swad20.45.css" #define JS_FILE "swad20.6.2.js" /* TODO: Rename CENTRE to CENTER in help wiki. TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams + Version 20.56.1: Apr 04, 2021 Optimizations in database selects. (309252 lines) Version 20.56: Apr 04, 2021 Optimizations in database selects. (309296 lines) Version 20.55: Apr 04, 2021 Optimizations in database selects. (309500 lines) Version 20.54: Mar 30, 2021 Statistics about agendas. (309539 lines) diff --git a/swad_game.c b/swad_game.c index 71d63dc5e..74fc4a1d0 100644 --- a/swad_game.c +++ b/swad_game.c @@ -1138,7 +1138,7 @@ static void Gam_GetGameTxtFromDB (long GamCod,char Txt[Cns_MAX_BYTES_TEXT + 1]) /***** Get text of game from database *****/ NumRows = DB_QuerySELECT (&mysql_res,"can not get game text", - "SELECT Txt" + "SELECT Txt" // row[0] " FROM gam_games" " WHERE GamCod=%ld", GamCod); @@ -1878,27 +1878,19 @@ static unsigned Gam_GetQstIndFromQstCod (long GamCod,long QstCod) long Gam_GetQstCodFromQstInd (long GamCod,unsigned QstInd) { - MYSQL_RES *mysql_res; - MYSQL_ROW row; long QstCod; /***** Get question code of the question to be moved up *****/ - if (!DB_QuerySELECT (&mysql_res,"can not get question code", - "SELECT QstCod" - " FROM gam_questions" - " WHERE GamCod=%ld" - " AND QstInd=%u", - GamCod,QstInd)) + QstCod = DB_QuerySELECTCode ("can not get question code", + "SELECT QstCod" + " FROM gam_questions" + " WHERE GamCod=%ld" + " AND QstInd=%u", + GamCod, + QstInd); + if (QstCod <= 0) Lay_ShowErrorAndExit ("Error: wrong question index."); - /***** Get question code (row[0]) *****/ - row = mysql_fetch_row (mysql_res); - if ((QstCod = Str_ConvertStrCodToLongCod (row[0])) <= 0) - Lay_ShowErrorAndExit ("Error: wrong question code."); - - /***** Free structure that stores the query result *****/ - DB_FreeMySQLResult (&mysql_res); - return QstCod; } @@ -1916,7 +1908,7 @@ static unsigned Gam_GetMaxQuestionIndexInGame (long GamCod) /***** Get maximum question index in a game from database *****/ DB_QuerySELECT (&mysql_res,"can not get last question index", - "SELECT MAX(QstInd)" + "SELECT MAX(QstInd)" // row[0] " FROM gam_questions" " WHERE GamCod=%ld", GamCod); @@ -1984,7 +1976,7 @@ unsigned Gam_GetNextQuestionIndexInGame (long GamCod,unsigned QstInd) // Although indexes are always continuous... // ...this implementation works even with non continuous indexes if (!DB_QuerySELECT (&mysql_res,"can not get next question index", - "SELECT MIN(QstInd)" + "SELECT MIN(QstInd)" // row[0] " FROM gam_questions" " WHERE GamCod=%ld" " AND QstInd>%u", @@ -2834,7 +2826,7 @@ double Gam_GetNumQstsPerCrsGame (Hie_Lvl_Level_t Scope) { case Hie_Lvl_SYS: DB_QuerySELECT (&mysql_res,"can not get number of questions per game", - "SELECT AVG(NumQsts)" + "SELECT AVG(NumQsts)" // row[0] " FROM (SELECT COUNT(gam_questions.QstCod) AS NumQsts" " FROM gam_games," "gam_questions" @@ -2843,7 +2835,7 @@ double Gam_GetNumQstsPerCrsGame (Hie_Lvl_Level_t Scope) break; case Hie_Lvl_CTY: DB_QuerySELECT (&mysql_res,"can not get number of questions per game", - "SELECT AVG(NumQsts)" + "SELECT AVG(NumQsts)" // row[0] " FROM (SELECT COUNT(gam_questions.QstCod) AS NumQsts" " FROM ins_instits," "ctr_centers," @@ -2862,7 +2854,7 @@ double Gam_GetNumQstsPerCrsGame (Hie_Lvl_Level_t Scope) break; case Hie_Lvl_INS: DB_QuerySELECT (&mysql_res,"can not get number of questions per game", - "SELECT AVG(NumQsts)" + "SELECT AVG(NumQsts)" // row[0] " FROM (SELECT COUNT(gam_questions.QstCod) AS NumQsts" " FROM ctr_centers," "deg_degrees," @@ -2879,7 +2871,7 @@ double Gam_GetNumQstsPerCrsGame (Hie_Lvl_Level_t Scope) break; case Hie_Lvl_CTR: DB_QuerySELECT (&mysql_res,"can not get number of questions per game", - "SELECT AVG(NumQsts)" + "SELECT AVG(NumQsts)" // row[0] " FROM (SELECT COUNT(gam_questions.QstCod) AS NumQsts" " FROM deg_degrees," "crs_courses," @@ -2894,7 +2886,7 @@ double Gam_GetNumQstsPerCrsGame (Hie_Lvl_Level_t Scope) break; case Hie_Lvl_DEG: DB_QuerySELECT (&mysql_res,"can not get number of questions per game", - "SELECT AVG(NumQsts)" + "SELECT AVG(NumQsts)" // row[0] " FROM (SELECT COUNT(gam_questions.QstCod) AS NumQsts" " FROM crs_courses," "gam_games," @@ -2907,7 +2899,7 @@ double Gam_GetNumQstsPerCrsGame (Hie_Lvl_Level_t Scope) break; case Hie_Lvl_CRS: DB_QuerySELECT (&mysql_res,"can not get number of questions per game", - "SELECT AVG(NumQsts)" + "SELECT AVG(NumQsts)" // row[0] " FROM (SELECT COUNT(gam_questions.QstCod) AS NumQsts" " FROM gam_games," "gam_questions" @@ -2964,39 +2956,22 @@ void Gam_ShowTstTagsPresentInAGame (long GamCod) void Gam_GetScoreRange (long GamCod,double *MinScore,double *MaxScore) { - MYSQL_RES *mysql_res; - MYSQL_ROW row; - unsigned NumRows; - unsigned NumRow; unsigned NumAnswers; /***** Get maximum score of a game from database *****/ - NumRows = (unsigned) - DB_QuerySELECT (&mysql_res,"can not get data of a question", - "SELECT COUNT(tst_answers.AnsInd) AS N" - " FROM tst_answers," - "gam_questions" - " WHERE gam_questions.GamCod=%ld" - " AND gam_questions.QstCod=tst_answers.QstCod" - " GROUP BY tst_answers.QstCod", - GamCod); - for (NumRow = 0, *MinScore = *MaxScore = 0.0; - NumRow < NumRows; - NumRow++) - { - row = mysql_fetch_row (mysql_res); + NumAnswers = DB_QueryCOUNT ("can not number of answers of a question", + "SELECT COUNT(tst_answers.AnsInd)" + " FROM tst_answers," + "gam_questions" + " WHERE gam_questions.GamCod=%ld" + " AND gam_questions.QstCod=tst_answers.QstCod" + " GROUP BY tst_answers.QstCod", + GamCod); + if (NumAnswers < 2) + Lay_ShowErrorAndExit ("Wrong number of answers."); - /* Get min answers (row[0]) */ - if (sscanf (row[0],"%u",&NumAnswers) != 1) - NumAnswers = 0; - - /* Accumulate minimum and maximum score */ - if (NumAnswers < 2) - Lay_ShowErrorAndExit ("Wrong number of answers."); - *MinScore += -1.0 / (double) (NumAnswers - 1); - *MaxScore += 1.0; - } - - /***** Free structure that stores the query result *****/ - DB_FreeMySQLResult (&mysql_res); + /***** Set minimum and maximum scores *****/ + *MinScore = *MaxScore = 0.0; + *MinScore += -1.0 / (double) (NumAnswers - 1); + *MaxScore += 1.0; } diff --git a/swad_group.c b/swad_group.c index 851fa6fd9..8377ab835 100644 --- a/swad_group.c +++ b/swad_group.c @@ -2768,56 +2768,54 @@ void Grp_GetListGrpTypesInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes) switch (WhichGroupTypes) { case Grp_ONLY_GROUP_TYPES_WITH_GROUPS: - Gbl.Crs.Grps.GrpTypes.Num = - (unsigned) DB_QuerySELECT (&mysql_res,"can not get types of group" - " of a course", - "SELECT grp_types.GrpTypCod," - "grp_types.GrpTypName," - "grp_types.Mandatory," - "grp_types.Multiple," - "grp_types.MustBeOpened," - "UNIX_TIMESTAMP(grp_types.OpenTime)," - "COUNT(grp_groups.GrpCod)" - " FROM grp_types," - "grp_groups" - " WHERE grp_types.CrsCod=%ld" - " AND grp_types.GrpTypCod=grp_groups.GrpTypCod" - " GROUP BY grp_types.GrpTypCod" - " ORDER BY grp_types.GrpTypName", - Gbl.Hierarchy.Crs.CrsCod); + Gbl.Crs.Grps.GrpTypes.Num = (unsigned) + DB_QuerySELECT (&mysql_res,"can not get types of group of a course", + "SELECT grp_types.GrpTypCod," // row[0] + "grp_types.GrpTypName," // row[1] + "grp_types.Mandatory," // row[2] + "grp_types.Multiple," // row[3] + "grp_types.MustBeOpened," // row[4] + "UNIX_TIMESTAMP(grp_types.OpenTime)," // row[5] + "COUNT(grp_groups.GrpCod)" // row[6] + " FROM grp_types," + "grp_groups" + " WHERE grp_types.CrsCod=%ld" + " AND grp_types.GrpTypCod=grp_groups.GrpTypCod" + " GROUP BY grp_types.GrpTypCod" + " ORDER BY grp_types.GrpTypName", + Gbl.Hierarchy.Crs.CrsCod); break; case Grp_ALL_GROUP_TYPES: - Gbl.Crs.Grps.GrpTypes.Num = - (unsigned) DB_QuerySELECT (&mysql_res,"can not get types of group" - " of a course", - "(SELECT grp_types.GrpTypCod," - "grp_types.GrpTypName AS GrpTypName," - "grp_types.Mandatory," - "grp_types.Multiple," - "grp_types.MustBeOpened," - "UNIX_TIMESTAMP(grp_types.OpenTime)," - "COUNT(grp_groups.GrpCod)" - " FROM grp_types," - "grp_groups" - " WHERE grp_types.CrsCod=%ld" - " AND grp_types.GrpTypCod=grp_groups.GrpTypCod" - " GROUP BY grp_types.GrpTypCod)" - " UNION " - "(SELECT GrpTypCod," - "GrpTypName," - "Mandatory," - "Multiple," - "MustBeOpened," - "UNIX_TIMESTAMP(OpenTime)," - "0" - " FROM grp_types" - " WHERE CrsCod=%ld" - " AND GrpTypCod NOT IN" - " (SELECT GrpTypCod" - " FROM grp_groups))" - " ORDER BY GrpTypName", - Gbl.Hierarchy.Crs.CrsCod, - Gbl.Hierarchy.Crs.CrsCod); + Gbl.Crs.Grps.GrpTypes.Num = (unsigned) + DB_QuerySELECT (&mysql_res,"can not get types of group of a course", + "(SELECT grp_types.GrpTypCod," // row[0] + "grp_types.GrpTypName AS GrpTypName," // row[1] + "grp_types.Mandatory," // row[2] + "grp_types.Multiple," // row[3] + "grp_types.MustBeOpened," // row[4] + "UNIX_TIMESTAMP(grp_types.OpenTime)," // row[5] + "COUNT(grp_groups.GrpCod)" // row[6] + " FROM grp_types," + "grp_groups" + " WHERE grp_types.CrsCod=%ld" + " AND grp_types.GrpTypCod=grp_groups.GrpTypCod" + " GROUP BY grp_types.GrpTypCod)" + " UNION " + "(SELECT GrpTypCod," // row[0] + "GrpTypName," // row[1] + "Mandatory," // row[2] + "Multiple," // row[3] + "MustBeOpened," // row[4] + "UNIX_TIMESTAMP(OpenTime)," // row[5] + "0" + " FROM grp_types" + " WHERE CrsCod=%ld" + " AND GrpTypCod NOT IN" + " (SELECT GrpTypCod" + " FROM grp_groups))" + " ORDER BY GrpTypName", + Gbl.Hierarchy.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod); break; } @@ -2884,30 +2882,26 @@ void Grp_GetListGrpTypesInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes) void Grp_OpenGroupsAutomatically (void) { MYSQL_RES *mysql_res; - MYSQL_ROW row; unsigned NumGrpTypes; unsigned NumGrpTyp; long GrpTypCod; /***** Find group types to be opened *****/ - NumGrpTypes = - (unsigned) DB_QuerySELECT (&mysql_res,"can not get the types of group" - " to be opened", - "SELECT GrpTypCod" - " FROM grp_types" - " WHERE CrsCod=%ld" - " AND MustBeOpened='Y'" - " AND OpenTime<=NOW()", - Gbl.Hierarchy.Crs.CrsCod); + NumGrpTypes = (unsigned) + DB_QuerySELECT (&mysql_res,"can not get the types of group to be opened", + "SELECT GrpTypCod" + " FROM grp_types" + " WHERE CrsCod=%ld" + " AND MustBeOpened='Y'" + " AND OpenTime<=NOW()", + Gbl.Hierarchy.Crs.CrsCod); for (NumGrpTyp = 0; NumGrpTyp < NumGrpTypes; NumGrpTyp++) { /* Get next group TYPE */ - row = mysql_fetch_row (mysql_res); - - if ((GrpTypCod = Str_ConvertStrCodToLongCod (row[0])) > 0) + if ((GrpTypCod = DB_GetNextCode (mysql_res)) > 0) { /***** Open all the closed groups in this course the must be opened and with open time in the past ****/ @@ -3123,15 +3117,15 @@ static void Grp_GetDataOfGroupTypeByCod (struct GroupType *GrpTyp) /***** Get data of a type of group from database *****/ if (DB_QuerySELECT (&mysql_res,"can not get type of group", - "SELECT GrpTypName," // row[0] - "Mandatory," // row[1] - "Multiple," // row[2] - "MustBeOpened," // row[3] - "UNIX_TIMESTAMP(OpenTime)" // row[4] - " FROM grp_types" - " WHERE CrsCod=%ld" - " AND GrpTypCod=%ld", - Gbl.Hierarchy.Crs.CrsCod,GrpTyp->GrpTypCod) != 1) + "SELECT GrpTypName," // row[0] + "Mandatory," // row[1] + "Multiple," // row[2] + "MustBeOpened," // row[3] + "UNIX_TIMESTAMP(OpenTime)" // row[4] + " FROM grp_types" + " WHERE CrsCod=%ld" + " AND GrpTypCod=%ld", + Gbl.Hierarchy.Crs.CrsCod,GrpTyp->GrpTypCod) != 1) Lay_ShowErrorAndExit ("Error when getting type of group."); /***** Get some data of group type *****/ @@ -3159,7 +3153,7 @@ static bool Grp_GetMultipleEnrolmentOfAGroupType (long GrpTypCod) /***** Get data of a type of group from database *****/ if (DB_QuerySELECT (&mysql_res,"can not get if type of group" " has multiple enrolment", - "SELECT Multiple" + "SELECT Multiple" // row[0] " FROM grp_types" " WHERE GrpTypCod=%ld", GrpTypCod) != 1) @@ -3204,8 +3198,8 @@ void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat) NumRows = DB_QuerySELECT (&mysql_res,"can not get data of a group", "SELECT grp_groups.GrpTypCod," // row[0] "grp_types.CrsCod," // row[1] - "grp_types.GrpTypName," // row[2] - "grp_types.Multiple," // row[3] + "grp_types.GrpTypName," // row[2] + "grp_types.Multiple," // row[3] "grp_groups.GrpName," // row[4] "grp_groups.RooCod," // row[5] "roo_rooms.ShortName," // row[6] @@ -3273,27 +3267,17 @@ void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat) static long Grp_GetTypeOfGroupOfAGroup (long GrpCod) { - MYSQL_RES *mysql_res; - MYSQL_ROW row; long GrpTypCod; - /***** Get data of a group from database *****/ - if (DB_QuerySELECT (&mysql_res,"can not get the type of a group", - "SELECT GrpTypCod" - " FROM grp_groups" - " WHERE GrpCod=%ld", - GrpCod) != 1) + /***** Get group type of a group from database *****/ + GrpTypCod = DB_QuerySELECTCode ("can not get the type of a group", + "SELECT GrpTypCod" + " FROM grp_groups" + " WHERE GrpCod=%ld", + GrpCod); + if (GrpTypCod <= 0) Lay_ShowErrorAndExit ("Error when getting group."); - /***** Get data of group *****/ - row = mysql_fetch_row (mysql_res); - /* Get the code of the group type (row[0]) */ - if ((GrpTypCod = Str_ConvertStrCodToLongCod (row[0])) < 0) - Lay_ShowErrorAndExit ("Wrong code of type of group."); - - /***** Free structure that stores the query result *****/ - DB_FreeMySQLResult (&mysql_res); - return GrpTypCod; } @@ -3621,51 +3605,47 @@ static void Grp_GetLstCodGrpsUsrBelongs (long CrsCod,long GrpTypCod, long UsrCod,struct ListCodGrps *LstGrps) { MYSQL_RES *mysql_res; - MYSQL_ROW row; unsigned NumGrp; /***** Get groups which a user belong to from database *****/ if (CrsCod < 0) // Query the groups from all the user's courses - LstGrps->NumGrps = - (unsigned) DB_QuerySELECT (&mysql_res,"can not get the groups" - " which a user belongs to", - "SELECT GrpCod" - " FROM grp_users" - " WHERE UsrCod=%ld", // Groups will be unordered - UsrCod); + LstGrps->NumGrps = (unsigned) + DB_QuerySELECT (&mysql_res,"can not get the groups which a user belongs to", + "SELECT GrpCod" // row[0] + " FROM grp_users" + " WHERE UsrCod=%ld", // Groups will be unordered + UsrCod); else if (GrpTypCod < 0) // Query the groups of any type in the course - LstGrps->NumGrps = - (unsigned) DB_QuerySELECT (&mysql_res,"can not get the groups" - " which a user belongs to", - "SELECT grp_groups.GrpCod" - " FROM grp_types," - "grp_groups," - "grp_users" - " WHERE grp_types.CrsCod=%ld" - " AND grp_types.GrpTypCod=grp_groups.GrpTypCod" - " AND grp_groups.GrpCod=grp_users.GrpCod" - " AND grp_users.UsrCod=%ld" - " ORDER BY grp_types.GrpTypName," - "grp_groups.GrpName", - Gbl.Hierarchy.Crs.CrsCod, - UsrCod); + LstGrps->NumGrps = (unsigned) + DB_QuerySELECT (&mysql_res,"can not get the groups which a user belongs to", + "SELECT grp_groups.GrpCod" // row[0] + " FROM grp_types," + "grp_groups," + "grp_users" + " WHERE grp_types.CrsCod=%ld" + " AND grp_types.GrpTypCod=grp_groups.GrpTypCod" + " AND grp_groups.GrpCod=grp_users.GrpCod" + " AND grp_users.UsrCod=%ld" + " ORDER BY grp_types.GrpTypName," + "grp_groups.GrpName", + Gbl.Hierarchy.Crs.CrsCod, + UsrCod); else // Query only the groups of specified type in the course - LstGrps->NumGrps = - (unsigned) DB_QuerySELECT (&mysql_res,"can not get the groups" - " which a user belongs to", - "SELECT grp_groups.GrpCod" - " FROM grp_types," - "grp_groups," - "grp_users" - " WHERE grp_types.CrsCod=%ld" - " AND grp_types.GrpTypCod=%ld" - " AND grp_types.GrpTypCod=grp_groups.GrpTypCod" - " AND grp_groups.GrpCod=grp_users.GrpCod" - " AND grp_users.UsrCod=%ld" - " ORDER BY grp_groups.GrpName", - Gbl.Hierarchy.Crs.CrsCod, - GrpTypCod, - UsrCod); + LstGrps->NumGrps = (unsigned) + DB_QuerySELECT (&mysql_res,"can not get the groups which a user belongs to", + "SELECT grp_groups.GrpCod" // row[0] + " FROM grp_types," + "grp_groups," + "grp_users" + " WHERE grp_types.CrsCod=%ld" + " AND grp_types.GrpTypCod=%ld" + " AND grp_types.GrpTypCod=grp_groups.GrpTypCod" + " AND grp_groups.GrpCod=grp_users.GrpCod" + " AND grp_users.UsrCod=%ld" + " ORDER BY grp_groups.GrpName", + Gbl.Hierarchy.Crs.CrsCod, + GrpTypCod, + UsrCod); /***** Get the groups *****/ if (LstGrps->NumGrps) @@ -3677,13 +3657,9 @@ static void Grp_GetLstCodGrpsUsrBelongs (long CrsCod,long GrpTypCod, for (NumGrp = 0; NumGrp < LstGrps->NumGrps; NumGrp++) - { - row = mysql_fetch_row (mysql_res); - /* Get the code of group (row[0]) */ - if ((LstGrps->GrpCods[NumGrp] = Str_ConvertStrCodToLongCod (row[0])) < 0) + if ((LstGrps->GrpCods[NumGrp] = DB_GetNextCode (mysql_res)) < 0) Lay_ShowErrorAndExit ("Wrong code of group."); - } } /***** Free structure that stores the query result *****/ @@ -3697,25 +3673,24 @@ static void Grp_GetLstCodGrpsUsrBelongs (long CrsCod,long GrpTypCod, void Grp_GetLstCodGrpsWithFileZonesIBelong (struct ListCodGrps *LstGrps) { MYSQL_RES *mysql_res; - MYSQL_ROW row; unsigned NumGrp; /***** Get groups which I belong to from database *****/ - LstGrps->NumGrps = - (unsigned) DB_QuerySELECT (&mysql_res,"can not get the groups" - " which you belong to", - "SELECT grp_groups.GrpCod" - " FROM grp_types," - "grp_groups," - "grp_users" - " WHERE grp_types.CrsCod=%ld" - " AND grp_types.GrpTypCod=grp_groups.GrpTypCod" - " AND grp_groups.FileZones='Y'" - " AND grp_groups.GrpCod=grp_users.GrpCod" - " AND grp_users.UsrCod=%ld" - " ORDER BY grp_types.GrpTypName," - "grp_groups.GrpName", - Gbl.Hierarchy.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod); + LstGrps->NumGrps = (unsigned) + DB_QuerySELECT (&mysql_res,"can not get the groups which you belong to", + "SELECT grp_groups.GrpCod" // row[0] + " FROM grp_types," + "grp_groups," + "grp_users" + " WHERE grp_types.CrsCod=%ld" + " AND grp_types.GrpTypCod=grp_groups.GrpTypCod" + " AND grp_groups.FileZones='Y'" + " AND grp_groups.GrpCod=grp_users.GrpCod" + " AND grp_users.UsrCod=%ld" + " ORDER BY grp_types.GrpTypName," + "grp_groups.GrpName", + Gbl.Hierarchy.Crs.CrsCod, + Gbl.Usrs.Me.UsrDat.UsrCod); /***** Get the groups *****/ if (LstGrps->NumGrps) @@ -3727,13 +3702,9 @@ void Grp_GetLstCodGrpsWithFileZonesIBelong (struct ListCodGrps *LstGrps) for (NumGrp = 0; NumGrp < LstGrps->NumGrps; NumGrp++) - { - row = mysql_fetch_row (mysql_res); - - /* Get the code of group (row[0]) */ - if ((LstGrps->GrpCods[NumGrp] = Str_ConvertStrCodToLongCod (row[0])) < 0) + /* Get the code of group */ + if ((LstGrps->GrpCods[NumGrp] = DB_GetNextCode (mysql_res)) < 0) Lay_ShowErrorAndExit ("Wrong code of group."); - } } /***** Free structure that stores the query result *****/ @@ -3772,7 +3743,7 @@ void Grp_GetNamesGrpsStdBelongsTo (long GrpTypCod,long UsrCod,char *GroupNames) /***** Get the names of groups which a user belongs to, from database *****/ NumRows = DB_QuerySELECT (&mysql_res,"can not get the names of groups" " a user belongs to", - "SELECT grp_groups.GrpName" + "SELECT grp_groups.GrpName" // row[0] " FROM grp_groups," "grp_users" " WHERE grp_groups.GrpTypCod=%ld"