Version 20.65.1: Apr 17, 2021 Code refactoring in database replaces.

This commit is contained in:
acanas 2021-04-17 11:27:33 +02:00
parent dcac830080
commit 0a664e61f1
59 changed files with 471 additions and 318 deletions

View File

@ -544,7 +544,9 @@ static int API_GenerateNewWSKey (struct soap *soap,
" (WSKey,UsrCod,PlgCod,LastTime)"
" VALUES"
" ('%s',%ld,%ld,NOW())",
WSKey,UsrCod,Gbl.WebService.PlgCod);
WSKey,
UsrCod,
Gbl.WebService.PlgCod);
return SOAP_OK;
}
@ -1135,31 +1137,9 @@ int swad__getAvailableRoles (struct soap *soap,
Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role;
/***** Return available roles *****/
/*
DB_QueryINSERT ("can not debug",
"INSERT INTO dbg_debug"
" (DebugTime,Txt)"
" VALUES"
" (NOW(),'Gbl.Usrs.Me.Role.Available before Rol_SetMyRoles: %u')",
Gbl.Usrs.Me.Role.Available);
*/
Rol_SetMyRoles ();
getAvailableRolesOut->roles = Gbl.Usrs.Me.Role.Available;
/*
DB_QueryINSERT ("can not debug",
"INSERT INTO dbg_debug"
" (DebugTime,Txt)"
" VALUES"
" (NOW(),'Gbl.Usrs.Me.Role.Available after Rol_SetMyRoles: %u')",
Gbl.Usrs.Me.Role.Available);
DB_QueryINSERT ("can not debug",
"INSERT INTO dbg_debug"
" (DebugTime,Txt)"
" VALUES"
" (NOW(),'getAvailableRolesOut->roles: %d')",
getAvailableRolesOut->roles);
*/
return SOAP_OK;
}
@ -3794,7 +3774,8 @@ static int API_SendMessageToUsr (long OriginalMsgCod,
" (Subject,Content,MedCod)"
" VALUES"
" ('%s','%s',-1)",
Subject,Content);
Subject,
Content);
/* Insert message in sent messages */
DB_QueryINSERT ("can not create message",
@ -3802,7 +3783,8 @@ static int API_SendMessageToUsr (long OriginalMsgCod,
" (MsgCod,CrsCod,UsrCod,Expanded,CreatTime)"
" VALUES"
" (%ld,-1,%ld,'N',NOW())",
NewMsgCod,SenderUsrCod);
NewMsgCod,
SenderUsrCod);
MsgAlreadyInserted = true;
}
@ -3813,7 +3795,8 @@ static int API_SendMessageToUsr (long OriginalMsgCod,
" (MsgCod,UsrCod,Notified,Open,Replied,Expanded)"
" VALUES"
" (%ld,%ld,'%c','N','N','N')",
NewMsgCod,RecipientUsrCod,
NewMsgCod,
RecipientUsrCod,
NotifyByEmail ? 'Y' :
'N');
@ -6047,7 +6030,8 @@ int swad__sendMyLocation (struct soap *soap,
"NOW()"
" FROM roo_rooms"
" WHERE RooCod=%d", // Check that room exists
Gbl.Usrs.Me.UsrDat.UsrCod,roomCode);
Gbl.Usrs.Me.UsrDat.UsrCod,
roomCode);
/***** Return notification code *****/
sendMyLocationOut->success = (ChkCod > 0) ? 1 : 0;

View File

@ -856,7 +856,8 @@ static void ID_RemoveUsrIDFromDB (long UsrCod,const char *UsrID)
"DELETE FROM usr_ids"
" WHERE UsrCod=%ld"
" AND UsrID='%s'",
UsrCod,UsrID);
UsrCod,
UsrID);
}
/*****************************************************************************/
@ -995,7 +996,8 @@ static void ID_InsertANewUsrIDInDB (long UsrCod,const char *NewID,bool Confirmed
" (UsrCod,UsrID,CreatTime,Confirmed)"
" VALUES"
" (%ld,'%s',NOW(),'%c')",
UsrCod,NewID,
UsrCod,
NewID,
Confirmed ? 'Y' :
'N');
}

View File

@ -374,7 +374,9 @@ void MFU_UpdateMFUActions (void)
" (UsrCod,ActCod,Score,LastClick)"
" VALUES"
" (%ld,%ld,'%15lg',NOW())",
Gbl.Usrs.Me.UsrDat.UsrCod,ActCod,Score);
Gbl.Usrs.Me.UsrDat.UsrCod,
ActCod,
Score);
/***** Update score for other actions *****/
DB_QueryUPDATE ("can not update most frequently used actions",
@ -382,8 +384,10 @@ void MFU_UpdateMFUActions (void)
" SET Score=GREATEST(Score*'%.15lg','%.15lg')"
" WHERE UsrCod=%ld"
" AND ActCod<>%ld",
MFU_DECREASE_FACTOR,MFU_MIN_SCORE,
Gbl.Usrs.Me.UsrDat.UsrCod,ActCod);
MFU_DECREASE_FACTOR,
MFU_MIN_SCORE,
Gbl.Usrs.Me.UsrDat.UsrCod,
ActCod);
Str_SetDecimalPointToLocal (); // Return to local system
}

View File

@ -756,25 +756,27 @@ void Acc_CreateNewUsr (struct UsrData *UsrDat,bool CreatingMyOwnAccount)
DB_QueryINSERTandReturnCode ("can not create user",
"INSERT INTO usr_data"
" (EncryptedUsrCod,Password,"
"Surname1,Surname2,FirstName,Sex,"
"Theme,IconSet,Language,FirstDayOfWeek,DateFormat,"
"PhotoVisibility,BaPrfVisibility,ExPrfVisibility,"
"CtyCod,"
"LocalPhone,FamilyPhone,"
"Birthday,Comments,"
"Menu,SideCols,NotifNtfEvents,EmailNtfEvents)"
"Surname1,Surname2,FirstName,Sex,"
"Theme,IconSet,Language,FirstDayOfWeek,DateFormat,"
"PhotoVisibility,BaPrfVisibility,ExPrfVisibility,"
"CtyCod,"
"LocalPhone,FamilyPhone,"
"Birthday,Comments,"
"Menu,SideCols,NotifNtfEvents,EmailNtfEvents)"
" VALUES"
" ('%s','%s',"
"'%s','%s','%s','%s',"
"'%s','%s','%s',%u,%u,"
"'%s','%s','%s',"
"%ld,"
"'%s','%s',"
"%s,'%s',"
"%u,%u,-1,0)",
"'%s','%s','%s','%s',"
"'%s','%s','%s',%u,%u,"
"'%s','%s','%s',"
"%ld,"
"'%s','%s',"
"%s,'%s',"
"%u,%u,-1,0)",
UsrDat->EnUsrCod,
UsrDat->Password,
UsrDat->Surname1,UsrDat->Surname2,UsrDat->FrstName,
UsrDat->Surname1,
UsrDat->Surname2,
UsrDat->FrstName,
Usr_StringsSexDB[UsrDat->Sex],
The_ThemeId[UsrDat->Prefs.Theme],
Ico_IconSetId[UsrDat->Prefs.IconSet],

View File

@ -1782,10 +1782,11 @@ static void Agd_CreateEvent (struct Agd_Event *AgdEvent,const char *Txt)
AgdEvent->AgdCod =
DB_QueryINSERTandReturnCode ("can not create new event",
"INSERT INTO agd_agendas"
" (UsrCod,StartTime,EndTime,Event,Location,Txt)"
" (UsrCod,StartTime,EndTime,"
"Event,Location,Txt)"
" VALUES"
" (%ld,FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
"'%s','%s','%s')",
"'%s','%s','%s')",
AgdEvent->UsrCod,
AgdEvent->TimeUTC[Dat_START_TIME],
AgdEvent->TimeUTC[Dat_END_TIME ],

View File

@ -525,7 +525,9 @@ static void Ann_CreateAnnouncement (unsigned Roles,const char *Subject,const cha
" (Roles,Subject,Content)"
" VALUES"
" (%u,'%s','%s')",
Roles,Subject,Content);
Roles,
Subject,
Content);
}
/*****************************************************************************/
@ -615,7 +617,8 @@ void Ann_MarkAnnouncementAsSeen (void)
" (AnnCod,UsrCod)"
" VALUES"
" (%ld,%ld)",
AnnCod,Gbl.Usrs.Me.UsrDat.UsrCod);
AnnCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Show other announcements again *****/
Ann_ShowMyAnnouncementsNotMarkedAsSeen ();

View File

