Version 16.155.7

This commit is contained in:
Antonio Cañas Vargas 2017-03-11 20:36:55 +01:00
parent 2570a8cc4c
commit f9f6e9fe05
4 changed files with 55 additions and 49 deletions

View File

@ -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

View File

@ -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;

View File

@ -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 *****/
/*

View File

@ -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;