Version 18.11.19

This commit is contained in:
Antonio Cañas Vargas 2018-11-02 19:37:11 +01:00
parent c364d4ea76
commit 8ec272448b
41 changed files with 620 additions and 654 deletions

View File

@ -1015,14 +1015,14 @@ static void ID_NewUsrID (const struct UsrData *UsrDat,bool ItsMe)
static void ID_InsertANewUsrIDInDB (long UsrCod,const char *NewID,bool Confirmed) static void ID_InsertANewUsrIDInDB (long UsrCod,const char *NewID,bool Confirmed)
{ {
/***** Update my nickname in database *****/ /***** Update my nickname in database *****/
DB_BuildQuery ("INSERT INTO usr_IDs" DB_QueryINSERT ("can not insert a new ID",
" (UsrCod,UsrID,CreatTime,Confirmed)" "INSERT INTO usr_IDs"
" VALUES" " (UsrCod,UsrID,CreatTime,Confirmed)"
" (%ld,'%s',NOW(),'%c')", " VALUES"
UsrCod,NewID, " (%ld,'%s',NOW(),'%c')",
Confirmed ? 'Y' : UsrCod,NewID,
'N'); Confirmed ? 'Y' :
DB_QueryINSERT_new ("can not insert a new ID"); 'N');
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1148,8 +1148,8 @@ void ID_ConfirmOtherUsrID (void)
void ID_ConfirmUsrID (const struct UsrData *UsrDat,const char *UsrID) void ID_ConfirmUsrID (const struct UsrData *UsrDat,const char *UsrID)
{ {
/***** Update database *****/ /***** Update database *****/
DB_BuildQuery ("UPDATE usr_IDs SET Confirmed='Y'" DB_QueryINSERT ("can not confirm a user's ID",
" WHERE UsrCod=%ld AND UsrID='%s' AND Confirmed<>'Y'", "UPDATE usr_IDs SET Confirmed='Y'"
UsrDat->UsrCod,UsrID); " WHERE UsrCod=%ld AND UsrID='%s' AND Confirmed<>'Y'",
DB_QueryINSERT_new ("can not confirm a user's ID"); UsrDat->UsrCod,UsrID);
} }

View File

@ -775,15 +775,15 @@ void Acc_CreateNewUsr (struct UsrData *UsrDat,bool CreatingMyOwnAccount)
NumID++) NumID++)
{ {
Str_ConvertToUpperText (UsrDat->IDs.List[NumID].ID); Str_ConvertToUpperText (UsrDat->IDs.List[NumID].ID);
DB_BuildQuery ("INSERT INTO usr_IDs" DB_QueryINSERT ("can not store user's ID when creating user",
" (UsrCod,UsrID,CreatTime,Confirmed)" "INSERT INTO usr_IDs"
" VALUES" " (UsrCod,UsrID,CreatTime,Confirmed)"
" (%ld,'%s',NOW(),'%c')", " VALUES"
UsrDat->UsrCod, " (%ld,'%s',NOW(),'%c')",
UsrDat->IDs.List[NumID].ID, UsrDat->UsrCod,
UsrDat->IDs.List[NumID].Confirmed ? 'Y' : UsrDat->IDs.List[NumID].ID,
'N'); UsrDat->IDs.List[NumID].Confirmed ? 'Y' :
DB_QueryINSERT_new ("can not store user's ID when creating user"); 'N');
} }
/***** Create directory for the user, if not exists *****/ /***** Create directory for the user, if not exists *****/

View File