@ -1604,10 +1604,13 @@ static void Asg_CreateAssignment (struct Asg_Assignment *Asg,const char *Txt)
Asg->AsgCod =
DB_QueryINSERTandReturnCode ("can not create new assignment",
"INSERT INTO asg_assignments"
" (CrsCod,UsrCod,StartTime,EndTime,Title,Folder,Txt)"
" (CrsCod,UsrCod,"
"StartTime,EndTime,"
"Title,Folder,Txt)"
" VALUES"
" (%ld,%ld,FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
"'%s','%s','%s')",
" (%ld,%ld,"
"FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
"'%s','%s','%s')",
Gbl.Hierarchy.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod,
Asg->TimeUTC[Dat_START_TIME],

View File

@ -1388,13 +1388,15 @@ void Att_CreateAttEvent (struct Att_Event *Event,const char *Description)
DB_QueryINSERTandReturnCode ("can not create new attendance event",
"INSERT INTO att_events"
" (CrsCod,Hidden,UsrCod,"
"StartTime,EndTime,CommentTchVisible,Title,Txt)"
"StartTime,EndTime,"
"CommentTchVisible,Title,Txt)"
" VALUES"
" (%ld,'%c',%ld,"
"FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),'%c','%s','%s')",
"FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
"'%c','%s','%s')",
Gbl.Hierarchy.Crs.CrsCod,
Event->Hidden ? 'Y' :
'N',
'N',
Gbl.Usrs.Me.UsrDat.UsrCod,
Event->TimeUTC[Att_START_TIME],
Event->TimeUTC[Att_END_TIME ],
@ -2647,7 +2649,8 @@ static void Att_RegUsrInAttEventChangingComments (long AttCod,long UsrCod,bool P
" (AttCod,UsrCod,Present,CommentStd,CommentTch)"
" VALUES"
" (%ld,%ld,'%c','%s','%s')",
AttCod,UsrCod,
AttCod,
UsrCod,
Present ? 'Y' :
'N',
CommentStd,

View File

@ -927,7 +927,9 @@ static void Bld_CreateBuilding (struct Bld_Building *Building)
" VALUES"
" (%ld,'%s','%s','%s')",
Gbl.Hierarchy.Ctr.CtrCod,
Building->ShrtName,Building->FullName,Building->Location);
Building->ShrtName,
Building->FullName,
Building->Location);
}
/*****************************************************************************/

View File

@ -809,12 +809,14 @@ static long Cfe_AddCallForExamToDB (const struct Cfe_CallsForExams *CallsForExam
DB_QueryINSERTandReturnCode ("can not create a new call for exam",
"INSERT INTO cfe_exams "
"(CrsCod,Status,NumNotif,CrsFullName,Year,ExamSession,"
"CallDate,ExamDate,Duration,"
"Place,ExamMode,Structure,DocRequired,MatRequired,MatAllowed,OtherInfo)"
"CallDate,ExamDate,Duration,"
"Place,ExamMode,Structure,"
"DocRequired,MatRequired,MatAllowed,OtherInfo)"
" VALUES "
"(%ld,%u,0,'%s',%u,'%s',"
"NOW(),'%04u-%02u-%02u %02u:%02u:00','%02u:%02u:00','%s',"
"'%s','%s','%s','%s','%s','%s')",
"NOW(),'%04u-%02u-%02u %02u:%02u:00','%02u:%02u:00',"
"'%s','%s','%s',"
"'%s','%s','%s','%s')",
Gbl.Hierarchy.Crs.CrsCod,
(unsigned) Cfe_VISIBLE_CALL_FOR_EXAM,
CallsForExams->CallForExam.CrsFullName,

View File

@ -1874,10 +1874,10 @@ static void Ctr_CreateCenter (unsigned Status)
DB_QueryINSERTandReturnCode ("can not create a new center",
"INSERT INTO ctr_centers"
" (InsCod,PlcCod,Status,RequesterUsrCod,"
"ShortName,FullName,WWW,PhotoAttribution)"
"ShortName,FullName,WWW,PhotoAttribution)"
" VALUES"
" (%ld,%ld,%u,%ld,"
"'%s','%s','%s','')",
"'%s','%s','%s','')",
Ctr_EditingCtr->InsCod,
Ctr_EditingCtr->PlcCod,
Status,

View File

@ -600,13 +600,15 @@ 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.64.1 (2021-04-17)"
#define Log_PLATFORM_VERSION "SWAD 20.65.1 (2021-04-17)"
#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.65.1: Apr 17, 2021 Code refactoring in database replaces. (308677 lines)
Version 20.65: Apr 17, 2021 Code refactoring in database inserts. (308629 lines)
Version 20.64.1: Apr 17, 2021 Optimizations in database selects. (308523 lines)
Version 20.64: Apr 17, 2021 Optimizations in database selects. (308518 lines)
Version 20.63: Apr 16, 2021 Optimizations in database selects. (308487 lines)

View File

@ -1872,9 +1872,12 @@ static void Cty_CreateCountry (void)
" (CtyCod,Alpha2,MapAttribution%s%s)"
" VALUES"
" ('%03ld','%s',''%s%s)",
SubQueryNam1,SubQueryWWW1,
Cty_EditingCty->CtyCod,Cty_EditingCty->Alpha2,
SubQueryNam2,SubQueryWWW2);
SubQueryNam1,
SubQueryWWW1,
Cty_EditingCty->CtyCod,
Cty_EditingCty->Alpha2,
SubQueryNam2,
SubQueryWWW2);
}
/*****************************************************************************/

View File

