From f9f6e9fe0511f677bc3d77d200a64fc1d9973139 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sat, 11 Mar 2017 20:36:55 +0100 Subject: [PATCH] Version 16.155.7 --- sql/swad.sql | 2 +- swad_changelog.h | 6 +++- swad_database.c | 78 +++++++++++++++++++++++----------------------- swad_degree_type.c | 18 ++++++----- 4 files changed, 55 insertions(+), 49 deletions(-) diff --git a/sql/swad.sql b/sql/swad.sql index 062b678f9..589e35064 100644 --- a/sql/swad.sql +++ b/sql/swad.sql @@ -392,7 +392,7 @@ CREATE TABLE IF NOT EXISTS debug ( -- CREATE TABLE IF NOT EXISTS deg_types ( DegTypCod INT NOT NULL AUTO_INCREMENT, - DegTypName VARCHAR(32) NOT NULL, + DegTypName VARCHAR(511) NOT NULL, UNIQUE INDEX(DegTypCod)); -- -- Table degrees: stores the degrees diff --git a/swad_changelog.h b/swad_changelog.h index bc0d2ee4a..73a5e3cf8 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -207,13 +207,17 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.155.6 (2017-03-11)" +#define Log_PLATFORM_VERSION "SWAD 16.155.7 (2017-03-11)" #define CSS_FILE "swad16.147.css" #define JS_FILE "swad16.144.js" // Number of lines (includes comments but not blank lines) has been got with the following command: // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1 /* + Version 16.155.7: Mar 11, 2017 Adjusting size of database fields. (216682 lines) + 1 change necessary in database: +ALTER TABLE deg_types CHANGE COLUMN DegTypName DegTypName VARCHAR(511) NOT NULL; + Version 16.155.6: Mar 11, 2017 Adjusting size of database fields. (216677 lines) 1 change necessary in database: ALTER TABLE crs_record_fields CHANGE COLUMN FieldName FieldName VARCHAR(2047) NOT NULL; diff --git a/swad_database.c b/swad_database.c index 4f598dcf0..b1490f0ff 100644 --- a/swad_database.c +++ b/swad_database.c @@ -798,10 +798,10 @@ mysql> DESCRIBE crs_records; 3 rows in set (0.00 sec) */ DB_CreateTable ("CREATE TABLE IF NOT EXISTS crs_records (" - "FieldCod INT NOT NULL," - "UsrCod INT NOT NULL," - "Txt TEXT NOT NULL," - "UNIQUE INDEX(FieldCod,UsrCod))"); + "FieldCod INT NOT NULL," + "UsrCod INT NOT NULL," + "Txt TEXT NOT NULL," // Cns_MAX_BYTES_TEXT + "UNIQUE INDEX(FieldCod,UsrCod))"); /***** Table crs_usr *****/ /* @@ -826,23 +826,23 @@ mysql> DESCRIBE crs_usr; 13 rows in set (0.00 sec) */ DB_CreateTable ("CREATE TABLE IF NOT EXISTS crs_usr (" - "CrsCod INT NOT NULL DEFAULT -1," - "UsrCod INT NOT NULL," - "Role TINYINT NOT NULL DEFAULT 0," - "Accepted ENUM('N','Y') NOT NULL DEFAULT 'N'," - "LastDowGrpCod INT NOT NULL DEFAULT -1," - "LastComGrpCod INT NOT NULL DEFAULT -1," - "LastAssGrpCod INT NOT NULL DEFAULT -1," - "NumAccTst INT NOT NULL DEFAULT 0," - "LastAccTst DATETIME NOT NULL," - "NumQstsLastTst INT NOT NULL DEFAULT 0," - "UsrListType ENUM('classphoto','list') NOT NULL DEFAULT 'classphoto'," - "ColsClassPhoto TINYINT NOT NULL," - "ListWithPhotos ENUM('N','Y') NOT NULL DEFAULT 'Y'," - "UNIQUE INDEX(CrsCod,UsrCod,Role)," - "UNIQUE INDEX(UsrCod,CrsCod,Role)," - "INDEX(CrsCod,Role)," - "INDEX(UsrCod,Role))"); + "CrsCod INT NOT NULL DEFAULT -1," + "UsrCod INT NOT NULL," + "Role TINYINT NOT NULL DEFAULT 0," + "Accepted ENUM('N','Y') NOT NULL DEFAULT 'N'," + "LastDowGrpCod INT NOT NULL DEFAULT -1," + "LastComGrpCod INT NOT NULL DEFAULT -1," + "LastAssGrpCod INT NOT NULL DEFAULT -1," + "NumAccTst INT NOT NULL DEFAULT 0," + "LastAccTst DATETIME NOT NULL," + "NumQstsLastTst INT NOT NULL DEFAULT 0," + "UsrListType ENUM('classphoto','list') NOT NULL DEFAULT 'classphoto'," + "ColsClassPhoto TINYINT NOT NULL," + "ListWithPhotos ENUM('N','Y') NOT NULL DEFAULT 'Y'," + "UNIQUE INDEX(CrsCod,UsrCod,Role)," + "UNIQUE INDEX(UsrCod,CrsCod,Role)," + "INDEX(CrsCod,Role)," + "INDEX(UsrCod,Role))"); /***** Table crs_usr_requests *****/ /* @@ -859,30 +859,30 @@ mysql> DESCRIBE crs_usr_requests; 5 rows in set (0.01 sec) */ DB_CreateTable ("CREATE TABLE IF NOT EXISTS crs_usr_requests (" - "ReqCod INT NOT NULL AUTO_INCREMENT," - "CrsCod INT NOT NULL DEFAULT -1," - "UsrCod INT NOT NULL," - "Role TINYINT NOT NULL DEFAULT 0," - "RequestTime DATETIME NOT NULL," - "UNIQUE INDEX(ReqCod)," - "UNIQUE INDEX(CrsCod,UsrCod)," - "INDEX(UsrCod))"); + "ReqCod INT NOT NULL AUTO_INCREMENT," + "CrsCod INT NOT NULL DEFAULT -1," + "UsrCod INT NOT NULL," + "Role TINYINT NOT NULL DEFAULT 0," + "RequestTime DATETIME NOT NULL," + "UNIQUE INDEX(ReqCod)," + "UNIQUE INDEX(CrsCod,UsrCod)," + "INDEX(UsrCod))"); /***** Table deg_types *****/ /* mysql> DESCRIBE deg_types; -+------------+-------------+------+-----+---------+----------------+ -| Field | Type | Null | Key | Default | Extra | -+------------+-------------+------+-----+---------+----------------+ -| DegTypCod | int(11) | NO | PRI | NULL | auto_increment | -| DegTypName | varchar(32) | NO | | NULL | | -+------------+-------------+------+-----+---------+----------------+ -2 rows in set (0.00 sec) ++------------+--------------+------+-----+---------+----------------+ +| Field | Type | Null | Key | Default | Extra | ++------------+--------------+------+-----+---------+----------------+ +| DegTypCod | int(11) | NO | PRI | NULL | auto_increment | +| DegTypName | varchar(511) | NO | | NULL | | ++------------+--------------+------+-----+---------+----------------+ +2 rows in set (0,00 sec) */ DB_CreateTable ("CREATE TABLE IF NOT EXISTS deg_types (" - "DegTypCod INT NOT NULL AUTO_INCREMENT," - "DegTypName VARCHAR(32) NOT NULL," - "UNIQUE INDEX(DegTypCod))"); + "DegTypCod INT NOT NULL AUTO_INCREMENT," + "DegTypName VARCHAR(511) NOT NULL," // Deg_MAX_BYTES_DEGREE_TYPE_NAME + "UNIQUE INDEX(DegTypCod))"); /***** Table degrees *****/ /* diff --git a/swad_degree_type.c b/swad_degree_type.c index c1ab97e70..6b1fa001e 100644 --- a/swad_degree_type.c +++ b/swad_degree_type.c @@ -453,11 +453,13 @@ void DT_GetListDegreeTypes (void) /***** Get types of degree from database *****/ sprintf (Query,"(SELECT deg_types.DegTypCod,deg_types.DegTypName AS DegTypName," " COUNT(degrees.DegCod)" - " FROM deg_types,degrees WHERE deg_types.DegTypCod=degrees.DegTypCod" + " FROM deg_types,degrees" + " WHERE deg_types.DegTypCod=degrees.DegTypCod" " GROUP BY degrees.DegTypCod)" " UNION " "(SELECT DegTypCod,DegTypName,'0'" - " FROM deg_types WHERE DegTypCod NOT IN (SELECT DegTypCod FROM degrees))" + " FROM deg_types" + " WHERE DegTypCod NOT IN (SELECT DegTypCod FROM degrees))" " ORDER BY DegTypName"); Gbl.Degs.DegTypes.Num = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get types of degree"); @@ -608,7 +610,7 @@ long DT_GetParamOtherDegTypCod (void) static unsigned DT_CountNumDegsOfType (long DegTypCod) { - char Query[512]; + char Query[128]; /***** Get number of degrees of a type from database *****/ sprintf (Query,"SELECT COUNT(*) FROM degrees WHERE DegTypCod='%ld'", @@ -622,7 +624,7 @@ static unsigned DT_CountNumDegsOfType (long DegTypCod) bool DT_GetDataOfDegreeTypeByCod (struct DegreeType *DegTyp) { - char Query[512]; + char Query[128]; MYSQL_RES *mysql_res; MYSQL_ROW row; unsigned long NumRows; @@ -678,7 +680,7 @@ bool DT_GetDataOfDegreeTypeByCod (struct DegreeType *DegTyp) static void DT_RemoveDegreeTypeCompletely (long DegTypCod) { - char Query[512]; + char Query[128]; MYSQL_RES *mysql_res; MYSQL_ROW row; unsigned long NumRow,NumRows; @@ -724,7 +726,7 @@ void DT_RenameDegreeType (void) extern const char *Txt_The_type_of_degree_X_has_been_renamed_as_Y; extern const char *Txt_The_name_of_the_type_of_degree_X_has_not_changed; struct DegreeType *DegTyp; - char Query[1024]; + char Query[128 + Deg_MAX_BYTES_DEGREE_TYPE_NAME]; char NewNameDegTyp[Deg_MAX_BYTES_DEGREE_TYPE_NAME + 1]; DegTyp = &Gbl.Degs.EditingDegTyp; @@ -794,7 +796,7 @@ void DT_RenameDegreeType (void) static bool DT_CheckIfDegreeTypeNameExists (const char *DegTypName,long DegTypCod) { - char Query[512]; + char Query[256 + Deg_MAX_BYTES_DEGREE_TYPE_NAME]; /***** Get number of degree types with a name from database *****/ sprintf (Query,"SELECT COUNT(*) FROM deg_types" @@ -812,7 +814,7 @@ void DT_ChangeDegreeType (void) extern const char *Txt_The_type_of_degree_of_the_degree_X_has_changed; struct Degree *Deg; long NewDegTypCod; - char Query[512]; + char Query[128]; Deg = &Gbl.Degs.EditingDeg;