mirror of https://github.com/acanas/swad-core.git
Version 20.44: Mar 04, 2021 Timeline database tables renamed.
This commit is contained in:
parent
fd83fc8087
commit
82467a3d67
28
sql/swad.sql
28
sql/swad.sql
|
@ -1442,9 +1442,9 @@ CREATE TABLE IF NOT EXISTS timetable_tut (
|
||||||
INDEX(UsrCod));
|
INDEX(UsrCod));
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table tl_comments: stores the content of comments to timeline notes
|
-- Table tml_comments: stores the content of comments to timeline notes
|
||||||
--
|
--
|
||||||
CREATE TABLE IF NOT EXISTS tl_comments (
|
CREATE TABLE IF NOT EXISTS tml_comments (
|
||||||
PubCod BIGINT NOT NULL,
|
PubCod BIGINT NOT NULL,
|
||||||
Txt LONGTEXT NOT NULL,
|
Txt LONGTEXT NOT NULL,
|
||||||
MedCod INT NOT NULL DEFAULT -1,
|
MedCod INT NOT NULL DEFAULT -1,
|
||||||
|
@ -1452,9 +1452,9 @@ CREATE TABLE IF NOT EXISTS tl_comments (
|
||||||
FULLTEXT(Txt),
|
FULLTEXT(Txt),
|
||||||
INDEX(MedCod)) ENGINE = MYISAM;
|
INDEX(MedCod)) ENGINE = MYISAM;
|
||||||
--
|
--
|
||||||
-- Table tl_comments_fav: stores users who marked timeline comments as favourite
|
-- Table tml_comments_fav: stores users who marked timeline comments as favourite
|
||||||
--
|
--
|
||||||
CREATE TABLE IF NOT EXISTS tl_comments_fav (
|
CREATE TABLE IF NOT EXISTS tml_comments_fav (
|
||||||
FavCod BIGINT AUTO_INCREMENT,
|
FavCod BIGINT AUTO_INCREMENT,
|
||||||
PubCod BIGINT NOT NULL,
|
PubCod BIGINT NOT NULL,
|
||||||
UsrCod INT NOT NULL,
|
UsrCod INT NOT NULL,
|
||||||
|
@ -1463,9 +1463,9 @@ CREATE TABLE IF NOT EXISTS tl_comments_fav (
|
||||||
UNIQUE INDEX(PubCod,UsrCod),
|
UNIQUE INDEX(PubCod,UsrCod),
|
||||||
INDEX(UsrCod));
|
INDEX(UsrCod));
|
||||||
--
|
--
|
||||||
-- Table tl_notes: stores timeline notes
|
-- Table tml_notes: stores timeline notes
|
||||||
--
|
--
|
||||||
CREATE TABLE IF NOT EXISTS tl_notes (
|
CREATE TABLE IF NOT EXISTS tml_notes (
|
||||||
NotCod BIGINT NOT NULL AUTO_INCREMENT,
|
NotCod BIGINT NOT NULL AUTO_INCREMENT,
|
||||||
NoteType TINYINT NOT NULL,
|
NoteType TINYINT NOT NULL,
|
||||||
Cod INT NOT NULL DEFAULT -1,
|
Cod INT NOT NULL DEFAULT -1,
|
||||||
|
@ -1478,9 +1478,9 @@ CREATE TABLE IF NOT EXISTS tl_notes (
|
||||||
INDEX(UsrCod),
|
INDEX(UsrCod),
|
||||||
INDEX(TimeNote));
|
INDEX(TimeNote));
|
||||||
--
|
--
|
||||||
-- Table tl_notes_fav: stores users who marked timeline notes as favourite
|
-- Table tml_notes_fav: stores users who marked timeline notes as favourite
|
||||||
--
|
--
|
||||||
CREATE TABLE IF NOT EXISTS tl_notes_fav (
|
CREATE TABLE IF NOT EXISTS tml_notes_fav (
|
||||||
FavCod BIGINT AUTO_INCREMENT,
|
FavCod BIGINT AUTO_INCREMENT,
|
||||||
NotCod BIGINT NOT NULL,
|
NotCod BIGINT NOT NULL,
|
||||||
UsrCod INT NOT NULL,
|
UsrCod INT NOT NULL,
|
||||||
|
@ -1489,9 +1489,9 @@ CREATE TABLE IF NOT EXISTS tl_notes_fav (
|
||||||
UNIQUE INDEX(NotCod,UsrCod),
|
UNIQUE INDEX(NotCod,UsrCod),
|
||||||
INDEX(UsrCod));
|
INDEX(UsrCod));
|
||||||
--
|
--
|
||||||
-- Table tl_posts: stores timeline posts (public comments written by users)
|
-- Table tml_posts: stores timeline posts (public comments written by users)
|
||||||
--
|
--
|
||||||
CREATE TABLE IF NOT EXISTS tl_posts (
|
CREATE TABLE IF NOT EXISTS tml_posts (
|
||||||
PstCod INT NOT NULL AUTO_INCREMENT,
|
PstCod INT NOT NULL AUTO_INCREMENT,
|
||||||
Txt LONGTEXT NOT NULL,
|
Txt LONGTEXT NOT NULL,
|
||||||
MedCod INT NOT NULL DEFAULT -1,
|
MedCod INT NOT NULL DEFAULT -1,
|
||||||
|
@ -1499,9 +1499,9 @@ CREATE TABLE IF NOT EXISTS tl_posts (
|
||||||
FULLTEXT(Content),
|
FULLTEXT(Content),
|
||||||
INDEX(MedCod)) ENGINE = MYISAM;
|
INDEX(MedCod)) ENGINE = MYISAM;
|
||||||
--
|
--
|
||||||
-- Table tl_pubs: stores timeline publications (original notes, sharede notes or comments)
|
-- Table tml_pubs: stores timeline publications (original notes, sharede notes or comments)
|
||||||
--
|
--
|
||||||
CREATE TABLE IF NOT EXISTS tl_pubs (
|
CREATE TABLE IF NOT EXISTS tml_pubs (
|
||||||
PubCod BIGINT NOT NULL AUTO_INCREMENT,
|
PubCod BIGINT NOT NULL AUTO_INCREMENT,
|
||||||
NotCod BIGINT NOT NULL,
|
NotCod BIGINT NOT NULL,
|
||||||
PublisherCod INT NOT NULL,
|
PublisherCod INT NOT NULL,
|
||||||
|
@ -1513,9 +1513,9 @@ CREATE TABLE IF NOT EXISTS tl_pubs (
|
||||||
INDEX(PubType),
|
INDEX(PubType),
|
||||||
INDEX(TimePublish));
|
INDEX(TimePublish));
|
||||||
--
|
--
|
||||||
-- Table tl_timelines: stores notes published in timeline for every active session
|
-- Table tml_timelines: stores notes published in timeline for every active session
|
||||||
--
|
--
|
||||||
CREATE TABLE IF NOT EXISTS tl_timelines (
|
CREATE TABLE IF NOT EXISTS tml_timelines (
|
||||||
SessionId CHAR(43) NOT NULL,
|
SessionId CHAR(43) NOT NULL,
|
||||||
NotCod BIGINT NOT NULL,
|
NotCod BIGINT NOT NULL,
|
||||||
UNIQUE INDEX(SessionId,NotCod));
|
UNIQUE INDEX(SessionId,NotCod));
|
||||||
|
|
|
@ -600,10 +600,20 @@ TODO: Salvador Romero Cort
|
||||||
|
|
||||||
TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria.
|
TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria.
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 20.43 (2021-03-04)"
|
#define Log_PLATFORM_VERSION "SWAD 20.44 (2021-03-04)"
|
||||||
#define CSS_FILE "swad20.33.9.css"
|
#define CSS_FILE "swad20.33.9.css"
|
||||||
#define JS_FILE "swad20.6.2.js"
|
#define JS_FILE "swad20.6.2.js"
|
||||||
/*
|
/*
|
||||||
|
Version 20.44: Mar 04, 2021 Timeline database tables renamed. (305618 lines)
|
||||||
|
7 change necessary in database:
|
||||||
|
RENAME TABLE tl_comments TO tml_comments;
|
||||||
|
RENAME TABLE tl_comments_fav TO tml_comments_fav;
|
||||||
|
RENAME TABLE tl_notes TO tml_notes;
|
||||||
|
RENAME TABLE tl_notes_fav TO tml_notes_fav;
|
||||||
|
RENAME TABLE tl_posts TO tml_posts;
|
||||||
|
RENAME TABLE tl_pubs TO tml_pubs;
|
||||||
|
RENAME TABLE tl_timelines TO tml_timelines;
|
||||||
|
|
||||||
Version 20.43: Mar 04, 2021 Code refactoring in timeline. (305609 lines)
|
Version 20.43: Mar 04, 2021 Code refactoring in timeline. (305609 lines)
|
||||||
Version 20.42: Mar 04, 2021 Fixed bugs in GROUP BY, caused by upgrading MySQL 5 (order by default) to MySQL 8 (no order by default). (305624 lines)
|
Version 20.42: Mar 04, 2021 Fixed bugs in GROUP BY, caused by upgrading MySQL 5 (order by default) to MySQL 8 (no order by default). (305624 lines)
|
||||||
3 change necessary in database:
|
3 change necessary in database:
|
||||||
|
|
|
@ -3038,9 +3038,9 @@ mysql> DESCRIBE timetable_tut;
|
||||||
"Info VARCHAR(2047) NOT NULL DEFAULT ''," // TT_MAX_BYTES_INFO
|
"Info VARCHAR(2047) NOT NULL DEFAULT ''," // TT_MAX_BYTES_INFO
|
||||||
"INDEX(UsrCod))");
|
"INDEX(UsrCod))");
|
||||||
|
|
||||||
/***** Table tl_comments *****/
|
/***** Table tml_comments *****/
|
||||||
/*
|
/*
|
||||||
mysql> DESCRIBE tl_comments;
|
mysql> DESCRIBE tml_comments;
|
||||||
+--------+------------+------+-----+---------+-------+
|
+--------+------------+------+-----+---------+-------+
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
+--------+------------+------+-----+---------+-------+
|
+--------+------------+------+-----+---------+-------+
|
||||||
|
@ -3050,7 +3050,7 @@ mysql> DESCRIBE tl_comments;
|
||||||
+--------+------------+------+-----+---------+-------+
|
+--------+------------+------+-----+---------+-------+
|
||||||
3 rows in set (0.00 sec)
|
3 rows in set (0.00 sec)
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS tl_comments ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS tml_comments ("
|
||||||
"PubCod BIGINT NOT NULL,"
|
"PubCod BIGINT NOT NULL,"
|
||||||
"Txt LONGTEXT NOT NULL,"
|
"Txt LONGTEXT NOT NULL,"
|
||||||
"MedCod INT NOT NULL DEFAULT -1,"
|
"MedCod INT NOT NULL DEFAULT -1,"
|
||||||
|
@ -3058,9 +3058,9 @@ mysql> DESCRIBE tl_comments;
|
||||||
"FULLTEXT(Txt),"
|
"FULLTEXT(Txt),"
|
||||||
"INDEX(MedCod)) ENGINE = MYISAM");
|
"INDEX(MedCod)) ENGINE = MYISAM");
|
||||||
|
|
||||||
/***** Table tl_comments_fav *****/
|
/***** Table tml_comments_fav *****/
|
||||||
/*
|
/*
|
||||||
mysql> DESCRIBE tl_comments_fav;
|
mysql> DESCRIBE tml_comments_fav;
|
||||||
+---------+------------+------+-----+---------+----------------+
|
+---------+------------+------+-----+---------+----------------+
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
+---------+------------+------+-----+---------+----------------+
|
+---------+------------+------+-----+---------+----------------+
|
||||||
|
@ -3071,7 +3071,7 @@ mysql> DESCRIBE tl_comments_fav;
|
||||||
+---------+------------+------+-----+---------+----------------+
|
+---------+------------+------+-----+---------+----------------+
|
||||||
4 rows in set (0.00 sec)
|
4 rows in set (0.00 sec)
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS tl_comments_fav ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS tml_comments_fav ("
|
||||||
"FavCod BIGINT AUTO_INCREMENT,"
|
"FavCod BIGINT AUTO_INCREMENT,"
|
||||||
"PubCod BIGINT NOT NULL,"
|
"PubCod BIGINT NOT NULL,"
|
||||||
"UsrCod INT NOT NULL,"
|
"UsrCod INT NOT NULL,"
|
||||||
|
@ -3080,9 +3080,9 @@ mysql> DESCRIBE tl_comments_fav;
|
||||||
"UNIQUE INDEX(PubCod,UsrCod),"
|
"UNIQUE INDEX(PubCod,UsrCod),"
|
||||||
"INDEX(UsrCod))");
|
"INDEX(UsrCod))");
|
||||||
|
|
||||||
/***** Table tl_notes *****/
|
/***** Table tml_notes *****/
|
||||||
/*
|
/*
|
||||||
mysql> DESCRIBE tl_notes;
|
mysql> DESCRIBE tml_notes;
|
||||||
+-------------+---------------+------+-----+---------+----------------+
|
+-------------+---------------+------+-----+---------+----------------+
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
+-------------+---------------+------+-----+---------+----------------+
|
+-------------+---------------+------+-----+---------+----------------+
|
||||||
|
@ -3096,7 +3096,7 @@ mysql> DESCRIBE tl_notes;
|
||||||
+-------------+---------------+------+-----+---------+----------------+
|
+-------------+---------------+------+-----+---------+----------------+
|
||||||
7 rows in set (0.00 sec)
|
7 rows in set (0.00 sec)
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS tl_notes ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS tml_notes ("
|
||||||
"NotCod BIGINT NOT NULL AUTO_INCREMENT,"
|
"NotCod BIGINT NOT NULL AUTO_INCREMENT,"
|
||||||
"NoteType TINYINT NOT NULL,"
|
"NoteType TINYINT NOT NULL,"
|
||||||
"Cod INT NOT NULL DEFAULT -1,"
|
"Cod INT NOT NULL DEFAULT -1,"
|
||||||
|
@ -3109,9 +3109,9 @@ mysql> DESCRIBE tl_notes;
|
||||||
"INDEX(UsrCod),"
|
"INDEX(UsrCod),"
|
||||||
"INDEX(TimeNote))");
|
"INDEX(TimeNote))");
|
||||||
|
|
||||||
/***** Table tl_notes_fav *****/
|
/***** Table tml_notes_fav *****/
|
||||||
/*
|
/*
|
||||||
mysql> DESCRIBE tl_notes_fav;
|
mysql> DESCRIBE tml_notes_fav;
|
||||||
+---------+------------+------+-----+---------+----------------+
|
+---------+------------+------+-----+---------+----------------+
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
+---------+------------+------+-----+---------+----------------+
|
+---------+------------+------+-----+---------+----------------+
|
||||||
|
@ -3122,7 +3122,7 @@ mysql> DESCRIBE tl_notes_fav;
|
||||||
+---------+------------+------+-----+---------+----------------+
|
+---------+------------+------+-----+---------+----------------+
|
||||||
4 rows in set (0.00 sec)
|
4 rows in set (0.00 sec)
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS tl_notes_fav ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS tml_notes_fav ("
|
||||||
"FavCod BIGINT AUTO_INCREMENT,"
|
"FavCod BIGINT AUTO_INCREMENT,"
|
||||||
"NotCod BIGINT NOT NULL,"
|
"NotCod BIGINT NOT NULL,"
|
||||||
"UsrCod INT NOT NULL,"
|
"UsrCod INT NOT NULL,"
|
||||||
|
@ -3131,9 +3131,9 @@ mysql> DESCRIBE tl_notes_fav;
|
||||||
"UNIQUE INDEX(NotCod,UsrCod),"
|
"UNIQUE INDEX(NotCod,UsrCod),"
|
||||||
"INDEX(UsrCod))");
|
"INDEX(UsrCod))");
|
||||||
|
|
||||||
/***** Table tl_posts *****/
|
/***** Table tml_posts *****/
|
||||||
/*
|
/*
|
||||||
mysql> DESCRIBE tl_posts;
|
mysql> DESCRIBE tml_posts;
|
||||||
+--------+----------+------+-----+---------+----------------+
|
+--------+----------+------+-----+---------+----------------+
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
+--------+----------+------+-----+---------+----------------+
|
+--------+----------+------+-----+---------+----------------+
|
||||||
|
@ -3143,7 +3143,7 @@ mysql> DESCRIBE tl_posts;
|
||||||
+--------+----------+------+-----+---------+----------------+
|
+--------+----------+------+-----+---------+----------------+
|
||||||
3 rows in set (0.00 sec)
|
3 rows in set (0.00 sec)
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS tl_posts ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS tml_posts ("
|
||||||
"PubCod INT NOT NULL AUTO_INCREMENT,"
|
"PubCod INT NOT NULL AUTO_INCREMENT,"
|
||||||
"Txt LONGTEXT NOT NULL,"
|
"Txt LONGTEXT NOT NULL,"
|
||||||
"MedCod INT NOT NULL DEFAULT -1,"
|
"MedCod INT NOT NULL DEFAULT -1,"
|
||||||
|
@ -3151,9 +3151,9 @@ mysql> DESCRIBE tl_posts;
|
||||||
"FULLTEXT(Txt),"
|
"FULLTEXT(Txt),"
|
||||||
"INDEX(MedCod)) ENGINE = MYISAM");
|
"INDEX(MedCod)) ENGINE = MYISAM");
|
||||||
|
|
||||||
/***** Table tl_pubs *****/
|
/***** Table tml_pubs *****/
|
||||||
/*
|
/*
|
||||||
mysql> DESCRIBE tl_pubs;
|
mysql> DESCRIBE tml_pubs;
|
||||||
+--------------+------------+------+-----+---------+----------------+
|
+--------------+------------+------+-----+---------+----------------+
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
+--------------+------------+------+-----+---------+----------------+
|
+--------------+------------+------+-----+---------+----------------+
|
||||||
|
@ -3165,7 +3165,7 @@ mysql> DESCRIBE tl_pubs;
|
||||||
+--------------+------------+------+-----+---------+----------------+
|
+--------------+------------+------+-----+---------+----------------+
|
||||||
5 rows in set (0.00 sec)
|
5 rows in set (0.00 sec)
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS tl_pubs ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS tml_pubs ("
|
||||||
"PubCod BIGINT NOT NULL AUTO_INCREMENT,"
|
"PubCod BIGINT NOT NULL AUTO_INCREMENT,"
|
||||||
"NotCod BIGINT NOT NULL,"
|
"NotCod BIGINT NOT NULL,"
|
||||||
"PublisherCod INT NOT NULL,"
|
"PublisherCod INT NOT NULL,"
|
||||||
|
@ -3177,9 +3177,9 @@ mysql> DESCRIBE tl_pubs;
|
||||||
"INDEX(PubType),"
|
"INDEX(PubType),"
|
||||||
"INDEX(TimePublish))");
|
"INDEX(TimePublish))");
|
||||||
|
|
||||||
/***** Table tl_timelines *****/
|
/***** Table tml_timelines *****/
|
||||||
/*
|
/*
|
||||||
mysql> DESCRIBE tl_timelines;
|
mysql> DESCRIBE tml_timelines;
|
||||||
+-----------+------------+------+-----+---------+-------+
|
+-----------+------------+------+-----+---------+-------+
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
+-----------+------------+------+-----+---------+-------+
|
+-----------+------------+------+-----+---------+-------+
|
||||||
|
@ -3188,7 +3188,7 @@ mysql> DESCRIBE tl_timelines;
|
||||||
+-----------+------------+------+-----+---------+-------+
|
+-----------+------------+------+-----+---------+-------+
|
||||||
2 rows in set (0.00 sec)
|
2 rows in set (0.00 sec)
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS tl_timelines ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS tml_timelines ("
|
||||||
"SessionId CHAR(43) NOT NULL," // Cns_BYTES_SESSION_ID
|
"SessionId CHAR(43) NOT NULL," // Cns_BYTES_SESSION_ID
|
||||||
"NotCod BIGINT NOT NULL,"
|
"NotCod BIGINT NOT NULL,"
|
||||||
"UNIQUE INDEX(SessionId,NotCod))");
|
"UNIQUE INDEX(SessionId,NotCod))");
|
||||||
|
|
|
@ -3428,71 +3428,71 @@ static void Fig_GetAndShowTimelineActivityStats (void)
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
||||||
"SELECT COUNT(*),"
|
"SELECT COUNT(*),"
|
||||||
"COUNT(DISTINCT UsrCod)"
|
"COUNT(DISTINCT UsrCod)"
|
||||||
" FROM tl_notes WHERE NoteType=%u",
|
" FROM tml_notes WHERE NoteType=%u",
|
||||||
NoteType);
|
NoteType);
|
||||||
break;
|
break;
|
||||||
case Hie_Lvl_CTY:
|
case Hie_Lvl_CTY:
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
||||||
"SELECT COUNT(DISTINCT tl_notes.NotCod),"
|
"SELECT COUNT(DISTINCT tml_notes.NotCod),"
|
||||||
"COUNT(DISTINCT tl_notes.UsrCod)"
|
"COUNT(DISTINCT tml_notes.UsrCod)"
|
||||||
" FROM institutions,centres,degrees,courses,crs_usr,tl_notes"
|
" FROM institutions,centres,degrees,courses,crs_usr,tml_notes"
|
||||||
" WHERE institutions.CtyCod=%ld"
|
" WHERE institutions.CtyCod=%ld"
|
||||||
" AND institutions.InsCod=centres.InsCod"
|
" AND institutions.InsCod=centres.InsCod"
|
||||||
" AND centres.CtrCod=degrees.CtrCod"
|
" AND centres.CtrCod=degrees.CtrCod"
|
||||||
" AND degrees.DegCod=courses.DegCod"
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
" AND crs_usr.UsrCod=tl_notes.UsrCod"
|
" AND crs_usr.UsrCod=tml_notes.UsrCod"
|
||||||
" AND tl_notes.NoteType=%u",
|
" AND tml_notes.NoteType=%u",
|
||||||
Gbl.Hierarchy.Cty.CtyCod,
|
Gbl.Hierarchy.Cty.CtyCod,
|
||||||
(unsigned) NoteType);
|
(unsigned) NoteType);
|
||||||
break;
|
break;
|
||||||
case Hie_Lvl_INS:
|
case Hie_Lvl_INS:
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
||||||
"SELECT COUNT(DISTINCT tl_notes.NotCod),"
|
"SELECT COUNT(DISTINCT tml_notes.NotCod),"
|
||||||
"COUNT(DISTINCT tl_notes.UsrCod)"
|
"COUNT(DISTINCT tml_notes.UsrCod)"
|
||||||
" FROM centres,degrees,courses,crs_usr,tl_notes"
|
" FROM centres,degrees,courses,crs_usr,tml_notes"
|
||||||
" WHERE centres.InsCod=%ld"
|
" WHERE centres.InsCod=%ld"
|
||||||
" AND centres.CtrCod=degrees.CtrCod"
|
" AND centres.CtrCod=degrees.CtrCod"
|
||||||
" AND degrees.DegCod=courses.DegCod"
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
" AND crs_usr.UsrCod=tl_notes.UsrCod"
|
" AND crs_usr.UsrCod=tml_notes.UsrCod"
|
||||||
" AND tl_notes.NoteType=%u",
|
" AND tml_notes.NoteType=%u",
|
||||||
Gbl.Hierarchy.Ins.InsCod,
|
Gbl.Hierarchy.Ins.InsCod,
|
||||||
(unsigned) NoteType);
|
(unsigned) NoteType);
|
||||||
break;
|
break;
|
||||||
case Hie_Lvl_CTR:
|
case Hie_Lvl_CTR:
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
||||||
"SELECT COUNT(DISTINCT tl_notes.NotCod),"
|
"SELECT COUNT(DISTINCT tml_notes.NotCod),"
|
||||||
"COUNT(DISTINCT tl_notes.UsrCod)"
|
"COUNT(DISTINCT tml_notes.UsrCod)"
|
||||||
" FROM degrees,courses,crs_usr,tl_notes"
|
" FROM degrees,courses,crs_usr,tml_notes"
|
||||||
" WHERE degrees.CtrCod=%ld"
|
" WHERE degrees.CtrCod=%ld"
|
||||||
" AND degrees.DegCod=courses.DegCod"
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
" AND crs_usr.UsrCod=tl_notes.UsrCod"
|
" AND crs_usr.UsrCod=tml_notes.UsrCod"
|
||||||
" AND tl_notes.NoteType=%u",
|
" AND tml_notes.NoteType=%u",
|
||||||
Gbl.Hierarchy.Ctr.CtrCod,
|
Gbl.Hierarchy.Ctr.CtrCod,
|
||||||
(unsigned) NoteType);
|
(unsigned) NoteType);
|
||||||
break;
|
break;
|
||||||
case Hie_Lvl_DEG:
|
case Hie_Lvl_DEG:
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
||||||
"SELECT COUNT(DISTINCT tl_notes.NotCod),"
|
"SELECT COUNT(DISTINCT tml_notes.NotCod),"
|
||||||
"COUNT(DISTINCT tl_notes.UsrCod)"
|
"COUNT(DISTINCT tml_notes.UsrCod)"
|
||||||
" FROM courses,crs_usr,tl_notes"
|
" FROM courses,crs_usr,tml_notes"
|
||||||
" WHERE courses.DegCod=%ld"
|
" WHERE courses.DegCod=%ld"
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
" AND crs_usr.UsrCod=tl_notes.UsrCod"
|
" AND crs_usr.UsrCod=tml_notes.UsrCod"
|
||||||
" AND tl_notes.NoteType=%u",
|
" AND tml_notes.NoteType=%u",
|
||||||
Gbl.Hierarchy.Deg.DegCod,
|
Gbl.Hierarchy.Deg.DegCod,
|
||||||
(unsigned) NoteType);
|
(unsigned) NoteType);
|
||||||
break;
|
break;
|
||||||
case Hie_Lvl_CRS:
|
case Hie_Lvl_CRS:
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
||||||
"SELECT COUNT(DISTINCT tl_notes.NotCod),"
|
"SELECT COUNT(DISTINCT tml_notes.NotCod),"
|
||||||
"COUNT(DISTINCT tl_notes.UsrCod)"
|
"COUNT(DISTINCT tml_notes.UsrCod)"
|
||||||
" FROM crs_usr,tl_notes"
|
" FROM crs_usr,tml_notes"
|
||||||
" WHERE crs_usr.CrsCod=%ld"
|
" WHERE crs_usr.CrsCod=%ld"
|
||||||
" AND crs_usr.UsrCod=tl_notes.UsrCod"
|
" AND crs_usr.UsrCod=tml_notes.UsrCod"
|
||||||
" AND tl_notes.NoteType=%u",
|
" AND tml_notes.NoteType=%u",
|
||||||
Gbl.Hierarchy.Crs.CrsCod,
|
Gbl.Hierarchy.Crs.CrsCod,
|
||||||
(unsigned) NoteType);
|
(unsigned) NoteType);
|
||||||
break;
|
break;
|
||||||
|
@ -3559,61 +3559,61 @@ static void Fig_GetAndShowTimelineActivityStats (void)
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
||||||
"SELECT COUNT(*),"
|
"SELECT COUNT(*),"
|
||||||
"COUNT(DISTINCT UsrCod)"
|
"COUNT(DISTINCT UsrCod)"
|
||||||
" FROM tl_notes");
|
" FROM tml_notes");
|
||||||
break;
|
break;
|
||||||
case Hie_Lvl_CTY:
|
case Hie_Lvl_CTY:
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
||||||
"SELECT COUNT(DISTINCT tl_notes.NotCod),"
|
"SELECT COUNT(DISTINCT tml_notes.NotCod),"
|
||||||
"COUNT(DISTINCT tl_notes.UsrCod)"
|
"COUNT(DISTINCT tml_notes.UsrCod)"
|
||||||
" FROM institutions,centres,degrees,courses,crs_usr,tl_notes"
|
" FROM institutions,centres,degrees,courses,crs_usr,tml_notes"
|
||||||
" WHERE institutions.CtyCod=%ld"
|
" WHERE institutions.CtyCod=%ld"
|
||||||
" AND institutions.InsCod=centres.InsCod"
|
" AND institutions.InsCod=centres.InsCod"
|
||||||
" AND centres.CtrCod=degrees.CtrCod"
|
" AND centres.CtrCod=degrees.CtrCod"
|
||||||
" AND degrees.DegCod=courses.DegCod"
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
" AND crs_usr.UsrCod=tl_notes.UsrCod",
|
" AND crs_usr.UsrCod=tml_notes.UsrCod",
|
||||||
Gbl.Hierarchy.Cty.CtyCod);
|
Gbl.Hierarchy.Cty.CtyCod);
|
||||||
break;
|
break;
|
||||||
case Hie_Lvl_INS:
|
case Hie_Lvl_INS:
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
||||||
"SELECT COUNT(DISTINCT tl_notes.NotCod),"
|
"SELECT COUNT(DISTINCT tml_notes.NotCod),"
|
||||||
"COUNT(DISTINCT tl_notes.UsrCod)"
|
"COUNT(DISTINCT tml_notes.UsrCod)"
|
||||||
" FROM centres,degrees,courses,crs_usr,tl_notes"
|
" FROM centres,degrees,courses,crs_usr,tml_notes"
|
||||||
" WHERE centres.InsCod=%ld"
|
" WHERE centres.InsCod=%ld"
|
||||||
" AND centres.CtrCod=degrees.CtrCod"
|
" AND centres.CtrCod=degrees.CtrCod"
|
||||||
" AND degrees.DegCod=courses.DegCod"
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
" AND crs_usr.UsrCod=tl_notes.UsrCod",
|
" AND crs_usr.UsrCod=tml_notes.UsrCod",
|
||||||
Gbl.Hierarchy.Ins.InsCod);
|
Gbl.Hierarchy.Ins.InsCod);
|
||||||
break;
|
break;
|
||||||
case Hie_Lvl_CTR:
|
case Hie_Lvl_CTR:
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
||||||
"SELECT COUNT(DISTINCT tl_notes.NotCod),"
|
"SELECT COUNT(DISTINCT tml_notes.NotCod),"
|
||||||
"COUNT(DISTINCT tl_notes.UsrCod)"
|
"COUNT(DISTINCT tml_notes.UsrCod)"
|
||||||
" FROM degrees,courses,crs_usr,tl_notes"
|
" FROM degrees,courses,crs_usr,tml_notes"
|
||||||
" WHERE degrees.CtrCod=%ld"
|
" WHERE degrees.CtrCod=%ld"
|
||||||
" AND degrees.DegCod=courses.DegCod"
|
" AND degrees.DegCod=courses.DegCod"
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
" AND crs_usr.UsrCod=tl_notes.UsrCod",
|
" AND crs_usr.UsrCod=tml_notes.UsrCod",
|
||||||
Gbl.Hierarchy.Ctr.CtrCod);
|
Gbl.Hierarchy.Ctr.CtrCod);
|
||||||
break;
|
break;
|
||||||
case Hie_Lvl_DEG:
|
case Hie_Lvl_DEG:
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
||||||
"SELECT COUNT(DISTINCT tl_notes.NotCod),"
|
"SELECT COUNT(DISTINCT tml_notes.NotCod),"
|
||||||
"COUNT(DISTINCT tl_notes.UsrCod)"
|
"COUNT(DISTINCT tml_notes.UsrCod)"
|
||||||
" FROM courses,crs_usr,tl_notes"
|
" FROM courses,crs_usr,tml_notes"
|
||||||
" WHERE courses.DegCod=%ld"
|
" WHERE courses.DegCod=%ld"
|
||||||
" AND courses.CrsCod=crs_usr.CrsCod"
|
" AND courses.CrsCod=crs_usr.CrsCod"
|
||||||
" AND crs_usr.UsrCod=tl_notes.UsrCod",
|
" AND crs_usr.UsrCod=tml_notes.UsrCod",
|
||||||
Gbl.Hierarchy.Deg.DegCod);
|
Gbl.Hierarchy.Deg.DegCod);
|
||||||
break;
|
break;
|
||||||
case Hie_Lvl_CRS:
|
case Hie_Lvl_CRS:
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get number of social notes",
|
||||||
"SELECT COUNT(DISTINCT tl_notes.NotCod),"
|
"SELECT COUNT(DISTINCT tml_notes.NotCod),"
|
||||||
"COUNT(DISTINCT tl_notes.UsrCod)"
|
"COUNT(DISTINCT tml_notes.UsrCod)"
|
||||||
" FROM crs_usr,tl_notes"
|
" FROM crs_usr,tml_notes"
|
||||||
" WHERE crs_usr.CrsCod=%ld"
|
" WHERE crs_usr.CrsCod=%ld"
|
||||||
" AND crs_usr.UsrCod=tl_notes.UsrCod",
|
" AND crs_usr.UsrCod=tml_notes.UsrCod",
|
||||||
Gbl.Hierarchy.Crs.CrsCod);
|
Gbl.Hierarchy.Crs.CrsCod);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -1295,9 +1295,9 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
||||||
// Cod is the code of the social publishing
|
// Cod is the code of the social publishing
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get users"
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get users"
|
||||||
" to be notified",
|
" to be notified",
|
||||||
"SELECT DISTINCT(PublisherCod) FROM tl_pubs"
|
"SELECT DISTINCT(PublisherCod) FROM tml_pubs"
|
||||||
" WHERE NotCod="
|
" WHERE NotCod="
|
||||||
"(SELECT NotCod FROM tl_pubs"
|
"(SELECT NotCod FROM tml_pubs"
|
||||||
" WHERE PubCod=%ld)"
|
" WHERE PubCod=%ld)"
|
||||||
" AND PublisherCod<>%ld",
|
" AND PublisherCod<>%ld",
|
||||||
Cod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
Cod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
|
|
|
@ -23,18 +23,18 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
mysql> SHOW TABLES LIKE 'tl_%';
|
mysql> SHOW TABLES LIKE 'tml_%';
|
||||||
+-----------------------+
|
+------------------------+
|
||||||
| Tables_in_swad (tl_%) |
|
| Tables_in_swad (tml_%) |
|
||||||
+-----------------------+
|
+------------------------+
|
||||||
| tl_comments |
|
| tml_comments |
|
||||||
| tl_comments_fav |
|
| tml_comments_fav |
|
||||||
| tl_notes |
|
| tml_notes |
|
||||||
| tl_notes_fav |
|
| tml_notes_fav |
|
||||||
| tl_posts |
|
| tml_posts |
|
||||||
| tl_pubs |
|
| tml_pubs |
|
||||||
| tl_timelines |
|
| tml_timelines |
|
||||||
+-----------------------+
|
+------------------------+
|
||||||
7 rows in set (0.00 sec)
|
7 rows in set (0.00 sec)
|
||||||
|
|
||||||
The timeline is a set of publications.
|
The timeline is a set of publications.
|
||||||
|
@ -45,7 +45,7 @@ mysql> SHOW TABLES LIKE 'tl_%';
|
||||||
|
|
||||||
*Numbers are got from swad.ugr.es on february 2020
|
*Numbers are got from swad.ugr.es on february 2020
|
||||||
|
|
||||||
____tl_pubs____ _tl_comments_
|
____tml_pubs___ _tml_comments
|
||||||
| | | |
|
| | | |
|
||||||
| Publication p |---------->| Comment c |-----+
|
| Publication p |---------->| Comment c |-----+
|
||||||
| (comment) | | (to note 2) | |
|
| (comment) | | (to note 2) | |
|
||||||
|
@ -61,7 +61,7 @@ mysql> SHOW TABLES LIKE 'tl_%';
|
||||||
| | (3863) | |
|
| | (3863) | |
|
||||||
|Publication i+3|-- | |
|
|Publication i+3|-- | |
|
||||||
|(original note)| \ | |
|
|(original note)| \ | |
|
||||||
|_______________| \ ___tl_notes____ | | exam_announcements
|
|_______________| \ ___tml_notes___ | | exam_announcements
|
||||||
| | \ | | | | | |
|
| | \ | | | | | |
|
||||||
|Publication i+2|-- ---->| Note n |<-+ | | Exam announc. | (5571)
|
|Publication i+2|-- ---->| Note n |<-+ | | Exam announc. | (5571)
|
||||||
|(original note)| \ |(exam announc.)|-(2639)->|_______________|
|
|(original note)| \ |(exam announc.)|-(2639)->|_______________|
|
||||||
|
@ -73,7 +73,7 @@ mysql> SHOW TABLES LIKE 'tl_%';
|
||||||
| | \ | | | | |
|
| | \ | | | | |
|
||||||
| Publication i |-- ---->| Note n-2 |-(16693)>| Notice | (14793)
|
| Publication i |-- ---->| Note n-2 |-(16693)>| Notice | (14793)
|
||||||
|(original note)| \ | (notice) | 73% |_________|
|
|(original note)| \ | (notice) | 73% |_________|
|
||||||
|_______________| \ |_______________| | __tl_posts___
|
|_______________| \ |_______________| | __tml_posts__
|
||||||
| | \ | | | | |
|
| | \ | | | | |
|
||||||
· ... · ---->| Note n-3 |-(3119)->| Post s |
|
· ... · ---->| Note n-3 |-(3119)->| Post s |
|
||||||
· ... · | (tl. post) | 14% | |
|
· ... · | (tl. post) | 14% | |
|
||||||
|
|
|
@ -42,8 +42,8 @@
|
||||||
|
|
||||||
static const char *Tml_DB_TableFav[Tml_Usr_NUM_FAV_SHA] =
|
static const char *Tml_DB_TableFav[Tml_Usr_NUM_FAV_SHA] =
|
||||||
{
|
{
|
||||||
[Tml_Usr_FAV_UNF_NOTE] = "tl_notes_fav",
|
[Tml_Usr_FAV_UNF_NOTE] = "tml_notes_fav",
|
||||||
[Tml_Usr_FAV_UNF_COMM] = "tl_comments_fav",
|
[Tml_Usr_FAV_UNF_COMM] = "tml_comments_fav",
|
||||||
[Tml_Usr_SHA_UNS_NOTE] = NULL, // Not used
|
[Tml_Usr_SHA_UNS_NOTE] = NULL, // Not used
|
||||||
};
|
};
|
||||||
static const char *Tml_DB_FieldFav[Tml_Usr_NUM_FAV_SHA] =
|
static const char *Tml_DB_FieldFav[Tml_Usr_NUM_FAV_SHA] =
|
||||||
|
@ -125,7 +125,7 @@ unsigned Tml_DB_GetDataOfNoteByCod (long NotCod,MYSQL_RES **mysql_res)
|
||||||
"HieCod," // row[4]
|
"HieCod," // row[4]
|
||||||
"Unavailable," // row[5]
|
"Unavailable," // row[5]
|
||||||
"UNIX_TIMESTAMP(TimeNote)" // row[6]
|
"UNIX_TIMESTAMP(TimeNote)" // row[6]
|
||||||
" FROM tl_notes"
|
" FROM tml_notes"
|
||||||
" WHERE NotCod=%ld",
|
" WHERE NotCod=%ld",
|
||||||
NotCod);
|
NotCod);
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ long Tml_DB_GetPubCodOfOriginalNote (long NotCod)
|
||||||
|
|
||||||
/***** Get code of publication of the original note *****/
|
/***** Get code of publication of the original note *****/
|
||||||
if (DB_QuerySELECT (&mysql_res,"can not get code of publication",
|
if (DB_QuerySELECT (&mysql_res,"can not get code of publication",
|
||||||
"SELECT PubCod FROM tl_pubs"
|
"SELECT PubCod FROM tml_pubs"
|
||||||
" WHERE NotCod=%ld AND PubType=%u",
|
" WHERE NotCod=%ld AND PubType=%u",
|
||||||
NotCod,(unsigned) Tml_Pub_ORIGINAL_NOTE) == 1)
|
NotCod,(unsigned) Tml_Pub_ORIGINAL_NOTE) == 1)
|
||||||
{ // Result should have a unique row
|
{ // Result should have a unique row
|
||||||
|
@ -167,7 +167,7 @@ long Tml_DB_CreateNewNote (Tml_Not_NoteType_t NoteType,long Cod,
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
DB_QueryINSERTandReturnCode ("can not create new note",
|
DB_QueryINSERTandReturnCode ("can not create new note",
|
||||||
"INSERT INTO tl_notes"
|
"INSERT INTO tml_notes"
|
||||||
" (NoteType,Cod,UsrCod,HieCod,Unavailable,TimeNote)"
|
" (NoteType,Cod,UsrCod,HieCod,Unavailable,TimeNote)"
|
||||||
" VALUES"
|
" VALUES"
|
||||||
" (%u,%ld,%ld,%ld,'N',NOW())",
|
" (%u,%ld,%ld,%ld,'N',NOW())",
|
||||||
|
@ -185,7 +185,7 @@ void Tml_DB_MarkNoteAsUnavailable (Tml_Not_NoteType_t NoteType,long Cod)
|
||||||
{
|
{
|
||||||
/***** Mark note as unavailable *****/
|
/***** Mark note as unavailable *****/
|
||||||
DB_QueryUPDATE ("can not mark note as unavailable",
|
DB_QueryUPDATE ("can not mark note as unavailable",
|
||||||
"UPDATE tl_notes SET Unavailable='Y'"
|
"UPDATE tml_notes SET Unavailable='Y'"
|
||||||
" WHERE NoteType=%u AND Cod=%ld",
|
" WHERE NoteType=%u AND Cod=%ld",
|
||||||
(unsigned) NoteType,Cod);
|
(unsigned) NoteType,Cod);
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ void Tml_DB_MarkNotesChildrenOfFolderAsUnavailable (Tml_Not_NoteType_t NoteType,
|
||||||
{
|
{
|
||||||
/***** Mark notes as unavailable *****/
|
/***** Mark notes as unavailable *****/
|
||||||
DB_QueryUPDATE ("can not mark notes as unavailable",
|
DB_QueryUPDATE ("can not mark notes as unavailable",
|
||||||
"UPDATE tl_notes SET Unavailable='Y'"
|
"UPDATE tml_notes SET Unavailable='Y'"
|
||||||
" WHERE NoteType=%u AND Cod IN"
|
" WHERE NoteType=%u AND Cod IN"
|
||||||
" (SELECT FilCod FROM files"
|
" (SELECT FilCod FROM files"
|
||||||
" WHERE FileBrowser=%u AND Cod=%ld"
|
" WHERE FileBrowser=%u AND Cod=%ld"
|
||||||
|
@ -218,7 +218,7 @@ void Tml_DB_CreateTmpTableJustRetrievedNotes (void)
|
||||||
{
|
{
|
||||||
/***** Create temporary table with notes just retrieved *****/
|
/***** Create temporary table with notes just retrieved *****/
|
||||||
DB_Query ("can not create temporary table",
|
DB_Query ("can not create temporary table",
|
||||||
"CREATE TEMPORARY TABLE tl_tmp_just_retrieved_notes "
|
"CREATE TEMPORARY TABLE tml_tmp_just_retrieved_notes "
|
||||||
"(NotCod BIGINT NOT NULL,UNIQUE INDEX(NotCod))"
|
"(NotCod BIGINT NOT NULL,UNIQUE INDEX(NotCod))"
|
||||||
" ENGINE=MEMORY");
|
" ENGINE=MEMORY");
|
||||||
}
|
}
|
||||||
|
@ -227,10 +227,10 @@ void Tml_DB_CreateTmpTableVisibleTimeline (void)
|
||||||
{
|
{
|
||||||
/***** Create temporary table with all notes visible in timeline *****/
|
/***** Create temporary table with all notes visible in timeline *****/
|
||||||
DB_Query ("can not create temporary table",
|
DB_Query ("can not create temporary table",
|
||||||
"CREATE TEMPORARY TABLE tl_tmp_visible_timeline "
|
"CREATE TEMPORARY TABLE tml_tmp_visible_timeline "
|
||||||
"(NotCod BIGINT NOT NULL,UNIQUE INDEX(NotCod))"
|
"(NotCod BIGINT NOT NULL,UNIQUE INDEX(NotCod))"
|
||||||
" ENGINE=MEMORY"
|
" ENGINE=MEMORY"
|
||||||
" SELECT NotCod FROM tl_timelines WHERE SessionId='%s'",
|
" SELECT NotCod FROM tml_timelines WHERE SessionId='%s'",
|
||||||
Gbl.Session.Id);
|
Gbl.Session.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ void Tml_DB_InsertNoteInJustRetrievedNotes (long NotCod)
|
||||||
/* Insert note in temporary table with just retrieved notes.
|
/* Insert note in temporary table with just retrieved notes.
|
||||||
This table will be used to not get notes already shown */
|
This table will be used to not get notes already shown */
|
||||||
DB_QueryINSERT ("can not store note code",
|
DB_QueryINSERT ("can not store note code",
|
||||||
"INSERT IGNORE INTO tl_tmp_just_retrieved_notes"
|
"INSERT IGNORE INTO tml_tmp_just_retrieved_notes"
|
||||||
" SET NotCod=%ld",
|
" SET NotCod=%ld",
|
||||||
NotCod);
|
NotCod);
|
||||||
}
|
}
|
||||||
|
@ -253,7 +253,7 @@ void Tml_DB_InsertNoteInVisibleTimeline (long NotCod)
|
||||||
/* Insert note in temporary table with visible timeline.
|
/* Insert note in temporary table with visible timeline.
|
||||||
This table will be used to not get notes already shown */
|
This table will be used to not get notes already shown */
|
||||||
DB_QueryINSERT ("can not store note code",
|
DB_QueryINSERT ("can not store note code",
|
||||||
"INSERT IGNORE INTO tl_tmp_visible_timeline"
|
"INSERT IGNORE INTO tml_tmp_visible_timeline"
|
||||||
" SET NotCod=%ld",
|
" SET NotCod=%ld",
|
||||||
NotCod);
|
NotCod);
|
||||||
}
|
}
|
||||||
|
@ -264,8 +264,8 @@ void Tml_DB_InsertNoteInVisibleTimeline (long NotCod)
|
||||||
|
|
||||||
void Tml_DB_AddNotesJustRetrievedToVisibleTimelineOfSession (void)
|
void Tml_DB_AddNotesJustRetrievedToVisibleTimelineOfSession (void)
|
||||||
{
|
{
|
||||||
/* tl_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 tl_timelines GROUP BY SessionId;
|
mysql> SELECT SessionId,COUNT(*) FROM tml_timelines GROUP BY SessionId;
|
||||||
+---------------------------------------------+----------+
|
+---------------------------------------------+----------+
|
||||||
| SessionId | COUNT(*) |
|
| SessionId | COUNT(*) |
|
||||||
+---------------------------------------------+----------+
|
+---------------------------------------------+----------+
|
||||||
|
@ -283,9 +283,9 @@ mysql> SELECT SessionId,COUNT(*) FROM tl_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",
|
DB_QueryINSERT ("can not insert notes in timeline",
|
||||||
"INSERT IGNORE INTO tl_timelines"
|
"INSERT IGNORE INTO tml_timelines"
|
||||||
" (SessionId,NotCod)"
|
" (SessionId,NotCod)"
|
||||||
" SELECT '%s',NotCod FROM tl_tmp_just_retrieved_notes",
|
" SELECT '%s',NotCod FROM tml_tmp_just_retrieved_notes",
|
||||||
Gbl.Session.Id);
|
Gbl.Session.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,14 +297,14 @@ void Tml_DB_DropTmpTableJustRetrievedNotes (void)
|
||||||
{
|
{
|
||||||
/***** Drop temporary table with notes just retrieved *****/
|
/***** Drop temporary table with notes just retrieved *****/
|
||||||
DB_Query ("can not remove temporary table",
|
DB_Query ("can not remove temporary table",
|
||||||
"DROP TEMPORARY TABLE IF EXISTS tl_tmp_just_retrieved_notes");
|
"DROP TEMPORARY TABLE IF EXISTS tml_tmp_just_retrieved_notes");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tml_DB_DropTmpTableVisibleTimeline (void)
|
void Tml_DB_DropTmpTableVisibleTimeline (void)
|
||||||
{
|
{
|
||||||
/***** Drop temporary table with all notes visible in timeline *****/
|
/***** Drop temporary table with all notes visible in timeline *****/
|
||||||
DB_Query ("can not remove temporary table",
|
DB_Query ("can not remove temporary table",
|
||||||
"DROP TEMPORARY TABLE IF EXISTS tl_tmp_visible_timeline");
|
"DROP TEMPORARY TABLE IF EXISTS tml_tmp_visible_timeline");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -315,7 +315,7 @@ void Tml_DB_ClearOldTimelinesNotesFromDB (void)
|
||||||
{
|
{
|
||||||
/***** Remove timelines for expired sessions *****/
|
/***** Remove timelines for expired sessions *****/
|
||||||
DB_QueryDELETE ("can not remove old timelines",
|
DB_QueryDELETE ("can not remove old timelines",
|
||||||
"DELETE LOW_PRIORITY FROM tl_timelines"
|
"DELETE LOW_PRIORITY FROM tml_timelines"
|
||||||
" WHERE SessionId NOT IN (SELECT SessionId FROM sessions)");
|
" WHERE SessionId NOT IN (SELECT SessionId FROM sessions)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ void Tml_DB_ClearTimelineNotesOfSessionFromDB (void)
|
||||||
{
|
{
|
||||||
/***** Remove timeline for a session *****/
|
/***** Remove timeline for a session *****/
|
||||||
DB_QueryDELETE ("can not remove timeline",
|
DB_QueryDELETE ("can not remove timeline",
|
||||||
"DELETE FROM tl_timelines"
|
"DELETE FROM tml_timelines"
|
||||||
" WHERE SessionId='%s'",
|
" WHERE SessionId='%s'",
|
||||||
Gbl.Session.Id);
|
Gbl.Session.Id);
|
||||||
}
|
}
|
||||||
|
@ -340,7 +340,7 @@ void Tml_DB_RemoveNoteFavs (long NotCod)
|
||||||
{
|
{
|
||||||
/***** Remove favs for note *****/
|
/***** Remove favs for note *****/
|
||||||
DB_QueryDELETE ("can not remove favs for note",
|
DB_QueryDELETE ("can not remove favs for note",
|
||||||
"DELETE FROM tl_notes_fav"
|
"DELETE FROM tml_notes_fav"
|
||||||
" WHERE NotCod=%ld",
|
" WHERE NotCod=%ld",
|
||||||
NotCod);
|
NotCod);
|
||||||
}
|
}
|
||||||
|
@ -353,7 +353,7 @@ void Tml_DB_RemoveNotePubs (long NotCod)
|
||||||
{
|
{
|
||||||
/***** Remove all publications of this note *****/
|
/***** Remove all publications of this note *****/
|
||||||
DB_QueryDELETE ("can not remove a publication",
|
DB_QueryDELETE ("can not remove a publication",
|
||||||
"DELETE FROM tl_pubs"
|
"DELETE FROM tml_pubs"
|
||||||
" WHERE NotCod=%ld",
|
" WHERE NotCod=%ld",
|
||||||
NotCod);
|
NotCod);
|
||||||
}
|
}
|
||||||
|
@ -366,7 +366,7 @@ void Tml_DB_RemoveNote (long NotCod)
|
||||||
{
|
{
|
||||||
/***** Remove note *****/
|
/***** Remove note *****/
|
||||||
DB_QueryDELETE ("can not remove a note",
|
DB_QueryDELETE ("can not remove a note",
|
||||||
"DELETE FROM tl_notes"
|
"DELETE FROM tml_notes"
|
||||||
" WHERE NotCod=%ld"
|
" WHERE NotCod=%ld"
|
||||||
" AND UsrCod=%ld", // Extra check: author
|
" AND UsrCod=%ld", // Extra check: author
|
||||||
NotCod,
|
NotCod,
|
||||||
|
@ -381,7 +381,7 @@ void Tml_DB_RemoveAllNotesUsr (long UsrCod)
|
||||||
{
|
{
|
||||||
/***** Remove all notes created by user *****/
|
/***** Remove all notes created by user *****/
|
||||||
DB_QueryDELETE ("can not remove notes",
|
DB_QueryDELETE ("can not remove notes",
|
||||||
"DELETE FROM tl_notes WHERE UsrCod=%ld",
|
"DELETE FROM tml_notes WHERE UsrCod=%ld",
|
||||||
UsrCod);
|
UsrCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ unsigned Tml_DB_GetPostByCod (long PstCod,MYSQL_RES **mysql_res)
|
||||||
" of a post",
|
" of a post",
|
||||||
"SELECT Txt," // row[0]
|
"SELECT Txt," // row[0]
|
||||||
"MedCod" // row[1]
|
"MedCod" // row[1]
|
||||||
" FROM tl_posts"
|
" FROM tml_posts"
|
||||||
" WHERE PstCod=%ld",
|
" WHERE PstCod=%ld",
|
||||||
PstCod);
|
PstCod);
|
||||||
}
|
}
|
||||||
|
@ -413,7 +413,7 @@ unsigned Tml_DB_GetPostByCod (long PstCod,MYSQL_RES **mysql_res)
|
||||||
|
|
||||||
long Tml_DB_GetMedCodFromPost (long PstCod)
|
long Tml_DB_GetMedCodFromPost (long PstCod)
|
||||||
{
|
{
|
||||||
return Tml_DB_GetMedCod ("tl_posts","PstCod",PstCod);
|
return Tml_DB_GetMedCod ("tml_posts","PstCod",PstCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -426,7 +426,7 @@ long Tml_DB_CreateNewPost (const struct Tml_Pst_Content *Content)
|
||||||
/***** Insert post content in the database *****/
|
/***** Insert post content in the database *****/
|
||||||
return
|
return
|
||||||
DB_QueryINSERTandReturnCode ("can not create post",
|
DB_QueryINSERTandReturnCode ("can not create post",
|
||||||
"INSERT INTO tl_posts"
|
"INSERT INTO tml_posts"
|
||||||
" (Txt,MedCod)"
|
" (Txt,MedCod)"
|
||||||
" VALUES"
|
" VALUES"
|
||||||
" ('%s',%ld)",
|
" ('%s',%ld)",
|
||||||
|
@ -442,7 +442,7 @@ void Tml_DB_RemovePost (long PstCod)
|
||||||
{
|
{
|
||||||
/***** Remove post *****/
|
/***** Remove post *****/
|
||||||
DB_QueryDELETE ("can not remove a post",
|
DB_QueryDELETE ("can not remove a post",
|
||||||
"DELETE FROM tl_posts"
|
"DELETE FROM tml_posts"
|
||||||
" WHERE PstCod=%ld",
|
" WHERE PstCod=%ld",
|
||||||
PstCod);
|
PstCod);
|
||||||
}
|
}
|
||||||
|
@ -455,9 +455,9 @@ void Tml_DB_RemoveAllPostsUsr (long UsrCod)
|
||||||
{
|
{
|
||||||
/***** Remove all posts of the user *****/
|
/***** Remove all posts of the user *****/
|
||||||
DB_QueryDELETE ("can not remove posts",
|
DB_QueryDELETE ("can not remove posts",
|
||||||
"DELETE FROM tl_posts"
|
"DELETE FROM tml_posts"
|
||||||
" WHERE PstCod IN"
|
" WHERE PstCod IN"
|
||||||
" (SELECT Cod FROM tl_notes"
|
" (SELECT Cod FROM tml_notes"
|
||||||
" WHERE UsrCod=%ld AND NoteType=%u)",
|
" WHERE UsrCod=%ld AND NoteType=%u)",
|
||||||
UsrCod,(unsigned) TL_NOTE_POST);
|
UsrCod,(unsigned) TL_NOTE_POST);
|
||||||
}
|
}
|
||||||
|
@ -470,7 +470,7 @@ unsigned Tml_DB_GetNumCommsInNote (long NotCod)
|
||||||
{
|
{
|
||||||
return (unsigned)
|
return (unsigned)
|
||||||
DB_QueryCOUNT ("can not get number of comments in a note",
|
DB_QueryCOUNT ("can not get number of comments in a note",
|
||||||
"SELECT COUNT(*) FROM tl_pubs"
|
"SELECT COUNT(*) FROM tml_pubs"
|
||||||
" WHERE NotCod=%ld AND PubType=%u",
|
" WHERE NotCod=%ld AND PubType=%u",
|
||||||
NotCod,(unsigned) Tml_Pub_COMMENT_TO_NOTE);
|
NotCod,(unsigned) Tml_Pub_COMMENT_TO_NOTE);
|
||||||
}
|
}
|
||||||
|
@ -485,7 +485,7 @@ unsigned Tml_DB_GetComms (long NotCod,MYSQL_RES **mysql_res)
|
||||||
return (unsigned)
|
return (unsigned)
|
||||||
DB_QuerySELECT (mysql_res,"can not get comments",
|
DB_QuerySELECT (mysql_res,"can not get comments",
|
||||||
"SELECT PubCod" // row[0]
|
"SELECT PubCod" // row[0]
|
||||||
" FROM tl_pubs"
|
" FROM tml_pubs"
|
||||||
" WHERE NotCod=%ld AND PubType=%u",
|
" WHERE NotCod=%ld AND PubType=%u",
|
||||||
NotCod,(unsigned) Tml_Pub_COMMENT_TO_NOTE);
|
NotCod,(unsigned) Tml_Pub_COMMENT_TO_NOTE);
|
||||||
}
|
}
|
||||||
|
@ -500,17 +500,17 @@ unsigned Tml_DB_GetInitialComms (long NotCod,unsigned NumInitialCommsToGet,
|
||||||
{
|
{
|
||||||
return (unsigned)
|
return (unsigned)
|
||||||
DB_QuerySELECT (mysql_res,"can not get comments",
|
DB_QuerySELECT (mysql_res,"can not get comments",
|
||||||
"SELECT tl_pubs.PubCod," // row[0]
|
"SELECT tml_pubs.PubCod," // row[0]
|
||||||
"tl_pubs.PublisherCod," // row[1]
|
"tml_pubs.PublisherCod," // row[1]
|
||||||
"tl_pubs.NotCod," // row[2]
|
"tml_pubs.NotCod," // row[2]
|
||||||
"UNIX_TIMESTAMP(tl_pubs.TimePublish),"// row[3]
|
"UNIX_TIMESTAMP(tml_pubs.TimePublish)," // row[3]
|
||||||
"tl_comments.Txt," // row[4]
|
"tml_comments.Txt," // row[4]
|
||||||
"tl_comments.MedCod" // row[5]
|
"tml_comments.MedCod" // row[5]
|
||||||
" FROM tl_pubs,tl_comments"
|
" FROM tml_pubs,tml_comments"
|
||||||
" WHERE tl_pubs.NotCod=%ld"
|
" WHERE tml_pubs.NotCod=%ld"
|
||||||
" AND tl_pubs.PubType=%u"
|
" AND tml_pubs.PubType=%u"
|
||||||
" AND tl_pubs.PubCod=tl_comments.PubCod"
|
" AND tml_pubs.PubCod=tml_comments.PubCod"
|
||||||
" ORDER BY tl_pubs.PubCod"
|
" ORDER BY tml_pubs.PubCod"
|
||||||
" LIMIT %lu",
|
" LIMIT %lu",
|
||||||
NotCod,(unsigned) Tml_Pub_COMMENT_TO_NOTE,
|
NotCod,(unsigned) Tml_Pub_COMMENT_TO_NOTE,
|
||||||
NumInitialCommsToGet);
|
NumInitialCommsToGet);
|
||||||
|
@ -529,17 +529,17 @@ unsigned Tml_DB_GetFinalComms (long NotCod,unsigned NumFinalCommsToGet,
|
||||||
DB_QuerySELECT (mysql_res,"can not get comments",
|
DB_QuerySELECT (mysql_res,"can not get comments",
|
||||||
"SELECT * FROM "
|
"SELECT * FROM "
|
||||||
"("
|
"("
|
||||||
"SELECT tl_pubs.PubCod," // row[0]
|
"SELECT tml_pubs.PubCod," // row[0]
|
||||||
"tl_pubs.PublisherCod," // row[1]
|
"tml_pubs.PublisherCod," // row[1]
|
||||||
"tl_pubs.NotCod," // row[2]
|
"tml_pubs.NotCod," // row[2]
|
||||||
"UNIX_TIMESTAMP(tl_pubs.TimePublish),"// row[3]
|
"UNIX_TIMESTAMP(tml_pubs.TimePublish)," // row[3]
|
||||||
"tl_comments.Txt," // row[4]
|
"tml_comments.Txt," // row[4]
|
||||||
"tl_comments.MedCod" // row[5]
|
"tml_comments.MedCod" // row[5]
|
||||||
" FROM tl_pubs,tl_comments"
|
" FROM tml_pubs,tml_comments"
|
||||||
" WHERE tl_pubs.NotCod=%ld"
|
" WHERE tml_pubs.NotCod=%ld"
|
||||||
" AND tl_pubs.PubType=%u"
|
" AND tml_pubs.PubType=%u"
|
||||||
" AND tl_pubs.PubCod=tl_comments.PubCod"
|
" AND tml_pubs.PubCod=tml_comments.PubCod"
|
||||||
" ORDER BY tl_pubs.PubCod DESC LIMIT %u"
|
" ORDER BY tml_pubs.PubCod DESC LIMIT %u"
|
||||||
") AS comments"
|
") AS comments"
|
||||||
" ORDER BY PubCod",
|
" ORDER BY PubCod",
|
||||||
NotCod,(unsigned) Tml_Pub_COMMENT_TO_NOTE,
|
NotCod,(unsigned) Tml_Pub_COMMENT_TO_NOTE,
|
||||||
|
@ -560,16 +560,16 @@ unsigned Tml_DB_GetDataOfCommByCod (long PubCod,MYSQL_RES **mysql_res)
|
||||||
/***** Get data of comment from database *****/
|
/***** Get data of comment from database *****/
|
||||||
return (unsigned)
|
return (unsigned)
|
||||||
DB_QuerySELECT (mysql_res,"can not get data of comment",
|
DB_QuerySELECT (mysql_res,"can not get data of comment",
|
||||||
"SELECT tl_pubs.PubCod," // row[0]
|
"SELECT tml_pubs.PubCod," // row[0]
|
||||||
"tl_pubs.PublisherCod," // row[1]
|
"tml_pubs.PublisherCod," // row[1]
|
||||||
"tl_pubs.NotCod," // row[2]
|
"tml_pubs.NotCod," // row[2]
|
||||||
"UNIX_TIMESTAMP(tl_pubs.TimePublish),"// row[3]
|
"UNIX_TIMESTAMP(tml_pubs.TimePublish)," // row[3]
|
||||||
"tl_comments.Txt," // row[4]
|
"tml_comments.Txt," // row[4]
|
||||||
"tl_comments.MedCod" // row[5]
|
"tml_comments.MedCod" // row[5]
|
||||||
" FROM tl_pubs,tl_comments"
|
" FROM tml_pubs,tml_comments"
|
||||||
" WHERE tl_pubs.PubCod=%ld"
|
" WHERE tml_pubs.PubCod=%ld"
|
||||||
" AND tl_pubs.PubType=%u"
|
" AND tml_pubs.PubType=%u"
|
||||||
" AND tl_pubs.PubCod=tl_comments.PubCod",
|
" AND tml_pubs.PubCod=tml_comments.PubCod",
|
||||||
PubCod,(unsigned) Tml_Pub_COMMENT_TO_NOTE);
|
PubCod,(unsigned) Tml_Pub_COMMENT_TO_NOTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -582,7 +582,7 @@ void Tml_DB_InsertCommContent (long PubCod,
|
||||||
{
|
{
|
||||||
/***** Insert comment content in database *****/
|
/***** Insert comment content in database *****/
|
||||||
DB_QueryINSERT ("can not store comment content",
|
DB_QueryINSERT ("can not store comment content",
|
||||||
"INSERT INTO tl_comments"
|
"INSERT INTO tml_comments"
|
||||||
" (PubCod,Txt,MedCod)"
|
" (PubCod,Txt,MedCod)"
|
||||||
" VALUES"
|
" VALUES"
|
||||||
" (%ld,'%s',%ld)",
|
" (%ld,'%s',%ld)",
|
||||||
|
@ -597,7 +597,7 @@ void Tml_DB_InsertCommContent (long PubCod,
|
||||||
|
|
||||||
long Tml_DB_GetMedCodFromComm (long PubCod)
|
long Tml_DB_GetMedCodFromComm (long PubCod)
|
||||||
{
|
{
|
||||||
return Tml_DB_GetMedCod ("tl_comments","PubCod",PubCod);
|
return Tml_DB_GetMedCod ("tml_comments","PubCod",PubCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -608,7 +608,7 @@ void Tml_DB_RemoveCommFavs (long PubCod)
|
||||||
{
|
{
|
||||||
/***** Remove favs for comment *****/
|
/***** Remove favs for comment *****/
|
||||||
DB_QueryDELETE ("can not remove favs for comment",
|
DB_QueryDELETE ("can not remove favs for comment",
|
||||||
"DELETE FROM tl_comments_fav"
|
"DELETE FROM tml_comments_fav"
|
||||||
" WHERE PubCod=%ld",
|
" WHERE PubCod=%ld",
|
||||||
PubCod);
|
PubCod);
|
||||||
}
|
}
|
||||||
|
@ -621,7 +621,7 @@ void Tml_DB_RemoveCommContent (long PubCod)
|
||||||
{
|
{
|
||||||
/***** Remove content of comment *****/
|
/***** Remove content of comment *****/
|
||||||
DB_QueryDELETE ("can not remove comment content",
|
DB_QueryDELETE ("can not remove comment content",
|
||||||
"DELETE FROM tl_comments"
|
"DELETE FROM tml_comments"
|
||||||
" WHERE PubCod=%ld",
|
" WHERE PubCod=%ld",
|
||||||
PubCod);
|
PubCod);
|
||||||
}
|
}
|
||||||
|
@ -634,7 +634,7 @@ void Tml_DB_RemoveCommPub (long PubCod)
|
||||||
{
|
{
|
||||||
/***** Remove comment publication *****/
|
/***** Remove comment publication *****/
|
||||||
DB_QueryDELETE ("can not remove comment",
|
DB_QueryDELETE ("can not remove comment",
|
||||||
"DELETE FROM tl_pubs"
|
"DELETE FROM tml_pubs"
|
||||||
" WHERE PubCod=%ld"
|
" WHERE PubCod=%ld"
|
||||||
" AND PublisherCod=%ld" // Extra check: author
|
" AND PublisherCod=%ld" // Extra check: author
|
||||||
" AND PubType=%u", // Extra check: it's a comment
|
" AND PubType=%u", // Extra check: it's a comment
|
||||||
|
@ -651,12 +651,12 @@ void Tml_DB_RemoveAllCommsInAllNotesOf (long UsrCod)
|
||||||
{
|
{
|
||||||
/***** Remove all comments in all notes of the user *****/
|
/***** Remove all comments in all notes of the user *****/
|
||||||
DB_QueryDELETE ("can not remove comments",
|
DB_QueryDELETE ("can not remove comments",
|
||||||
"DELETE FROM tl_comments"
|
"DELETE FROM tml_comments"
|
||||||
" USING tl_notes,tl_pubs,tl_comments"
|
" USING tml_notes,tml_pubs,tml_comments"
|
||||||
" WHERE tl_notes.UsrCod=%ld"
|
" WHERE tml_notes.UsrCod=%ld"
|
||||||
" AND tl_notes.NotCod=tl_pubs.NotCod"
|
" AND tml_notes.NotCod=tml_pubs.NotCod"
|
||||||
" AND tl_pubs.PubType=%u"
|
" AND tml_pubs.PubType=%u"
|
||||||
" AND tl_pubs.PubCod=tl_comments.PubCod",
|
" AND tml_pubs.PubCod=tml_comments.PubCod",
|
||||||
UsrCod,(unsigned) Tml_Pub_COMMENT_TO_NOTE);
|
UsrCod,(unsigned) Tml_Pub_COMMENT_TO_NOTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -668,11 +668,11 @@ void Tml_DB_RemoveAllCommsMadeBy (long UsrCod)
|
||||||
{
|
{
|
||||||
/***** Remove all comments made by this user in any note *****/
|
/***** Remove all comments made by this user in any note *****/
|
||||||
DB_QueryDELETE ("can not remove comments",
|
DB_QueryDELETE ("can not remove comments",
|
||||||
"DELETE FROM tl_comments"
|
"DELETE FROM tml_comments"
|
||||||
" USING tl_pubs,tl_comments"
|
" USING tml_pubs,tml_comments"
|
||||||
" WHERE tl_pubs.PublisherCod=%ld"
|
" WHERE tml_pubs.PublisherCod=%ld"
|
||||||
" AND tl_pubs.PubType=%u"
|
" AND tml_pubs.PubType=%u"
|
||||||
" AND tl_pubs.PubCod=tl_comments.PubCod",
|
" AND tml_pubs.PubCod=tml_comments.PubCod",
|
||||||
UsrCod,(unsigned) Tml_Pub_COMMENT_TO_NOTE);
|
UsrCod,(unsigned) Tml_Pub_COMMENT_TO_NOTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -716,7 +716,7 @@ void Tml_DB_CreateSubQueryPublishers (const struct Tml_Timeline *Timeline,
|
||||||
{
|
{
|
||||||
case Tml_Usr_TIMELINE_USR: // Show the timeline of a user
|
case Tml_Usr_TIMELINE_USR: // Show the timeline of a user
|
||||||
SubQueries->TablePublishers = "";
|
SubQueries->TablePublishers = "";
|
||||||
sprintf (SubQueries->Publishers,"tl_pubs.PublisherCod=%ld AND ",
|
sprintf (SubQueries->Publishers,"tml_pubs.PublisherCod=%ld AND ",
|
||||||
Gbl.Usrs.Other.UsrDat.UsrCod);
|
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
break;
|
break;
|
||||||
case Tml_Usr_TIMELINE_GBL: // Show the global timeline
|
case Tml_Usr_TIMELINE_GBL: // Show the global timeline
|
||||||
|
@ -725,14 +725,14 @@ void Tml_DB_CreateSubQueryPublishers (const struct Tml_Timeline *Timeline,
|
||||||
case Usr_WHO_ME: // Show my timeline
|
case Usr_WHO_ME: // Show my timeline
|
||||||
SubQueries->TablePublishers = "";
|
SubQueries->TablePublishers = "";
|
||||||
snprintf (SubQueries->Publishers,sizeof (SubQueries->Publishers),
|
snprintf (SubQueries->Publishers,sizeof (SubQueries->Publishers),
|
||||||
"tl_pubs.PublisherCod=%ld AND ",
|
"tml_pubs.PublisherCod=%ld AND ",
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
break;
|
break;
|
||||||
case Usr_WHO_FOLLOWED: // Show the timeline of the users I follow
|
case Usr_WHO_FOLLOWED: // Show the timeline of the users I follow
|
||||||
Fol_CreateTmpTableMeAndUsrsIFollow ();
|
Fol_CreateTmpTableMeAndUsrsIFollow ();
|
||||||
SubQueries->TablePublishers = ",fol_tmp_me_and_followed";
|
SubQueries->TablePublishers = ",fol_tmp_me_and_followed";
|
||||||
Str_Copy (SubQueries->Publishers,
|
Str_Copy (SubQueries->Publishers,
|
||||||
"tl_pubs.PublisherCod=fol_tmp_me_and_followed.UsrCod AND ",
|
"tml_pubs.PublisherCod=fol_tmp_me_and_followed.UsrCod AND ",
|
||||||
sizeof (SubQueries->Publishers) - 1);
|
sizeof (SubQueries->Publishers) - 1);
|
||||||
break;
|
break;
|
||||||
case Usr_WHO_ALL: // Show the timeline of all users
|
case Usr_WHO_ALL: // Show the timeline of all users
|
||||||
|
@ -756,24 +756,24 @@ void Tml_DB_CreateSubQueryAlreadyExists (const struct Tml_Timeline *Timeline,
|
||||||
{
|
{
|
||||||
static const char *Table[Tml_NUM_WHAT_TO_GET] =
|
static const char *Table[Tml_NUM_WHAT_TO_GET] =
|
||||||
{
|
{
|
||||||
[Tml_GET_RECENT_TIMELINE] = "tl_tmp_just_retrieved_notes", // Avoid notes just retrieved
|
[Tml_GET_RECENT_TIMELINE] = "tml_tmp_just_retrieved_notes", // Avoid notes just retrieved
|
||||||
[Tml_GET_ONLY_NEW_PUBS ] = "tl_tmp_just_retrieved_notes", // Avoid notes just retrieved
|
[Tml_GET_ONLY_NEW_PUBS ] = "tml_tmp_just_retrieved_notes", // Avoid notes just retrieved
|
||||||
[Tml_GET_ONLY_OLD_PUBS ] = "tl_tmp_visible_timeline", // Avoid notes already shown
|
[Tml_GET_ONLY_OLD_PUBS ] = "tml_tmp_visible_timeline", // Avoid notes already shown
|
||||||
};
|
};
|
||||||
|
|
||||||
snprintf (SubQueries->AlreadyExists,sizeof (SubQueries->AlreadyExists),
|
snprintf (SubQueries->AlreadyExists,sizeof (SubQueries->AlreadyExists),
|
||||||
" tl_pubs.NotCod NOT IN (SELECT NotCod FROM %s)",
|
" tml_pubs.NotCod NOT IN (SELECT NotCod FROM %s)",
|
||||||
Table[Timeline->WhatToGet]);
|
Table[Timeline->WhatToGet]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/***** Create subqueries with range of publications to get from tl_pubs ******/
|
/***** Create subqueries with range of publications to get from tml_pubs *****/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Tml_DB_CreateSubQueryRangeBottom (long Bottom,struct Tml_Pub_SubQueries *SubQueries)
|
void Tml_DB_CreateSubQueryRangeBottom (long Bottom,struct Tml_Pub_SubQueries *SubQueries)
|
||||||
{
|
{
|
||||||
if (Bottom > 0)
|
if (Bottom > 0)
|
||||||
sprintf (SubQueries->RangeBottom,"tl_pubs.PubCod>%ld AND ",Bottom);
|
sprintf (SubQueries->RangeBottom,"tml_pubs.PubCod>%ld AND ",Bottom);
|
||||||
else
|
else
|
||||||
SubQueries->RangeBottom[0] = '\0';
|
SubQueries->RangeBottom[0] = '\0';
|
||||||
}
|
}
|
||||||
|
@ -781,7 +781,7 @@ void Tml_DB_CreateSubQueryRangeBottom (long Bottom,struct Tml_Pub_SubQueries *Su
|
||||||
void Tml_DB_CreateSubQueryRangeTop (long Top,struct Tml_Pub_SubQueries *SubQueries)
|
void Tml_DB_CreateSubQueryRangeTop (long Top,struct Tml_Pub_SubQueries *SubQueries)
|
||||||
{
|
{
|
||||||
if (Top > 0)
|
if (Top > 0)
|
||||||
sprintf (SubQueries->RangeTop,"tl_pubs.PubCod<%ld AND ",Top);
|
sprintf (SubQueries->RangeTop,"tml_pubs.PubCod<%ld AND ",Top);
|
||||||
else
|
else
|
||||||
SubQueries->RangeTop[0] = '\0';
|
SubQueries->RangeTop[0] = '\0';
|
||||||
}
|
}
|
||||||
|
@ -796,13 +796,13 @@ unsigned Tml_DB_SelectTheMostRecentPub (const struct Tml_Pub_SubQueries *SubQuer
|
||||||
{
|
{
|
||||||
return (unsigned)
|
return (unsigned)
|
||||||
DB_QuerySELECT (mysql_res,"can not get publication",
|
DB_QuerySELECT (mysql_res,"can not get publication",
|
||||||
"SELECT tl_pubs.PubCod," // row[0]
|
"SELECT tml_pubs.PubCod," // row[0]
|
||||||
"tl_pubs.NotCod," // row[1]
|
"tml_pubs.NotCod," // row[1]
|
||||||
"tl_pubs.PublisherCod," // row[2]
|
"tml_pubs.PublisherCod," // row[2]
|
||||||
"tl_pubs.PubType" // row[3]
|
"tml_pubs.PubType" // row[3]
|
||||||
" FROM tl_pubs%s"
|
" FROM tml_pubs%s"
|
||||||
" WHERE %s%s%s%s"
|
" WHERE %s%s%s%s"
|
||||||
" ORDER BY tl_pubs.PubCod DESC LIMIT 1",
|
" ORDER BY tml_pubs.PubCod DESC LIMIT 1",
|
||||||
SubQueries->TablePublishers,
|
SubQueries->TablePublishers,
|
||||||
SubQueries->RangeBottom,
|
SubQueries->RangeBottom,
|
||||||
SubQueries->RangeTop,
|
SubQueries->RangeTop,
|
||||||
|
@ -828,7 +828,7 @@ unsigned Tml_DB_GetDataOfPubByCod (long PubCod,MYSQL_RES **mysql_res)
|
||||||
"NotCod," // row[1]
|
"NotCod," // row[1]
|
||||||
"PublisherCod," // row[2]
|
"PublisherCod," // row[2]
|
||||||
"PubType" // row[3]
|
"PubType" // row[3]
|
||||||
" FROM tl_pubs WHERE PubCod=%ld",
|
" FROM tml_pubs WHERE PubCod=%ld",
|
||||||
PubCod);
|
PubCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -844,7 +844,7 @@ long Tml_DB_GetNotCodFromPubCod (long PubCod)
|
||||||
|
|
||||||
/***** Get code of note from database *****/
|
/***** Get code of note from database *****/
|
||||||
if (DB_QuerySELECT (&mysql_res,"can not get code of note",
|
if (DB_QuerySELECT (&mysql_res,"can not get code of note",
|
||||||
"SELECT NotCod FROM tl_pubs"
|
"SELECT NotCod FROM tml_pubs"
|
||||||
" WHERE PubCod=%ld",
|
" WHERE PubCod=%ld",
|
||||||
PubCod) == 1) // Result should have a unique row
|
PubCod) == 1) // Result should have a unique row
|
||||||
{
|
{
|
||||||
|
@ -900,7 +900,7 @@ unsigned long Tml_DB_GetNumPubsUsr (long UsrCod)
|
||||||
{
|
{
|
||||||
/***** Get number of posts from a user from database *****/
|
/***** Get number of posts from a user from database *****/
|
||||||
return DB_QueryCOUNT ("can not get number of publications from a user",
|
return DB_QueryCOUNT ("can not get number of publications from a user",
|
||||||
"SELECT COUNT(*) FROM tl_pubs"
|
"SELECT COUNT(*) FROM tml_pubs"
|
||||||
" WHERE PublisherCod=%ld",
|
" WHERE PublisherCod=%ld",
|
||||||
UsrCod);
|
UsrCod);
|
||||||
}
|
}
|
||||||
|
@ -915,7 +915,7 @@ long Tml_DB_CreateNewPub (const struct Tml_Pub_Publication *Pub)
|
||||||
/***** Insert new publication in database *****/
|
/***** Insert new publication in database *****/
|
||||||
return
|
return
|
||||||
DB_QueryINSERTandReturnCode ("can not publish note/comment",
|
DB_QueryINSERTandReturnCode ("can not publish note/comment",
|
||||||
"INSERT INTO tl_pubs"
|
"INSERT INTO tml_pubs"
|
||||||
" (NotCod,PublisherCod,PubType,TimePublish)"
|
" (NotCod,PublisherCod,PubType,TimePublish)"
|
||||||
" VALUES"
|
" VALUES"
|
||||||
" (%ld,%ld,%u,NOW())",
|
" (%ld,%ld,%u,NOW())",
|
||||||
|
@ -948,7 +948,7 @@ void Tml_DB_UpdateLastPubCodInSession (void)
|
||||||
"UPDATE sessions"
|
"UPDATE sessions"
|
||||||
" SET LastPubCod="
|
" SET LastPubCod="
|
||||||
"(SELECT IFNULL(MAX(PubCod),0)"
|
"(SELECT IFNULL(MAX(PubCod),0)"
|
||||||
" FROM tl_pubs)" // The most recent publication
|
" FROM tml_pubs)" // The most recent publication
|
||||||
" WHERE SessionId='%s'",
|
" WHERE SessionId='%s'",
|
||||||
Gbl.Session.Id);
|
Gbl.Session.Id);
|
||||||
}
|
}
|
||||||
|
@ -964,7 +964,7 @@ void Tml_DB_UpdateFirstLastPubCodsInSession (long FirstPubCod)
|
||||||
" SET FirstPubCod=%ld,"
|
" SET FirstPubCod=%ld,"
|
||||||
"LastPubCod="
|
"LastPubCod="
|
||||||
"(SELECT IFNULL(MAX(PubCod),0)"
|
"(SELECT IFNULL(MAX(PubCod),0)"
|
||||||
" FROM tl_pubs)" // The most recent publication
|
" FROM tml_pubs)" // The most recent publication
|
||||||
" WHERE SessionId='%s'",
|
" WHERE SessionId='%s'",
|
||||||
FirstPubCod,
|
FirstPubCod,
|
||||||
Gbl.Session.Id);
|
Gbl.Session.Id);
|
||||||
|
@ -981,10 +981,10 @@ void Tml_DB_RemoveAllPubsPublishedByAnyUsrOfNotesAuthoredBy (long UsrCod)
|
||||||
published by any user
|
published by any user
|
||||||
and related to notes authored by this user *****/
|
and related to notes authored by this user *****/
|
||||||
DB_QueryDELETE ("can not remove publications",
|
DB_QueryDELETE ("can not remove publications",
|
||||||
"DELETE FROM tl_pubs"
|
"DELETE FROM tml_pubs"
|
||||||
" USING tl_notes,tl_pubs"
|
" USING tml_notes,tml_pubs"
|
||||||
" WHERE tl_notes.UsrCod=%ld"
|
" WHERE tml_notes.UsrCod=%ld"
|
||||||
" AND tl_notes.NotCod=tl_pubs.NotCod",
|
" AND tml_notes.NotCod=tml_pubs.NotCod",
|
||||||
UsrCod);
|
UsrCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -996,7 +996,7 @@ void Tml_DB_RemoveAllPubsPublishedBy (long UsrCod)
|
||||||
{
|
{
|
||||||
/***** Remove all publications published by the user *****/
|
/***** Remove all publications published by the user *****/
|
||||||
DB_QueryDELETE ("can not remove publications",
|
DB_QueryDELETE ("can not remove publications",
|
||||||
"DELETE FROM tl_pubs WHERE PublisherCod=%ld",
|
"DELETE FROM tml_pubs WHERE PublisherCod=%ld",
|
||||||
UsrCod);
|
UsrCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1105,10 +1105,10 @@ void Tml_DB_RemoveAllFavsToPubsBy (Tml_Usr_FavSha_t FavSha,long UsrCod)
|
||||||
/***** Remove all favs to notes/comments of this user *****/
|
/***** Remove all favs to notes/comments of this user *****/
|
||||||
DB_QueryDELETE ("can not remove favs",
|
DB_QueryDELETE ("can not remove favs",
|
||||||
"DELETE FROM %s"
|
"DELETE FROM %s"
|
||||||
" USING tl_pubs,%s"
|
" USING tml_pubs,%s"
|
||||||
" WHERE tl_pubs.PublisherCod=%ld" // Author of the comment
|
" WHERE tml_pubs.PublisherCod=%ld" // Author of the comment
|
||||||
" AND tl_pubs.PubType=%u"
|
" AND tml_pubs.PubType=%u"
|
||||||
" AND tl_pubs.PubCod=%s.PubCod",
|
" AND tml_pubs.PubCod=%s.PubCod",
|
||||||
Tml_DB_TableFav[FavSha],
|
Tml_DB_TableFav[FavSha],
|
||||||
Tml_DB_TableFav[FavSha],
|
Tml_DB_TableFav[FavSha],
|
||||||
UsrCod,
|
UsrCod,
|
||||||
|
@ -1125,12 +1125,12 @@ void Tml_DB_RemoveAllFavsToAllCommsInAllNotesBy (long UsrCod)
|
||||||
/***** Remove all favs to all comments
|
/***** Remove all favs to all comments
|
||||||
in all notes authored by this user *****/
|
in all notes authored by this user *****/
|
||||||
DB_QueryDELETE ("can not remove favs",
|
DB_QueryDELETE ("can not remove favs",
|
||||||
"DELETE FROM tl_comments_fav"
|
"DELETE FROM tml_comments_fav"
|
||||||
" USING tl_notes,tl_pubs,tl_comments_fav"
|
" USING tml_notes,tml_pubs,tml_comments_fav"
|
||||||
" WHERE tl_notes.UsrCod=%ld" // Author of the note
|
" WHERE tml_notes.UsrCod=%ld" // Author of the note
|
||||||
" AND tl_notes.NotCod=tl_pubs.NotCod"
|
" AND tml_notes.NotCod=tml_pubs.NotCod"
|
||||||
" AND tl_pubs.PubType=%u"
|
" AND tml_pubs.PubType=%u"
|
||||||
" AND tl_pubs.PubCod=tl_comments_fav.PubCod",
|
" AND tml_pubs.PubCod=tml_comments_fav.PubCod",
|
||||||
UsrCod,(unsigned) Tml_Pub_COMMENT_TO_NOTE);
|
UsrCod,(unsigned) Tml_Pub_COMMENT_TO_NOTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1141,7 +1141,7 @@ void Tml_DB_RemoveAllFavsToAllCommsInAllNotesBy (long UsrCod)
|
||||||
bool Tml_DB_CheckIfSharedByUsr (long NotCod,long UsrCod)
|
bool Tml_DB_CheckIfSharedByUsr (long NotCod,long UsrCod)
|
||||||
{
|
{
|
||||||
return (DB_QueryCOUNT ("can not check if a user has shared a note",
|
return (DB_QueryCOUNT ("can not check if a user has shared a note",
|
||||||
"SELECT COUNT(*) FROM tl_pubs"
|
"SELECT COUNT(*) FROM tml_pubs"
|
||||||
" WHERE NotCod=%ld"
|
" WHERE NotCod=%ld"
|
||||||
" AND PublisherCod=%ld"
|
" AND PublisherCod=%ld"
|
||||||
" AND PubType=%u",
|
" AND PubType=%u",
|
||||||
|
@ -1159,7 +1159,7 @@ unsigned Tml_DB_GetNumSharers (long NotCod,long UsrCod)
|
||||||
/***** Get number of times (users) this note has been shared *****/
|
/***** Get number of times (users) this note has been shared *****/
|
||||||
return (unsigned)
|
return (unsigned)
|
||||||
DB_QueryCOUNT ("can not get number of times a note has been shared",
|
DB_QueryCOUNT ("can not get number of times a note has been shared",
|
||||||
"SELECT COUNT(*) FROM tl_pubs"
|
"SELECT COUNT(*) FROM tml_pubs"
|
||||||
" WHERE NotCod=%ld"
|
" WHERE NotCod=%ld"
|
||||||
" AND PublisherCod<>%ld"
|
" AND PublisherCod<>%ld"
|
||||||
" AND PubType=%u",
|
" AND PubType=%u",
|
||||||
|
@ -1179,7 +1179,7 @@ unsigned Tml_DB_GetSharers (long NotCod,long UsrCod,unsigned MaxUsrs,
|
||||||
return (unsigned)
|
return (unsigned)
|
||||||
DB_QuerySELECT (mysql_res,"can not get users",
|
DB_QuerySELECT (mysql_res,"can not get users",
|
||||||
"SELECT PublisherCod" // row[0]
|
"SELECT PublisherCod" // row[0]
|
||||||
" FROM tl_pubs"
|
" FROM tml_pubs"
|
||||||
" WHERE NotCod=%ld"
|
" WHERE NotCod=%ld"
|
||||||
" AND PublisherCod<>%ld"
|
" AND PublisherCod<>%ld"
|
||||||
" AND PubType=%u"
|
" AND PubType=%u"
|
||||||
|
@ -1198,7 +1198,7 @@ void Tml_DB_RemoveSharedPub (long NotCod)
|
||||||
{
|
{
|
||||||
/***** Remove shared publication *****/
|
/***** Remove shared publication *****/
|
||||||
DB_QueryDELETE ("can not remove a publication",
|
DB_QueryDELETE ("can not remove a publication",
|
||||||
"DELETE FROM tl_pubs"
|
"DELETE FROM tml_pubs"
|
||||||
" WHERE NotCod=%ld"
|
" WHERE NotCod=%ld"
|
||||||
" AND PublisherCod=%ld"
|
" AND PublisherCod=%ld"
|
||||||
" AND PubType=%u", // Extra check: shared note
|
" AND PubType=%u", // Extra check: shared note
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
|
|
||||||
#define TL_NOT_NUM_NOTE_TYPES 13
|
#define TL_NOT_NUM_NOTE_TYPES 13
|
||||||
// If the numbers assigned to each event type change,
|
// If the numbers assigned to each event type change,
|
||||||
// it is necessary to change old numbers to new ones in database table tl_notes
|
// it is necessary to change old numbers to new ones in database table tml_notes
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
TL_NOTE_UNKNOWN = 0,
|
TL_NOTE_UNKNOWN = 0,
|
||||||
|
|
|
@ -103,7 +103,7 @@ void Tml_Pub_GetListPubsToShowInTimeline (struct Tml_Timeline *Timeline)
|
||||||
/* Create subquery to get only notes not present in timeline */
|
/* Create subquery to get only notes not present in timeline */
|
||||||
Tml_DB_CreateSubQueryAlreadyExists (Timeline,&SubQueries);
|
Tml_DB_CreateSubQueryAlreadyExists (Timeline,&SubQueries);
|
||||||
|
|
||||||
/* Create subquery with bottom range of publications to get from tl_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. */
|
||||||
Tml_DB_CreateSubQueryRangeBottom (RangePubsToGet.Bottom,&SubQueries);
|
Tml_DB_CreateSubQueryRangeBottom (RangePubsToGet.Bottom,&SubQueries);
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ void Tml_Pub_GetListPubsToShowInTimeline (struct Tml_Timeline *Timeline)
|
||||||
As an alternative, we tried to get the maximum PubCod,
|
As an alternative, we tried to get the maximum PubCod,
|
||||||
i.e more recent publication (original, shared or commment),
|
i.e more recent publication (original, shared or commment),
|
||||||
of every set of publications corresponding to the same note:
|
of every set of publications corresponding to the same note:
|
||||||
"SELECT MAX(PubCod) AS NewestPubCod FROM tl_pubs ...
|
"SELECT MAX(PubCod) AS NewestPubCod FROM tml_pubs ...
|
||||||
" GROUP BY NotCod ORDER BY NewestPubCod DESC LIMIT ..."
|
" GROUP BY NotCod ORDER BY NewestPubCod DESC LIMIT ..."
|
||||||
but this query is slow (several seconds) with a big table.
|
but this query is slow (several seconds) with a big table.
|
||||||
*/
|
*/
|
||||||
|
@ -147,11 +147,11 @@ void Tml_Pub_GetListPubsToShowInTimeline (struct Tml_Timeline *Timeline)
|
||||||
NumPub < MaxPubsToGet;
|
NumPub < MaxPubsToGet;
|
||||||
NumPub++)
|
NumPub++)
|
||||||
{
|
{
|
||||||
/* Create subquery with top range of publications to get from tl_pubs
|
/* Create subquery with top range of publications to get from tml_pubs
|
||||||
In each iteration of this loop, top publication code is changed to a lower value */
|
In each iteration of this loop, top publication code is changed to a lower value */
|
||||||
Tml_DB_CreateSubQueryRangeTop (RangePubsToGet.Top,&SubQueries);
|
Tml_DB_CreateSubQueryRangeTop (RangePubsToGet.Top,&SubQueries);
|
||||||
|
|
||||||
/* Select the most recent publication from tl_pubs */
|
/* Select the most recent publication from tml_pubs */
|
||||||
Pub = Tml_Pub_SelectTheMostRecentPub (&SubQueries);
|
Pub = Tml_Pub_SelectTheMostRecentPub (&SubQueries);
|
||||||
|
|
||||||
/* Chain the previous publication with the current one */
|
/* Chain the previous publication with the current one */
|
||||||
|
@ -202,7 +202,7 @@ static void Tml_Pub_InitializeRangeOfPubs (Tml_WhatToGet_t WhatToGet,
|
||||||
{
|
{
|
||||||
/* Initialize range of pubs:
|
/* Initialize range of pubs:
|
||||||
|
|
||||||
tl_pubs
|
tml_pubs
|
||||||
_____
|
_____
|
||||||
|_____|11
|
|_____|11
|
||||||
|_____|10
|
|_____|10
|
||||||
|
@ -314,7 +314,7 @@ void Tml_Pub_FreeListPubs (struct Tml_Timeline *Timeline)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************** Select the most recent publication from tl_pubs **************/
|
/************** Select the most recent publication from tml_pubs *************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static struct Tml_Pub_Publication *Tml_Pub_SelectTheMostRecentPub (const struct Tml_Pub_SubQueries *SubQueries)
|
static struct Tml_Pub_Publication *Tml_Pub_SelectTheMostRecentPub (const struct Tml_Pub_SubQueries *SubQueries)
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
|
|
||||||
#define Tml_Pub_NUM_PUB_TYPES 4
|
#define Tml_Pub_NUM_PUB_TYPES 4
|
||||||
// If the numbers assigned to each event type change,
|
// If the numbers assigned to each event type change,
|
||||||
// it is necessary to change old numbers to new ones in database table tl_notes
|
// it is necessary to change old numbers to new ones in database table tml_notes
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
Tml_Pub_UNKNOWN = 0,
|
Tml_Pub_UNKNOWN = 0,
|
||||||
|
|
Loading…
Reference in New Issue