@ -1717,11 +1717,12 @@ static void Crs_CreateCourse (unsigned Status)
DB_QueryINSERTandReturnCode ("can not create a new course",
"INSERT INTO crs_courses"
" (DegCod,Year,InsCrsCod,Status,RequesterUsrCod,"
"ShortName,FullName)"
"ShortName,FullName)"
" VALUES"
" (%ld,%u,'%s',%u,%ld,"
"'%s','%s')",
Crs_EditingCrs->DegCod,Crs_EditingCrs->Year,
"'%s','%s')",
Crs_EditingCrs->DegCod,
Crs_EditingCrs->Year,
Crs_EditingCrs->InstitutionalCrsCod,
Status,
Gbl.Usrs.Me.UsrDat.UsrCod,

View File

@ -781,9 +781,12 @@ static void Deg_CreateDegree (unsigned Status)
/***** Create a new degree *****/
Deg_EditingDeg->DegCod =
DB_QueryINSERTandReturnCode ("can not create a new degree",
"INSERT INTO deg_degrees (CtrCod,DegTypCod,Status,"
"RequesterUsrCod,ShortName,FullName,WWW)"
" VALUES (%ld,%ld,%u,%ld,'%s','%s','%s')",
"INSERT INTO deg_degrees"
" (CtrCod,DegTypCod,Status,"
"RequesterUsrCod,ShortName,FullName,WWW)"
" VALUES"
" (%ld,%ld,%u,"
"%ld,'%s','%s','%s')",
Deg_EditingDeg->CtrCod,
Deg_EditingDeg->DegTypCod,
Status,

View File

@ -574,7 +574,8 @@ static void DT_CreateDegreeType (struct DegreeType *DegTyp)
{
/***** Create a new degree type *****/
DB_QueryINSERT ("can not create a new type of degree",
"INSERT INTO deg_types SET DegTypName='%s'",
"INSERT INTO deg_types"
" SET DegTypName='%s'",
DegTyp->DegTypName);
}

View File

@ -89,13 +89,13 @@ void Dup_ReportUsrAsPossibleDuplicate (void)
if (!ItsMe && Gbl.Usrs.Me.Role.Logged >= Rol_TCH)
{
/***** Insert possible duplicate into database *****/
DB_QueryINSERT ("can not report duplicate",
"REPLACE INTO usr_duplicated"
" (UsrCod,InformerCod,InformTime)"
" VALUES"
" (%ld,%ld,NOW())",
Gbl.Usrs.Other.UsrDat.UsrCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
DB_QueryREPLACE ("can not report duplicate",
"REPLACE INTO usr_duplicated"
" (UsrCod,InformerCod,InformTime)"
" VALUES"
" (%ld,%ld,NOW())",
Gbl.Usrs.Other.UsrDat.UsrCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Show feedback message *****/
Ale_ShowAlert (Ale_SUCCESS,Txt_Thank_you_for_reporting_a_possible_duplicate_user);

View File

@ -299,7 +299,9 @@ void Enr_RegisterUsrInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole,
" (CrsCod,UsrCod,Role,Accepted)"
" VALUES"
" (%ld,%ld,%u,'%c')",
Gbl.Hierarchy.Crs.CrsCod,UsrDat->UsrCod,(unsigned) NewRole,
Gbl.Hierarchy.Crs.CrsCod,
UsrDat->UsrCod,
(unsigned) NewRole,
KeepOrSetAccepted == Enr_SET_ACCEPTED_TO_TRUE ? 'Y' :
'N');
@ -307,15 +309,16 @@ void Enr_RegisterUsrInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole,
DB_QueryINSERT ("can not register user in course",
"INSERT INTO crs_user_settings"
" (UsrCod,CrsCod,"
"LastDowGrpCod,LastComGrpCod,LastAssGrpCod,"
"NumAccTst,LastAccTst,NumQstsLastTst,"
"UsrListType,ColsClassPhoto,ListWithPhotos)"
"LastDowGrpCod,LastComGrpCod,LastAssGrpCod,"
"NumAccTst,LastAccTst,NumQstsLastTst,"
"UsrListType,ColsClassPhoto,ListWithPhotos)"
" VALUES"
" (%ld,%ld,"
"-1,-1,-1,"
"0,FROM_UNIXTIME(%ld),0,"
"'%s',%u,'%c')",
UsrDat->UsrCod,Gbl.Hierarchy.Crs.CrsCod,
"-1,-1,-1,"
"0,FROM_UNIXTIME(%ld),0,"
"'%s',%u,'%c')",
UsrDat->UsrCod,
Gbl.Hierarchy.Crs.CrsCod,
(long) (time_t) 0, // The user never accessed to tests in this course
Usr_StringsUsrListTypeInDB[Usr_SHOW_USRS_TYPE_DEFAULT],
Usr_CLASS_PHOTO_COLS_DEF,
@ -3478,7 +3481,9 @@ static void Enr_RegisterAdmin (struct UsrData *UsrDat,Hie_Lvl_Level_t Scope,long
" (UsrCod,Scope,Cod)"
" VALUES"
" (%ld,'%s',%ld)",
UsrDat->UsrCod,Sco_GetDBStrFromScope (Scope),Cod);
UsrDat->UsrCod,
Sco_GetDBStrFromScope (Scope),
Cod);
Ale_ShowAlert (Ale_SUCCESS,Txt_THE_USER_X_has_been_enroled_as_administrator_of_Y,
UsrDat->FullName,InsCtrDegName);

View File

@ -1667,9 +1667,11 @@ static void Exa_CreateExam (struct Exa_Exam *Exam,const char *Txt)
Exam->ExaCod =
DB_QueryINSERTandReturnCode ("can not create new exam",
"INSERT INTO exa_exams"
" (CrsCod,Hidden,UsrCod,MaxGrade,Visibility,Title,Txt)"
" (CrsCod,Hidden,UsrCod,MaxGrade,Visibility,"
"Title,Txt)"
" VALUES"
" (%ld,'N',%ld,%.15lg,%u,'%s','%s')",
" (%ld,'N',%ld,%.15lg,%u,"
"'%s','%s')",
Gbl.Hierarchy.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod,
Exam->MaxGrade,

View File

@ -585,9 +585,11 @@ static void ExaPrn_CreatePrintInDB (struct ExaPrn_Print *Print)
Print->PrnCod =
DB_QueryINSERTandReturnCode ("can not create new exam print",
"INSERT INTO exa_prints"
" (SesCod,UsrCod,StartTime,EndTime,NumQsts,NumQstsNotBlank,Sent,Score)"
" (SesCod,UsrCod,StartTime,EndTime,"
"NumQsts,NumQstsNotBlank,Sent,Score)"
" VALUES"
" (%ld,%ld,NOW(),NOW(),%u,0,'N',0)",
" (%ld,%ld,NOW(),NOW(),"
"%u,0,'N',0)",
Print->SesCod,
Print->UsrCod,
Print->NumQsts.All);
@ -1469,7 +1471,8 @@ static void ExaPrn_StoreOneQstOfPrintInDB (const struct ExaPrn_Print *Print,
" (PrnCod,QstCod,QstInd,SetCod,Score,Indexes,Answers)"
" VALUES"
" (%ld,%ld,%u,%ld,'%.15lg','%s','%s')",
Print->PrnCod,Print->PrintedQuestions[NumQst].QstCod,
Print->PrnCod,
Print->PrintedQuestions[NumQst].QstCod,
NumQst, // 0, 1, 2, 3...
Print->PrintedQuestions[NumQst].SetCod,
Print->PrintedQuestions[NumQst].Score,

View File

@ -1550,19 +1550,25 @@ static void ExaSes_CreateSession (struct ExaSes_Session *Session)
/***** Insert this new exam session into database *****/
Session->SesCod =
DB_QueryINSERTandReturnCode ("can not create exam session",
"INSERT exa_sessions "
"(ExaCod,Hidden,UsrCod,StartTime,EndTime,Title,ShowUsrResults)"
" VALUES "
"(%ld," // ExaCod
"'%c'," // Hidden
"%ld," // UsrCod
"FROM_UNIXTIME(%ld)," // Start time
"FROM_UNIXTIME(%ld)," // End time
"'%s'," // Title
"'N')", // ShowUsrResults: Don't show user results initially
"INSERT exa_sessions"
" (ExaCod,"
"Hidden,"
"UsrCod,"
"StartTime,"
"EndTime,"
"Title,"
"ShowUsrResults)"
" VALUES"
" (%ld," // ExaCod
"'%c'," // Hidden
"%ld," // UsrCod
"FROM_UNIXTIME(%ld)," // Start time
"FROM_UNIXTIME(%ld)," // End time
"'%s'," // Title
"'N')", // ShowUsrResults: Don't show user results initially
Session->ExaCod,
Session->Hidden ? 'Y' :
'N',
'N',
Gbl.Usrs.Me.UsrDat.UsrCod, // Session creator
Session->TimeUTC[Dat_START_TIME], // Start time
Session->TimeUTC[Dat_END_TIME ], // End time
@ -1626,7 +1632,8 @@ static void ExaSes_CreateGrps (long SesCod)
" (SesCod,GrpCod)"
" VALUES"
" (%ld,%ld)",
SesCod,Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
SesCod,
Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
}
/*****************************************************************************/

View File

@ -1665,19 +1665,22 @@ static void ExaSet_CopyQstFromBankToExamSet (struct ExaSet_Set *Set,long QstCod)
CloneMedCod = Med_CloneMedia (&Question.Media);
/***** Insert question in table of questions *****/
QstCodInSet = DB_QueryINSERTandReturnCode ("can not add question to set",
"INSERT INTO exa_set_questions"
" (SetCod,Invalid,AnsType,Shuffle,Stem,Feedback,MedCod)"
" VALUES"
" (%ld,'%c','%s','%c','%s','%s',%ld)",
Set->SetCod,
CharInvalid[Question.Validity],
Tst_StrAnswerTypesDB[Question.Answer.Type],
Question.Answer.Shuffle ? 'Y' :
'N',
Question.Stem,
Question.Feedback,
CloneMedCod);
QstCodInSet =
DB_QueryINSERTandReturnCode ("can not add question to set",
"INSERT INTO exa_set_questions"
" (SetCod,Invalid,AnsType,Shuffle,"
"Stem,Feedback,MedCod)"
" VALUES"
" (%ld,'%c','%s','%c',"
"'%s','%s',%ld)",
Set->SetCod,
CharInvalid[Question.Validity],
Tst_StrAnswerTypesDB[Question.Answer.Type],
Question.Answer.Shuffle ? 'Y' :
'N',
Question.Stem,
Question.Feedback,
CloneMedCod);
/***** Get the answers from the database *****/
Tst_GetAnswersQst (&Question,&mysql_res,

View File

@ -73,7 +73,9 @@ void FigCch_UpdateFigureIntoCache (FigCch_FigureCached_t Figure,
" (Figure,Scope,Cod,ValueInt,ValueDouble)"
" VALUES"
" (%u,'%s',%ld,%u,'0.0')",
(unsigned) Figure,Sco_GetDBStrFromScope (Scope),Cod,
(unsigned) Figure,
Sco_GetDBStrFromScope (Scope),
Cod,
*((unsigned *) ValuePtr));
break;
case FigCch_DOUBLE:
@ -83,7 +85,9 @@ void FigCch_UpdateFigureIntoCache (FigCch_FigureCached_t Figure,
" (Figure,Scope,Cod,ValueInt,ValueDouble)"
" VALUES"
" (%u,'%s',%ld,0,'%.15lg')",
(unsigned) Figure,Sco_GetDBStrFromScope (Scope),Cod,
(unsigned) Figure,
Sco_GetDBStrFromScope (Scope),
Cod,
*((double *) ValuePtr));
Str_SetDecimalPointToLocal (); // Return to local system
break;

View File

@ -4154,10 +4154,10 @@ static void Brw_StoreSizeOfFileTreeInDB (void)
DB_QueryREPLACE ("can not store the size of a file browser",
"REPLACE INTO brw_sizes"
" (FileBrowser,Cod,ZoneUsrCod,"
"NumLevels,NumFolders,NumFiles,TotalSize)"
"NumLevels,NumFolders,NumFiles,TotalSize)"
" VALUES"
" (%u,%ld,%ld,"
"%u,'%lu','%lu','%llu')",
"%u,'%lu','%lu','%llu')",
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
Cod,ZoneUsrCod,
Gbl.FileBrowser.Size.NumLevls,
@ -10890,7 +10890,8 @@ static void Brw_UpdateFileViews (unsigned NumViews,long FilCod)
" (FilCod,UsrCod,NumViews)"
" VALUES"
" (%ld,%ld,1)",
FilCod,Gbl.Usrs.Me.UsrDat.UsrCod);
FilCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
}
/*****************************************************************************/
@ -11180,11 +11181,11 @@ long Brw_AddPathToDB (long PublisherUsrCod,Brw_FileType_t FileType,
return
DB_QueryINSERTandReturnCode ("can not add path to database",
"INSERT INTO brw_files"
" (FileBrowser,Cod,ZoneUsrCod,"
"PublisherUsrCod,FileType,Path,Hidden,Public,License)"
" (FileBrowser,Cod,ZoneUsrCod,PublisherUsrCod,"
"FileType,Path,Hidden,Public,License)"
" VALUES"
" (%u,%ld,%ld,"
"%ld,%u,'%s','N','%c',%u)",
" (%u,%ld,%ld,%ld,"
"%u,'%s','N','%c',%u)",
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
Cod,ZoneUsrCod,
PublisherUsrCod,

View File

@ -177,7 +177,8 @@ static void Fir_BanIP (void)
" (IP,BanTime,UnbanTime)"
" VALUES"
" ('%s',NOW(),FROM_UNIXTIME(UNIX_TIMESTAMP()+%lu))",
Gbl.IP,(unsigned long) Fw_TIME_BANNED);
Gbl.IP,
(unsigned long) Fw_TIME_BANNED);
}
/*****************************************************************************/

View File

@ -549,7 +549,8 @@ static void For_InsertPstIntoBannedPstTable (long PstCod)
" (PstCod,UsrCod,DisableTime)"
" VALUES"
" (%ld,%ld,NOW())",
PstCod,Gbl.Usrs.Me.UsrDat.UsrCod);
PstCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
}
/*****************************************************************************/
@ -570,12 +571,14 @@ static long For_InsertForumPst (long ThrCod,long UsrCod,
DB_QueryINSERTandReturnCode ("can not create a new post in a forum",
"INSERT INTO for_posts"
" (ThrCod,UsrCod,CreatTime,ModifTime,NumNotif,"
"Subject,Content,MedCod)"
"Subject,Content,MedCod)"
" VALUES"
" (%ld,%ld,NOW(),NOW(),0,"
"'%s','%s',%ld)",
ThrCod,UsrCod,
Subject,Content,Media->MedCod);
"'%s','%s',%ld)",
ThrCod,
UsrCod,
Subject,
Content,Media->MedCod);
return PstCod;
}
@ -674,7 +677,8 @@ static long For_InsertForumThread (const struct For_Forums *Forums,
" (%u,%ld,%ld,%ld)",
(unsigned) Forums->Forum.Type,
Forums->Forum.Location,
FirstPstCod,FirstPstCod);
FirstPstCod,
FirstPstCod);
}
/*****************************************************************************/
@ -862,7 +866,8 @@ static void For_UpdateThrReadTime (long ThrCod,
" (ThrCod,UsrCod,ReadTime)"
" VALUES"
" (%ld,%ld,FROM_UNIXTIME(%ld))",
ThrCod,Gbl.Usrs.Me.UsrDat.UsrCod,
ThrCod,
Gbl.Usrs.Me.UsrDat.UsrCod,
(long) CreatTimeUTCOfTheMostRecentPostRead);
}
@ -4634,7 +4639,8 @@ static void For_InsertThrInClipboard (long ThrCod)
" (ThrCod,UsrCod)"
" VALUES"
" (%ld,%ld)",
ThrCod,Gbl.Usrs.Me.UsrDat.UsrCod);
ThrCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
}
/*****************************************************************************/