@ -512,12 +512,12 @@ void Ann_ReceiveAnnouncement (void)
static void Ann_CreateAnnouncement (unsigned Roles,const char *Subject,const char *Content) static void Ann_CreateAnnouncement (unsigned Roles,const char *Subject,const char *Content)
{ {
/***** Select announcements not seen *****/ /***** Select announcements not seen *****/
DB_BuildQuery ("INSERT INTO announcements" DB_QueryINSERT ("can not create announcement",
" (Roles,Subject,Content)" "INSERT INTO announcements"
" VALUES" " (Roles,Subject,Content)"
" (%u,'%s','%s')", " VALUES"
Roles,Subject,Content); " (%u,'%s','%s')",
DB_QueryINSERT_new ("can not create announcement"); Roles,Subject,Content);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -1617,15 +1617,14 @@ static void Asg_CreateGrps (long AsgCod)
for (NumGrpSel = 0; for (NumGrpSel = 0;
NumGrpSel < Gbl.CurrentCrs.Grps.LstGrpsSel.NumGrps; NumGrpSel < Gbl.CurrentCrs.Grps.LstGrpsSel.NumGrps;
NumGrpSel++) NumGrpSel++)
{
/* Create group */ /* Create group */
DB_BuildQuery ("INSERT INTO asg_grp" DB_QueryINSERT ("can not associate a group to an assignment",
" (AsgCod,GrpCod)" "INSERT INTO asg_grp"
" VALUES" " (AsgCod,GrpCod)"
" (%ld,%ld)", " VALUES"
AsgCod,Gbl.CurrentCrs.Grps.LstGrpsSel.GrpCods[NumGrpSel]); " (%ld,%ld)",
DB_QueryINSERT_new ("can not associate a group to an assignment"); AsgCod,
} Gbl.CurrentCrs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -1483,15 +1483,14 @@ static void Att_CreateGrps (long AttCod)
for (NumGrpSel = 0; for (NumGrpSel = 0;
NumGrpSel < Gbl.CurrentCrs.Grps.LstGrpsSel.NumGrps; NumGrpSel < Gbl.CurrentCrs.Grps.LstGrpsSel.NumGrps;
NumGrpSel++) NumGrpSel++)
{
/* Create group */ /* Create group */
DB_BuildQuery ("INSERT INTO att_grp" DB_QueryINSERT ("can not associate a group to an attendance event",
" (AttCod,GrpCod)" "INSERT INTO att_grp"
" VALUES" " (AttCod,GrpCod)"
" (%ld,%ld)", " VALUES"
AttCod,Gbl.CurrentCrs.Grps.LstGrpsSel.GrpCods[NumGrpSel]); " (%ld,%ld)",
DB_QueryINSERT_new ("can not associate a group to an attendance event"); AttCod,
} Gbl.CurrentCrs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -986,12 +986,12 @@ static void Ban_CreateBanner (struct Banner *Ban)
extern const char *Txt_Created_new_banner_X; extern const char *Txt_Created_new_banner_X;
/***** Create a new banner *****/ /***** Create a new banner *****/
DB_BuildQuery ("INSERT INTO banners" DB_QueryINSERT ("can not create banner",
" (Hidden,ShortName,FullName,Img,WWW)" "INSERT INTO banners"
" VALUES" " (Hidden,ShortName,FullName,Img,WWW)"
" ('N','%s','%s','%s','%s')", " VALUES"
Ban->ShrtName,Ban->FullName,Ban->Img,Ban->WWW); " ('N','%s','%s','%s','%s')",
DB_QueryINSERT_new ("can not create banner"); Ban->ShrtName,Ban->FullName,Ban->Img,Ban->WWW);
/***** Write success message *****/ /***** Write success message *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),

View File

@ -355,10 +355,11 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf ps2pdf source.ps destination.pdf
*/ */
#define Log_PLATFORM_VERSION "SWAD 18.11.18 (2018-11-02)" #define Log_PLATFORM_VERSION "SWAD 18.11.19 (2018-11-02)"
#define CSS_FILE "swad18.4.css" #define CSS_FILE "swad18.4.css"
#define JS_FILE "swad17.17.1.js" #define JS_FILE "swad17.17.1.js"
/* /*
Version 18.11.19: Nov 02, 2018 Joining building and performing query into one function. (236465 lines)
Version 18.11.18: Nov 02, 2018 Joining building and performing query into one function. (236499 lines) Version 18.11.18: Nov 02, 2018 Joining building and performing query into one function. (236499 lines)
Version 18.11.17: Nov 02, 2018 Joining building and performing query into one function. (236504 lines) Version 18.11.17: Nov 02, 2018 Joining building and performing query into one function. (236504 lines)
Version 18.11.16: Nov 02, 2018 Joining building and performing query into one function. (236332 lines) Version 18.11.16: Nov 02, 2018 Joining building and performing query into one function. (236332 lines)

View File

@ -2255,13 +2255,13 @@ static void Cty_CreateCountry (struct Country *Cty)
Str_Concat (SubQueryWWW2,"'", Str_Concat (SubQueryWWW2,"'",
Cty_MAX_BYTES_SUBQUERY_CTYS_WWW); Cty_MAX_BYTES_SUBQUERY_CTYS_WWW);
} }
DB_BuildQuery ("INSERT INTO countries" DB_QueryINSERT ("can not create country",
" (CtyCod,Alpha2%s%s)" "INSERT INTO countries"
" VALUES" " (CtyCod,Alpha2%s%s)"
" ('%03ld','%s'%s%s)", " VALUES"
SubQueryNam1,SubQueryWWW1, " ('%03ld','%s'%s%s)",
Cty->CtyCod,Cty->Alpha2,SubQueryNam2,SubQueryWWW2); SubQueryNam1,SubQueryWWW1,
DB_QueryINSERT_new ("can not create country"); Cty->CtyCod,Cty->Alpha2,SubQueryNam2,SubQueryWWW2);
/***** Write success message *****/ /***** Write success message *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),

View File

@ -2208,13 +2208,13 @@ static void Crs_EmptyCourseCompletely (long CrsCod)
/***** Remove notices in the course *****/ /***** Remove notices in the course *****/
/* Copy all notices from the course to table of deleted notices */ /* Copy all notices from the course to table of deleted notices */
DB_BuildQuery ("INSERT INTO notices_deleted" DB_QueryINSERT ("can not remove notices in a course",
" (NotCod,CrsCod,UsrCod,CreatTime,Content,NumNotif)" "INSERT INTO notices_deleted"
" SELECT NotCod,CrsCod,UsrCod,CreatTime,Content,NumNotif" " (NotCod,CrsCod,UsrCod,CreatTime,Content,NumNotif)"
" FROM notices" " SELECT NotCod,CrsCod,UsrCod,CreatTime,Content,NumNotif"
" WHERE CrsCod=%ld", " FROM notices"
CrsCod); " WHERE CrsCod=%ld",
DB_QueryINSERT_new ("can not remove notices in a course"); CrsCod);
/* Remove all notices from the course */ /* Remove all notices from the course */
DB_BuildQuery ("DELETE FROM notices WHERE CrsCod=%ld",CrsCod); DB_BuildQuery ("DELETE FROM notices WHERE CrsCod=%ld",CrsCod);

View File

@ -3154,8 +3154,7 @@ unsigned long DB_QuerySELECT_old (char **Query,MYSQL_RES **mysql_res,const char
/**************** Make a SELECT COUNT query from database ********************/ /**************** Make a SELECT COUNT query from database ********************/
/*****************************************************************************/ /*****************************************************************************/
unsigned long DB_QueryCOUNT (const char *MsgError, unsigned long DB_QueryCOUNT (const char *MsgError,const char *fmt,...)
const char *fmt,...)
{ {
va_list ap; va_list ap;
int NumBytesPrinted; int NumBytesPrinted;
@ -3202,21 +3201,22 @@ unsigned long DB_QueryCOUNT_old (char **Query,const char *MsgError)
/******************** Make an INSERT query in database ***********************/ /******************** Make an INSERT query in database ***********************/
/*****************************************************************************/ /*****************************************************************************/
void DB_QueryINSERT_new (const char *MsgError) void DB_QueryINSERT (const char *MsgError,const char *fmt,...)
{ {
int Result; va_list ap;
int NumBytesPrinted;
char *Query = NULL;
/***** Check that query string pointer va_start (ap,fmt);
does point to an allocated string *****/ NumBytesPrinted = vasprintf (&Query,fmt,ap);
if (Gbl.DB.QueryPtr == NULL) va_end (ap);
Lay_ShowErrorAndExit ("Wrong query string.");
/***** Query database and free query string pointer *****/ if (NumBytesPrinted < 0) // If memory allocation wasn't possible,
Result = mysql_query (&Gbl.mysql,Gbl.DB.QueryPtr); // Returns 0 on success // or some other error occurs,
free ((void *) Gbl.DB.QueryPtr); // vasprintf will return -1
Gbl.DB.QueryPtr = NULL; Lay_NotEnoughMemoryExit ();
if (Result)
DB_ExitOnMySQLError (MsgError); DB_QueryINSERT_old (&Query,MsgError);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -44,12 +44,11 @@ unsigned long DB_QuerySELECT (MYSQL_RES **mysql_res,const char *MsgError,
const char *fmt,...); const char *fmt,...);
unsigned long DB_QuerySELECT_old (char **Query,MYSQL_RES **mysql_res,const char *MsgError); unsigned long DB_QuerySELECT_old (char **Query,MYSQL_RES **mysql_res,const char *MsgError);
unsigned long DB_QueryCOUNT (const char *MsgError, unsigned long DB_QueryCOUNT (const char *MsgError,const char *fmt,...);
const char *fmt,...);
unsigned long DB_QueryCOUNT_new (const char *MsgError); unsigned long DB_QueryCOUNT_new (const char *MsgError);
unsigned long DB_QueryCOUNT_old (char **Query,const char *MsgError); unsigned long DB_QueryCOUNT_old (char **Query,const char *MsgError);
void DB_QueryINSERT_new (const char *MsgError); void DB_QueryINSERT (const char *MsgError,const char *fmt,...);
void DB_QueryINSERT_old (char **Query,const char *MsgError); void DB_QueryINSERT_old (char **Query,const char *MsgError);
long DB_QueryINSERTandReturnCode_new (const char *MsgError); long DB_QueryINSERTandReturnCode_new (const char *MsgError);

View File

@ -546,9 +546,9 @@ static void DT_CreateDegreeType (struct DegreeType *DegTyp)
extern const char *Txt_Created_new_type_of_degree_X; extern const char *Txt_Created_new_type_of_degree_X;
/***** Create a new degree type *****/ /***** Create a new degree type *****/
DB_BuildQuery ("INSERT INTO deg_types SET DegTypName='%s'", DB_QueryINSERT ("can not create a new type of degree",
DegTyp->DegTypName); "INSERT INTO deg_types SET DegTypName='%s'",
DB_QueryINSERT_new ("can not create a new type of degree"); DegTyp->DegTypName);
/***** Write success message *****/ /***** Write success message *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),

View File

@ -1051,12 +1051,12 @@ static void Dpt_CreateDepartment (struct Department *Dpt)
extern const char *Txt_Created_new_department_X; extern const char *Txt_Created_new_department_X;
/***** Create a new department *****/ /***** Create a new department *****/
DB_BuildQuery ("INSERT INTO departments" DB_QueryINSERT ("can not create a new department",
" (InsCod,ShortName,FullName,WWW)" "INSERT INTO departments"
" VALUES" " (InsCod,ShortName,FullName,WWW)"
" (%ld,'%s','%s','%s')", " VALUES"
Dpt->InsCod,Dpt->ShrtName,Dpt->FullName,Dpt->WWW); " (%ld,'%s','%s','%s')",
DB_QueryINSERT_new ("can not create a new department"); Dpt->InsCod,Dpt->ShrtName,Dpt->FullName,Dpt->WWW);
/***** Write success message *****/ /***** Write success message *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),

View File

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

View File

@ -264,25 +264,25 @@ void Enr_RegisterUsrInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole,
} }
/***** Register user in current course in database *****/ /***** Register user in current course in database *****/
DB_BuildQuery ("INSERT INTO crs_usr" DB_QueryINSERT ("can not register user in course",
" (CrsCod,UsrCod,Role,Accepted," "INSERT INTO crs_usr"
"LastDowGrpCod,LastComGrpCod,LastAssGrpCod," " (CrsCod,UsrCod,Role,Accepted,"
"NumAccTst,LastAccTst,NumQstsLastTst," "LastDowGrpCod,LastComGrpCod,LastAssGrpCod,"
"UsrListType,ColsClassPhoto,ListWithPhotos)" "NumAccTst,LastAccTst,NumQstsLastTst,"
" VALUES" "UsrListType,ColsClassPhoto,ListWithPhotos)"
" (%ld,%ld,%u,'%c'," " VALUES"
"-1,-1,-1," " (%ld,%ld,%u,'%c',"
"0,FROM_UNIXTIME(%ld),0," "-1,-1,-1,"
"'%s',%u,'%c')", "0,FROM_UNIXTIME(%ld),0,"
Gbl.CurrentCrs.Crs.CrsCod,UsrDat->UsrCod,(unsigned) NewRole, "'%s',%u,'%c')",
KeepOrSetAccepted == Enr_SET_ACCEPTED_TO_TRUE ? 'Y' : Gbl.CurrentCrs.Crs.CrsCod,UsrDat->UsrCod,(unsigned) NewRole,
'N', KeepOrSetAccepted == Enr_SET_ACCEPTED_TO_TRUE ? 'Y' :
(long) (time_t) 0, // The user never accessed to tests in this course 'N',
Usr_StringsUsrListTypeInDB[Usr_SHOW_USRS_TYPE_DEFAULT], (long) (time_t) 0, // The user never accessed to tests in this course
Usr_CLASS_PHOTO_COLS_DEF, Usr_StringsUsrListTypeInDB[Usr_SHOW_USRS_TYPE_DEFAULT],
Usr_LIST_WITH_PHOTOS_DEF ? 'Y' : Usr_CLASS_PHOTO_COLS_DEF,
'N'); Usr_LIST_WITH_PHOTOS_DEF ? 'Y' :
DB_QueryINSERT_new ("can not register user in course"); 'N');
/***** Flush caches *****/ /***** Flush caches *****/
Usr_FlushCachesUsr (); Usr_FlushCachesUsr ();

View File

@ -7806,14 +7806,14 @@ static void Brw_AddPathToClipboards (void)
long WorksUsrCod = Brw_GetWorksUsrCodForClipboard (); long WorksUsrCod = Brw_GetWorksUsrCodForClipboard ();
/***** Add path to clipboards *****/ /***** Add path to clipboards *****/
DB_BuildQuery ("INSERT INTO clipboard" DB_QueryINSERT ("can not add source of copy to clipboard",
" (UsrCod,FileBrowser,Cod,WorksUsrCod,FileType,Path)" "INSERT INTO clipboard"
" VALUES" " (UsrCod,FileBrowser,Cod,WorksUsrCod,FileType,Path)"
" (%ld,%u,%ld,%ld,%u,'%s')", " VALUES"
Gbl.Usrs.Me.UsrDat.UsrCod,(unsigned) Gbl.FileBrowser.Type, " (%ld,%u,%ld,%ld,%u,'%s')",
Cod,WorksUsrCod, Gbl.Usrs.Me.UsrDat.UsrCod,(unsigned) Gbl.FileBrowser.Type,
(unsigned) Gbl.FileBrowser.FileType,Gbl.FileBrowser.Priv.FullPathInTree); Cod,WorksUsrCod,
DB_QueryINSERT_new ("can not add source of copy to clipboard"); (unsigned) Gbl.FileBrowser.FileType,Gbl.FileBrowser.Priv.FullPathInTree);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -7956,15 +7956,15 @@ static void Brw_InsertFolderInExpandedFolders (const char Path[PATH_MAX + 1])
/***** Update path time in table of expanded folders *****/ /***** Update path time in table of expanded folders *****/
// Path must be stored with final '/' // Path must be stored with final '/'
DB_BuildQuery ("INSERT INTO expanded_folders" DB_QueryINSERT ("can not expand the content of a folder",
" (UsrCod,FileBrowser,Cod,WorksUsrCod,Path,ClickTime)" "INSERT INTO expanded_folders"
" VALUES" " (UsrCod,FileBrowser,Cod,WorksUsrCod,Path,ClickTime)"
" (%ld,%u,%ld,%ld,'%s/',NOW())", " VALUES"
Gbl.Usrs.Me.UsrDat.UsrCod, " (%ld,%u,%ld,%ld,'%s/',NOW())",
(unsigned) Brw_FileBrowserForDB_expanded_folders[Gbl.FileBrowser.Type], Gbl.Usrs.Me.UsrDat.UsrCod,
Cod,WorksUsrCod, (unsigned) Brw_FileBrowserForDB_expanded_folders[Gbl.FileBrowser.Type],
Path); Cod,WorksUsrCod,
DB_QueryINSERT_new ("can not expand the content of a folder"); Path);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -11542,15 +11542,13 @@ static void Brw_UpdateFileViews (unsigned NumViews,long FilCod)
DB_QueryUPDATE_new ("can not update number of views of a file"); DB_QueryUPDATE_new ("can not update number of views of a file");
} }
else // NumViews == 0 else // NumViews == 0
{
/* Insert number of views in database */ /* Insert number of views in database */
DB_BuildQuery ("INSERT INTO file_view" DB_QueryINSERT ("can not insert number of views of a file",
" (FilCod,UsrCod,NumViews)" "INSERT INTO file_view"
" VALUES" " (FilCod,UsrCod,NumViews)"
" (%ld,%ld,1)", " VALUES"
FilCod,Gbl.Usrs.Me.UsrDat.UsrCod); " (%ld,%ld,1)",
DB_QueryINSERT_new ("can not insert number of views of a file"); FilCod,Gbl.Usrs.Me.UsrDat.UsrCod);
}
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -2313,15 +2313,13 @@ static void Gam_CreateGrps (long GamCod)
for (NumGrpSel = 0; for (NumGrpSel = 0;
NumGrpSel < Gbl.CurrentCrs.Grps.LstGrpsSel.NumGrps; NumGrpSel < Gbl.CurrentCrs.Grps.LstGrpsSel.NumGrps;
NumGrpSel++) NumGrpSel++)
{
/* Create group */ /* Create group */
DB_BuildQuery ("INSERT INTO gam_grp" DB_QueryINSERT ("can not associate a group to a game",
" (GamCod,GrpCod)" "INSERT INTO gam_grp"
" VALUES" " (GamCod,GrpCod)"
" (%ld,%ld)", " VALUES"
GamCod,Gbl.CurrentCrs.Grps.LstGrpsSel.GrpCods[NumGrpSel]); " (%ld,%ld)",
DB_QueryINSERT_new ("can not associate a group to a game"); GamCod,Gbl.CurrentCrs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
}
} }
/*****************************************************************************/ /*****************************************************************************/
@ -3031,12 +3029,12 @@ void Gam_AddTstQuestionsToGame (void)
MaxQstInd = Gam_GetMaxQuestionIndexInGame (Game.GamCod); // -1 if no questions MaxQstInd = Gam_GetMaxQuestionIndexInGame (Game.GamCod); // -1 if no questions
/* Insert question in the table of questions */ /* Insert question in the table of questions */
DB_BuildQuery ("INSERT INTO gam_questions" DB_QueryINSERT ("can not create question",
" (GamCod,QstCod,QstInd)" "INSERT INTO gam_questions"
" VALUES" " (GamCod,QstCod,QstInd)"
" (%ld,%ld,%u)", " VALUES"
Game.GamCod,QstCod,(unsigned) (MaxQstInd + 1)); " (%ld,%ld,%u)",
DB_QueryINSERT_new ("can not create question"); Game.GamCod,QstCod,(unsigned) (MaxQstInd + 1));
} }
/***** Free space for selected question codes *****/ /***** Free space for selected question codes *****/
@ -3750,10 +3748,10 @@ static void Gam_IncreaseAnswerInDB (long QstCod,unsigned AnsInd)
{ {
/***** Increase number of users who have selected /***** Increase number of users who have selected
the answer AnsInd in the question QstCod *****/ the answer AnsInd in the question QstCod *****/
DB_BuildQuery ("UPDATE gam_answers SET NumUsrs=NumUsrs+1" DB_QueryINSERT ("can not register your answer to the game",
" WHERE QstCod=%ld AND AnsInd=%u", "UPDATE gam_answers SET NumUsrs=NumUsrs+1"
QstCod,AnsInd); " WHERE QstCod=%ld AND AnsInd=%u",
DB_QueryINSERT_new ("can not register your answer to the game"); QstCod,AnsInd);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -3762,12 +3760,12 @@ static void Gam_IncreaseAnswerInDB (long QstCod,unsigned AnsInd)
static void Gam_RegisterIHaveAnsweredGame (long GamCod) static void Gam_RegisterIHaveAnsweredGame (long GamCod)
{ {
DB_BuildQuery ("INSERT INTO gam_users" DB_QueryINSERT ("can not register that you have answered the game",
" (GamCod,UsrCod)" "INSERT INTO gam_users"
" VALUES" " (GamCod,UsrCod)"
" (%ld,%ld)", " VALUES"
GamCod,Gbl.Usrs.Me.UsrDat.UsrCod); " (%ld,%ld)",
DB_QueryINSERT_new ("can not register that you have answered the game"); GamCod,Gbl.Usrs.Me.UsrDat.UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -1266,12 +1266,12 @@ static void Grp_RemoveUsrFromGroup (long UsrCod,long GrpCod)
static void Grp_AddUsrToGroup (struct UsrData *UsrDat,long GrpCod) static void Grp_AddUsrToGroup (struct UsrData *UsrDat,long GrpCod)
{ {
/***** Register in group *****/ /***** Register in group *****/
DB_BuildQuery ("INSERT INTO crs_grp_usr" DB_QueryINSERT ("can not add a user to a group",
" (GrpCod,UsrCod)" "INSERT INTO crs_grp_usr"
" VALUES" " (GrpCod,UsrCod)"
" (%ld,%ld)", " VALUES"
GrpCod,UsrDat->UsrCod); " (%ld,%ld)",
DB_QueryINSERT_new ("can not add a user to a group"); GrpCod,UsrDat->UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -3846,14 +3846,14 @@ static void Grp_CreateGroupType (void)
static void Grp_CreateGroup (void) static void Grp_CreateGroup (void)
{ {
/***** Create a new group *****/ /***** Create a new group *****/
DB_BuildQuery ("INSERT INTO crs_grp" DB_QueryINSERT ("can not create group",
" (GrpTypCod,GrpName,MaxStudents,Open,FileZones)" "INSERT INTO crs_grp"
" VALUES" " (GrpTypCod,GrpName,MaxStudents,Open,FileZones)"
" (%ld,'%s',%u,'N','N')", " VALUES"
Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod, " (%ld,'%s',%u,'N','N')",
Gbl.CurrentCrs.Grps.GrpName, Gbl.CurrentCrs.Grps.GrpTyp.GrpTypCod,
Gbl.CurrentCrs.Grps.MaxStudents); Gbl.CurrentCrs.Grps.GrpName,
DB_QueryINSERT_new ("can not create group"); Gbl.CurrentCrs.Grps.MaxStudents);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -1199,17 +1199,17 @@ void Hld_RecFormNewHoliday2 (void)
static void Hld_CreateHoliday (struct Holiday *Hld) static void Hld_CreateHoliday (struct Holiday *Hld)
{ {
/***** Create a new holiday or no school period *****/ /***** Create a new holiday or no school period *****/
DB_BuildQuery ("INSERT INTO holidays" DB_QueryINSERT ("can not create holiday",
" (InsCod,PlcCod,HldTyp,StartDate,EndDate,Name)" "INSERT INTO holidays"
" VALUES" " (InsCod,PlcCod,HldTyp,StartDate,EndDate,Name)"
" (%ld,%ld,%u,'%04u%02u%02u','%04u%02u%02u','%s')", " VALUES"
Gbl.CurrentIns.Ins.InsCod,Hld->PlcCod,(unsigned) Hld->HldTyp, " (%ld,%ld,%u,'%04u%02u%02u','%04u%02u%02u','%s')",
Hld->StartDate.Year, Gbl.CurrentIns.Ins.InsCod,Hld->PlcCod,(unsigned) Hld->HldTyp,
Hld->StartDate.Month, Hld->StartDate.Year,
Hld->StartDate.Day, Hld->StartDate.Month,
Hld->EndDate.Year, Hld->StartDate.Day,
Hld->EndDate.Month, Hld->EndDate.Year,
Hld->EndDate.Day, Hld->EndDate.Month,
Hld->Name); Hld->EndDate.Day,
DB_QueryINSERT_new ("can not create holiday"); Hld->Name);
} }

View File

@ -1502,16 +1502,14 @@ void Inf_SetInfoSrcIntoDB (Inf_InfoSrc_t InfoSrc)
DB_QueryUPDATE_new ("can not update info source"); DB_QueryUPDATE_new ("can not update info source");
} }
else // Info is not stored in database, so insert it else // Info is not stored in database, so insert it
{ DB_QueryINSERT ("can not insert info source",
DB_BuildQuery ("INSERT INTO crs_info_src" "INSERT INTO crs_info_src"
" (CrsCod,InfoType,InfoSrc,MustBeRead)" " (CrsCod,InfoType,InfoSrc,MustBeRead)"
" VALUES" " VALUES"
" (%ld,'%s','%s','N')", " (%ld,'%s','%s','N')",
Gbl.CurrentCrs.Crs.CrsCod, Gbl.CurrentCrs.Crs.CrsCod,
Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type], Inf_NamesInDBForInfoType[Gbl.CurrentCrs.Info.Type],
Inf_NamesInDBForInfoSrc[InfoSrc]); Inf_NamesInDBForInfoSrc[InfoSrc]);
DB_QueryINSERT_new ("can not insert info source");
}
} }

View File

@ -846,12 +846,12 @@ static void Lnk_CreateLink (struct Link *Lnk)
extern const char *Txt_Created_new_link_X; extern const char *Txt_Created_new_link_X;
/***** Create a new link *****/ /***** Create a new link *****/
DB_BuildQuery ("INSERT INTO links" DB_QueryINSERT ("can not create institutional link",
" (ShortName,FullName,WWW)" "INSERT INTO links"
" VALUES" " (ShortName,FullName,WWW)"
" ('%s','%s','%s')", " VALUES"
Lnk->ShrtName,Lnk->FullName,Lnk->WWW); " ('%s','%s','%s')",
DB_QueryINSERT_new ("can not create institutional link"); Lnk->ShrtName,Lnk->FullName,Lnk->WWW);
/***** Write success message *****/ /***** Write success message *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),

View File

@ -856,12 +856,12 @@ static void Mai_CreateMailDomain (struct Mail *Mai)
extern const char *Txt_Created_new_email_domain_X; extern const char *Txt_Created_new_email_domain_X;
/***** Create a new mail *****/ /***** Create a new mail *****/
DB_BuildQuery ("INSERT INTO mail_domains" DB_QueryINSERT ("can not create mail domain",
" (Domain,Info)" "INSERT INTO mail_domains"
" VALUES" " (Domain,Info)"
" ('%s','%s')", " VALUES"
Mai->Domain,Mai->Info); " ('%s','%s')",
DB_QueryINSERT_new ("can not create mail domain"); Mai->Domain,Mai->Info);
/***** Write success message *****/ /***** Write success message *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),

View File

@ -88,16 +88,16 @@ static bool Mrk_GetUsrMarks (FILE *FileUsrMarks,struct UsrData *UsrDat,
void Mrk_AddMarksToDB (long FilCod,struct MarksProperties *Marks) void Mrk_AddMarksToDB (long FilCod,struct MarksProperties *Marks)
{ {
/***** Add file of marks to the database *****/ /***** Add file of marks to the database *****/
DB_BuildQuery ("INSERT INTO marks_properties" DB_QueryINSERT ("can not add properties of marks to database",
" (FilCod,%s,%s)" "INSERT INTO marks_properties"
" VALUES" " (FilCod,%s,%s)"
" (%ld,%u,%u)", " VALUES"
Mrk_HeadOrFootStr[Brw_HEADER], " (%ld,%u,%u)",
Mrk_HeadOrFootStr[Brw_FOOTER], Mrk_HeadOrFootStr[Brw_HEADER],
FilCod, Mrk_HeadOrFootStr[Brw_FOOTER],
Marks->Header, FilCod,
Marks->Footer); Marks->Header,
DB_QueryINSERT_new ("can not add properties of marks to database"); Marks->Footer);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -1324,14 +1324,14 @@ static long Msg_InsertNewMsg (const char *Subject,const char *Content,
MsgCod = DB_QueryINSERTandReturnCode_new ("can not create message"); MsgCod = DB_QueryINSERTandReturnCode_new ("can not create message");
/***** Insert message in sent messages *****/ /***** Insert message in sent messages *****/
DB_BuildQuery ("INSERT INTO msg_snt" DB_QueryINSERT ("can not create message",
" (MsgCod,CrsCod,UsrCod,Expanded,CreatTime)" "INSERT INTO msg_snt"
" VALUES" " (MsgCod,CrsCod,UsrCod,Expanded,CreatTime)"
" (%ld,%ld,%ld,'N',NOW())", " VALUES"
MsgCod, " (%ld,%ld,%ld,'N',NOW())",
Gbl.CurrentCrs.Crs.CrsCod, MsgCod,
Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.CurrentCrs.Crs.CrsCod,
DB_QueryINSERT_new ("can not create message"); Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Increment number of messages sent by me *****/ /***** Increment number of messages sent by me *****/
Prf_IncrementNumMsgSntUsr (Gbl.Usrs.Me.UsrDat.UsrCod); Prf_IncrementNumMsgSntUsr (Gbl.Usrs.Me.UsrDat.UsrCod);
@ -1393,11 +1393,12 @@ void Msg_DelAllRecAndSntMsgsUsr (long UsrCod)
{ {
/***** Move messages from msg_rcv to msg_rcv_deleted *****/ /***** Move messages from msg_rcv to msg_rcv_deleted *****/
/* Insert messages into msg_rcv_deleted */ /* Insert messages into msg_rcv_deleted */
DB_BuildQuery ("INSERT IGNORE INTO msg_rcv_deleted" DB_QueryINSERT ("can not remove received messages",
" (MsgCod,UsrCod,Notified,Open,Replied)" "INSERT IGNORE INTO msg_rcv_deleted"
" SELECT MsgCod,UsrCod,Notified,Open,Replied FROM msg_rcv WHERE UsrCod=%ld", " (MsgCod,UsrCod,Notified,Open,Replied)"
UsrCod); " SELECT MsgCod,UsrCod,Notified,Open,Replied FROM msg_rcv"
DB_QueryINSERT_new ("can not remove received messages"); " WHERE UsrCod=%ld",
UsrCod);
/* Delete messages from msg_rcv *****/ /* Delete messages from msg_rcv *****/
DB_BuildQuery ("DELETE FROM msg_rcv WHERE UsrCod=%ld",UsrCod); DB_BuildQuery ("DELETE FROM msg_rcv WHERE UsrCod=%ld",UsrCod);
@ -1405,12 +1406,12 @@ void Msg_DelAllRecAndSntMsgsUsr (long UsrCod)
/***** Move message from msg_snt to msg_snt_deleted *****/ /***** Move message from msg_snt to msg_snt_deleted *****/
/* Insert message into msg_snt_deleted */ /* Insert message into msg_snt_deleted */
DB_BuildQuery ("INSERT IGNORE INTO msg_snt_deleted" DB_QueryINSERT ("can not remove sent messages",
" (MsgCod,CrsCod,UsrCod,CreatTime)" "INSERT IGNORE INTO msg_snt_deleted"
" SELECT MsgCod,CrsCod,UsrCod,CreatTime" " (MsgCod,CrsCod,UsrCod,CreatTime)"
" FROM msg_snt WHERE UsrCod=%ld", " SELECT MsgCod,CrsCod,UsrCod,CreatTime"
UsrCod); " FROM msg_snt WHERE UsrCod=%ld",
DB_QueryINSERT_new ("can not remove sent messages"); UsrCod);
/* Delete message from msg_snt *****/ /* Delete message from msg_snt *****/
DB_BuildQuery ("DELETE FROM msg_snt WHERE UsrCod=%ld",UsrCod); DB_BuildQuery ("DELETE FROM msg_snt WHERE UsrCod=%ld",UsrCod);
@ -1424,14 +1425,14 @@ void Msg_DelAllRecAndSntMsgsUsr (long UsrCod)
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 *****/ /***** Insert message received in the database *****/
DB_BuildQuery ("INSERT INTO msg_rcv" DB_QueryINSERT ("can not create received message",
" (MsgCod,UsrCod,Notified,Open,Replied,Expanded)" "INSERT INTO msg_rcv"
" VALUES" " (MsgCod,UsrCod,Notified,Open,Replied,Expanded)"
" (%ld,%ld,'%c','N','N','N')", " VALUES"
MsgCod,UsrCod, " (%ld,%ld,'%c','N','N','N')",
NotifyByEmail ? 'Y' : MsgCod,UsrCod,
'N'); NotifyByEmail ? 'Y' :
DB_QueryINSERT_new ("can not create received message"); 'N');
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1455,12 +1456,12 @@ static void Msg_MoveReceivedMsgToDeleted (long MsgCod,long UsrCod)
{ {
/***** Move message from msg_rcv to msg_rcv_deleted *****/ /***** Move message from msg_rcv to msg_rcv_deleted *****/
/* Insert message into msg_rcv_deleted */ /* Insert message into msg_rcv_deleted */
DB_BuildQuery ("INSERT IGNORE INTO msg_rcv_deleted" DB_QueryINSERT ("can not remove a received message",
" (MsgCod,UsrCod,Notified,Open,Replied)" "INSERT IGNORE INTO msg_rcv_deleted"
" SELECT MsgCod,UsrCod,Notified,Open,Replied" " (MsgCod,UsrCod,Notified,Open,Replied)"
" FROM msg_rcv WHERE MsgCod=%ld AND UsrCod=%ld", " SELECT MsgCod,UsrCod,Notified,Open,Replied"
MsgCod,UsrCod); " FROM msg_rcv WHERE MsgCod=%ld AND UsrCod=%ld",
DB_QueryINSERT_new ("can not remove a received message"); MsgCod,UsrCod);
/* Delete message from msg_rcv *****/ /* Delete message from msg_rcv *****/
DB_BuildQuery ("DELETE FROM msg_rcv WHERE MsgCod=%ld AND UsrCod=%ld", DB_BuildQuery ("DELETE FROM msg_rcv WHERE MsgCod=%ld AND UsrCod=%ld",
@ -1484,12 +1485,12 @@ static void Msg_MoveSentMsgToDeleted (long MsgCod)
{ {
/***** Move message from msg_snt to msg_snt_deleted *****/ /***** Move message from msg_snt to msg_snt_deleted *****/
/* Insert message into msg_snt_deleted */ /* Insert message into msg_snt_deleted */
DB_BuildQuery ("INSERT IGNORE INTO msg_snt_deleted" DB_QueryINSERT ("can not remove a sent message",
" (MsgCod,CrsCod,UsrCod,CreatTime)" "INSERT IGNORE INTO msg_snt_deleted"
" SELECT MsgCod,CrsCod,UsrCod,CreatTime" " (MsgCod,CrsCod,UsrCod,CreatTime)"
" FROM msg_snt WHERE MsgCod=%ld", " SELECT MsgCod,CrsCod,UsrCod,CreatTime"
MsgCod); " FROM msg_snt WHERE MsgCod=%ld",
DB_QueryINSERT_new ("can not remove a sent message"); MsgCod);
/* Delete message from msg_snt *****/ /* Delete message from msg_snt *****/
DB_BuildQuery ("DELETE FROM msg_snt WHERE MsgCod=%ld",MsgCod); DB_BuildQuery ("DELETE FROM msg_snt WHERE MsgCod=%ld",MsgCod);
@ -1508,12 +1509,12 @@ static void Msg_MoveMsgContentToDeleted (long MsgCod)
{ {
/***** Move message from msg_content to msg_content_deleted *****/ /***** Move message from msg_content to msg_content_deleted *****/
/* Insert message content into msg_content_deleted */ /* Insert message content into msg_content_deleted */
DB_BuildQuery ("INSERT IGNORE INTO msg_content_deleted" DB_QueryINSERT ("can not remove the content of a message",
" (MsgCod,Subject,Content,ImageName,ImageTitle,ImageURL)" "INSERT IGNORE INTO msg_content_deleted"
" SELECT MsgCod,Subject,Content,ImageName,ImageTitle,ImageURL" " (MsgCod,Subject,Content,ImageName,ImageTitle,ImageURL)"
" FROM msg_content WHERE MsgCod=%ld", " SELECT MsgCod,Subject,Content,ImageName,ImageTitle,ImageURL"
MsgCod); " FROM msg_content WHERE MsgCod=%ld",
DB_QueryINSERT_new ("can not remove the content of a message"); MsgCod);
/* TODO: Messages in msg_content_deleted older than a certain time /* TODO: Messages in msg_content_deleted older than a certain time
should be deleted to ensure the protection of personal data */ should be deleted to ensure the protection of personal data */
@ -1531,12 +1532,12 @@ void Msg_MoveUnusedMsgsContentToDeleted (void)
{ {
/***** Move messages from msg_content to msg_content_deleted *****/ /***** Move messages from msg_content to msg_content_deleted *****/
/* Insert message content into msg_content_deleted */ /* Insert message content into msg_content_deleted */
DB_BuildQuery ("INSERT IGNORE INTO msg_content_deleted" DB_QueryINSERT ("can not remove the content of some messages",
" (MsgCod,Subject,Content)" "INSERT IGNORE INTO msg_content_deleted"
" SELECT MsgCod,Subject,Content FROM msg_content" " (MsgCod,Subject,Content)"
" WHERE MsgCod NOT IN (SELECT MsgCod FROM msg_snt)" " SELECT MsgCod,Subject,Content FROM msg_content"
" AND MsgCod NOT IN (SELECT DISTINCT MsgCod FROM msg_rcv)"); " WHERE MsgCod NOT IN (SELECT MsgCod FROM msg_snt)"
DB_QueryINSERT_new ("can not remove the content of some messages"); " AND MsgCod NOT IN (SELECT DISTINCT MsgCod FROM msg_rcv)");
/* Messages in msg_content_deleted older than a certain time /* Messages in msg_content_deleted older than a certain time
should be deleted to ensure the protection of personal data */ should be deleted to ensure the protection of personal data */

View File

@ -299,13 +299,13 @@ void Not_RemoveNotice (void)
/***** Remove notice *****/ /***** Remove notice *****/
/* Copy notice to table of deleted notices */ /* Copy notice to table of deleted notices */
DB_BuildQuery ("INSERT IGNORE INTO notices_deleted" DB_QueryINSERT ("can not remove notice",
" (NotCod,CrsCod,UsrCod,CreatTime,Content,NumNotif)" "INSERT IGNORE INTO notices_deleted"
" SELECT NotCod,CrsCod,UsrCod,CreatTime,Content,NumNotif" " (NotCod,CrsCod,UsrCod,CreatTime,Content,NumNotif)"
" FROM notices" " SELECT NotCod,CrsCod,UsrCod,CreatTime,Content,NumNotif"
" WHERE NotCod=%ld AND CrsCod=%ld", " FROM notices"
NotCod,Gbl.CurrentCrs.Crs.CrsCod); " WHERE NotCod=%ld AND CrsCod=%ld",
DB_QueryINSERT_new ("can not remove notice"); NotCod,Gbl.CurrentCrs.Crs.CrsCod);
/* Remove notice */ /* Remove notice */
DB_BuildQuery ("DELETE FROM notices" DB_BuildQuery ("DELETE FROM notices"

View File

@ -1494,15 +1494,16 @@ void Ntf_StoreNotifyEventToOneUser (Ntf_NotifyEvent_t NotifyEvent,
} }
/***** Store notify event *****/ /***** Store notify event *****/
DB_BuildQuery ("INSERT INTO notif" DB_QueryINSERT ("can not create new notification event",
" (NotifyEvent,ToUsrCod,FromUsrCod," "INSERT INTO notif"
"InsCod,CtrCod,DegCod,CrsCod,Cod,TimeNotif,Status)" " (NotifyEvent,ToUsrCod,FromUsrCod,"
" VALUES" "InsCod,CtrCod,DegCod,CrsCod,Cod,TimeNotif,Status)"
" (%u,%ld,%ld," " VALUES"
"%ld,%ld,%ld,%ld,%ld,NOW(),%u)", " (%u,%ld,%ld,"
(unsigned) NotifyEvent,UsrDat->UsrCod,Gbl.Usrs.Me.UsrDat.UsrCod, "%ld,%ld,%ld,%ld,%ld,NOW(),%u)",
InsCod,CtrCod,DegCod,CrsCod,Cod,(unsigned) Status); (unsigned) NotifyEvent,
DB_QueryINSERT_new ("can not create new notification event"); UsrDat->UsrCod,Gbl.Usrs.Me.UsrDat.UsrCod,
InsCod,CtrCod,DegCod,CrsCod,Cod,(unsigned) Status);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -1009,12 +1009,12 @@ unsigned Pho_UpdateMyClicksWithoutPhoto (void)
else // The user does not exist ==> add him/her else // The user does not exist ==> add him/her
{ {
/* Add the user, with one access */ /* Add the user, with one access */
DB_BuildQuery ("INSERT INTO clicks_without_photo" DB_QueryINSERT ("can not create number of clicks without photo",
" (UsrCod,NumClicks)" "INSERT INTO clicks_without_photo"
" VALUES" " (UsrCod,NumClicks)"
" (%ld,1)", " VALUES"
Gbl.Usrs.Me.UsrDat.UsrCod); " (%ld,1)",
DB_QueryINSERT_new ("can not create number of clicks without photo"); Gbl.Usrs.Me.UsrDat.UsrCod);
NumClicks = 1; NumClicks = 1;
} }

View File

@ -880,12 +880,12 @@ static void Plc_CreatePlace (struct Place *Plc)
extern const char *Txt_Created_new_place_X; extern const char *Txt_Created_new_place_X;
/***** Create a new place *****/ /***** Create a new place *****/
DB_BuildQuery ("INSERT INTO places" DB_QueryINSERT ("can not create place",
" (InsCod,ShortName,FullName)" "INSERT INTO places"
" VALUES" " (InsCod,ShortName,FullName)"
" (%ld,'%s','%s')", " VALUES"
Gbl.CurrentIns.Ins.InsCod,Plc->ShrtName,Plc->FullName); " (%ld,'%s','%s')",
DB_QueryINSERT_new ("can not create place"); Gbl.CurrentIns.Ins.InsCod,Plc->ShrtName,Plc->FullName);
/***** Write success message *****/ /***** Write success message *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),

View File

@ -1041,15 +1041,15 @@ static void Plg_CreatePlugin (struct Plugin *Plg)
extern const char *Txt_Created_new_plugin_X; extern const char *Txt_Created_new_plugin_X;
/***** Create a new plugin *****/ /***** Create a new plugin *****/
DB_BuildQuery ("INSERT INTO plugins" DB_QueryINSERT ("can not create plugin",
" (Name,Description,Logo," "INSERT INTO plugins"
"AppKey,URL,IP)" " (Name,Description,Logo,"
" VALUES" "AppKey,URL,IP)"
" ('%s','%s','%s'," " VALUES"
"'%s','%s','%s')", " ('%s','%s','%s',"
Plg->Name,Plg->Description,Plg->Logo, "'%s','%s','%s')",
Plg->AppKey,Plg->URL,Plg->IP); Plg->Name,Plg->Description,Plg->Logo,
DB_QueryINSERT_new ("can not create plugin"); Plg->AppKey,Plg->URL,Plg->IP);
/***** Write success message *****/ /***** Write success message *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),

View File

@ -1040,17 +1040,17 @@ static void Prf_CreateUsrFigures (long UsrCod,const struct UsrFigures *UsrFigure
(long) UsrFigures->FirstClickTimeUTC); // 0 ==> unknown first click time or user never logged (long) UsrFigures->FirstClickTimeUTC); // 0 ==> unknown first click time or user never logged
/***** Create user's figures *****/ /***** Create user's figures *****/
DB_BuildQuery ("INSERT INTO usr_figures" DB_QueryINSERT ("can not create user's figures",
" (UsrCod,FirstClickTime,NumClicks,NumFileViews,NumForPst,NumMsgSnt)" "INSERT INTO usr_figures"
" VALUES" " (UsrCod,FirstClickTime,NumClicks,NumFileViews,NumForPst,NumMsgSnt)"
" (%ld,%s,%ld,%ld,%ld,%ld)", " VALUES"
UsrCod, " (%ld,%s,%ld,%ld,%ld,%ld)",
SubQueryFirstClickTime, UsrCod,
UsrFigures->NumClicks, // -1L ==> unknown number of clicks SubQueryFirstClickTime,
UsrFigures->NumFileViews, // -1L ==> unknown number of file views UsrFigures->NumClicks, // -1L ==> unknown number of clicks
UsrFigures->NumForPst, // -1L ==> unknown number of forum posts UsrFigures->NumFileViews, // -1L ==> unknown number of file views
UsrFigures->NumMsgSnt); // -1L ==> unknown number of messages sent UsrFigures->NumForPst, // -1L ==> unknown number of forum posts
DB_QueryINSERT_new ("can not create user's figures"); UsrFigures->NumMsgSnt); // -1L ==> unknown number of messages sent
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1082,10 +1082,10 @@ void Prf_IncrementNumClicksUsr (long UsrCod)
{ {
/***** Increment number of clicks *****/ /***** Increment number of clicks *****/
// If NumClicks < 0 ==> not yet calculated, so do nothing // If NumClicks < 0 ==> not yet calculated, so do nothing
DB_BuildQuery ("UPDATE IGNORE usr_figures SET NumClicks=NumClicks+1" DB_QueryINSERT ("can not increment user's clicks",
" WHERE UsrCod=%ld AND NumClicks>=0", "UPDATE IGNORE usr_figures SET NumClicks=NumClicks+1"
UsrCod); " WHERE UsrCod=%ld AND NumClicks>=0",
DB_QueryINSERT_new ("can not increment user's clicks"); UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1096,10 +1096,10 @@ void Prf_IncrementNumFileViewsUsr (long UsrCod)
{ {
/***** Increment number of file views *****/ /***** Increment number of file views *****/
// If NumFileViews < 0 ==> not yet calculated, so do nothing // If NumFileViews < 0 ==> not yet calculated, so do nothing
DB_BuildQuery ("UPDATE IGNORE usr_figures SET NumFileViews=NumFileViews+1" DB_QueryINSERT ("can not increment user's file views",
" WHERE UsrCod=%ld AND NumFileViews>=0", "UPDATE IGNORE usr_figures SET NumFileViews=NumFileViews+1"
UsrCod); " WHERE UsrCod=%ld AND NumFileViews>=0",
DB_QueryINSERT_new ("can not increment user's file views"); UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1110,10 +1110,10 @@ void Prf_IncrementNumForPstUsr (long UsrCod)
{ {
/***** Increment number of forum posts *****/ /***** Increment number of forum posts *****/
// If NumForPst < 0 ==> not yet calculated, so do nothing // If NumForPst < 0 ==> not yet calculated, so do nothing
DB_BuildQuery ("UPDATE IGNORE usr_figures SET NumForPst=NumForPst+1" DB_QueryINSERT ("can not increment user's forum posts",
" WHERE UsrCod=%ld AND NumForPst>=0", "UPDATE IGNORE usr_figures SET NumForPst=NumForPst+1"
UsrCod); " WHERE UsrCod=%ld AND NumForPst>=0",
DB_QueryINSERT_new ("can not increment user's forum posts"); UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1124,10 +1124,10 @@ void Prf_IncrementNumMsgSntUsr (long UsrCod)
{ {
/***** Increment number of messages sent *****/ /***** Increment number of messages sent *****/
// If NumMsgSnt < 0 ==> not yet calculated, so do nothing // If NumMsgSnt < 0 ==> not yet calculated, so do nothing
DB_BuildQuery ("UPDATE IGNORE usr_figures SET NumMsgSnt=NumMsgSnt+1" DB_QueryINSERT ("can not increment user's messages sent",
" WHERE UsrCod=%ld AND NumMsgSnt>=0", "UPDATE IGNORE usr_figures SET NumMsgSnt=NumMsgSnt+1"
UsrCod); " WHERE UsrCod=%ld AND NumMsgSnt>=0",
DB_QueryINSERT_new ("can not increment user's messages sent"); UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -3339,14 +3339,14 @@ static void Prj_CreateProject (struct Project *Prj)
Prj->PrjCod = DB_QueryINSERTandReturnCode_new ("can not create new project"); Prj->PrjCod = DB_QueryINSERTandReturnCode_new ("can not create new project");
/***** Insert creator as first tutor *****/ /***** Insert creator as first tutor *****/
DB_BuildQuery ("INSERT INTO prj_usr" DB_QueryINSERT ("can not add tutor",
" (PrjCod,RoleInProject,UsrCod)" "INSERT INTO prj_usr"
" VALUES" " (PrjCod,RoleInProject,UsrCod)"
" (%ld,%u,%ld)", " VALUES"
Prj->PrjCod, " (%ld,%u,%ld)",
(unsigned) Prj_ROLE_TUT, Prj->PrjCod,
Gbl.Usrs.Me.UsrDat.UsrCod); (unsigned) Prj_ROLE_TUT,
DB_QueryINSERT_new ("can not add tutor"); Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Flush cache *****/ /***** Flush cache *****/
Prj_FlushCacheMyRoleInProject (); Prj_FlushCacheMyRoleInProject ();

View File

@ -577,15 +577,15 @@ void Rec_CreateRecordField (void)
extern const char *Txt_Created_new_record_field_X; extern const char *Txt_Created_new_record_field_X;
/***** Create the new field *****/ /***** Create the new field *****/
DB_BuildQuery ("INSERT INTO crs_record_fields" DB_QueryINSERT ("can not create field of record",
" (CrsCod,FieldName,NumLines,Visibility)" "INSERT INTO crs_record_fields"
" VALUES" " (CrsCod,FieldName,NumLines,Visibility)"
" (%ld,'%s',%u,%u)", " VALUES"
Gbl.CurrentCrs.Crs.CrsCod, " (%ld,'%s',%u,%u)",
Gbl.CurrentCrs.Records.Field.Name, Gbl.CurrentCrs.Crs.CrsCod,
Gbl.CurrentCrs.Records.Field.NumLines, Gbl.CurrentCrs.Records.Field.Name,
(unsigned) Gbl.CurrentCrs.Records.Field.Visibility); Gbl.CurrentCrs.Records.Field.NumLines,
DB_QueryINSERT_new ("can not create field of record"); (unsigned) Gbl.CurrentCrs.Records.Field.Visibility);
/***** Write message of success *****/ /***** Write message of success *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
@ -2014,17 +2014,15 @@ void Rec_UpdateCrsRecord (long UsrCod)
} }
} }
else if (Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text[0]) else if (Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text[0])
{
/***** Insert text field of record course *****/ /***** Insert text field of record course *****/
DB_BuildQuery ("INSERT INTO crs_records" DB_QueryINSERT ("can not create field of record",
" (FieldCod,UsrCod,Txt)" "INSERT INTO crs_records"
" VALUES" " (FieldCod,UsrCod,Txt)"
" (%ld,%ld,'%s')", " VALUES"
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].FieldCod, " (%ld,%ld,'%s')",
UsrCod, Gbl.CurrentCrs.Records.LstFields.Lst[NumField].FieldCod,
Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text); UsrCod,
DB_QueryINSERT_new ("can not create field of record"); Gbl.CurrentCrs.Records.LstFields.Lst[NumField].Text);
}
} }
} }

View File

@ -427,24 +427,24 @@ static void Rep_CreateNewReportFile (struct Rep_Report *Report)
static void Rep_CreateNewReportEntryIntoDB (const struct Rep_Report *Report) static void Rep_CreateNewReportEntryIntoDB (const struct Rep_Report *Report)
{ {
/***** Insert a new user's usage report into database *****/ /***** Insert a new user's usage report into database *****/
DB_BuildQuery ("INSERT INTO usr_report" DB_QueryINSERT ("can not create new user's usage report",
" (UsrCod,ReportTimeUTC," "INSERT INTO usr_report"
"UniqueDirL,UniqueDirR,Filename,Permalink)" " (UsrCod,ReportTimeUTC,"
" VALUES" "UniqueDirL,UniqueDirR,Filename,Permalink)"
" (%ld,'%04d-%02d-%02d %02d:%02d:%02d'," " VALUES"
"'%c%c','%s','%s','%s')", " (%ld,'%04d-%02d-%02d %02d:%02d:%02d',"
Gbl.Usrs.Me.UsrDat.UsrCod, "'%c%c','%s','%s','%s')",
1900 + Report->tm_CurrentTime.tm_year, // year Gbl.Usrs.Me.UsrDat.UsrCod,
1 + Report->tm_CurrentTime.tm_mon, // month 1900 + Report->tm_CurrentTime.tm_year, // year
Report->tm_CurrentTime.tm_mday, // day of the month 1 + Report->tm_CurrentTime.tm_mon, // month
Report->tm_CurrentTime.tm_hour, // hours Report->tm_CurrentTime.tm_mday, // day of the month
Report->tm_CurrentTime.tm_min, // minutes Report->tm_CurrentTime.tm_hour, // hours
Report->tm_CurrentTime.tm_sec, // seconds Report->tm_CurrentTime.tm_min, // minutes
Gbl.UniqueNameEncrypted[0], // 2 leftmost chars from a unique 43 chars base64url codified from a unique SHA-256 string Report->tm_CurrentTime.tm_sec, // seconds
Gbl.UniqueNameEncrypted[1], Gbl.UniqueNameEncrypted[0], // 2 leftmost chars from a unique 43 chars base64url codified from a unique SHA-256 string
&Gbl.UniqueNameEncrypted[2], // 41 rightmost chars from a unique 43 chars base64url codified from a unique SHA-256 string Gbl.UniqueNameEncrypted[1],
Report->FilenameReport,Report->Permalink); &Gbl.UniqueNameEncrypted[2], // 41 rightmost chars from a unique 43 chars base64url codified from a unique SHA-256 string
DB_QueryINSERT_new ("can not create new user's usage report"); Report->FilenameReport,Report->Permalink);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -155,23 +155,23 @@ void Ses_InsertSessionInDB (void)
if (Gbl.Search.WhatToSearch == Sch_SEARCH_UNKNOWN) if (Gbl.Search.WhatToSearch == Sch_SEARCH_UNKNOWN)
Gbl.Search.WhatToSearch = Sch_WHAT_TO_SEARCH_DEFAULT; Gbl.Search.WhatToSearch = Sch_WHAT_TO_SEARCH_DEFAULT;
DB_BuildQuery ("INSERT INTO sessions" DB_QueryINSERT ("can not create session",
" (SessionId,UsrCod,Password,Role," "INSERT INTO sessions"
"CtyCod,InsCod,CtrCod,DegCod,CrsCod,LastTime,LastRefresh,WhatToSearch)" " (SessionId,UsrCod,Password,Role,"
" VALUES" "CtyCod,InsCod,CtrCod,DegCod,CrsCod,LastTime,LastRefresh,WhatToSearch)"
" ('%s',%ld,'%s',%u," " VALUES"
"%ld,%ld,%ld,%ld,%ld,NOW(),NOW(),%u)", " ('%s',%ld,'%s',%u,"
Gbl.Session.Id, "%ld,%ld,%ld,%ld,%ld,NOW(),NOW(),%u)",
Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Session.Id,
Gbl.Usrs.Me.UsrDat.Password, Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Gbl.Usrs.Me.Role.Logged, Gbl.Usrs.Me.UsrDat.Password,
Gbl.CurrentCty.Cty.CtyCod, (unsigned) Gbl.Usrs.Me.Role.Logged,
Gbl.CurrentIns.Ins.InsCod, Gbl.CurrentCty.Cty.CtyCod,
Gbl.CurrentCtr.Ctr.CtrCod, Gbl.CurrentIns.Ins.InsCod,
Gbl.CurrentDeg.Deg.DegCod, Gbl.CurrentCtr.Ctr.CtrCod,
Gbl.CurrentCrs.Crs.CrsCod, Gbl.CurrentDeg.Deg.DegCod,
Gbl.Search.WhatToSearch); Gbl.CurrentCrs.Crs.CrsCod,
DB_QueryINSERT_new ("can not create session"); Gbl.Search.WhatToSearch);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -343,16 +343,16 @@ void Ses_InsertHiddenParInDB (Act_Action_t NextAction,
if (!Ses_CheckIfHiddenParIsAlreadyInDB (NextAction,ParamName)) if (!Ses_CheckIfHiddenParIsAlreadyInDB (NextAction,ParamName))
{ {
/***** Insert parameter in the database *****/ /***** Insert parameter in the database *****/
DB_BuildQuery ("INSERT INTO hidden_params" DB_QueryINSERT ("can not create hidden parameter",
" (SessionId,Action,ParamName,ParamValue)" "INSERT INTO hidden_params"
" VALUES" " (SessionId,Action,ParamName,ParamValue)"
" ('%s',%ld,'%s','%s')", " VALUES"
Gbl.Session.Id, " ('%s',%ld,'%s','%s')",
Act_GetActCod (NextAction), Gbl.Session.Id,
ParamName, Act_GetActCod (NextAction),
ParamValue ? ParamValue : ParamName,
""); ParamValue ? ParamValue :
DB_QueryINSERT_new ("can not create hidden parameter"); "");
Gbl.HiddenParamsInsertedIntoDB = true; Gbl.HiddenParamsInsertedIntoDB = true;
} }
} }

View File

@ -777,16 +777,19 @@ static void Soc_BuildQueryToGetTimeline (char **Query,
if (PubCod > 0) if (PubCod > 0)
{ {
DB_BuildQuery ("INSERT INTO pub_codes SET PubCod=%ld",PubCod); DB_QueryINSERT ("can not store publishing code",
DB_QueryINSERT_new ("can not store publishing code"); "INSERT INTO pub_codes SET PubCod=%ld",
PubCod);
RangePubsToGet.Top = PubCod; // Narrow the range for the next iteration RangePubsToGet.Top = PubCod; // Narrow the range for the next iteration
/* Get social note code (row[1]) */ /* Get social note code (row[1]) */
NotCod = Str_ConvertStrCodToLongCod (row[1]); NotCod = Str_ConvertStrCodToLongCod (row[1]);
DB_BuildQuery ("INSERT INTO not_codes SET NotCod=%ld",NotCod); DB_QueryINSERT ("can not store note code",
DB_QueryINSERT_new ("can not store note code"); "INSERT INTO not_codes SET NotCod=%ld",
DB_BuildQuery ("INSERT INTO current_timeline SET NotCod=%ld",NotCod); NotCod);
DB_QueryINSERT_new ("can not store note code"); DB_QueryINSERT ("can not store note code",
"INSERT INTO current_timeline SET NotCod=%ld",
NotCod);
} }
else // Nothing got ==> abort loop else // Nothing got ==> abort loop
break; // Last publishing break; // Last publishing
@ -2998,18 +3001,18 @@ static long Soc_ReceiveComment (void)
Soc_PublishSocialNoteInTimeline (&SocPub); // Set SocPub.PubCod Soc_PublishSocialNoteInTimeline (&SocPub); // Set SocPub.PubCod
/* Insert comment content in the database */ /* Insert comment content in the database */
DB_BuildQuery ("INSERT INTO social_comments" DB_QueryINSERT ("can not store comment content",
" (PubCod,Content,ImageName,ImageTitle,ImageURL)" "INSERT INTO social_comments"
" VALUES" " (PubCod,Content,ImageName,ImageTitle,ImageURL)"
" (%ld,'%s','%s','%s','%s')", " VALUES"
SocPub.PubCod, " (%ld,'%s','%s','%s','%s')",
Content, SocPub.PubCod,
Image.Name, Content,
(Image.Name[0] && // Save image title only if image attached Image.Name,
Image.Title) ? Image.Title : "", (Image.Name[0] && // Save image title only if image attached
(Image.Name[0] && // Save image URL only if image attached Image.Title) ? Image.Title : "",
Image.URL ) ? Image.URL : ""); (Image.Name[0] && // Save image URL only if image attached
DB_QueryINSERT_new ("can not store comment content"); Image.URL ) ? Image.URL : "");
/***** Store notifications about the new comment *****/ /***** Store notifications about the new comment *****/
Ntf_StoreNotifyEventsToAllUsrs (Ntf_EVENT_TIMELINE_COMMENT,SocPub.PubCod); Ntf_StoreNotifyEventsToAllUsrs (Ntf_EVENT_TIMELINE_COMMENT,SocPub.PubCod);
@ -3168,13 +3171,13 @@ static long Soc_FavSocialNote (void)
Gbl.Usrs.Me.UsrDat.UsrCod)) // I have not yet favourited the note Gbl.Usrs.Me.UsrDat.UsrCod)) // I have not yet favourited the note
{ {
/***** Mark as favourite in database *****/ /***** Mark as favourite in database *****/
DB_BuildQuery ("INSERT IGNORE INTO social_notes_fav" DB_QueryINSERT ("can not favourite social note",
" (NotCod,UsrCod,TimeFav)" "INSERT IGNORE INTO social_notes_fav"
" VALUES" " (NotCod,UsrCod,TimeFav)"
" (%ld,%ld,NOW())", " VALUES"
SocNot.NotCod, " (%ld,%ld,NOW())",
Gbl.Usrs.Me.UsrDat.UsrCod); SocNot.NotCod,
DB_QueryINSERT_new ("can not favourite social note"); Gbl.Usrs.Me.UsrDat.UsrCod);
/* Update number of times this social note is favourited */ /* Update number of times this social note is favourited */
SocNot.NumFavs = Soc_GetNumTimesANoteHasBeenFav (&SocNot); SocNot.NumFavs = Soc_GetNumTimesANoteHasBeenFav (&SocNot);
@ -3256,13 +3259,13 @@ static long Soc_FavSocialComment (void)
Gbl.Usrs.Me.UsrDat.UsrCod)) // I have not yet favourited the comment Gbl.Usrs.Me.UsrDat.UsrCod)) // I have not yet favourited the comment
{ {
/***** Mark as favourite in database *****/ /***** Mark as favourite in database *****/
DB_BuildQuery ("INSERT IGNORE INTO social_comments_fav" DB_QueryINSERT ("can not favourite social comment",
" (PubCod,UsrCod,TimeFav)" "INSERT IGNORE INTO social_comments_fav"
" VALUES" " (PubCod,UsrCod,TimeFav)"
" (%ld,%ld,NOW())", " VALUES"
SocCom.PubCod, " (%ld,%ld,NOW())",
Gbl.Usrs.Me.UsrDat.UsrCod); SocCom.PubCod,
DB_QueryINSERT_new ("can not favourite social comment"); Gbl.Usrs.Me.UsrDat.UsrCod);
/* Update number of times this social comment is favourited */ /* Update number of times this social comment is favourited */
SocCom.NumFavs = Soc_GetNumTimesACommHasBeenFav (&SocCom); SocCom.NumFavs = Soc_GetNumTimesACommHasBeenFav (&SocCom);
@ -4756,11 +4759,11 @@ static void Soc_ClearTimelineThisSession (void)
static void Soc_AddNotesJustRetrievedToTimelineThisSession (void) static void Soc_AddNotesJustRetrievedToTimelineThisSession (void)
{ {
DB_BuildQuery ("INSERT IGNORE INTO social_timelines" DB_QueryINSERT ("can not insert social notes in timeline",
" (SessionId,NotCod)" "INSERT IGNORE INTO social_timelines"
" SELECT DISTINCTROW '%s',NotCod FROM not_codes", " (SessionId,NotCod)"
Gbl.Session.Id); " SELECT DISTINCTROW '%s',NotCod FROM not_codes",
DB_QueryINSERT_new ("can not insert social notes in timeline"); Gbl.Session.Id);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -313,24 +313,24 @@ void Sta_LogAccess (const char *Comments)
LogCod = DB_QueryINSERTandReturnCode_new ("can not log access (full)"); LogCod = DB_QueryINSERTandReturnCode_new ("can not log access (full)");
/* Log access in recent log (log_recent) */ /* Log access in recent log (log_recent) */
DB_BuildQuery ("INSERT INTO log_recent " DB_QueryINSERT ("can not log access (recent)",
"(LogCod,ActCod,CtyCod,InsCod,CtrCod,DegCod,CrsCod,UsrCod," "INSERT INTO log_recent "
"Role,ClickTime,TimeToGenerate,TimeToSend,IP)" "(LogCod,ActCod,CtyCod,InsCod,CtrCod,DegCod,CrsCod,UsrCod,"
" VALUES " "Role,ClickTime,TimeToGenerate,TimeToSend,IP)"
"(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld," " VALUES "
"%u,NOW(),%ld,%ld,'%s')", "(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,"
LogCod,ActCod, "%u,NOW(),%ld,%ld,'%s')",
Gbl.CurrentCty.Cty.CtyCod, LogCod,ActCod,
Gbl.CurrentIns.Ins.InsCod, Gbl.CurrentCty.Cty.CtyCod,
Gbl.CurrentCtr.Ctr.CtrCod, Gbl.CurrentIns.Ins.InsCod,
Gbl.CurrentDeg.Deg.DegCod, Gbl.CurrentCtr.Ctr.CtrCod,
Gbl.CurrentCrs.Crs.CrsCod, Gbl.CurrentDeg.Deg.DegCod,
Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.CurrentCrs.Crs.CrsCod,
(unsigned) RoleToStore, Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.TimeGenerationInMicroseconds, (unsigned) RoleToStore,
Gbl.TimeSendInMicroseconds, Gbl.TimeGenerationInMicroseconds,
Gbl.IP); Gbl.TimeSendInMicroseconds,
DB_QueryINSERT_new ("can not log access (recent)"); Gbl.IP);
if (Comments) if (Comments)
{ {
@ -375,27 +375,22 @@ void Sta_LogAccess (const char *Comments)
} }
if (Gbl.WebService.IsWebService) if (Gbl.WebService.IsWebService)
{
/* Log web service plugin and function */ /* Log web service plugin and function */
DB_BuildQuery ("INSERT INTO log_ws" DB_QueryINSERT ("can not log access (comments)",
" (LogCod,PlgCod,FunCod)" "INSERT INTO log_ws"
" VALUES" " (LogCod,PlgCod,FunCod)"
" (%ld,%ld,%u)", " VALUES"
LogCod,Gbl.WebService.PlgCod, " (%ld,%ld,%u)",
(unsigned) Gbl.WebService.Function); LogCod,Gbl.WebService.PlgCod,
(unsigned) Gbl.WebService.Function);
DB_QueryINSERT_new ("can not log access (comments)");
}
else if (Gbl.Banners.BanCodClicked > 0) else if (Gbl.Banners.BanCodClicked > 0)
{
/* Log banner clicked */ /* Log banner clicked */
DB_BuildQuery ("INSERT INTO log_banners" DB_QueryINSERT ("can not log banner clicked",
" (LogCod,BanCod)" "INSERT INTO log_banners"
" VALUES" " (LogCod,BanCod)"
" (%ld,%ld)", " VALUES"
LogCod,Gbl.Banners.BanCodClicked); " (%ld,%ld)",
DB_QueryINSERT_new ("can not log banner clicked"); LogCod,Gbl.Banners.BanCodClicked);
}
/***** Increment my number of clicks *****/ /***** Increment my number of clicks *****/
if (Gbl.Usrs.Me.Logged) if (Gbl.Usrs.Me.Logged)

View File

@ -2390,15 +2390,13 @@ static void Svy_CreateGrps (long SvyCod)
for (NumGrpSel = 0; for (NumGrpSel = 0;
NumGrpSel < Gbl.CurrentCrs.Grps.LstGrpsSel.NumGrps; NumGrpSel < Gbl.CurrentCrs.Grps.LstGrpsSel.NumGrps;
NumGrpSel++) NumGrpSel++)
{
/* Create group */ /* Create group */
DB_BuildQuery ("INSERT INTO svy_grp" DB_QueryINSERT ("can not associate a group to a survey",
" (SvyCod,GrpCod)" "INSERT INTO svy_grp"
" VALUES" " (SvyCod,GrpCod)"
" (%ld,%ld)", " VALUES"
SvyCod,Gbl.CurrentCrs.Grps.LstGrpsSel.GrpCods[NumGrpSel]); " (%ld,%ld)",
DB_QueryINSERT_new ("can not associate a group to a survey"); SvyCod,Gbl.CurrentCrs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
}
} }
/*****************************************************************************/ /*****************************************************************************/
@ -3062,15 +3060,13 @@ void Svy_ReceiveQst (void)
else // If this answer does not exist... else // If this answer does not exist...
{ {
if (SvyQst.AnsChoice[NumAns].Text[0]) // Answer is not empty if (SvyQst.AnsChoice[NumAns].Text[0]) // Answer is not empty
{
/* Create answer into database */ /* Create answer into database */
DB_BuildQuery ("INSERT INTO svy_answers" DB_QueryINSERT ("can not create answer",
" (QstCod,AnsInd,NumUsrs,Answer)" "INSERT INTO svy_answers"
" VALUES" " (QstCod,AnsInd,NumUsrs,Answer)"
" (%ld,%u,0,'%s')", " VALUES"
SvyQst.QstCod,NumAns,SvyQst.AnsChoice[NumAns].Text); " (%ld,%u,0,'%s')",
DB_QueryINSERT_new ("can not create answer"); SvyQst.QstCod,NumAns,SvyQst.AnsChoice[NumAns].Text);
}
} }
/***** List the questions of this survey, including the new one just inserted into the database *****/ /***** List the questions of this survey, including the new one just inserted into the database *****/
@ -3733,12 +3729,12 @@ static void Svy_IncreaseAnswerInDB (long QstCod,unsigned AnsInd)
static void Svy_RegisterIHaveAnsweredSvy (long SvyCod) static void Svy_RegisterIHaveAnsweredSvy (long SvyCod)
{ {
DB_BuildQuery ("INSERT INTO svy_users" DB_QueryINSERT ("can not register that you have answered the survey",
" (SvyCod,UsrCod)" "INSERT INTO svy_users"
" VALUES" " (SvyCod,UsrCod)"
" (%ld,%ld)", " VALUES"
SvyCod,Gbl.Usrs.Me.UsrDat.UsrCod); " (%ld,%ld)",
DB_QueryINSERT_new ("can not register that you have answered the survey"); SvyCod,Gbl.Usrs.Me.UsrDat.UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -6615,12 +6615,12 @@ static void Tst_InsertTagsIntoDB (void)
TagCod = Tst_CreateNewTag (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Test.Tags.Txt[NumTag]); TagCod = Tst_CreateNewTag (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Test.Tags.Txt[NumTag]);
/***** Insert tag in tst_question_tags *****/ /***** Insert tag in tst_question_tags *****/
DB_BuildQuery ("INSERT INTO tst_question_tags" DB_QueryINSERT ("can not create tag",
" (QstCod,TagCod,TagInd)" "INSERT INTO tst_question_tags"
" VALUES" " (QstCod,TagCod,TagInd)"
" (%ld,%ld,%u)", " VALUES"
Gbl.Test.QstCod,TagCod,TagIdx); " (%ld,%ld,%u)",
DB_QueryINSERT_new ("can not create tag"); Gbl.Test.QstCod,TagCod,TagIdx);
TagIdx++; TagIdx++;
} }
@ -6648,41 +6648,39 @@ static void Tst_InsertAnswersIntoDB (void)
switch (Gbl.Test.AnswerType) switch (Gbl.Test.AnswerType)
{ {
case Tst_ANS_INT: case Tst_ANS_INT:
DB_BuildQuery ("INSERT INTO tst_answers" DB_QueryINSERT ("can not create answer",
" (QstCod,AnsInd,Answer,Feedback," "INSERT INTO tst_answers"
"ImageName,ImageTitle,ImageURL,Correct)" " (QstCod,AnsInd,Answer,Feedback,"
" VALUES" "ImageName,ImageTitle,ImageURL,Correct)"
" (%ld,0,%ld,'','','','','Y')", " VALUES"
Gbl.Test.QstCod, " (%ld,0,%ld,'','','','','Y')",
Gbl.Test.Answer.Integer); Gbl.Test.QstCod,
DB_QueryINSERT_new ("can not create answer"); Gbl.Test.Answer.Integer);
break; break;
case Tst_ANS_FLOAT: case Tst_ANS_FLOAT:
Str_SetDecimalPointToUS (); // To print the floating point as a dot Str_SetDecimalPointToUS (); // To print the floating point as a dot
for (i = 0; for (i = 0;
i < 2; i < 2;
i++) i++)
{ DB_QueryINSERT ("can not create answer",
DB_BuildQuery ("INSERT INTO tst_answers" "INSERT INTO tst_answers"
" (QstCod,AnsInd,Answer,Feedback," " (QstCod,AnsInd,Answer,Feedback,"
"ImageName,ImageTitle,ImageURL,Correct)" "ImageName,ImageTitle,ImageURL,Correct)"
" VALUES" " VALUES"
" (%ld,%u,'%lg','','','','','Y')", " (%ld,%u,'%lg','','','','','Y')",
Gbl.Test.QstCod,i, Gbl.Test.QstCod,i,
Gbl.Test.Answer.FloatingPoint[i]); Gbl.Test.Answer.FloatingPoint[i]);
DB_QueryINSERT_new ("can not create answer");
}
Str_SetDecimalPointToLocal (); // Return to local system Str_SetDecimalPointToLocal (); // Return to local system
break; break;
case Tst_ANS_TRUE_FALSE: case Tst_ANS_TRUE_FALSE:
DB_BuildQuery ("INSERT INTO tst_answers" DB_QueryINSERT ("can not create answer",
" (QstCod,AnsInd,Answer,Feedback," "INSERT INTO tst_answers"
"ImageName,ImageTitle,ImageURL,Correct)" " (QstCod,AnsInd,Answer,Feedback,"
" VALUES" "ImageName,ImageTitle,ImageURL,Correct)"
" (%ld,0,'%c','','','','','Y')", " VALUES"
Gbl.Test.QstCod, " (%ld,0,'%c','','','','','Y')",
Gbl.Test.Answer.TF); Gbl.Test.QstCod,
DB_QueryINSERT_new ("can not create answer"); Gbl.Test.Answer.TF);
break; break;
case Tst_ANS_UNIQUE_CHOICE: case Tst_ANS_UNIQUE_CHOICE:
case Tst_ANS_MULTIPLE_CHOICE: case Tst_ANS_MULTIPLE_CHOICE:
@ -6692,20 +6690,20 @@ static void Tst_InsertAnswersIntoDB (void)
NumOpt++) NumOpt++)
if (Gbl.Test.Answer.Options[NumOpt].Text[0]) if (Gbl.Test.Answer.Options[NumOpt].Text[0])
{ {
DB_BuildQuery ("INSERT INTO tst_answers" DB_QueryINSERT ("can not create answer",
" (QstCod,AnsInd,Answer,Feedback," "INSERT INTO tst_answers"
"ImageName,ImageTitle,ImageURL,Correct)" " (QstCod,AnsInd,Answer,Feedback,"
" VALUES" "ImageName,ImageTitle,ImageURL,Correct)"
" (%ld,%u,'%s','%s','%s','%s','%s','%c')", " VALUES"
Gbl.Test.QstCod,NumOpt, " (%ld,%u,'%s','%s','%s','%s','%s','%c')",
Gbl.Test.Answer.Options[NumOpt].Text, Gbl.Test.QstCod,NumOpt,
Gbl.Test.Answer.Options[NumOpt].Feedback ? Gbl.Test.Answer.Options[NumOpt].Feedback : "", Gbl.Test.Answer.Options[NumOpt].Text,
Gbl.Test.Answer.Options[NumOpt].Image.Name, Gbl.Test.Answer.Options[NumOpt].Feedback ? Gbl.Test.Answer.Options[NumOpt].Feedback : "",
Gbl.Test.Answer.Options[NumOpt].Image.Title ? Gbl.Test.Answer.Options[NumOpt].Image.Title : "", Gbl.Test.Answer.Options[NumOpt].Image.Name,
Gbl.Test.Answer.Options[NumOpt].Image.URL ? Gbl.Test.Answer.Options[NumOpt].Image.URL : "", Gbl.Test.Answer.Options[NumOpt].Image.Title ? Gbl.Test.Answer.Options[NumOpt].Image.Title : "",
Gbl.Test.Answer.Options[NumOpt].Correct ? 'Y' : Gbl.Test.Answer.Options[NumOpt].Image.URL ? Gbl.Test.Answer.Options[NumOpt].Image.URL : "",
'N'); Gbl.Test.Answer.Options[NumOpt].Correct ? 'Y' :
DB_QueryINSERT_new ("can not create answer"); 'N');
/* Update image status */ /* Update image status */
if (Gbl.Test.Answer.Options[NumOpt].Image.Name[0]) if (Gbl.Test.Answer.Options[NumOpt].Image.Name[0])
@ -8503,17 +8501,17 @@ static void Tst_StoreOneTestResultQstInDB (long TstCod,long QstCod,unsigned NumQ
/***** Insert question and user's answers into database *****/ /***** Insert question and user's answers into database *****/
Str_SetDecimalPointToUS (); // To print the floating point as a dot Str_SetDecimalPointToUS (); // To print the floating point as a dot
DB_BuildQuery ("INSERT INTO tst_exam_questions" DB_QueryINSERT ("can not insert a question of a test result",
" (TstCod,QstCod,QstInd,Score,Indexes,Answers)" "INSERT INTO tst_exam_questions"
" VALUES" " (TstCod,QstCod,QstInd,Score,Indexes,Answers)"
" (%ld,%ld,%u,'%lf','%s','%s')", " VALUES"
TstCod,QstCod, " (%ld,%ld,%u,'%lf','%s','%s')",
NumQst, // 0, 1, 2, 3... TstCod,QstCod,
Score, NumQst, // 0, 1, 2, 3...
Indexes, Score,
Answers); Indexes,
Answers);
Str_SetDecimalPointToLocal (); // Return to local system Str_SetDecimalPointToLocal (); // Return to local system
DB_QueryINSERT_new ("can not insert a question of a test result");
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -583,24 +583,22 @@ static void TT_WriteCrsTimeTableIntoDB (long CrsCod)
Column++) Column++)
if (TT_TimeTable[Weekday][Interval].Columns[Column].IntervalType == TT_FIRST_INTERVAL && if (TT_TimeTable[Weekday][Interval].Columns[Column].IntervalType == TT_FIRST_INTERVAL &&
TT_TimeTable[Weekday][Interval].Columns[Column].DurationIntervals) TT_TimeTable[Weekday][Interval].Columns[Column].DurationIntervals)
{ DB_QueryINSERT ("can not create course timetable",
DB_BuildQuery ("INSERT INTO timetable_crs" "INSERT INTO timetable_crs"
" (CrsCod,GrpCod,Weekday,StartTime,Duration," " (CrsCod,GrpCod,Weekday,StartTime,Duration,"
"ClassType,Place,GroupName)" "ClassType,Place,GroupName)"
" VALUES" " VALUES"
" (%ld,%ld,%u,'%02u:%02u:00',SEC_TO_TIME(%u)," " (%ld,%ld,%u,'%02u:%02u:00',SEC_TO_TIME(%u),"
"'%s','%s','%s')", "'%s','%s','%s')",
CrsCod, CrsCod,
TT_TimeTable[Weekday][Interval].Columns[Column].GrpCod, TT_TimeTable[Weekday][Interval].Columns[Column].GrpCod,
Weekday, Weekday,
Hour,Min, Hour,Min,
TT_TimeTable[Weekday][Interval].Columns[Column].DurationIntervals * TT_TimeTable[Weekday][Interval].Columns[Column].DurationIntervals *
Gbl.TimeTable.Config.SecondsPerInterval, Gbl.TimeTable.Config.SecondsPerInterval,
TT_ClassTypeDB[TT_TimeTable[Weekday][Interval].Columns[Column].ClassType], TT_ClassTypeDB[TT_TimeTable[Weekday][Interval].Columns[Column].ClassType],
TT_TimeTable[Weekday][Interval].Columns[Column].Place, TT_TimeTable[Weekday][Interval].Columns[Column].Place,
TT_TimeTable[Weekday][Interval].Columns[Column].Group); TT_TimeTable[Weekday][Interval].Columns[Column].Group);
DB_QueryINSERT_new ("can not create course timetable");
}
} }
/*****************************************************************************/ /*****************************************************************************/
@ -633,19 +631,17 @@ static void TT_WriteTutTimeTableIntoDB (long UsrCod)
Column++) Column++)
if (TT_TimeTable[Weekday][Interval].Columns[Column].IntervalType == TT_FIRST_INTERVAL && if (TT_TimeTable[Weekday][Interval].Columns[Column].IntervalType == TT_FIRST_INTERVAL &&
TT_TimeTable[Weekday][Interval].Columns[Column].DurationIntervals) TT_TimeTable[Weekday][Interval].Columns[Column].DurationIntervals)
{ DB_QueryINSERT ("can not create office timetable",
DB_BuildQuery ("INSERT INTO timetable_tut" "INSERT INTO timetable_tut"
" (UsrCod,Weekday,StartTime,Duration,Place)" " (UsrCod,Weekday,StartTime,Duration,Place)"
" VALUES" " VALUES"
" (%ld,%u,'%02u:%02u:00',SEC_TO_TIME(%u),'%s')", " (%ld,%u,'%02u:%02u:00',SEC_TO_TIME(%u),'%s')",
UsrCod, UsrCod,
Weekday, Weekday,
Hour,Min, Hour,Min,
TT_TimeTable[Weekday][Interval].Columns[Column].DurationIntervals * TT_TimeTable[Weekday][Interval].Columns[Column].DurationIntervals *
Gbl.TimeTable.Config.SecondsPerInterval, Gbl.TimeTable.Config.SecondsPerInterval,
TT_TimeTable[Weekday][Interval].Columns[Column].Place); TT_TimeTable[Weekday][Interval].Columns[Column].Place);
DB_QueryINSERT_new ("can not create office timetable");
}
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -2585,12 +2585,12 @@ static void Usr_InsertMyBirthday (void)
DB_QueryDELETE_new ("can not delete old birthdays"); DB_QueryDELETE_new ("can not delete old birthdays");
/***** Insert new birthday *****/ /***** Insert new birthday *****/
DB_BuildQuery ("INSERT INTO birthdays_today" DB_QueryINSERT ("can not insert birthday",
" (UsrCod,Today)" "INSERT INTO birthdays_today"
" VALUES" " (UsrCod,Today)"
" (%ld,CURDATE())", " VALUES"
Gbl.Usrs.Me.UsrDat.UsrCod); " (%ld,CURDATE())",
DB_QueryINSERT_new ("can not insert birthday"); Gbl.Usrs.Me.UsrDat.UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -3413,16 +3413,16 @@ void Usr_UpdateMyLastData (void)
static void Usr_InsertMyLastData (void) static void Usr_InsertMyLastData (void)
{ {
/***** Insert my last accessed course, tab and time of click in database *****/ /***** Insert my last accessed course, tab and time of click in database *****/
DB_BuildQuery ("INSERT INTO usr_last" DB_QueryINSERT ("can not insert last user's data",
" (UsrCod,WhatToSearch,LastCrs,LastTab,LastTime,LastAccNotif)" "INSERT INTO usr_last"
" VALUES" " (UsrCod,WhatToSearch,LastCrs,LastTab,LastTime,LastAccNotif)"
" (%ld,%u,%ld,%u,NOW(),FROM_UNIXTIME(%ld))", " VALUES"
Gbl.Usrs.Me.UsrDat.UsrCod, " (%ld,%u,%ld,%u,NOW(),FROM_UNIXTIME(%ld))",
(unsigned) Sch_SEARCH_ALL, Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.CurrentCrs.Crs.CrsCod, (unsigned) Sch_SEARCH_ALL,
(unsigned) Gbl.Action.Tab, Gbl.CurrentCrs.Crs.CrsCod,
(long) (time_t) 0); // The user never accessed to notifications (unsigned) Gbl.Action.Tab,
DB_QueryINSERT_new ("can not insert last user's data"); (long) (time_t) 0); // The user never accessed to notifications
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -461,12 +461,12 @@ static int Svc_GenerateNewWSKey (long UsrCod,
"Generated key already existed in database"); "Generated key already existed in database");
/***** Insert key into database *****/ /***** Insert key into database *****/
DB_BuildQuery ("INSERT INTO ws_keys" DB_QueryINSERT ("can not insert new key",
" (WSKey,UsrCod,PlgCod,LastTime)" "INSERT INTO ws_keys"
" VALUES" " (WSKey,UsrCod,PlgCod,LastTime)"
" ('%s',%ld,%ld,NOW())", " VALUES"
WSKey,UsrCod,Gbl.WebService.PlgCod); " ('%s',%ld,%ld,NOW())",
DB_QueryINSERT_new ("can not insert new key"); WSKey,UsrCod,Gbl.WebService.PlgCod);
return SOAP_OK; return SOAP_OK;
} }
@ -3434,39 +3434,39 @@ static int Svc_SendMessageToUsr (long OriginalMsgCod,
NewMsgCod = DB_QueryINSERTandReturnCode_new ("can not create message"); NewMsgCod = DB_QueryINSERTandReturnCode_new ("can not create message");
/***** Insert message in sent messages *****/ /***** Insert message in sent messages *****/
DB_BuildQuery ("INSERT INTO msg_snt" DB_QueryINSERT ("can not create message",
" (MsgCod,CrsCod,UsrCod,Expanded,CreatTime)" "INSERT INTO msg_snt"
" VALUES" " (MsgCod,CrsCod,UsrCod,Expanded,CreatTime)"
" (%ld,-1,%ld,'N',NOW())", " VALUES"
NewMsgCod,SenderUsrCod); " (%ld,-1,%ld,'N',NOW())",
DB_QueryINSERT_new ("can not create message"); NewMsgCod,SenderUsrCod);
MsgAlreadyInserted = true; MsgAlreadyInserted = true;
} }
/***** Insert message received in the database *****/ /***** Insert message received in the database *****/
DB_BuildQuery ("INSERT INTO msg_rcv" DB_QueryINSERT ("can not create received message",
" (MsgCod,UsrCod,Notified,Open,Replied,Expanded)" "INSERT INTO msg_rcv"
" VALUES" " (MsgCod,UsrCod,Notified,Open,Replied,Expanded)"
" (%ld,%ld,'%c','N','N','N')", " VALUES"
NewMsgCod,RecipientUsrCod, " (%ld,%ld,'%c','N','N','N')",
NotifyByEmail ? 'Y' : NewMsgCod,RecipientUsrCod,
'N'); NotifyByEmail ? 'Y' :
DB_QueryINSERT_new ("can not create received message"); 'N');
/***** Create notification for this recipient. /***** Create notification for this recipient.
If this recipient wants to receive notifications by email, activate the sending of a notification *****/ If this recipient wants to receive notifications by email, activate the sending of a notification *****/
DB_BuildQuery ("INSERT INTO notif" DB_QueryINSERT ("can not create new notification event",
" (NotifyEvent,ToUsrCod,FromUsrCod,InsCod,DegCod,CrsCod,Cod,TimeNotif,Status)" "INSERT INTO notif"
" VALUES" " (NotifyEvent,ToUsrCod,FromUsrCod,InsCod,DegCod,CrsCod,Cod,TimeNotif,Status)"
" (%u,%ld,%ld,-1,-1,-1,%ld,NOW(),%u)", " VALUES"
(unsigned) Ntf_EVENT_MESSAGE, " (%u,%ld,%ld,-1,-1,-1,%ld,NOW(),%u)",
RecipientUsrCod, (unsigned) Ntf_EVENT_MESSAGE,
SenderUsrCod, RecipientUsrCod,
NewMsgCod, SenderUsrCod,
(unsigned) (NotifyByEmail ? Ntf_STATUS_BIT_EMAIL : NewMsgCod,
0)); (unsigned) (NotifyByEmail ? Ntf_STATUS_BIT_EMAIL :
DB_QueryINSERT_new ("can not create new notification event"); 0));
/***** If this recipient is the original sender of a message been replied... *****/ /***** If this recipient is the original sender of a message been replied... *****/
if (RecipientUsrCod == ReplyUsrCod) if (RecipientUsrCod == ReplyUsrCod)
@ -4111,13 +4111,6 @@ int swad__getTrivialQuestion (struct soap *soap,
/***** Loop over recipients' nicknames building query *****/ /***** Loop over recipients' nicknames building query *****/
DegreesStr[0] = '\0'; DegreesStr[0] = '\0';
Ptr = degrees; Ptr = degrees;
/*
if (Gbl.Usrs.Me.UsrDat.UsrCod == 19543)
{
DB_BuildQuery ("INSERT INTO debug (DebugTime,Txt) VALUES (NOW(),'degrees = %s')",degrees);
DB_QueryINSERT_new ("Error inserting in debug table");
}
*/
while (*Ptr) while (*Ptr)
{ {
/* Find next string in text until comma (leading and trailing spaces are removed) */ /* Find next string in text until comma (leading and trailing spaces are removed) */
@ -4187,13 +4180,6 @@ int swad__getTrivialQuestion (struct soap *soap,
if (NumRows == 1) // Question found if (NumRows == 1) // Question found
{ {
/*
if (Gbl.Usrs.Me.UsrDat.UsrCod == 19543)
{
DB_BuildQuery ("INSERT INTO debug (DebugTime,Txt) VALUES (NOW(),'Una pregunta devuelta')");
DB_QueryINSERT_new ("Error inserting in debug table");
}
*/
/* Get next question */ /* Get next question */
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);