mirror of https://github.com/acanas/swad-core.git
Version 21.58: Nov 21, 2021 Code refactoring in timeline.
This commit is contained in:
parent
e3a4494721
commit
733ae0e86d
|
@ -937,8 +937,30 @@ function readNewTimelineData () {
|
||||||
// (move all the LI elements (notes) in UL 'just_now_timeline_list'...
|
// (move all the LI elements (notes) in UL 'just_now_timeline_list'...
|
||||||
// ...to the top of UL 'new_timeline_list')
|
// ...to the top of UL 'new_timeline_list')
|
||||||
var newTimeline = document.getElementById('new_timeline_list'); // Access to UL with the new timeline
|
var newTimeline = document.getElementById('new_timeline_list'); // Access to UL with the new timeline
|
||||||
for (var i=0; i<numNotesJustGot; i++)
|
|
||||||
newTimeline.insertBefore(justNowTimeline.lastChild, newTimeline.firstChild);
|
for (var i=1; i<=numNotesJustGot; i++) {
|
||||||
|
// Check if the last child (the oldest) in just now timeline...
|
||||||
|
// ...is the last ocurrence of the note
|
||||||
|
var mostRecentOcurrenceOfNote = true;
|
||||||
|
var lastChildIndex = numNotesJustGot - i;
|
||||||
|
var noteCode = justNowTimeline.lastChild.dataset.noteCode;
|
||||||
|
for (var j=0; j<lastChildIndex; j++)
|
||||||
|
if (justNowTimeline.childNodes[j].dataset.noteCode == noteCode) {
|
||||||
|
mostRecentOcurrenceOfNote = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move or remove node from new timeline
|
||||||
|
if (mostRecentOcurrenceOfNote) {
|
||||||
|
// Move node from just now timeline to new timeline
|
||||||
|
newTimeline.insertBefore(justNowTimeline.lastChild, newTimeline.firstChild);
|
||||||
|
newTimeline.firstChild.className += " Tml_NEW_PUB";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
// Remove last child (because is repeated in more recent pubs)
|
||||||
|
justNowTimeline.removeChild(justNowTimeline.lastChild);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Update number of new posts
|
// Update number of new posts
|
||||||
var viewNewPostsCount = document.getElementById('view_new_posts_count');
|
var viewNewPostsCount = document.getElementById('view_new_posts_count');
|
||||||
|
@ -975,10 +997,9 @@ function moveNewTimelineToTimeline () {
|
||||||
// ...is the last ocurrence of the note
|
// ...is the last ocurrence of the note
|
||||||
var mostRecentOcurrenceOfNote = true;
|
var mostRecentOcurrenceOfNote = true;
|
||||||
var lastChildIndex = numNewNotes - i;
|
var lastChildIndex = numNewNotes - i;
|
||||||
|
var noteCode = newTimeline.lastChild.dataset.noteCode;
|
||||||
for (var j=0; j<lastChildIndex; j++)
|
for (var j=0; j<lastChildIndex; j++)
|
||||||
if (newTimeline.childNodes[j].dataset.noteCode ==
|
if (newTimeline.childNodes[j].dataset.noteCode == noteCode) {
|
||||||
newTimeline.lastChild.dataset.noteCode) {
|
|
||||||
mostRecentOcurrenceOfNote = false;
|
mostRecentOcurrenceOfNote = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
|
@ -13522,4 +13522,41 @@ WHERE NotCod NOT IN (SELECT NotCod FROM tml_tmp_just_retrieved_notes)
|
||||||
ORDER BY PubCod DESC
|
ORDER BY PubCod DESC
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TEMPORARY TABLE tml_tmp_just_retrieved_notes (NotCod BIGINT NOT NULL,UNIQUE INDEX(NotCod)) ENGINE=MEMORY;
|
||||||
|
CREATE TEMPORARY TABLE tml_tmp_visible_timeline (NotCod BIGINT NOT NULL,UNIQUE INDEX(NotCod)) ENGINE=MEMORY SELECT NotCod FROM tml_timelines WHERE SessionId='%s',Gbl.Session.Id);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TEMPORARY TABLE fol_tmp_me_and_followed (UsrCod INT NOT NULL,UNIQUE INDEX(UsrCod)) ENGINE=MEMORY SELECT 1 AS UsrCod UNION SELECT FollowedCod AS UsrCod FROM usr_follow WHERE FollowerCod=1;
|
||||||
|
|
||||||
|
CREATE TEMPORARY TABLE fol_tmp_me_and_followed_2 (UsrCod INT NOT NULL,UNIQUE INDEX(UsrCod)) ENGINE=MEMORY SELECT 1 UNION SELECT FollowedCod FROM usr_follow WHERE FollowerCod=1;
|
||||||
|
|
||||||
|
|
||||||
|
SELECT tml_pubs.PubCod,
|
||||||
|
tml_pubs.NotCod,
|
||||||
|
tml_pubs.PublisherCod,
|
||||||
|
tml_pubs.PubType
|
||||||
|
FROM tml_pubs,
|
||||||
|
fol_tmp_me_and_followed
|
||||||
|
WHERE tml_pubs.PublisherCod=fol_tmp_me_and_followed.UsrCod
|
||||||
|
AND tml_pubs.NotCod NOT IN
|
||||||
|
(SELECT NotCod
|
||||||
|
FROM tml_tmp_just_retrieved_notes)
|
||||||
|
ORDER BY PubCod DESC
|
||||||
|
LIMIT 1;
|
||||||
|
|
||||||
|
"SELECT tml_pubs.PubCod," // row[0]
|
||||||
|
"tml_pubs.NotCod," // row[1]
|
||||||
|
"tml_pubs.PublisherCod," // row[2]
|
||||||
|
"tml_pubs.PubType" // row[3]
|
||||||
|
" FROM tml_pubs%s"
|
||||||
|
" WHERE tml_pubs.PublisherCod=fol_tmp_me_and_followed.UsrCod
|
||||||
|
AND "
|
||||||
|
" ORDER BY tml_pubs.PubCod DESC"
|
||||||
|
" LIMIT 1",
|
||||||
|
SubQueries->Publishers.Table,
|
||||||
|
SubQueries->RangeBottom,
|
||||||
|
SubQueries->RangeTop,
|
||||||
|
SubQueries->Publishers.SubQuery,
|
||||||
|
SubQueries->AlreadyExists);
|
||||||
|
|
||||||
|
|
|
@ -1722,43 +1722,40 @@ unsigned Brw_DB_SearchFilesInMyCrss (MYSQL_RES **mysql_res,
|
||||||
|
|
||||||
/***** Create temporary tables with codes of files in documents and shared areas accessible by me.
|
/***** Create temporary tables with codes of files in documents and shared areas accessible by me.
|
||||||
It is necessary to speed up the second query *****/
|
It is necessary to speed up the second query *****/
|
||||||
DB_Query ("can not remove temporary tables",
|
DB_DropTmpTable ("my_files_crs");
|
||||||
"DROP TEMPORARY TABLE IF EXISTS my_files_crs,"
|
DB_DropTmpTable ("my_files_grp");
|
||||||
"my_files_grp");
|
|
||||||
|
|
||||||
DB_Query ("can not create temporary table",
|
DB_CreateTmpTable ("CREATE TEMPORARY TABLE my_files_crs"
|
||||||
"CREATE TEMPORARY TABLE my_files_crs"
|
" (FilCod INT NOT NULL,"
|
||||||
" (FilCod INT NOT NULL,"
|
"UNIQUE INDEX(FilCod))"
|
||||||
"UNIQUE INDEX(FilCod))"
|
" ENGINE=MEMORY"
|
||||||
" ENGINE=MEMORY"
|
" SELECT brw_files.FilCod"
|
||||||
" SELECT brw_files.FilCod"
|
" FROM crs_users,"
|
||||||
" FROM crs_users,"
|
"brw_files"
|
||||||
"brw_files"
|
" WHERE crs_users.UsrCod=%ld"
|
||||||
" WHERE crs_users.UsrCod=%ld"
|
" AND crs_users.CrsCod=brw_files.Cod"
|
||||||
" AND crs_users.CrsCod=brw_files.Cod"
|
" AND brw_files.FileBrowser IN (%u,%u,%u,%u)",
|
||||||
" AND brw_files.FileBrowser IN (%u,%u,%u,%u)",
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
(unsigned) Brw_ADMI_DOC_CRS,
|
||||||
(unsigned) Brw_ADMI_DOC_CRS,
|
(unsigned) Brw_ADMI_TCH_CRS,
|
||||||
(unsigned) Brw_ADMI_TCH_CRS,
|
(unsigned) Brw_ADMI_SHR_CRS,
|
||||||
(unsigned) Brw_ADMI_SHR_CRS,
|
(unsigned) Brw_ADMI_MRK_CRS);
|
||||||
(unsigned) Brw_ADMI_MRK_CRS);
|
|
||||||
|
|
||||||
DB_Query ("can not create temporary table",
|
DB_CreateTmpTable ("CREATE TEMPORARY TABLE my_files_grp"
|
||||||
"CREATE TEMPORARY TABLE my_files_grp"
|
" (FilCod INT NOT NULL,"
|
||||||
" (FilCod INT NOT NULL,"
|
"UNIQUE INDEX(FilCod))"
|
||||||
"UNIQUE INDEX(FilCod))"
|
" ENGINE=MEMORY"
|
||||||
" ENGINE=MEMORY"
|
" SELECT brw_files.FilCod"
|
||||||
" SELECT brw_files.FilCod"
|
" FROM grp_users,"
|
||||||
" FROM grp_users,"
|
"brw_files"
|
||||||
"brw_files"
|
" WHERE grp_users.UsrCod=%ld"
|
||||||
" WHERE grp_users.UsrCod=%ld"
|
" AND grp_users.GrpCod=brw_files.Cod"
|
||||||
" AND grp_users.GrpCod=brw_files.Cod"
|
" AND brw_files.FileBrowser IN (%u,%u,%u,%u)",
|
||||||
" AND brw_files.FileBrowser IN (%u,%u,%u,%u)",
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
(unsigned) Brw_ADMI_DOC_GRP,
|
||||||
(unsigned) Brw_ADMI_DOC_GRP,
|
(unsigned) Brw_ADMI_TCH_GRP,
|
||||||
(unsigned) Brw_ADMI_TCH_GRP,
|
(unsigned) Brw_ADMI_SHR_GRP,
|
||||||
(unsigned) Brw_ADMI_SHR_GRP,
|
(unsigned) Brw_ADMI_MRK_GRP);
|
||||||
(unsigned) Brw_ADMI_MRK_GRP);
|
|
||||||
|
|
||||||
/***** Build the query *****/
|
/***** Build the query *****/
|
||||||
NumFiles = (unsigned)
|
NumFiles = (unsigned)
|
||||||
|
@ -1853,9 +1850,8 @@ unsigned Brw_DB_SearchFilesInMyCrss (MYSQL_RES **mysql_res,
|
||||||
RangeQuery);
|
RangeQuery);
|
||||||
|
|
||||||
/***** Drop temporary tables *****/
|
/***** Drop temporary tables *****/
|
||||||
DB_Query ("can not remove temporary table",
|
DB_DropTmpTable ("my_files_crs");
|
||||||
"DROP TEMPORARY TABLE IF EXISTS my_files_crs,"
|
DB_DropTmpTable ("my_files_grp");
|
||||||
"my_files_grp");
|
|
||||||
|
|
||||||
return NumFiles;
|
return NumFiles;
|
||||||
}
|
}
|
||||||
|
|
|
@ -602,13 +602,14 @@ TODO: FIX BUG, URGENT! En las fechas como par
|
||||||
|
|
||||||
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
|
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 21.57.5 (2021-11-18)"
|
#define Log_PLATFORM_VERSION "SWAD 21.58 (2021-11-21)"
|
||||||
#define CSS_FILE "swad21.57.css"
|
#define CSS_FILE "swad21.57.css"
|
||||||
#define JS_FILE "swad21.57.js"
|
#define JS_FILE "swad21.58.js"
|
||||||
/*
|
/*
|
||||||
TODO: Rename CENTRE to CENTER in help wiki.
|
TODO: Rename CENTRE to CENTER in help wiki.
|
||||||
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
||||||
|
|
||||||
|
Version 21.58: Nov 21, 2021 Code refactoring in timeline. (319157 lines)
|
||||||
Version 21.57.5: Nov 18, 2021 Code refactoring related to check if user logged is me. (319174 lines)
|
Version 21.57.5: Nov 18, 2021 Code refactoring related to check if user logged is me. (319174 lines)
|
||||||
Version 21.57.4: Nov 17, 2021 Code refactoring in timeline. (319235 lines)
|
Version 21.57.4: Nov 17, 2021 Code refactoring in timeline. (319235 lines)
|
||||||
Version 21.57.3: Nov 17, 2021 Code refactoring in timeline. (319225 lines)
|
Version 21.57.3: Nov 17, 2021 Code refactoring in timeline. (319225 lines)
|
||||||
|
|
|
@ -3724,7 +3724,7 @@ mysql> DESCRIBE usr_webs;
|
||||||
static void DB_CreateTable (const char *Query)
|
static void DB_CreateTable (const char *Query)
|
||||||
{
|
{
|
||||||
HTM_LI_Begin ("class=\"DAT\"");
|
HTM_LI_Begin ("class=\"DAT\"");
|
||||||
HTM_Txt (Query);
|
HTM_Txt (Query);
|
||||||
HTM_LI_End ();
|
HTM_LI_End ();
|
||||||
|
|
||||||
if (mysql_query (&Gbl.mysql,Query))
|
if (mysql_query (&Gbl.mysql,Query))
|
||||||
|
@ -4224,6 +4224,36 @@ void DB_QueryDELETE (const char *MsgError,const char *fmt,...)
|
||||||
DB_ExitOnMySQLError (MsgError);
|
DB_ExitOnMySQLError (MsgError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/**************************** Create temporary table *************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void DB_CreateTmpTable (const char *fmt,...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
int NumBytesPrinted;
|
||||||
|
char *Query;
|
||||||
|
int Result;
|
||||||
|
|
||||||
|
va_start (ap,fmt);
|
||||||
|
NumBytesPrinted = vasprintf (&Query,fmt,ap);
|
||||||
|
va_end (ap);
|
||||||
|
if (NumBytesPrinted < 0) // -1 if no memory or any other error
|
||||||
|
Err_NotEnoughMemoryExit ();
|
||||||
|
|
||||||
|
/***** Query database and free query string pointer *****/
|
||||||
|
Result = mysql_query (&Gbl.mysql,Query); // Returns 0 on success
|
||||||
|
free (Query);
|
||||||
|
if (Result)
|
||||||
|
DB_ExitOnMySQLError ("can not create temporary table");
|
||||||
|
}
|
||||||
|
|
||||||
|
void DB_DropTmpTable (const char *Table)
|
||||||
|
{
|
||||||
|
DB_Query ("can not remove temporary table",
|
||||||
|
"DROP TEMPORARY TABLE IF EXISTS %s",Table);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**************** Make other kind of query from database *********************/
|
/**************** Make other kind of query from database *********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -69,6 +69,9 @@ void DB_QueryUPDATE (const char *MsgError,const char *fmt,...);
|
||||||
|
|
||||||
void DB_QueryDELETE (const char *MsgError,const char *fmt,...);
|
void DB_QueryDELETE (const char *MsgError,const char *fmt,...);
|
||||||
|
|
||||||
|
void DB_CreateTmpTable (const char *fmt,...);
|
||||||
|
void DB_DropTmpTable (const char *Table);
|
||||||
|
|
||||||
void DB_Query (const char *MsgError,const char *fmt,...);
|
void DB_Query (const char *MsgError,const char *fmt,...);
|
||||||
|
|
||||||
void DB_FreeMySQLResult (MYSQL_RES **mysql_res);
|
void DB_FreeMySQLResult (MYSQL_RES **mysql_res);
|
||||||
|
|
|
@ -78,24 +78,23 @@ void Enr_DB_AcceptUsrInCrs (long UsrCod,long CrsCod)
|
||||||
|
|
||||||
void Enr_DB_CreateTmpTableMyCourses (void)
|
void Enr_DB_CreateTmpTableMyCourses (void)
|
||||||
{
|
{
|
||||||
DB_Query ("can not create temporary table",
|
DB_CreateTmpTable ("CREATE TEMPORARY TABLE IF NOT EXISTS my_courses_tmp"
|
||||||
"CREATE TEMPORARY TABLE IF NOT EXISTS my_courses_tmp"
|
" (CrsCod INT NOT NULL,"
|
||||||
" (CrsCod INT NOT NULL,"
|
"Role TINYINT NOT NULL,"
|
||||||
"Role TINYINT NOT NULL,"
|
"DegCod INT NOT NULL,"
|
||||||
"DegCod INT NOT NULL,"
|
"UNIQUE INDEX(CrsCod,Role,DegCod)) ENGINE=MEMORY"
|
||||||
"UNIQUE INDEX(CrsCod,Role,DegCod)) ENGINE=MEMORY"
|
" SELECT crs_users.CrsCod,"
|
||||||
" SELECT crs_users.CrsCod,"
|
"crs_users.Role,"
|
||||||
"crs_users.Role,"
|
"crs_courses.DegCod"
|
||||||
"crs_courses.DegCod"
|
" FROM crs_users,"
|
||||||
" FROM crs_users,"
|
"crs_courses,"
|
||||||
"crs_courses,"
|
"deg_degrees"
|
||||||
"deg_degrees"
|
" WHERE crs_users.UsrCod=%ld"
|
||||||
" WHERE crs_users.UsrCod=%ld"
|
" AND crs_users.CrsCod=crs_courses.CrsCod"
|
||||||
" AND crs_users.CrsCod=crs_courses.CrsCod"
|
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
" ORDER BY deg_degrees.ShortName,"
|
||||||
" ORDER BY deg_degrees.ShortName,"
|
"crs_courses.ShortName",
|
||||||
"crs_courses.ShortName",
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -118,8 +117,7 @@ unsigned Enr_DB_GetMyCourses (MYSQL_RES **mysql_res)
|
||||||
|
|
||||||
void Enr_DB_DropTmpTableMyCourses (void)
|
void Enr_DB_DropTmpTableMyCourses (void)
|
||||||
{
|
{
|
||||||
DB_Query ("can not remove temporary table",
|
DB_DropTmpTable ("my_courses_tmp");
|
||||||
"DROP TEMPORARY TABLE IF EXISTS my_courses_tmp");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -205,19 +203,17 @@ bool Enr_DB_CheckIfUsrSharesAnyOfMyCrsWithDifferentRole (long UsrCod)
|
||||||
Enr_GetMyCourses ();
|
Enr_GetMyCourses ();
|
||||||
|
|
||||||
/* Remove temporary table if exists */
|
/* Remove temporary table if exists */
|
||||||
DB_Query ("can not remove temporary tables",
|
DB_DropTmpTable ("usr_courses_tmp");
|
||||||
"DROP TEMPORARY TABLE IF EXISTS usr_courses_tmp");
|
|
||||||
|
|
||||||
/* Create temporary table with all user's courses for a role */
|
/* Create temporary table with all user's courses for a role */
|
||||||
DB_Query ("can not create temporary table",
|
DB_CreateTmpTable ("CREATE TEMPORARY TABLE IF NOT EXISTS usr_courses_tmp "
|
||||||
"CREATE TEMPORARY TABLE IF NOT EXISTS usr_courses_tmp "
|
"(CrsCod INT NOT NULL,Role TINYINT NOT NULL,"
|
||||||
"(CrsCod INT NOT NULL,Role TINYINT NOT NULL,"
|
"UNIQUE INDEX(CrsCod,Role)) ENGINE=MEMORY"
|
||||||
"UNIQUE INDEX(CrsCod,Role)) ENGINE=MEMORY"
|
" SELECT CrsCod,"
|
||||||
" SELECT CrsCod,"
|
"Role"
|
||||||
"Role"
|
" FROM crs_users"
|
||||||
" FROM crs_users"
|
" WHERE UsrCod=%ld",
|
||||||
" WHERE UsrCod=%ld",
|
UsrCod);
|
||||||
UsrCod);
|
|
||||||
|
|
||||||
/* Get if a user shares any course with me from database */
|
/* Get if a user shares any course with me from database */
|
||||||
UsrSharesAnyOfMyCrsWithDifferentRole =
|
UsrSharesAnyOfMyCrsWithDifferentRole =
|
||||||
|
@ -230,8 +226,7 @@ bool Enr_DB_CheckIfUsrSharesAnyOfMyCrsWithDifferentRole (long UsrCod)
|
||||||
" AND my_courses_tmp.Role<>usr_courses_tmp.Role)");
|
" AND my_courses_tmp.Role<>usr_courses_tmp.Role)");
|
||||||
|
|
||||||
/* Remove temporary table if exists */
|
/* Remove temporary table if exists */
|
||||||
DB_Query ("can not remove temporary tables",
|
DB_DropTmpTable ("usr_courses_tmp");
|
||||||
"DROP TEMPORARY TABLE IF EXISTS usr_courses_tmp");
|
|
||||||
|
|
||||||
return UsrSharesAnyOfMyCrsWithDifferentRole;
|
return UsrSharesAnyOfMyCrsWithDifferentRole;
|
||||||
}
|
}
|
||||||
|
@ -381,8 +376,7 @@ unsigned Enr_DB_GetNumUsrsInCrssOfAUsr (long UsrCod,Rol_Role_t UsrRole,
|
||||||
// The temporary table achieves speedup from ~2s to few ms
|
// The temporary table achieves speedup from ~2s to few ms
|
||||||
|
|
||||||
/***** Remove temporary table if exists *****/
|
/***** Remove temporary table if exists *****/
|
||||||
DB_Query ("can not remove temporary tables",
|
DB_DropTmpTable ("usr_courses_tmp");
|
||||||
"DROP TEMPORARY TABLE IF EXISTS usr_courses_tmp");
|
|
||||||
|
|
||||||
/***** Create temporary table with all user's courses
|
/***** Create temporary table with all user's courses
|
||||||
as student/non-editing teacher/teacher *****/
|
as student/non-editing teacher/teacher *****/
|
||||||
|
@ -405,15 +399,15 @@ unsigned Enr_DB_GetNumUsrsInCrssOfAUsr (long UsrCod,Rol_Role_t UsrRole,
|
||||||
Err_WrongRoleExit ();
|
Err_WrongRoleExit ();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DB_Query ("can not create temporary table",
|
DB_CreateTmpTable ("CREATE TEMPORARY TABLE IF NOT EXISTS usr_courses_tmp"
|
||||||
"CREATE TEMPORARY TABLE IF NOT EXISTS usr_courses_tmp"
|
" (CrsCod INT NOT NULL,UNIQUE INDEX (CrsCod))"
|
||||||
" (CrsCod INT NOT NULL,UNIQUE INDEX (CrsCod))"
|
" ENGINE=MEMORY"
|
||||||
" ENGINE=MEMORY"
|
" SELECT CrsCod"
|
||||||
" SELECT CrsCod"
|
" FROM crs_users"
|
||||||
" FROM crs_users"
|
" WHERE UsrCod=%ld"
|
||||||
" WHERE UsrCod=%ld"
|
"%s",
|
||||||
"%s",
|
UsrCod,
|
||||||
UsrCod,SubQueryRole);
|
SubQueryRole);
|
||||||
|
|
||||||
/***** Get the number of students/teachers in a course from database ******/
|
/***** Get the number of students/teachers in a course from database ******/
|
||||||
OthersRolesStr[0] = '\0';
|
OthersRolesStr[0] = '\0';
|
||||||
|
@ -437,8 +431,7 @@ unsigned Enr_DB_GetNumUsrsInCrssOfAUsr (long UsrCod,Rol_Role_t UsrRole,
|
||||||
OthersRolesStr);
|
OthersRolesStr);
|
||||||
|
|
||||||
/***** Remove temporary table *****/
|
/***** Remove temporary table *****/
|
||||||
DB_Query ("can not remove temporary tables",
|
DB_DropTmpTable ("usr_courses_tmp");
|
||||||
"DROP TEMPORARY TABLE IF EXISTS usr_courses_tmp");
|
|
||||||
|
|
||||||
return NumUsrs;
|
return NumUsrs;
|
||||||
}
|
}
|
||||||
|
|
|
@ -693,22 +693,20 @@ void Fol_DB_RemoveUsrFromUsrFollow (long UsrCod)
|
||||||
|
|
||||||
void Fol_DB_CreateTmpTableMeAndUsrsIFollow (void)
|
void Fol_DB_CreateTmpTableMeAndUsrsIFollow (void)
|
||||||
{
|
{
|
||||||
DB_Query ("can not create temporary table",
|
DB_CreateTmpTable ("CREATE TEMPORARY TABLE fol_tmp_me_and_followed "
|
||||||
"CREATE TEMPORARY TABLE fol_tmp_me_and_followed "
|
"(UsrCod INT NOT NULL,"
|
||||||
"(UsrCod INT NOT NULL,"
|
"UNIQUE INDEX(UsrCod))"
|
||||||
"UNIQUE INDEX(UsrCod))"
|
" ENGINE=MEMORY"
|
||||||
" ENGINE=MEMORY"
|
" SELECT %ld AS UsrCod" // Me
|
||||||
" SELECT %ld AS UsrCod" // Me
|
" UNION"
|
||||||
" UNION"
|
" SELECT FollowedCod AS UsrCod" // Users I follow
|
||||||
" SELECT FollowedCod AS UsrCod" // Users I follow
|
" FROM usr_follow"
|
||||||
" FROM usr_follow"
|
" WHERE FollowerCod=%ld",
|
||||||
" WHERE FollowerCod=%ld",
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fol_DB_DropTmpTableMeAndUsrsIFollow (void)
|
void Fol_DB_DropTmpTableMeAndUsrsIFollow (void)
|
||||||
{
|
{
|
||||||
DB_Query ("can not remove temporary table",
|
DB_DropTmpTable ("fol_tmp_me_and_followed");
|
||||||
"DROP TEMPORARY TABLE IF EXISTS fol_tmp_me_and_followed");
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -307,17 +307,15 @@ void Mai_DB_RemoveExpiredPendingEmails (void)
|
||||||
|
|
||||||
void Mai_DB_CreateTmpTables (void)
|
void Mai_DB_CreateTmpTables (void)
|
||||||
{
|
{
|
||||||
DB_Query ("can not create temporary table",
|
DB_CreateTmpTable ("CREATE TEMPORARY TABLE T1 ENGINE=MEMORY"
|
||||||
"CREATE TEMPORARY TABLE T1 ENGINE=MEMORY"
|
" SELECT SUBSTRING_INDEX(E_mail,'@',-1) AS Domain,"
|
||||||
" SELECT SUBSTRING_INDEX(E_mail,'@',-1) AS Domain,"
|
"COUNT(*) as N"
|
||||||
"COUNT(*) as N"
|
" FROM usr_emails"
|
||||||
" FROM usr_emails"
|
" GROUP BY Domain");
|
||||||
" GROUP BY Domain");
|
|
||||||
|
|
||||||
DB_Query ("can not create temporary table",
|
DB_CreateTmpTable ("CREATE TEMPORARY TABLE T2 ENGINE=MEMORY"
|
||||||
"CREATE TEMPORARY TABLE T2 ENGINE=MEMORY"
|
" SELECT *"
|
||||||
" SELECT *"
|
" FROM T1");
|
||||||
" FROM T1");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -457,7 +455,6 @@ void Mai_DB_RemoveMailDomain (long MaiCod)
|
||||||
|
|
||||||
void Mai_DB_RemoveTmpTables (void)
|
void Mai_DB_RemoveTmpTables (void)
|
||||||
{
|
{
|
||||||
DB_Query ("can not remove temporary tables",
|
DB_DropTmpTable ("T1");
|
||||||
"DROP TEMPORARY TABLE IF EXISTS T1,"
|
DB_DropTmpTable ("T2");
|
||||||
"T2");
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,13 +76,12 @@ void Tag_DB_AddTagToQst (long QstCod,long TagCod,unsigned TagInd)
|
||||||
|
|
||||||
void Tag_DB_CreateTmpTableQuestionsWithTag (long TagCod)
|
void Tag_DB_CreateTmpTableQuestionsWithTag (long TagCod)
|
||||||
{
|
{
|
||||||
DB_Query ("can not create temporary table",
|
DB_CreateTmpTable ("CREATE TEMPORARY TABLE tst_question_tags_tmp"
|
||||||
"CREATE TEMPORARY TABLE tst_question_tags_tmp"
|
" ENGINE=MEMORY"
|
||||||
" ENGINE=MEMORY"
|
" SELECT QstCod"
|
||||||
" SELECT QstCod"
|
" FROM tst_question_tags"
|
||||||
" FROM tst_question_tags"
|
" WHERE TagCod=%ld",
|
||||||
" WHERE TagCod=%ld",
|
TagCod);
|
||||||
TagCod);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -92,8 +91,7 @@ void Tag_DB_CreateTmpTableQuestionsWithTag (long TagCod)
|
||||||
|
|
||||||
void Tag_DB_DropTmpTableQuestionsWithTag (void)
|
void Tag_DB_DropTmpTableQuestionsWithTag (void)
|
||||||
{
|
{
|
||||||
DB_Query ("can not remove temporary table",
|
DB_DropTmpTable ("tst_question_tags_tmp");
|
||||||
"DROP TEMPORARY TABLE IF EXISTS tst_question_tags_tmp");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -45,7 +45,7 @@ mysql> SHOW TABLES LIKE 'tml_%';
|
||||||
|
|
||||||
*Numbers are got from swad.ugr.es on may 2021
|
*Numbers are got from swad.ugr.es on may 2021
|
||||||
|
|
||||||
____tml_pubs___ _tml_comments
|
_tml_pubs______ _tml_comments
|
||||||
| | | |
|
| | | |
|
||||||
| Publication p |---------->| Comment c |-----+
|
| Publication p |---------->| Comment c |-----+
|
||||||
| (comment) | | (to note 2) | |
|
| (comment) | | (to note 2) | |
|
||||||
|
@ -61,35 +61,35 @@ mysql> SHOW TABLES LIKE 'tml_%';
|
||||||
| | (4855) | |
|
| | (4855) | |
|
||||||
|Publication i+3|-- | |
|
|Publication i+3|-- | |
|
||||||
|(original note)| \ | |
|
|(original note)| \ | |
|
||||||
|_______________| \ ___tml_notes___ | | _calls_for_exams
|
|_______________| \ _tml_notes_____ | | _cfe_exams_____
|
||||||
| | \ | | | | | |
|
| | \ | | | | | |
|
||||||
|Publication i+2|-- ---->| Note n |<-+ | | Call for exam | (5581)
|
|Publication i+2|-- ---->| Note n |<-+ | | Call for exam | (5581)
|
||||||
|(original note)| \ |(exam announc.)|-(2622)->|_______________|
|
|(original note)| \ |(exam announc.)|-(2622)->|_______________|
|
||||||
|_______________| \ |_______________| 11% ____files____
|
|_______________| \ |_______________| 11% _brw_files_____
|
||||||
| | \ | | | | |
|
| | \ | | | | |
|
||||||
|Publication i+1|-- ---->| Note n-1 |-(64)--->| Public file | (1497132)
|
|Publication i+1|-- ---->| Note n-1 |-(64)--->| Public file | (1497132)
|
||||||
|(original note)| \ | (public file) | <1% |_____________|
|
|(original note)| \ | (public file) | <1% |_______________|
|
||||||
|_______________| \ |_______________| | _notices_
|
|_______________| \ |_______________| | _not_notices___
|
||||||
| | \ | | | | |
|
| | \ | | | | |
|
||||||
| Publication i |-- ---->| Note n-2 |-(17078)>| Notice | (14984)
|
| Publication i |-- ---->| Note n-2 |-(17078)>| Notice | (14984)
|
||||||
|(original note)| \ | (notice) | 72% |_________|
|
|(original note)| \ | (notice) | 72% |_______________|
|
||||||
|_______________| \ |_______________| | __tml_posts__
|
|_______________| \ |_______________| | _tml_posts_____
|
||||||
| | \ | | | | |
|
| | \ | | | | |
|
||||||
· ... · ---->| Note n-3 |-(3533)->| Post s |
|
· ... · ---->| Note n-3 |-(3533)->| Post s |
|
||||||
· ... · | (tl. post) | 15% | |
|
· ... · | (tl. post) | 15% | |
|
||||||
|_______________| |_______________| | |_____________|
|
|_______________| |_______________| | |_______________|
|
||||||
| | | | | | |
|
| | | | | | |
|
||||||
| Publication 3 | · ... · | · ... · (3533)
|
| Publication 3 | · ... · | · ... · (3533)
|
||||||
| (shared note) |--- · ... · | · ... ·
|
| (shared note) |--- · ... · | · ... ·
|
||||||
|_______________| \ |_______________| | |_____________|
|
|_______________| \ |_______________| | |_______________|
|
||||||
| | \ | | | | |
|
| | \ | | | | |
|
||||||
| Publication 2 | ---->| Note 2 |<---+ | Post 1 |
|
| Publication 2 | ---->| Note 2 |<---+ | Post 1 |
|
||||||
|(original note)|--------->| (tl. post) |-------->| |
|
|(original note)|--------->| (tl. post) |-------->| |
|
||||||
|_______________| |_______________| |_____________|
|
|_______________| |_______________| |_______________|
|
||||||
| | | | _forum_post_
|
| | | | _for_posts_____
|
||||||
| Publication 1 |--------->| Note 1 | | |
|
| Publication 1 |--------->| Note 1 | | |
|
||||||
|(original note)| | (forum post) |-(276)-->| Forum post | (66226)
|
|(original note)| | (forum post) |-(276)-->| Forum post | (66226)
|
||||||
|_______________| |_______________| 1% |____________|
|
|_______________| |_______________| 1% |_______________|
|
||||||
(29435) (23573)
|
(29435) (23573)
|
||||||
|
|
||||||
A note can be:
|
A note can be:
|
||||||
|
|
|
@ -397,55 +397,34 @@ unsigned Tml_DB_GetNumNotesAndUsrsTotal (MYSQL_RES **mysql_res)
|
||||||
/******* Create temporary tables used to not get notes already shown *********/
|
/******* Create temporary tables used to not get notes already shown *********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Tml_DB_CreateTmpTableJustRetrievedNotes (void)
|
void Tml_DB_CreateTmpTableTimeline (Tml_WhatToGet_t WhatToGet)
|
||||||
{
|
{
|
||||||
DB_Query ("can not create temporary table",
|
switch (WhatToGet)
|
||||||
"CREATE TEMPORARY TABLE tml_tmp_just_retrieved_notes "
|
{
|
||||||
"(NotCod BIGINT NOT NULL,UNIQUE INDEX(NotCod))"
|
case Tml_GET_OLD_PUBS:
|
||||||
" ENGINE=MEMORY");
|
DB_CreateTmpTable ("CREATE TEMPORARY TABLE tml_tmp_timeline "
|
||||||
}
|
"(NotCod BIGINT NOT NULL,UNIQUE INDEX(NotCod))"
|
||||||
|
" ENGINE=MEMORY"
|
||||||
void Tml_DB_CreateTmpTableVisibleTimeline (void)
|
" SELECT NotCod"
|
||||||
{
|
" FROM tml_timelines"
|
||||||
DB_Query ("can not create temporary table",
|
" WHERE SessionId='%s'",
|
||||||
"CREATE TEMPORARY TABLE tml_tmp_visible_timeline "
|
Gbl.Session.Id);
|
||||||
"(NotCod BIGINT NOT NULL,UNIQUE INDEX(NotCod))"
|
break;
|
||||||
" ENGINE=MEMORY"
|
case Tml_GET_NEW_PUBS:
|
||||||
" SELECT NotCod"
|
case Tml_GET_REC_PUBS:
|
||||||
" FROM tml_timelines"
|
default:
|
||||||
" WHERE SessionId='%s'",
|
DB_CreateTmpTable ("CREATE TEMPORARY TABLE tml_tmp_timeline "
|
||||||
Gbl.Session.Id);
|
"(NotCod BIGINT NOT NULL,UNIQUE INDEX(NotCod))"
|
||||||
|
" ENGINE=MEMORY");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**** Insert note in temporary tables used to not get notes already shown ****/
|
/**** Insert note in temporary table used to not get notes already shown *****/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Tml_DB_InsertNoteInJustRetrievedNotes (long NotCod)
|
void Tml_DB_InsertNoteInTimeline (long NotCod)
|
||||||
{
|
|
||||||
/* Insert note in temporary table with just retrieved notes.
|
|
||||||
This table will be used to not get notes already shown */
|
|
||||||
DB_QueryINSERT ("can not store note code",
|
|
||||||
"INSERT IGNORE INTO tml_tmp_just_retrieved_notes"
|
|
||||||
" SET NotCod=%ld",
|
|
||||||
NotCod);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Tml_DB_InsertNoteInVisibleTimeline (long NotCod)
|
|
||||||
{
|
|
||||||
/* Insert note in temporary table with visible timeline.
|
|
||||||
This table will be used to not get notes already shown */
|
|
||||||
DB_QueryINSERT ("can not store note code",
|
|
||||||
"INSERT IGNORE INTO tml_tmp_visible_timeline"
|
|
||||||
" SET NotCod=%ld",
|
|
||||||
NotCod);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/****** Add just retrieved notes to current timeline for this session ********/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
void Tml_DB_AddNotesJustRetrievedToVisibleTimelineOfSession (void)
|
|
||||||
{
|
{
|
||||||
/* tml_timelines contains the distinct notes in timeline of each open session:
|
/* tml_timelines contains the distinct notes in timeline of each open session:
|
||||||
mysql> SELECT SessionId,COUNT(*) FROM tml_timelines GROUP BY SessionId;
|
mysql> SELECT SessionId,COUNT(*) FROM tml_timelines GROUP BY SessionId;
|
||||||
|
@ -465,31 +444,29 @@ mysql> SELECT SessionId,COUNT(*) FROM tml_timelines GROUP BY SessionId;
|
||||||
+---------------------------------------------+----------+
|
+---------------------------------------------+----------+
|
||||||
10 rows in set (0,01 sec)
|
10 rows in set (0,01 sec)
|
||||||
*/
|
*/
|
||||||
DB_QueryINSERT ("can not insert notes in timeline",
|
/* Insert note in temporary table with visible timeline.
|
||||||
|
This table will be used to not get notes already shown */
|
||||||
|
DB_QueryINSERT ("can not insert note in timeline",
|
||||||
|
"INSERT IGNORE INTO tml_tmp_timeline"
|
||||||
|
" SET NotCod=%ld",
|
||||||
|
NotCod);
|
||||||
|
|
||||||
|
DB_QueryINSERT ("can not insert note in timeline",
|
||||||
"INSERT IGNORE INTO tml_timelines"
|
"INSERT IGNORE INTO tml_timelines"
|
||||||
" (SessionId,NotCod)"
|
" (SessionId,NotCod)"
|
||||||
" SELECT '%s',"
|
" VALUES"
|
||||||
"NotCod"
|
" ('%s',%ld)",
|
||||||
" FROM tml_tmp_just_retrieved_notes",
|
Gbl.Session.Id,
|
||||||
Gbl.Session.Id);
|
NotCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******** Drop temporary tables used to not get notes already shown **********/
|
/********** Drop temporary table with all notes visible in timeline **********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Tml_DB_DropTmpTableJustRetrievedNotes (void)
|
void Tml_DB_DropTmpTableTimeline (void)
|
||||||
{
|
{
|
||||||
/***** Drop temporary table with notes just retrieved *****/
|
DB_DropTmpTable ("tml_tmp_timeline");
|
||||||
DB_Query ("can not remove temporary table",
|
|
||||||
"DROP TEMPORARY TABLE IF EXISTS tml_tmp_just_retrieved_notes");
|
|
||||||
}
|
|
||||||
|
|
||||||
void Tml_DB_DropTmpTableVisibleTimeline (void)
|
|
||||||
{
|
|
||||||
/***** Drop temporary table with all notes visible in timeline *****/
|
|
||||||
DB_Query ("can not remove temporary table",
|
|
||||||
"DROP TEMPORARY TABLE IF EXISTS tml_tmp_visible_timeline");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -918,21 +895,13 @@ void Tml_DB_CreateSubQueryPublishers (Tml_Usr_UsrOrGbl_t UsrOrGbl,Usr_Who_t Who,
|
||||||
/********* Create subquery to get only notes not present in timeline *********/
|
/********* Create subquery to get only notes not present in timeline *********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Tml_DB_CreateSubQueryAlreadyExists (Tml_WhatToGet_t WhatToGet,
|
void Tml_DB_CreateSubQueryAlreadyExists (char AlreadyExists[Tml_Pub_MAX_BYTES_SUBQUERY + 1])
|
||||||
char AlreadyExists[Tml_Pub_MAX_BYTES_SUBQUERY + 1])
|
|
||||||
{
|
{
|
||||||
static const char *Table[Tml_NUM_WHAT_TO_GET] =
|
Str_Copy (AlreadyExists,
|
||||||
{
|
|
||||||
[Tml_GET_NEW_PUBS] = "tml_tmp_just_retrieved_notes", // Avoid notes just retrieved
|
|
||||||
[Tml_GET_REC_PUBS] = "tml_tmp_just_retrieved_notes", // Avoid notes just retrieved
|
|
||||||
[Tml_GET_OLD_PUBS] = "tml_tmp_visible_timeline", // Avoid notes already shown
|
|
||||||
};
|
|
||||||
|
|
||||||
snprintf (AlreadyExists,Tml_Pub_MAX_BYTES_SUBQUERY + 1,
|
|
||||||
" tml_pubs.NotCod NOT IN"
|
" tml_pubs.NotCod NOT IN"
|
||||||
" (SELECT NotCod"
|
" (SELECT NotCod"
|
||||||
" FROM %s)",
|
" FROM tml_tmp_timeline)",
|
||||||
Table[WhatToGet]);
|
Tml_Pub_MAX_BYTES_SUBQUERY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -57,13 +57,9 @@ unsigned Tml_DB_GetNumNotesAndUsrsByType (MYSQL_RES **mysql_res,
|
||||||
Tml_Not_Type_t NoteType);
|
Tml_Not_Type_t NoteType);
|
||||||
unsigned Tml_DB_GetNumNotesAndUsrsTotal (MYSQL_RES **mysql_res);
|
unsigned Tml_DB_GetNumNotesAndUsrsTotal (MYSQL_RES **mysql_res);
|
||||||
|
|
||||||
void Tml_DB_CreateTmpTableJustRetrievedNotes (void);
|
void Tml_DB_CreateTmpTableTimeline (Tml_WhatToGet_t WhatToGet);
|
||||||
void Tml_DB_CreateTmpTableVisibleTimeline (void);
|
void Tml_DB_InsertNoteInTimeline (long NotCod);
|
||||||
void Tml_DB_InsertNoteInJustRetrievedNotes (long NotCod);
|
void Tml_DB_DropTmpTableTimeline (void);
|
||||||
void Tml_DB_InsertNoteInVisibleTimeline (long NotCod);
|
|
||||||
void Tml_DB_AddNotesJustRetrievedToVisibleTimelineOfSession (void);
|
|
||||||
void Tml_DB_DropTmpTableJustRetrievedNotes (void);
|
|
||||||
void Tml_DB_DropTmpTableVisibleTimeline (void);
|
|
||||||
void Tml_DB_ClearOldTimelinesNotesFromDB (void);
|
void Tml_DB_ClearOldTimelinesNotesFromDB (void);
|
||||||
void Tml_DB_ClearTimelineNotesOfSessionFromDB (void);
|
void Tml_DB_ClearTimelineNotesOfSessionFromDB (void);
|
||||||
|
|
||||||
|
@ -100,8 +96,7 @@ void Tml_DB_RemoveAllCommsMadeBy (long UsrCod);
|
||||||
void Tml_DB_CreateSubQueryPublishers (Tml_Usr_UsrOrGbl_t UsrOrGbl,Usr_Who_t Who,
|
void Tml_DB_CreateSubQueryPublishers (Tml_Usr_UsrOrGbl_t UsrOrGbl,Usr_Who_t Who,
|
||||||
char **Table,
|
char **Table,
|
||||||
char SubQuery[Tml_Pub_MAX_BYTES_SUBQUERY + 1]);
|
char SubQuery[Tml_Pub_MAX_BYTES_SUBQUERY + 1]);
|
||||||
void Tml_DB_CreateSubQueryAlreadyExists (Tml_WhatToGet_t WhatToGet,
|
void Tml_DB_CreateSubQueryAlreadyExists (char AlreadyExists[Tml_Pub_MAX_BYTES_SUBQUERY + 1]);
|
||||||
char AlreadyExists[Tml_Pub_MAX_BYTES_SUBQUERY + 1]);
|
|
||||||
void Tml_DB_CreateSubQueryRangeBottom (long Bottom,
|
void Tml_DB_CreateSubQueryRangeBottom (long Bottom,
|
||||||
char SubQuery[Tml_Pub_MAX_BYTES_SUBQUERY + 1]);
|
char SubQuery[Tml_Pub_MAX_BYTES_SUBQUERY + 1]);
|
||||||
void Tml_DB_CreateSubQueryRangeTop (long Top,
|
void Tml_DB_CreateSubQueryRangeTop (long Top,
|
||||||
|
|
|
@ -1172,8 +1172,7 @@ static void Tml_Not_RemoveNoteMediaAndDBEntries (struct Tml_Not_Note *Not)
|
||||||
|
|
||||||
/***** Mark possible notifications on the publications
|
/***** Mark possible notifications on the publications
|
||||||
of this note as removed *****/
|
of this note as removed *****/
|
||||||
PubCod = Tml_DB_GetPubCodOfOriginalNote (Not->NotCod);
|
if ((PubCod = Tml_DB_GetPubCodOfOriginalNote (Not->NotCod)) > 0)
|
||||||
if (PubCod > 0)
|
|
||||||
{
|
{
|
||||||
Ntf_DB_MarkNotifAsRemoved (Ntf_EVENT_TML_FAV ,PubCod);
|
Ntf_DB_MarkNotifAsRemoved (Ntf_EVENT_TML_FAV ,PubCod);
|
||||||
Ntf_DB_MarkNotifAsRemoved (Ntf_EVENT_TML_SHARE ,PubCod);
|
Ntf_DB_MarkNotifAsRemoved (Ntf_EVENT_TML_SHARE ,PubCod);
|
||||||
|
|
|
@ -96,13 +96,8 @@ void Tml_Pub_GetListPubsToShowInTimeline (struct Tml_Timeline *Timeline)
|
||||||
if (Timeline->WhatToGet == Tml_GET_REC_PUBS)
|
if (Timeline->WhatToGet == Tml_GET_REC_PUBS)
|
||||||
Tml_DB_ClearTimelineNotesOfSessionFromDB ();
|
Tml_DB_ClearTimelineNotesOfSessionFromDB ();
|
||||||
|
|
||||||
/***** Create temporary tables *****/
|
/***** Create temporary table with all notes visible in timeline *****/
|
||||||
/* Create temporary table with notes just retrieved */
|
Tml_DB_CreateTmpTableTimeline (Timeline->WhatToGet);
|
||||||
Tml_DB_CreateTmpTableJustRetrievedNotes ();
|
|
||||||
|
|
||||||
/* Create temporary table with all notes visible in timeline */
|
|
||||||
if (Timeline->WhatToGet == Tml_GET_OLD_PUBS)
|
|
||||||
Tml_DB_CreateTmpTableVisibleTimeline ();
|
|
||||||
|
|
||||||
/***** Create subqueries *****/
|
/***** Create subqueries *****/
|
||||||
/* Create subquery with potential publishers */
|
/* Create subquery with potential publishers */
|
||||||
|
@ -111,8 +106,7 @@ void Tml_Pub_GetListPubsToShowInTimeline (struct Tml_Timeline *Timeline)
|
||||||
SubQueries.Publishers.SubQuery);
|
SubQueries.Publishers.SubQuery);
|
||||||
|
|
||||||
/* Create subquery to get only notes not present in timeline */
|
/* Create subquery to get only notes not present in timeline */
|
||||||
Tml_DB_CreateSubQueryAlreadyExists (Timeline->WhatToGet,
|
Tml_DB_CreateSubQueryAlreadyExists (SubQueries.AlreadyExists);
|
||||||
SubQueries.AlreadyExists);
|
|
||||||
|
|
||||||
/* Create subquery with bottom range of publications to get from tml_pubs.
|
/* Create subquery with bottom range of publications to get from tml_pubs.
|
||||||
Bottom pub. code remains unchanged in all iterations of the loop. */
|
Bottom pub. code remains unchanged in all iterations of the loop. */
|
||||||
|
@ -179,11 +173,9 @@ void Tml_Pub_GetListPubsToShowInTimeline (struct Tml_Timeline *Timeline)
|
||||||
if (Pub == NULL) // Nothing got ==> abort loop
|
if (Pub == NULL) // Nothing got ==> abort loop
|
||||||
break; // Last publication
|
break; // Last publication
|
||||||
|
|
||||||
/* Insert note in temporary tables with just retrieved notes.
|
/* Insert note in temporary tables with visible notes.
|
||||||
These tables will be used to not get notes already shown */
|
These tables will be used to not get notes already shown */
|
||||||
Tml_DB_InsertNoteInJustRetrievedNotes (Pub->NotCod);
|
Tml_DB_InsertNoteInTimeline (Pub->NotCod);
|
||||||
if (Timeline->WhatToGet == Tml_GET_OLD_PUBS) // Get only old publications
|
|
||||||
Tml_DB_InsertNoteInVisibleTimeline (Pub->NotCod);
|
|
||||||
|
|
||||||
/* Narrow the range for the next iteration */
|
/* Narrow the range for the next iteration */
|
||||||
RangePubsToGet.Top = Pub->PubCod;
|
RangePubsToGet.Top = Pub->PubCod;
|
||||||
|
@ -193,14 +185,9 @@ void Tml_Pub_GetListPubsToShowInTimeline (struct Tml_Timeline *Timeline)
|
||||||
into session for next refresh *****/
|
into session for next refresh *****/
|
||||||
Tml_Pub_UpdateFirstLastPubCodesIntoSession (Timeline);
|
Tml_Pub_UpdateFirstLastPubCodesIntoSession (Timeline);
|
||||||
|
|
||||||
/***** Add notes just retrieved to visible timeline for this session *****/
|
|
||||||
Tml_DB_AddNotesJustRetrievedToVisibleTimelineOfSession ();
|
|
||||||
|
|
||||||
/***** Drop temporary tables *****/
|
/***** Drop temporary tables *****/
|
||||||
/* Drop temporary tables with notes already retrieved */
|
/* Drop temporary table with visible notes in timeline */
|
||||||
Tml_DB_DropTmpTableJustRetrievedNotes ();
|
Tml_DB_DropTmpTableTimeline ();
|
||||||
if (Timeline->WhatToGet == Tml_GET_OLD_PUBS) // Get only old publications
|
|
||||||
Tml_DB_DropTmpTableVisibleTimeline ();
|
|
||||||
|
|
||||||
/* Drop temporary table with me and users I follow */
|
/* Drop temporary table with me and users I follow */
|
||||||
if (Timeline->UsrOrGbl == Tml_Usr_TIMELINE_GBL && // Show the global timeline
|
if (Timeline->UsrOrGbl == Tml_Usr_TIMELINE_GBL && // Show the global timeline
|
||||||
|
|
|
@ -121,7 +121,7 @@ static void Tml_Sha_ShaNote (struct Tml_Not_Note *Not)
|
||||||
/***** Share (publish note in timeline) *****/
|
/***** Share (publish note in timeline) *****/
|
||||||
Pub.NotCod = Not->NotCod;
|
Pub.NotCod = Not->NotCod;
|
||||||
Pub.PublisherCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
Pub.PublisherCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||||
Pub.Type = Tml_Pub_SHARED_NOTE;
|
Pub.Type = Tml_Pub_SHARED_NOTE;
|
||||||
Tml_Pub_PublishPubInTimeline (&Pub); // Set Pub.PubCod
|
Tml_Pub_PublishPubInTimeline (&Pub); // Set Pub.PubCod
|
||||||
|
|
||||||
/***** Update number of times this note is shared *****/
|
/***** Update number of times this note is shared *****/
|
||||||
|
@ -129,8 +129,7 @@ static void Tml_Sha_ShaNote (struct Tml_Not_Note *Not)
|
||||||
|
|
||||||
/***** Create notification about shared post
|
/***** Create notification about shared post
|
||||||
for the author of the post *****/
|
for the author of the post *****/
|
||||||
OriginalPubCod = Tml_DB_GetPubCodOfOriginalNote (Not->NotCod);
|
if ((OriginalPubCod = Tml_DB_GetPubCodOfOriginalNote (Not->NotCod)) > 0)
|
||||||
if (OriginalPubCod > 0)
|
|
||||||
Tml_Ntf_CreateNotifToAuthor (Not->UsrCod,OriginalPubCod,Ntf_EVENT_TML_SHARE);
|
Tml_Ntf_CreateNotifToAuthor (Not->UsrCod,OriginalPubCod,Ntf_EVENT_TML_SHARE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +178,6 @@ static void Tml_Sha_UnsNote (struct Tml_Not_Note *Not)
|
||||||
Not->NumShared = Tml_DB_GetNumSharers (Not->NotCod,Not->UsrCod);
|
Not->NumShared = Tml_DB_GetNumSharers (Not->NotCod,Not->UsrCod);
|
||||||
|
|
||||||
/***** Mark possible notifications on this note as removed *****/
|
/***** Mark possible notifications on this note as removed *****/
|
||||||
OriginalPubCod = Tml_DB_GetPubCodOfOriginalNote (Not->NotCod);
|
if ((OriginalPubCod = Tml_DB_GetPubCodOfOriginalNote (Not->NotCod)) > 0)
|
||||||
if (OriginalPubCod > 0)
|
|
||||||
Ntf_DB_MarkNotifAsRemoved (Ntf_EVENT_TML_SHARE,OriginalPubCod);
|
Ntf_DB_MarkNotifAsRemoved (Ntf_EVENT_TML_SHARE,OriginalPubCod);
|
||||||
}
|
}
|
||||||
|
|
|
@ -961,7 +961,7 @@ void Usr_DB_BuildQueryToSearchListUsrs (Rol_Role_t Role,char **Query)
|
||||||
"usr_data.CtyCod," // row[ 9]
|
"usr_data.CtyCod," // row[ 9]
|
||||||
"usr_data.InsCod"; // row[10]
|
"usr_data.InsCod"; // row[10]
|
||||||
static const char *OrderBySubQuery =
|
static const char *OrderBySubQuery =
|
||||||
"candidate_users.UsrCod=usr_data.UsrCod"
|
"usr_candidate_users.UsrCod=usr_data.UsrCod"
|
||||||
" ORDER BY usr_data.Surname1,"
|
" ORDER BY usr_data.Surname1,"
|
||||||
"usr_data.Surname2,"
|
"usr_data.Surname2,"
|
||||||
"usr_data.FirstName,"
|
"usr_data.FirstName,"
|
||||||
|
@ -980,7 +980,7 @@ void Usr_DB_BuildQueryToSearchListUsrs (Rol_Role_t Role,char **Query)
|
||||||
/* Search users from the whole platform */
|
/* Search users from the whole platform */
|
||||||
DB_BuildQuery (Query,
|
DB_BuildQuery (Query,
|
||||||
"SELECT %s"
|
"SELECT %s"
|
||||||
" FROM candidate_users,usr_data"
|
" FROM usr_candidate_users,usr_data"
|
||||||
" WHERE %s",
|
" WHERE %s",
|
||||||
QueryFields,
|
QueryFields,
|
||||||
OrderBySubQuery);
|
OrderBySubQuery);
|
||||||
|
@ -989,14 +989,14 @@ void Usr_DB_BuildQueryToSearchListUsrs (Rol_Role_t Role,char **Query)
|
||||||
/* Search users in courses from the current country */
|
/* Search users in courses from the current country */
|
||||||
DB_BuildQuery (Query,
|
DB_BuildQuery (Query,
|
||||||
"SELECT %s"
|
"SELECT %s"
|
||||||
" FROM candidate_users,"
|
" FROM usr_candidate_users,"
|
||||||
"crs_users,"
|
"crs_users,"
|
||||||
"crs_courses,"
|
"crs_courses,"
|
||||||
"deg_degrees,"
|
"deg_degrees,"
|
||||||
"ctr_centers,"
|
"ctr_centers,"
|
||||||
"ins_instits,"
|
"ins_instits,"
|
||||||
"usr_data"
|
"usr_data"
|
||||||
" WHERE candidate_users.UsrCod=crs_users.UsrCod"
|
" WHERE usr_candidate_users.UsrCod=crs_users.UsrCod"
|
||||||
" AND crs_users.CrsCod=crs_courses.CrsCod"
|
" AND crs_users.CrsCod=crs_courses.CrsCod"
|
||||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||||
|
@ -1011,13 +1011,13 @@ void Usr_DB_BuildQueryToSearchListUsrs (Rol_Role_t Role,char **Query)
|
||||||
/* Search users in courses from the current institution */
|
/* Search users in courses from the current institution */
|
||||||
DB_BuildQuery (Query,
|
DB_BuildQuery (Query,
|
||||||
"SELECT %s"
|
"SELECT %s"
|
||||||
" FROM candidate_users,"
|
" FROM usr_candidate_users,"
|
||||||
"crs_users,"
|
"crs_users,"
|
||||||
"crs_courses,"
|
"crs_courses,"
|
||||||
"deg_degrees,"
|
"deg_degrees,"
|
||||||
"ctr_centers,"
|
"ctr_centers,"
|
||||||
"usr_data"
|
"usr_data"
|
||||||
" WHERE candidate_users.UsrCod=crs_users.UsrCod"
|
" WHERE usr_candidate_users.UsrCod=crs_users.UsrCod"
|
||||||
" AND crs_users.CrsCod=crs_courses.CrsCod"
|
" AND crs_users.CrsCod=crs_courses.CrsCod"
|
||||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||||
|
@ -1031,12 +1031,12 @@ void Usr_DB_BuildQueryToSearchListUsrs (Rol_Role_t Role,char **Query)
|
||||||
/* Search users in courses from the current center */
|
/* Search users in courses from the current center */
|
||||||
DB_BuildQuery (Query,
|
DB_BuildQuery (Query,
|
||||||
"SELECT %s"
|
"SELECT %s"
|
||||||
" FROM candidate_users,"
|
" FROM usr_candidate_users,"
|
||||||
"crs_users,"
|
"crs_users,"
|
||||||
"crs_courses,"
|
"crs_courses,"
|
||||||
"deg_degrees,"
|
"deg_degrees,"
|
||||||
" usr_data"
|
" usr_data"
|
||||||
" WHERE candidate_users.UsrCod=crs_users.UsrCod"
|
" WHERE usr_candidate_users.UsrCod=crs_users.UsrCod"
|
||||||
" AND crs_users.CrsCod=crs_courses.CrsCod"
|
" AND crs_users.CrsCod=crs_courses.CrsCod"
|
||||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||||
" AND deg_degrees.CtrCod=%ld"
|
" AND deg_degrees.CtrCod=%ld"
|
||||||
|
@ -1049,11 +1049,11 @@ void Usr_DB_BuildQueryToSearchListUsrs (Rol_Role_t Role,char **Query)
|
||||||
/* Search users in courses from the current degree */
|
/* Search users in courses from the current degree */
|
||||||
DB_BuildQuery (Query,
|
DB_BuildQuery (Query,
|
||||||
"SELECT %s"
|
"SELECT %s"
|
||||||
" FROM candidate_users,"
|
" FROM usr_candidate_users,"
|
||||||
"crs_users,"
|
"crs_users,"
|
||||||
"crs_courses,"
|
"crs_courses,"
|
||||||
"usr_data"
|
"usr_data"
|
||||||
" WHERE candidate_users.UsrCod=crs_users.UsrCod"
|
" WHERE usr_candidate_users.UsrCod=crs_users.UsrCod"
|
||||||
" AND crs_users.CrsCod=crs_courses.CrsCod"
|
" AND crs_users.CrsCod=crs_courses.CrsCod"
|
||||||
" AND crs_courses.DegCod=%ld"
|
" AND crs_courses.DegCod=%ld"
|
||||||
" AND %s",
|
" AND %s",
|
||||||
|
@ -1067,10 +1067,10 @@ void Usr_DB_BuildQueryToSearchListUsrs (Rol_Role_t Role,char **Query)
|
||||||
"SELECT %s,"
|
"SELECT %s,"
|
||||||
"crs_users.Role," // row[11]
|
"crs_users.Role," // row[11]
|
||||||
"crs_users.Accepted" // row[12]
|
"crs_users.Accepted" // row[12]
|
||||||
" FROM candidate_users,"
|
" FROM usr_candidate_users,"
|
||||||
"crs_users,"
|
"crs_users,"
|
||||||
"usr_data"
|
"usr_data"
|
||||||
" WHERE candidate_users.UsrCod=crs_users.UsrCod"
|
" WHERE usr_candidate_users.UsrCod=crs_users.UsrCod"
|
||||||
" AND crs_users.CrsCod=%ld"
|
" AND crs_users.CrsCod=%ld"
|
||||||
" AND %s",
|
" AND %s",
|
||||||
QueryFields,
|
QueryFields,
|
||||||
|
@ -1086,9 +1086,9 @@ void Usr_DB_BuildQueryToSearchListUsrs (Rol_Role_t Role,char **Query)
|
||||||
/* Search users with no courses */
|
/* Search users with no courses */
|
||||||
DB_BuildQuery (Query,
|
DB_BuildQuery (Query,
|
||||||
"SELECT %s"
|
"SELECT %s"
|
||||||
" FROM candidate_users,"
|
" FROM usr_candidate_users,"
|
||||||
"usr_data"
|
"usr_data"
|
||||||
" WHERE candidate_users.UsrCod NOT IN"
|
" WHERE usr_candidate_users.UsrCod NOT IN"
|
||||||
" (SELECT UsrCod"
|
" (SELECT UsrCod"
|
||||||
" FROM crs_users)"
|
" FROM crs_users)"
|
||||||
" AND %s",
|
" AND %s",
|
||||||
|
@ -1125,10 +1125,10 @@ void Usr_DB_BuildQueryToSearchListUsrs (Rol_Role_t Role,char **Query)
|
||||||
/* Search users in courses from the whole platform */
|
/* Search users in courses from the whole platform */
|
||||||
DB_BuildQuery (Query,
|
DB_BuildQuery (Query,
|
||||||
"SELECT %s"
|
"SELECT %s"
|
||||||
" FROM candidate_users,"
|
" FROM usr_candidate_users,"
|
||||||
"crs_users,"
|
"crs_users,"
|
||||||
"usr_data"
|
"usr_data"
|
||||||
" WHERE candidate_users.UsrCod=crs_users.UsrCod"
|
" WHERE usr_candidate_users.UsrCod=crs_users.UsrCod"
|
||||||
"%s"
|
"%s"
|
||||||
" AND %s",
|
" AND %s",
|
||||||
QueryFields,
|
QueryFields,
|
||||||
|
@ -1139,14 +1139,14 @@ void Usr_DB_BuildQueryToSearchListUsrs (Rol_Role_t Role,char **Query)
|
||||||
/* Search users in courses from the current country */
|
/* Search users in courses from the current country */
|
||||||
DB_BuildQuery (Query,
|
DB_BuildQuery (Query,
|
||||||
"SELECT %s"
|
"SELECT %s"
|
||||||
" FROM candidate_users,"
|
" FROM usr_candidate_users,"
|
||||||
"crs_users,"
|
"crs_users,"
|
||||||
"crs_courses,"
|
"crs_courses,"
|
||||||
"deg_degrees,"
|
"deg_degrees,"
|
||||||
"ctr_centers,"
|
"ctr_centers,"
|
||||||
"ins_instits,"
|
"ins_instits,"
|
||||||
"usr_data"
|
"usr_data"
|
||||||
" WHERE candidate_users.UsrCod=crs_users.UsrCod"
|
" WHERE usr_candidate_users.UsrCod=crs_users.UsrCod"
|
||||||
"%s"
|
"%s"
|
||||||
" AND crs_users.CrsCod=crs_courses.CrsCod"
|
" AND crs_users.CrsCod=crs_courses.CrsCod"
|
||||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||||
|
@ -1163,13 +1163,13 @@ void Usr_DB_BuildQueryToSearchListUsrs (Rol_Role_t Role,char **Query)
|
||||||
/* Search users in courses from the current institution */
|
/* Search users in courses from the current institution */
|
||||||
DB_BuildQuery (Query,
|
DB_BuildQuery (Query,
|
||||||
"SELECT %s"
|
"SELECT %s"
|
||||||
" FROM candidate_users,"
|
" FROM usr_candidate_users,"
|
||||||
"crs_users,"
|
"crs_users,"
|
||||||
"crs_courses,"
|
"crs_courses,"
|
||||||
"deg_degrees,"
|
"deg_degrees,"
|
||||||
"ctr_centers,"
|
"ctr_centers,"
|
||||||
"usr_data"
|
"usr_data"
|
||||||
" WHERE candidate_users.UsrCod=crs_users.UsrCod"
|
" WHERE usr_candidate_users.UsrCod=crs_users.UsrCod"
|
||||||
"%s"
|
"%s"
|
||||||
" AND crs_users.CrsCod=crs_courses.CrsCod"
|
" AND crs_users.CrsCod=crs_courses.CrsCod"
|
||||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||||
|
@ -1185,12 +1185,12 @@ void Usr_DB_BuildQueryToSearchListUsrs (Rol_Role_t Role,char **Query)
|
||||||
/* Search users in courses from the current center */
|
/* Search users in courses from the current center */
|
||||||
DB_BuildQuery (Query,
|
DB_BuildQuery (Query,
|
||||||
"SELECT %s"
|
"SELECT %s"
|
||||||
" FROM candidate_users,"
|
" FROM usr_candidate_users,"
|
||||||
"crs_users,"
|
"crs_users,"
|
||||||
"crs_courses,"
|
"crs_courses,"
|
||||||
"deg_degrees,"
|
"deg_degrees,"
|
||||||
"usr_data"
|
"usr_data"
|
||||||
" WHERE candidate_users.UsrCod=crs_users.UsrCod"
|
" WHERE usr_candidate_users.UsrCod=crs_users.UsrCod"
|
||||||
"%s"
|
"%s"
|
||||||
" AND crs_users.CrsCod=crs_courses.CrsCod"
|
" AND crs_users.CrsCod=crs_courses.CrsCod"
|
||||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||||
|
@ -1205,11 +1205,11 @@ void Usr_DB_BuildQueryToSearchListUsrs (Rol_Role_t Role,char **Query)
|
||||||
/* Search users in courses from the current degree */
|
/* Search users in courses from the current degree */
|
||||||
DB_BuildQuery (Query,
|
DB_BuildQuery (Query,
|
||||||
"SELECT %s"
|
"SELECT %s"
|
||||||
" FROM candidate_users,"
|
" FROM usr_candidate_users,"
|
||||||
"crs_users,"
|
"crs_users,"
|
||||||
"crs_courses,"
|
"crs_courses,"
|
||||||
"usr_data"
|
"usr_data"
|
||||||
" WHERE candidate_users.UsrCod=crs_users.UsrCod"
|
" WHERE usr_candidate_users.UsrCod=crs_users.UsrCod"
|
||||||
"%s"
|
"%s"
|
||||||
" AND crs_users.CrsCod=crs_courses.CrsCod"
|
" AND crs_users.CrsCod=crs_courses.CrsCod"
|
||||||
" AND crs_courses.DegCod=%ld"
|
" AND crs_courses.DegCod=%ld"
|
||||||
|
@ -1225,10 +1225,10 @@ void Usr_DB_BuildQueryToSearchListUsrs (Rol_Role_t Role,char **Query)
|
||||||
"SELECT %s,"
|
"SELECT %s,"
|
||||||
"crs_users.Role,"
|
"crs_users.Role,"
|
||||||
"crs_users.Accepted"
|
"crs_users.Accepted"
|
||||||
" FROM candidate_users,"
|
" FROM usr_candidate_users,"
|
||||||
"crs_users,"
|
"crs_users,"
|
||||||
"usr_data"
|
"usr_data"
|
||||||
" WHERE candidate_users.UsrCod=crs_users.UsrCod"
|
" WHERE usr_candidate_users.UsrCod=crs_users.UsrCod"
|
||||||
"%s"
|
"%s"
|
||||||
" AND crs_users.CrsCod=%ld"
|
" AND crs_users.CrsCod=%ld"
|
||||||
" AND %s",
|
" AND %s",
|
||||||
|
@ -1410,13 +1410,12 @@ void Usr_DB_CreateTmpTableAndSearchCandidateUsrs (const char SearchQuery[Sch_MAX
|
||||||
- Searching for names is made in the whole platform
|
- Searching for names is made in the whole platform
|
||||||
and stored in this table.
|
and stored in this table.
|
||||||
*/
|
*/
|
||||||
DB_Query ("can not create temporary table",
|
DB_CreateTmpTable ("CREATE TEMPORARY TABLE usr_candidate_users"
|
||||||
"CREATE TEMPORARY TABLE candidate_users"
|
" (UsrCod INT NOT NULL,UNIQUE INDEX(UsrCod)) ENGINE=MEMORY"
|
||||||
" (UsrCod INT NOT NULL,UNIQUE INDEX(UsrCod)) ENGINE=MEMORY"
|
" SELECT UsrCod"
|
||||||
" SELECT UsrCod"
|
" FROM usr_data"
|
||||||
" FROM usr_data"
|
" WHERE %s",
|
||||||
" WHERE %s",
|
SearchQuery);
|
||||||
SearchQuery);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1425,8 +1424,7 @@ void Usr_DB_CreateTmpTableAndSearchCandidateUsrs (const char SearchQuery[Sch_MAX
|
||||||
|
|
||||||
void Usr_DB_DropTmpTableWithCandidateUsrs (void)
|
void Usr_DB_DropTmpTableWithCandidateUsrs (void)
|
||||||
{
|
{
|
||||||
DB_Query ("can not remove temporary table",
|
DB_DropTmpTable ("usr_candidate_users");
|
||||||
"DROP TEMPORARY TABLE IF EXISTS candidate_users");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
Loading…
Reference in New Issue