View File

@ -1650,9 +1650,11 @@ static void Gam_CreateGame (struct Gam_Game *Game,const char *Txt)
Game->GamCod =
DB_QueryINSERTandReturnCode ("can not create new game",
"INSERT INTO gam_games"
" (CrsCod,Hidden,UsrCod,MaxGrade,Visibility,Title,Txt)"
" (CrsCod,Hidden,UsrCod,MaxGrade,Visibility,"
"Title,Txt)"
" VALUES"
" (%ld,'N',%ld,%.15lg,%u,'%s','%s')",
" (%ld,'N',%ld,%.15lg,%u,"
"'%s','%s')",
Gbl.Hierarchy.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod,
Game->MaxGrade,
@ -2199,7 +2201,9 @@ void Gam_AddQstsToGame (void)
" (GamCod,QstInd,QstCod)"
" VALUES"
" (%ld,%u,%ld)",
Game.GamCod,MaxQstInd + 1,QstCod);
Game.GamCod,
MaxQstInd + 1,
QstCod);
NumQstsAdded++;
}

View File

@ -1294,7 +1294,8 @@ static void Grp_AddUsrToGroup (struct UsrData *UsrDat,long GrpCod)
" (GrpCod,UsrCod)"
" VALUES"
" (%ld,%ld)",
GrpCod,UsrDat->UsrCod);
GrpCod,
UsrDat->UsrCod);
}
/*****************************************************************************/
@ -3946,16 +3947,19 @@ static void Grp_CreateGroupType (void)
Gbl.Crs.Grps.GrpTyp.GrpTypCod =
DB_QueryINSERTandReturnCode ("can not create type of group",
"INSERT INTO grp_types"
" (CrsCod,GrpTypName,Mandatory,Multiple,MustBeOpened,OpenTime)"
" (CrsCod,GrpTypName,"
"Mandatory,Multiple,MustBeOpened,OpenTime)"
" VALUES"
" (%ld,'%s','%c','%c','%c',FROM_UNIXTIME(%ld))",
Gbl.Hierarchy.Crs.CrsCod,Gbl.Crs.Grps.GrpTyp.GrpTypName,
" (%ld,'%s',"
"'%c','%c','%c',FROM_UNIXTIME(%ld))",
Gbl.Hierarchy.Crs.CrsCod,
Gbl.Crs.Grps.GrpTyp.GrpTypName,
Gbl.Crs.Grps.GrpTyp.MandatoryEnrolment ? 'Y' :
'N',
'N',
Gbl.Crs.Grps.GrpTyp.MultipleEnrolment ? 'Y' :
'N',
'N',
Gbl.Crs.Grps.GrpTyp.MustBeOpened ? 'Y' :
'N',
'N',
(long) Gbl.Crs.Grps.GrpTyp.OpenTimeUTC);
}

View File

@ -1645,7 +1645,8 @@ static void Inf_SetInfoTxtIntoDB (const char *InfoTxtHTML,const char *InfoTxtMD)
" (%ld,'%s','%s','%s')",
Gbl.Hierarchy.Crs.CrsCod,
Inf_NamesInDBForInfoType[Gbl.Crs.Info.Type],
InfoTxtHTML,InfoTxtMD);
InfoTxtHTML,
InfoTxtMD);
}
/*****************************************************************************/

View File

@ -1896,9 +1896,11 @@ static void Ins_CreateInstitution (unsigned Status)
Ins_EditingIns->InsCod =
DB_QueryINSERTandReturnCode ("can not create institution",
"INSERT INTO ins_instits"
" (CtyCod,Status,RequesterUsrCod,ShortName,FullName,WWW)"
" (CtyCod,Status,RequesterUsrCod,"
"ShortName,FullName,WWW)"
" VALUES"
" (%ld,%u,%ld,'%s','%s','%s')",
" (%ld,%u,%ld,"
"'%s','%s','%s')",
Ins_EditingIns->CtyCod,
Status,
Gbl.Usrs.Me.UsrDat.UsrCod,

View File

@ -1205,24 +1205,9 @@ static void Lay_ShowRightColumn (void)
}
else if (Gbl.Usrs.Me.Logged) // I am logged
{
/*
gettimeofday (&tv1,NULL);
*/
/***** Suggest one user to follow *****/
HTM_DIV_Begin ("class=\"LEFT_RIGHT_CELL\"");
Fol_SuggestUsrsToFollowMainZoneOnRightColumn ();
/*
gettimeofday (&tv2,NULL);
tv_usecs = (tv2.tv_sec - tv1.tv_sec ) * 1E6 +
(tv2.tv_usec - tv1.tv_usec);
DB_QueryINSERT ("can not debug",
"INSERT INTO dbg_debug"
" (DebugTime,Txt)"
" VALUES"
" (NOW(),'Fol_SuggestUsrsToFollowMainZoneOnRightColumn: %ld us')",
tv_usecs);
*/
HTM_DIV_End ();
}

View File

@ -849,7 +849,9 @@ static void Lnk_CreateLink (struct Link *Lnk)
" (ShortName,FullName,WWW)"
" VALUES"
" ('%s','%s','%s')",
Lnk->ShrtName,Lnk->FullName,Lnk->WWW);
Lnk->ShrtName,
Lnk->FullName,
Lnk->WWW);
}
/*****************************************************************************/

View File

@ -87,12 +87,14 @@ void Log_LogAccess (const char *Comments)
/* Log access in historical log */
LogCod =
DB_QueryINSERTandReturnCode ("can not log access",
"INSERT INTO log "
"(ActCod,CtyCod,InsCod,CtrCod,DegCod,CrsCod,UsrCod,"
"Role,ClickTime,TimeToGenerate,TimeToSend,IP)"
" VALUES "
"(%ld,%ld,%ld,%ld,%ld,%ld,%ld,"
"%u,NOW(),%ld,%ld,'%s')",
"INSERT INTO log"
" (ActCod,CtyCod,InsCod,CtrCod,DegCod,CrsCod,"
"UsrCod,Role,ClickTime,"
"TimeToGenerate,TimeToSend,IP)"
" VALUES"
" (%ld,%ld,%ld,%ld,%ld,%ld,"
"%ld,%u,NOW(),"
"%ld,%ld,'%s')",
ActCod,
Gbl.Hierarchy.Cty.CtyCod,
Gbl.Hierarchy.Ins.InsCod,
@ -107,13 +109,16 @@ void Log_LogAccess (const char *Comments)
/* Log access in recent log (log_recent) */
DB_QueryINSERT ("can not log access (recent)",
"INSERT INTO log_recent "
"(LogCod,ActCod,CtyCod,InsCod,CtrCod,DegCod,CrsCod,UsrCod,"
"Role,ClickTime,TimeToGenerate,TimeToSend,IP)"
" VALUES "
"(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,"
"%u,NOW(),%ld,%ld,'%s')",
LogCod,ActCod,
"INSERT INTO log_recent"
" (LogCod,ActCod,CtyCod,InsCod,CtrCod,DegCod,CrsCod,"
"UsrCod,Role,ClickTime,"
"TimeToGenerate,TimeToSend,IP)"
" VALUES"
" (%ld,%ld,%ld,%ld,%ld,%ld,%ld,"
"%ld,%u,NOW(),"
"%ld,%ld,'%s')",
LogCod,
ActCod,
Gbl.Hierarchy.Cty.CtyCod,
Gbl.Hierarchy.Ins.InsCod,
Gbl.Hierarchy.Ctr.CtrCod,
@ -142,7 +147,8 @@ void Log_LogAccess (const char *Comments)
" (LogCod,Comments)"
" VALUES"
" (%ld,'%s')",
LogCod,CommentsDB);
LogCod,
CommentsDB);
free (CommentsDB);
}
}
@ -154,7 +160,8 @@ void Log_LogAccess (const char *Comments)
" (LogCod,SearchStr)"
" VALUES"
" (%ld,'%s')",
LogCod,Gbl.Search.Str);
LogCod,
Gbl.Search.Str);
if (Gbl.WebService.IsWebService)
/* Log web service plugin and function */
@ -163,7 +170,8 @@ void Log_LogAccess (const char *Comments)
" (LogCod,PlgCod,FunCod)"
" VALUES"
" (%ld,%ld,%u)",
LogCod,Gbl.WebService.PlgCod,
LogCod,
Gbl.WebService.PlgCod,
(unsigned) Gbl.WebService.Function);
else
{
@ -175,7 +183,8 @@ void Log_LogAccess (const char *Comments)
" (LogCod,BanCod)"
" VALUES"
" (%ld,%ld)",
LogCod,BanCodClicked);
LogCod,
BanCodClicked);
}
/***** Increment my number of clicks *****/

View File

@ -1490,8 +1490,10 @@ static void Mai_RemoveEmailFromDB (long UsrCod,const char Email[Cns_MAX_BYTES_EM
/***** Remove an old email address *****/
DB_QueryREPLACE ("can not remove an old email address",
"DELETE FROM usr_emails"
" WHERE UsrCod=%ld AND E_mail='%s'",
UsrCod,Email);
" WHERE UsrCod=%ld"
" AND E_mail='%s'",
UsrCod,
Email);
}
/*****************************************************************************/
@ -1633,7 +1635,8 @@ bool Mai_UpdateEmailInDB (const struct UsrData *UsrDat,const char NewEmail[Cns_M
" (UsrCod,E_mail,CreatTime)"
" VALUES"
" (%ld,'%s',NOW())",
UsrDat->UsrCod,NewEmail);
UsrDat->UsrCod,
NewEmail);
return true; // Successfully updated
}

View File

@ -1734,29 +1734,30 @@ static long Mch_CreateMatch (long GamCod,char Title[Mch_MAX_BYTES_TITLE + 1])
long MchCod;
/***** Insert this new match into database *****/
MchCod = DB_QueryINSERTandReturnCode ("can not create match",
"INSERT mch_matches "
"(GamCod,UsrCod,StartTime,EndTime,Title,"
"QstInd,QstCod,Showing,Countdown,"
"NumCols,ShowQstResults,ShowUsrResults)"
" VALUES "
"(%ld," // GamCod
"%ld," // UsrCod
"NOW()," // StartTime
"NOW()," // EndTime
"'%s'," // Title
"0," // QstInd: Match has not started, so not the first question yet
"-1," // QstCod: Non-existent question
"'%s'," // Showing: What is being shown
"-1," // Countdown: No countdown
"%u," // NumCols: Number of columns in answers
"'N'," // ShowQstResults: Don't show question results initially
"'N')", // ShowUsrResults: Don't show user results initially
GamCod,
Gbl.Usrs.Me.UsrDat.UsrCod, // Game creator
Title,
Mch_ShowingStringsDB[Mch_SHOWING_DEFAULT],
Mch_NUM_COLS_DEFAULT);
MchCod =
DB_QueryINSERTandReturnCode ("can not create match",
"INSERT mch_matches"
" (GamCod,UsrCod,StartTime,EndTime,Title,"
"QstInd,QstCod,Showing,Countdown,"
"NumCols,ShowQstResults,ShowUsrResults)"
" VALUES"
" (%ld," // GamCod
"%ld," // UsrCod
"NOW()," // StartTime
"NOW()," // EndTime
"'%s'," // Title
"0," // QstInd: Match has not started, so not the first question yet
"-1," // QstCod: Non-existent question
"'%s'," // Showing: What is being shown
"-1," // Countdown: No countdown
"%u," // NumCols: Number of columns in answers
"'N'," // ShowQstResults: Don't show question results initially
"'N')", // ShowUsrResults: Don't show user results initially
GamCod,
Gbl.Usrs.Me.UsrDat.UsrCod, // Game creator
Title,
Mch_ShowingStringsDB[Mch_SHOWING_DEFAULT],
Mch_NUM_COLS_DEFAULT);
/***** Create indexes for answers *****/
Mch_CreateIndexes (GamCod,MchCod);
@ -1902,7 +1903,9 @@ static void Mch_ReorderAnswer (long MchCod,unsigned QstInd,
" (MchCod,QstInd,Indexes)"
" VALUES"
" (%ld,%u,'%s')",
MchCod,QstInd,StrAnswersOneQst);
MchCod,
QstInd,
StrAnswersOneQst);
}
/*****************************************************************************/
@ -1948,7 +1951,8 @@ static void Mch_CreateGrps (long MchCod)
" (MchCod,GrpCod)"
" VALUES"
" (%ld,%ld)",
MchCod,Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
MchCod,
Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
}
/*****************************************************************************/
@ -2046,11 +2050,14 @@ static void Mch_UpdateElapsedTimeInQuestion (const struct Mch_Match *Match)
Match->Status.Showing != Mch_START &&
Match->Status.Showing != Mch_END)
DB_QueryINSERT ("can not update elapsed time in question",
"INSERT INTO mch_times (MchCod,QstInd,ElapsedTime)"
" VALUES (%ld,%u,SEC_TO_TIME(%u))"
"INSERT INTO mch_times"
" (MchCod,QstInd,ElapsedTime)"
" VALUES"
" (%ld,%u,SEC_TO_TIME(%u))"
" ON DUPLICATE KEY"
" UPDATE ElapsedTime=ADDTIME(ElapsedTime,SEC_TO_TIME(%u))",
Match->MchCod,Match->Status.QstInd,
Match->MchCod,
Match->Status.QstInd,
Cfg_SECONDS_TO_REFRESH_MATCH_TCH,
Cfg_SECONDS_TO_REFRESH_MATCH_TCH);
}
@ -3800,7 +3807,10 @@ static void Mch_UpdateMatchAsBeingPlayed (long MchCod)
{
/***** Insert match as being played *****/
DB_QueryREPLACE ("can not set match as being played",
"REPLACE mch_playing (MchCod) VALUE (%ld)",
"REPLACE mch_playing"
" (MchCod)"
" VALUE"
" (%ld)",
MchCod);
}
@ -3877,8 +3887,12 @@ bool Mch_RegisterMeAsPlayerInMatch (struct Mch_Match *Match)
/***** Insert me as match player *****/
DB_QueryREPLACE ("can not insert match player",
"REPLACE mch_players (MchCod,UsrCod) VALUES (%ld,%ld)",
Match->MchCod,Gbl.Usrs.Me.UsrDat.UsrCod);
"REPLACE mch_players"
" (MchCod,UsrCod)"
" VALUES"
" (%ld,%ld)",
Match->MchCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
return true;
}
@ -4227,7 +4241,9 @@ static void Mch_UpdateMyAnswerToMatchQuestion (const struct Mch_Match *Match,
" (MchCod,UsrCod,QstInd,NumOpt,AnsInd)"
" VALUES"
" (%ld,%ld,%u,%d,%d)",
Match->MchCod,Gbl.Usrs.Me.UsrDat.UsrCod,Match->Status.QstInd,
Match->MchCod,
Gbl.Usrs.Me.UsrDat.UsrCod,
Match->Status.QstInd,
UsrAnswer->NumOpt,
UsrAnswer->AnsInd);
}

View File

@ -1380,15 +1380,19 @@ static bool Med_MoveTmpFileToDefDir (struct Med_Media *Media,
void Med_StoreMediaInDB (struct Med_Media *Media)
{
/***** Insert media into database *****/
Media->MedCod = DB_QueryINSERTandReturnCode ("can not create media",
"INSERT INTO med_media"
" (Type,Name,URL,Title)"
" VALUES"
" ('%s','%s','%s','%s')",
Med_GetStringTypeForDB (Media->Type),
Media->Name ? Media->Name : "",
Media->URL ? Media->URL : "",
Media->Title ? Media->Title : "");
Media->MedCod =
DB_QueryINSERTandReturnCode ("can not create media",
"INSERT INTO med_media"
" (Type,Name,URL,Title)"
" VALUES"
" ('%s','%s','%s','%s')",
Med_GetStringTypeForDB (Media->Type),
Media->Name ? Media->Name :
"",
Media->URL ? Media->URL :
"",
Media->Title ? Media->Title :
"");
Media->Status = Med_STORED_IN_DB;
}

View File

@ -151,7 +151,8 @@ static long Msg_InsertNewMsg (const char *Subject,const char *Content,
static unsigned long Msg_DelSomeRecOrSntMsgsUsr (const struct Msg_Messages *Messages,
long UsrCod,
const char *FilterFromToSubquery);
static void Msg_InsertReceivedMsgIntoDB (long MsgCod,long UsrCod,bool NotifyByEmail);
static void Msg_InsertReceivedMsgIntoDB (long MsgCod,long UsrCod,
bool NotifyByEmail);
static void Msg_SetReceivedMsgAsReplied (long MsgCod);
static void Msg_MoveReceivedMsgToDeleted (long MsgCod,long UsrCod);
static void Msg_MoveSentMsgToDeleted (long MsgCod);
@ -1411,7 +1412,9 @@ static long Msg_InsertNewMsg (const char *Subject,const char *Content,
" (Subject,Content,MedCod)"
" VALUES"
" ('%s','%s',%ld)",
Subject,Content,Media->MedCod);
Subject,
Content,
Media->MedCod);
/***** Insert message in sent messages *****/
DB_QueryINSERT ("can not create message",
@ -1498,7 +1501,8 @@ void Msg_DelAllRecAndSntMsgsUsr (long UsrCod)
/* Delete messages from msg_rcv *****/
DB_QueryDELETE ("can not remove received messages",
"DELETE FROM msg_rcv WHERE UsrCod=%ld",
"DELETE FROM msg_rcv"
" WHERE UsrCod=%ld",
UsrCod);
/***** Move message from msg_snt to msg_snt_deleted *****/
@ -1516,7 +1520,8 @@ void Msg_DelAllRecAndSntMsgsUsr (long UsrCod)
/* Delete message from msg_snt *****/
DB_QueryDELETE ("can not remove sent messages",
"DELETE FROM msg_snt WHERE UsrCod=%ld",
"DELETE FROM msg_snt"
" WHERE UsrCod=%ld",
UsrCod);
}
@ -1524,7 +1529,8 @@ void Msg_DelAllRecAndSntMsgsUsr (long UsrCod)
/**** Insert a message y su destinatario in the table of messages received ***/
/*****************************************************************************/
static void Msg_InsertReceivedMsgIntoDB (long MsgCod,long UsrCod,bool NotifyByEmail)
static void Msg_InsertReceivedMsgIntoDB (long MsgCod,long UsrCod,
bool NotifyByEmail)
{
/***** Insert message received in the database *****/
DB_QueryINSERT ("can not create received message",
@ -1532,7 +1538,8 @@ static void Msg_InsertReceivedMsgIntoDB (long MsgCod,long UsrCod,bool NotifyByEm
" (MsgCod,UsrCod,Notified,Open,Replied,Expanded)"
" VALUES"
" (%ld,%ld,'%c','N','N','N')",
MsgCod,UsrCod,
MsgCod,
UsrCod,
NotifyByEmail ? 'Y' :
'N');
}
@ -1642,7 +1649,8 @@ static void Msg_MoveMsgContentToDeleted (long MsgCod)
/* Delete message from msg_content *****/
DB_QueryUPDATE ("can not remove the content of a message",
"DELETE FROM msg_content WHERE MsgCod=%ld",
"DELETE FROM msg_content"
" WHERE MsgCod=%ld",
MsgCod);
}
@ -4021,7 +4029,8 @@ void Msg_BanSenderWhenShowingMsgs (void)
" (FromUsrCod,ToUsrCod)"
" VALUES"
" (%ld,%ld)",
Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.Usrs.Me.UsrDat.UsrCod);
Gbl.Usrs.Other.UsrDat.UsrCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Show alert with the change made *****/
Ale_ShowAlert (Ale_SUCCESS,Txt_From_this_time_you_will_not_receive_messages_from_X,

View File

@ -393,7 +393,9 @@ static void Net_GetMyWebsAndSocialNetsFromForm (void)
else
/***** Remove web / social network *****/
DB_QueryDELETE ("can not remove user's web / social network",
"DELETE FROM usr_webs WHERE UsrCod=%ld AND Web='%s'",
"DELETE FROM usr_webs"
" WHERE UsrCod=%ld"
" AND Web='%s'",
Gbl.Usrs.Me.UsrDat.UsrCod,
Net_WebsAndSocialNetworksDB[NumURL]);
}

View File

@ -479,8 +479,10 @@ static void Nck_RemoveNicknameFromDB (long UsrCod,const char *Nickname)
/***** Remove a nickname *****/
DB_QueryREPLACE ("can not remove a nickname",
"DELETE FROM usr_nicknames"
" WHERE UsrCod=%ld AND Nickname='%s'",
UsrCod,Nickname);
" WHERE UsrCod=%ld"
" AND Nickname='%s'",
UsrCod,
Nickname);
}
/*****************************************************************************/
@ -601,5 +603,6 @@ void Nck_UpdateNickInDB (long UsrCod,const char *NewNickname)
" (UsrCod,Nickname,CreatTime)"
" VALUES"
" (%ld,'%s',NOW())",
UsrCod,NewNickname);
UsrCod,
NewNickname);
}

View File

@ -178,7 +178,8 @@ static long Not_InsertNoticeInDB (const char *Content)
" (%ld,%ld,NOW(),'%s',%u)",
Gbl.Hierarchy.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod,
Content,(unsigned) Not_ACTIVE_NOTICE);
Content,
(unsigned) Not_ACTIVE_NOTICE);
}
/*****************************************************************************/

View File

@ -1540,13 +1540,19 @@ void Ntf_StoreNotifyEventToOneUser (Ntf_NotifyEvent_t NotifyEvent,
DB_QueryINSERT ("can not create new notification event",
"INSERT INTO ntf_notifications"
" (NotifyEvent,ToUsrCod,FromUsrCod,"
"InsCod,CtrCod,DegCod,CrsCod,Cod,TimeNotif,Status)"
"InsCod,CtrCod,DegCod,CrsCod,Cod,TimeNotif,Status)"
" VALUES"
" (%u,%ld,%ld,"
"%ld,%ld,%ld,%ld,%ld,NOW(),%u)",
"%ld,%ld,%ld,%ld,%ld,NOW(),%u)",
(unsigned) NotifyEvent,
UsrDat->UsrCod,Gbl.Usrs.Me.UsrDat.UsrCod,
InsCod,CtrCod,DegCod,CrsCod,Cod,(unsigned) Status);
UsrDat->UsrCod,
Gbl.Usrs.Me.UsrDat.UsrCod,
InsCod,
CtrCod,
DegCod,
CrsCod,
Cod,
(unsigned) Status);
}
/*****************************************************************************/
@ -1943,7 +1949,9 @@ static void Ntf_UpdateNumNotifSent (long DegCod,long CrsCod,
" (DegCod,CrsCod,NotifyEvent,NumEvents,NumMails)"
" VALUES"
" (%ld,%ld,%u,%u,%u)",
DegCod,CrsCod,(unsigned) NotifyEvent,
DegCod,
CrsCod,
(unsigned) NotifyEvent,
CurrentNumEvents + NumEvents,
CurrentNumMails + NumMails);
}

View File

@ -493,7 +493,8 @@ void Pwd_SetMyPendingPassword (char PlainPassword[Pwd_MAX_BYTES_PLAIN_PASSWORD +
" (UsrCod,PendingPassword,DateAndTime)"
" VALUES"
" (%ld,'%s',NOW())",
Gbl.Usrs.Me.UsrDat.UsrCod,Gbl.Usrs.Me.PendingPassword);
Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Usrs.Me.PendingPassword);
}
/*****************************************************************************/

View File

@ -2377,7 +2377,10 @@ static void Pho_UpdateDegStats (long DegCod,Usr_Sex_t Sex,unsigned NumStds,unsig
"TimeAvgPhoto,TimeToComputeAvgPhoto)"
" VALUES"
" (%ld,'%s',%u,%u,NOW(),%ld)",
DegCod,Usr_StringsSexDB[Sex],NumStds,NumStdsWithPhoto,
DegCod,
Usr_StringsSexDB[Sex],
NumStds,
NumStdsWithPhoto,
TimeToComputeAvgPhotoInMicroseconds);
}

View File

@ -928,7 +928,9 @@ static void Plc_CreatePlace (struct Plc_Place *Plc)
" (InsCod,ShortName,FullName)"
" VALUES"
" (%ld,'%s','%s')",
Gbl.Hierarchy.Ins.InsCod,Plc->ShrtName,Plc->FullName);
Gbl.Hierarchy.Ins.InsCod,
Plc->ShrtName,
Plc->FullName);
}
/*****************************************************************************/

View File

@ -1348,7 +1348,7 @@ void Prf_IncrementNumClicksUsr (long UsrCod)
{
/***** Increment number of clicks *****/
// If NumClicks < 0 ==> not yet calculated, so do nothing
DB_QueryINSERT ("can not increment user's clicks",
DB_QueryUPDATE ("can not increment user's clicks",
"UPDATE IGNORE usr_figures"
" SET NumClicks=NumClicks+1"
" WHERE UsrCod=%ld"
@ -1364,7 +1364,7 @@ void Prf_IncrementNumPubsUsr (long UsrCod)
{
/***** Increment number of social publications *****/
// If NumSocPub < 0 ==> not yet calculated, so do nothing
DB_QueryINSERT ("can not increment user's social publications",
DB_QueryUPDATE ("can not increment user's social publications",
"UPDATE IGNORE usr_figures"
" SET NumSocPub=NumSocPub+1"
" WHERE UsrCod=%ld"
@ -1380,7 +1380,7 @@ void Prf_IncrementNumFileViewsUsr (long UsrCod)
{
/***** Increment number of file views *****/
// If NumFileViews < 0 ==> not yet calculated, so do nothing
DB_QueryINSERT ("can not increment user's file views",
DB_QueryUPDATE ("can not increment user's file views",
"UPDATE IGNORE usr_figures"
" SET NumFileViews=NumFileViews+1"
" WHERE UsrCod=%ld"
@ -1396,7 +1396,7 @@ void Prf_IncrementNumForPstUsr (long UsrCod)
{
/***** Increment number of forum posts *****/
// If NumForPst < 0 ==> not yet calculated, so do nothing
DB_QueryINSERT ("can not increment user's forum posts",
DB_QueryUPDATE ("can not increment user's forum posts",
"UPDATE IGNORE usr_figures"
" SET NumForPst=NumForPst+1"
" WHERE UsrCod=%ld"
@ -1412,7 +1412,7 @@ void Prf_IncrementNumMsgSntUsr (long UsrCod)
{
/***** Increment number of messages sent *****/
// If NumMsgSnt < 0 ==> not yet calculated, so do nothing
DB_QueryINSERT ("can not increment user's messages sent",
DB_QueryUPDATE ("can not increment user's messages sent",
"UPDATE IGNORE usr_figures"
" SET NumMsgSnt=NumMsgSnt+1"
" WHERE UsrCod=%ld"

View File

@ -2110,20 +2110,24 @@ static void Prg_InsertItem (const struct ProgramItem *ParentItem,
static long Prg_InsertItemIntoDB (struct ProgramItem *Item,const char *Txt)
{
return DB_QueryINSERTandReturnCode ("can not create new program item",
"INSERT INTO prg_items"
" (CrsCod,ItmInd,Level,UsrCod,StartTime,EndTime,Title,Txt)"
" VALUES"
" (%ld,%u,%u,%ld,FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
"'%s','%s')",
Gbl.Hierarchy.Crs.CrsCod,
Item->Hierarchy.Index,
Item->Hierarchy.Level,
Gbl.Usrs.Me.UsrDat.UsrCod,
Item->TimeUTC[Dat_START_TIME],
Item->TimeUTC[Dat_END_TIME ],
Item->Title,
Txt);
return
DB_QueryINSERTandReturnCode ("can not create new program item",
"INSERT INTO prg_items"
" (CrsCod,ItmInd,Level,UsrCod,"
"StartTime,EndTime,"
"Title,Txt)"
" VALUES"
" (%ld,%u,%u,%ld,"
"FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
"'%s','%s')",
Gbl.Hierarchy.Crs.CrsCod,
Item->Hierarchy.Index,
Item->Hierarchy.Level,
Gbl.Usrs.Me.UsrDat.UsrCod,
Item->TimeUTC[Dat_START_TIME],
Item->TimeUTC[Dat_END_TIME ],
Item->Title,
Txt);
}
/*****************************************************************************/

View File

@ -2525,7 +2525,8 @@ static void Prj_AddUsrsToProject (Prj_RoleInProject_t RoleInProject)
" (PrjCod,RoleInProject,UsrCod)"
" VALUES"
" (%ld,%u,%ld)",
Projects.PrjCod,(unsigned) RoleInProject,
Projects.PrjCod,
(unsigned) RoleInProject,
Gbl.Usrs.Other.UsrDat.UsrCod);
/* Flush cache */
@ -3999,12 +4000,12 @@ static void Prj_CreateProject (struct Prj_Project *Prj)
DB_QueryINSERTandReturnCode ("can not create new project",
"INSERT INTO prj_projects"
" (CrsCod,DptCod,Hidden,Assigned,NumStds,Proposal,"
"CreatTime,ModifTime,"
"Title,Description,Knowledge,Materials,URL)"
"CreatTime,ModifTime,"
"Title,Description,Knowledge,Materials,URL)"
" VALUES"
" (%ld,%ld,'%c','%c',%u,'%s',"
"FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
"'%s','%s','%s','%s','%s')",
"FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
"'%s','%s','%s','%s','%s')",
Gbl.Hierarchy.Crs.CrsCod,
Prj->DptCod,
Prj->Hidden == Prj_HIDDEN ? 'Y' :

View File

@ -423,10 +423,10 @@ static void Rep_CreateNewReportEntryIntoDB (const struct Rep_Report *Report)
DB_QueryINSERT ("can not create new user's usage report",
"INSERT INTO usr_reports"
" (UsrCod,ReportTimeUTC,"
"UniqueDirL,UniqueDirR,Filename,Permalink)"
"UniqueDirL,UniqueDirR,Filename,Permalink)"
" VALUES"
" (%ld,'%04d-%02d-%02d %02d:%02d:%02d',"
"'%c%c','%s','%s','%s')",
"'%c%c','%s','%s','%s')",
Gbl.Usrs.Me.UsrDat.UsrCod,
1900 + Report->tm_CurrentTime.tm_year, // year
1 + Report->tm_CurrentTime.tm_mon, // month
@ -437,7 +437,8 @@ static void Rep_CreateNewReportEntryIntoDB (const struct Rep_Report *Report)
Gbl.UniqueNameEncrypted[0], // 2 leftmost chars from a unique 43 chars base64url codified from a unique SHA-256 string
Gbl.UniqueNameEncrypted[1],
&Gbl.UniqueNameEncrypted[2], // 41 rightmost chars from a unique 43 chars base64url codified from a unique SHA-256 string
Report->FilenameReport,Report->Permalink);
Report->FilenameReport,
Report->Permalink);
}
/*****************************************************************************/

View File

@ -1620,9 +1620,11 @@ static void Roo_CreateRoom (struct Roo_Room *Room)
Room->RooCod =
DB_QueryINSERTandReturnCode ("can not create room",
"INSERT INTO roo_rooms"
" (CtrCod,BldCod,Floor,Type,ShortName,FullName,Capacity)"
" (CtrCod,BldCod,Floor,Type,"
"ShortName,FullName,Capacity)"
" VALUES"
" (%ld,%ld,%d,'%s','%s','%s',%u)",
" (%ld,%ld,%d,'%s',"
"'%s','%s',%u)",
Gbl.Hierarchy.Ctr.CtrCod,
Room->BldCod,
Room->Floor,

View File

@ -165,10 +165,10 @@ void Ses_InsertSessionInDB (void)
DB_QueryINSERT ("can not create session",
"INSERT INTO ses_sessions"
" (SessionId,UsrCod,Password,Role,"
"CtyCod,InsCod,CtrCod,DegCod,CrsCod,LastTime,LastRefresh,WhatToSearch)"
"CtyCod,InsCod,CtrCod,DegCod,CrsCod,LastTime,LastRefresh,WhatToSearch)"
" VALUES"
" ('%s',%ld,'%s',%u,"
"%ld,%ld,%ld,%ld,%ld,NOW(),NOW(),%u)",
"%ld,%ld,%ld,%ld,%ld,NOW(),NOW(),%u)",
Gbl.Session.Id,
Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Usrs.Me.UsrDat.Password,
@ -513,7 +513,9 @@ void Ses_AddPublicDirToCache (const char *FullPathMediaPriv,
" (SessionId,PrivPath,TmpPubDir)"
" VALUES"
" ('%s','%s','%s')",
Gbl.Session.Id,FullPathMediaPriv,TmpPubDir);
Gbl.Session.Id,
FullPathMediaPriv,
TmpPubDir);
}
}

View File

@ -203,11 +203,12 @@ void Set_SetSettingsFromIP (void)
DB_QueryREPLACE ("can not store settings from current IP address",
"REPLACE INTO set_ip_settings"
" (IP,UsrCod,LastChange,"
"FirstDayOfWeek,DateFormat,Theme,IconSet,Menu,SideCols)"
"FirstDayOfWeek,DateFormat,Theme,IconSet,Menu,SideCols)"
" VALUES"
" ('%s',%ld,NOW(),"
"%u,%u,'%s','%s',%u,%u)",
Gbl.IP,Gbl.Usrs.Me.UsrDat.UsrCod,
"%u,%u,'%s','%s',%u,%u)",
Gbl.IP,
Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Prefs.FirstDayOfWeek,
(unsigned) Gbl.Prefs.DateFormat,
The_ThemeId[Gbl.Prefs.Theme],

View File

@ -2346,12 +2346,15 @@ static void Svy_CreateSurvey (struct Svy_Survey *Svy,const char *Txt)
Svy->SvyCod =
DB_QueryINSERTandReturnCode ("can not create new survey",
"INSERT INTO svy_surveys"
" (Scope,Cod,Hidden,Roles,UsrCod,StartTime,EndTime,Title,Txt)"
" (Scope,Cod,Hidden,Roles,UsrCod,"
"StartTime,EndTime,"
"Title,Txt)"
" VALUES"
" ('%s',%ld,'N',%u,%ld,"
"FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
"'%s','%s')",
Sco_GetDBStrFromScope (Svy->Scope),Svy->Cod,
"FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),"
"'%s','%s')",
Sco_GetDBStrFromScope (Svy->Scope),
Svy->Cod,
Svy->Roles,
Gbl.Usrs.Me.UsrDat.UsrCod,
Svy->TimeUTC[Svy_START_TIME],
@ -2466,7 +2469,8 @@ static void Svy_CreateGrps (long SvyCod)
" (SvyCod,GrpCod)"
" VALUES"
" (%ld,%ld)",
SvyCod,Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
SvyCod,
Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
}
/*****************************************************************************/
@ -3134,15 +3138,21 @@ void Svy_ReceiveQst (void)
" VALUES"
" (%ld,%u,'%s','%s')",
SvyCod,SvyQst.QstInd,
Svy_StrAnswerTypesDB[SvyQst.AnswerType],Txt);
Svy_StrAnswerTypesDB[SvyQst.AnswerType],
Txt);
}
else // It's an existing question
/* Update question */
DB_QueryUPDATE ("can not update question",
"UPDATE svy_questions SET Stem='%s',AnsType='%s'"
" WHERE QstCod=%ld AND SvyCod=%ld",
Txt,Svy_StrAnswerTypesDB[SvyQst.AnswerType],
SvyQst.QstCod,SvyCod);
"UPDATE svy_questions"
" SET Stem='%s',"
"AnsType='%s'"
" WHERE QstCod=%ld"
" AND SvyCod=%ld",
Txt,
Svy_StrAnswerTypesDB[SvyQst.AnswerType],
SvyQst.QstCod,
SvyCod);
/* Insert, update or delete answers in the answers table */
for (NumAns = 0;
@ -3153,15 +3163,20 @@ void Svy_ReceiveQst (void)
if (SvyQst.AnsChoice[NumAns].Text[0]) // Answer is not empty
/* Update answer text */
DB_QueryUPDATE ("can not update answer",
"UPDATE svy_answers SET Answer='%s'"
" WHERE QstCod=%ld AND AnsInd=%u",
SvyQst.AnsChoice[NumAns].Text,SvyQst.QstCod,NumAns);
"UPDATE svy_answers"
" SET Answer='%s'"
" WHERE QstCod=%ld"
" AND AnsInd=%u",
SvyQst.AnsChoice[NumAns].Text,
SvyQst.QstCod,NumAns);
else // Answer is empty
/* Delete answer from database */
DB_QueryDELETE ("can not delete answer",
"DELETE FROM svy_answers"
" WHERE QstCod=%ld AND AnsInd=%u",
SvyQst.QstCod,NumAns);
" WHERE QstCod=%ld"
" AND AnsInd=%u",
SvyQst.QstCod,
NumAns);
}
else // If this answer does not exist...
{
@ -3172,7 +3187,9 @@ void Svy_ReceiveQst (void)
" (QstCod,AnsInd,NumUsrs,Answer)"
" VALUES"
" (%ld,%u,0,'%s')",
SvyQst.QstCod,NumAns,SvyQst.AnsChoice[NumAns].Text);
SvyQst.QstCod,
NumAns,
SvyQst.AnsChoice[NumAns].Text);
}
/***** List the questions of this survey, including the new one just inserted into the database *****/
@ -3844,7 +3861,8 @@ static void Svy_RegisterIHaveAnsweredSvy (long SvyCod)
" (SvyCod,UsrCod)"
" VALUES"
" (%ld,%ld)",
SvyCod,Gbl.Usrs.Me.UsrDat.UsrCod);
SvyCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
}
/*****************************************************************************/

View File

@ -410,7 +410,9 @@ void Tag_InsertTagsIntoDB (long QstCod,const struct Tag_Tags *Tags)
" (QstCod,TagCod,TagInd)"
" VALUES"
" (%ld,%ld,%u)",
QstCod,TagCod,TagIdx);
QstCod,
TagCod,
TagIdx);
TagIdx++;
}
@ -429,7 +431,8 @@ static long Tag_CreateNewTag (long CrsCod,const char *TagTxt)
" (CrsCod,ChangeTime,TagTxt,TagHidden)"
" VALUES"
" (%ld,NOW(),'%s','Y')", // Hidden by default
CrsCod,TagTxt);
CrsCod,
TagTxt);
}
/*****************************************************************************/

View File

@ -4992,7 +4992,7 @@ static void Tst_InsertOrUpdateQstIntoDB (struct Tst_Question *Question)
'N',
Question->Stem,
Question->Feedback ? Question->Feedback :
"",
"",
Question->Media.MedCod);
}
else // It's an existing question
@ -5054,7 +5054,8 @@ static void Tst_InsertAnswersIntoDB (struct Tst_Question *Question)
" (QstCod,AnsInd,Answer,Feedback,MedCod,Correct)"
" VALUES"
" (%ld,%u,'%.15lg','',-1,'Y')",
Question->QstCod,i,
Question->QstCod,
i,
Question->Answer.FloatingPoint[i]);
Str_SetDecimalPointToLocal (); // Return to local system
break;

View File

@ -225,9 +225,11 @@ void TstCfg_ReceiveConfigTst (void)
/***** Update database *****/
DB_QueryREPLACE ("can not save configuration of tests",
"REPLACE INTO tst_config"
" (CrsCod,Pluggable,Min,Def,Max,MinTimeNxtTstPerQst,Visibility)"
" (CrsCod,Pluggable,Min,Def,Max,"
"MinTimeNxtTstPerQst,Visibility)"
" VALUES"
" (%ld,'%s',%u,%u,%u,'%lu',%u)",
" (%ld,'%s',%u,%u,%u,"
"'%lu',%u)",
Gbl.Hierarchy.Crs.CrsCod,
TstCfg_PluggableDB[TstCfg_GetConfigPluggable ()],
TstCfg_GetConfigMin (),

View File

@ -215,9 +215,13 @@ void TstPrn_CreatePrintInDB (struct TstPrn_Print *Print)
Print->PrnCod =
DB_QueryINSERTandReturnCode ("can not create new test exam print",
"INSERT INTO tst_exams"
" (CrsCod,UsrCod,StartTime,EndTime,NumQsts,NumQstsNotBlank,Sent,AllowTeachers,Score)"
" (CrsCod,UsrCod,StartTime,EndTime,"
"NumQsts,NumQstsNotBlank,"
"Sent,AllowTeachers,Score)"
" VALUES"
" (%ld,%ld,NOW(),NOW(),%u,0,'N','N',0)",
" (%ld,%ld,NOW(),NOW(),"
"%u,0,"
"'N','N',0)",
Gbl.Hierarchy.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod,
Print->NumQsts.All);
@ -1837,7 +1841,8 @@ static void TstPrn_StoreOneQstOfPrintInDB (const struct TstPrn_Print *Print,
" (ExaCod,QstCod,QstInd,Score,Indexes,Answers)"
" VALUES"
" (%ld,%ld,%u,'%.15lg','%s','%s')",
Print->PrnCod,Print->PrintedQuestions[NumQst].QstCod,
Print->PrnCod,
Print->PrintedQuestions[NumQst].QstCod,
NumQst, // 0, 1, 2, 3...
Print->PrintedQuestions[NumQst].Score,
Print->PrintedQuestions[NumQst].StrIndexes,

View File

@ -159,9 +159,11 @@ long Tml_DB_CreateNewNote (Tml_Not_NoteType_t NoteType,long Cod,
return
DB_QueryINSERTandReturnCode ("can not create new note",
"INSERT INTO tml_notes"
" (NoteType,Cod,UsrCod,HieCod,Unavailable,TimeNote)"
" (NoteType,Cod,UsrCod,HieCod,"
"Unavailable,TimeNote)"
" VALUES"
" (%u,%ld,%ld,%ld,'N',NOW())",
" (%u,%ld,%ld,%ld,"
"'N',NOW())",
(unsigned) NoteType, // Post, file, exam, notice, forum
Cod, // Post, file, exam, notice, forum code
PublisherCod, // Publisher code

View File

@ -628,7 +628,8 @@ static void Tmt_WriteCrsTimeTableIntoDB (const struct Tmt_Timetable *Timetable,
CrsCod,
Tmt_TimeTable[Weekday][Interval].Columns[Column].GrpCod,
Weekday,
Hour,Min,
Hour,
Min,
Tmt_TimeTable[Weekday][Interval].Columns[Column].DurationIntervals *
Timetable->Config.SecondsPerInterval,
Tmt_ClassTypeDB[Tmt_TimeTable[Weekday][Interval].Columns[Column].ClassType],
@ -675,7 +676,8 @@ static void Tmt_WriteTutTimeTableIntoDB (const struct Tmt_Timetable *Timetable,
" (%ld,%u,'%02u:%02u:00',SEC_TO_TIME(%u),'%s')",
UsrCod,
Weekday,
Hour,Min,
Hour,
Min,
Tmt_TimeTable[Weekday][Interval].Columns[Column].DurationIntervals *
Timetable->Config.SecondsPerInterval,
Tmt_TimeTable[Weekday][Interval].Columns[Column].Info);

View File

@ -3588,9 +3588,11 @@ static void Usr_InsertMyLastData (void)
/***** Insert my last accessed course, tab and time of click in database *****/
DB_QueryINSERT ("can not insert last user's data",
"INSERT INTO usr_last"
" (UsrCod,WhatToSearch,LastSco,LastCod,LastAct,LastRole,LastTime,LastAccNotif)"
" (UsrCod,WhatToSearch,"
"LastSco,LastCod,LastAct,LastRole,LastTime,LastAccNotif)"
" VALUES"
" (%ld,%u,'%s',%ld,%ld,%u,NOW(),FROM_UNIXTIME(%ld))",
" (%ld,%u,"
"'%s',%ld,%ld,%u,NOW(),FROM_UNIXTIME(%ld))",
Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Sch_SEARCH_ALL,
Sco_GetDBStrFromScope (Gbl.Hierarchy.Level),