Version 16.155.8

This commit is contained in:
Antonio Cañas Vargas 2017-03-11 20:59:09 +01:00
parent f9f6e9fe05
commit 82c5d58812
6 changed files with 57 additions and 54 deletions

View File

@ -403,8 +403,8 @@ CREATE TABLE IF NOT EXISTS degrees (
DegTypCod INT NOT NULL, DegTypCod INT NOT NULL,
Status TINYINT NOT NULL DEFAULT 0, Status TINYINT NOT NULL DEFAULT 0,
RequesterUsrCod INT NOT NULL DEFAULT -1, RequesterUsrCod INT NOT NULL DEFAULT -1,
ShortName VARCHAR(32) NOT NULL, ShortName VARCHAR(511) COLLATE latin1_spanish_ci NOT NULL,
FullName VARCHAR(127) NOT NULL, FullName VARCHAR(2047) COLLATE latin1_spanish_ci NOT NULL,
WWW VARCHAR(255) NOT NULL, WWW VARCHAR(255) NOT NULL,
UNIQUE INDEX(DegCod), UNIQUE INDEX(DegCod),
INDEX(CtrCod), INDEX(CtrCod),

View File

@ -207,13 +207,18 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.155.7 (2017-03-11)" #define Log_PLATFORM_VERSION "SWAD 16.155.8 (2017-03-11)"
#define CSS_FILE "swad16.147.css" #define CSS_FILE "swad16.147.css"
#define JS_FILE "swad16.144.js" #define JS_FILE "swad16.144.js"
// Number of lines (includes comments but not blank lines) has been got with the following command: // 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 // 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.8: Mar 11, 2017 Adjusting size of database fields. (216684 lines)
2 changes necessary in database:
ALTER TABLE degrees CHANGE COLUMN ShortName ShortName VARCHAR(511) COLLATE latin1_spanish_ci NOT NULL;
ALTER TABLE degrees CHANGE COLUMN FullName FullName VARCHAR(2047) COLLATE latin1_spanish_ci NOT NULL;
Version 16.155.7: Mar 11, 2017 Adjusting size of database fields. (216682 lines) Version 16.155.7: Mar 11, 2017 Adjusting size of database fields. (216682 lines)
1 change necessary in database: 1 change necessary in database:
ALTER TABLE deg_types CHANGE COLUMN DegTypName DegTypName VARCHAR(511) NOT NULL; ALTER TABLE deg_types CHANGE COLUMN DegTypName DegTypName VARCHAR(511) NOT NULL;

View File

@ -887,19 +887,19 @@ mysql> DESCRIBE deg_types;
/***** Table degrees *****/ /***** Table degrees *****/
/* /*
mysql> DESCRIBE degrees; mysql> DESCRIBE degrees;
+-----------------+--------------+------+-----+---------+----------------+ +-----------------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra | | Field | Type | Null | Key | Default | Extra |
+-----------------+--------------+------+-----+---------+----------------+ +-----------------+---------------+------+-----+---------+----------------+
| DegCod | int(11) | NO | PRI | NULL | auto_increment | | DegCod | int(11) | NO | PRI | NULL | auto_increment |
| CtrCod | int(11) | NO | MUL | NULL | | | CtrCod | int(11) | NO | MUL | NULL | |
| DegTypCod | int(11) | NO | MUL | NULL | | | DegTypCod | int(11) | NO | MUL | NULL | |
| Status | tinyint(4) | NO | MUL | 0 | | | Status | tinyint(4) | NO | MUL | 0 | |
| RequesterUsrCod | int(11) | NO | | -1 | | | RequesterUsrCod | int(11) | NO | | -1 | |
| ShortName | varchar(32) | NO | | NULL | | | ShortName | varchar(511) | NO | | NULL | |
| FullName | varchar(127) | NO | | NULL | | | FullName | varchar(2047) | NO | | NULL | |
| WWW | varchar(255) | NO | | NULL | | | WWW | varchar(255) | NO | | NULL | |
+-----------------+--------------+------+-----+---------+----------------+ +-----------------+---------------+------+-----+---------+----------------+
8 rows in set (0.00 sec) 8 rows in set (0,00 sec)
*/ */
DB_CreateTable ("CREATE TABLE IF NOT EXISTS degrees (" DB_CreateTable ("CREATE TABLE IF NOT EXISTS degrees ("
"DegCod INT NOT NULL AUTO_INCREMENT," "DegCod INT NOT NULL AUTO_INCREMENT,"
@ -907,9 +907,9 @@ mysql> DESCRIBE degrees;
"DegTypCod INT NOT NULL," "DegTypCod INT NOT NULL,"
"Status TINYINT NOT NULL DEFAULT 0," "Status TINYINT NOT NULL DEFAULT 0,"
"RequesterUsrCod INT NOT NULL DEFAULT -1," "RequesterUsrCod INT NOT NULL DEFAULT -1,"
"ShortName VARCHAR(32) NOT NULL," "ShortName VARCHAR(511) COLLATE latin1_spanish_ci NOT NULL," // Hie_MAX_BYTES_SHRT_NAME
"FullName VARCHAR(127) NOT NULL," "FullName VARCHAR(2047) COLLATE latin1_spanish_ci NOT NULL," // Hie_MAX_BYTES_FULL_NAME
"WWW VARCHAR(255) NOT NULL," "WWW VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
"UNIQUE INDEX(DegCod)," "UNIQUE INDEX(DegCod),"
"INDEX(CtrCod)," "INDEX(CtrCod),"
"INDEX(DegTypCod)," "INDEX(DegTypCod),"

View File

@ -591,7 +591,7 @@ static void Deg_PutIconsToPrintAndUpload (void)
void Deg_WriteSelectorOfDegree (void) void Deg_WriteSelectorOfDegree (void)
{ {
extern const char *Txt_Degree; extern const char *Txt_Degree;
char Query[512]; char Query[256];
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
unsigned NumDegs; unsigned NumDegs;
@ -617,8 +617,7 @@ void Deg_WriteSelectorOfDegree (void)
{ {
/***** Get degrees belonging to the current centre from database *****/ /***** Get degrees belonging to the current centre from database *****/
sprintf (Query,"SELECT DegCod,ShortName FROM degrees" sprintf (Query,"SELECT DegCod,ShortName FROM degrees"
" WHERE CtrCod='%ld'" " WHERE CtrCod='%ld' ORDER BY ShortName",
" ORDER BY ShortName",
Gbl.CurrentCtr.Ctr.CtrCod); Gbl.CurrentCtr.Ctr.CtrCod);
NumDegs = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get degrees of a centre"); NumDegs = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get degrees of a centre");
@ -1454,7 +1453,7 @@ void Deg_GetListAllDegsWithStds (struct ListDegrees *Degs)
void Deg_GetListDegsOfCurrentCtr (void) void Deg_GetListDegsOfCurrentCtr (void)
{ {
char Query[512]; char Query[256];
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
unsigned long NumRows; unsigned long NumRows;
@ -1666,7 +1665,7 @@ long Deg_GetAndCheckParamOtherDegCod (void)
bool Deg_GetDataOfDegreeByCod (struct Degree *Deg) bool Deg_GetDataOfDegreeByCod (struct Degree *Deg)
{ {
char Query[1024]; char Query[256];
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
bool DegFound = false; bool DegFound = false;
@ -1748,7 +1747,7 @@ static void Deg_GetDataOfDegreeFromRow (struct Degree *Deg,MYSQL_ROW row)
void Deg_GetShortNameOfDegreeByCod (struct Degree *Deg) void Deg_GetShortNameOfDegreeByCod (struct Degree *Deg)
{ {
char Query[512]; char Query[128];
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
@ -1756,8 +1755,7 @@ void Deg_GetShortNameOfDegreeByCod (struct Degree *Deg)
if (Deg->DegCod > 0) if (Deg->DegCod > 0)
{ {
/***** Get the short name of a degree from database *****/ /***** Get the short name of a degree from database *****/
sprintf (Query,"SELECT ShortName FROM degrees" sprintf (Query,"SELECT ShortName FROM degrees WHERE DegCod ='%ld'",
" WHERE DegCod ='%ld'",
Deg->DegCod); Deg->DegCod);
if (DB_QuerySELECT (Query,&mysql_res,"can not get the short name of a degree") == 1) if (DB_QuerySELECT (Query,&mysql_res,"can not get the short name of a degree") == 1)
{ {
@ -1818,7 +1816,8 @@ long Deg_GetInsCodOfDegreeByCod (long DegCod)
{ {
/***** Get the institution code of a degree from database *****/ /***** Get the institution code of a degree from database *****/
sprintf (Query,"SELECT centres.InsCod FROM degrees,centres" sprintf (Query,"SELECT centres.InsCod FROM degrees,centres"
" WHERE degrees.DegCod='%ld' AND degrees.CtrCod=centres.CtrCod", " WHERE degrees.DegCod='%ld'"
" AND degrees.CtrCod=centres.CtrCod",
DegCod); DegCod);
if (DB_QuerySELECT (Query,&mysql_res,"can not get the institution of a degree") == 1) if (DB_QuerySELECT (Query,&mysql_res,"can not get the institution of a degree") == 1)
{ {
@ -1841,7 +1840,7 @@ long Deg_GetInsCodOfDegreeByCod (long DegCod)
void Deg_RemoveDegreeCompletely (long DegCod) void Deg_RemoveDegreeCompletely (long DegCod)
{ {
extern const char *Sco_ScopeDB[Sco_NUM_SCOPES]; extern const char *Sco_ScopeDB[Sco_NUM_SCOPES];
char Query[512]; char Query[128];
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
unsigned long NumRow,NumRows; unsigned long NumRow,NumRows;
@ -1849,8 +1848,8 @@ void Deg_RemoveDegreeCompletely (long DegCod)
char PathDeg[PATH_MAX + 1]; char PathDeg[PATH_MAX + 1];
/***** Get courses of a degree from database *****/ /***** Get courses of a degree from database *****/
sprintf (Query,"SELECT CrsCod FROM courses" sprintf (Query,"SELECT CrsCod FROM courses WHERE DegCod='%ld'",
" WHERE DegCod='%ld'",DegCod); DegCod);
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get courses of a degree"); NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get courses of a degree");
/* Get courses in this degree */ /* Get courses in this degree */
@ -2214,7 +2213,7 @@ void Deg_ChangeDegStatus (void)
{ {
extern const char *Txt_The_status_of_the_degree_X_has_changed; extern const char *Txt_The_status_of_the_degree_X_has_changed;
struct Degree *Deg; struct Degree *Deg;
char Query[256]; char Query[128];
Deg_Status_t Status; Deg_Status_t Status;
Deg_StatusTxt_t StatusTxt; Deg_StatusTxt_t StatusTxt;
@ -2333,7 +2332,7 @@ void Deg_RemoveLogo (void)
unsigned Deg_GetNumDegsTotal (void) unsigned Deg_GetNumDegsTotal (void)
{ {
char Query[256]; char Query[128];
/***** Get total number of degrees from database *****/ /***** Get total number of degrees from database *****/
sprintf (Query,"SELECT COUNT(*) FROM degrees"); sprintf (Query,"SELECT COUNT(*) FROM degrees");
@ -2379,11 +2378,10 @@ unsigned Deg_GetNumDegsInIns (long InsCod)
unsigned Deg_GetNumDegsInCtr (long CtrCod) unsigned Deg_GetNumDegsInCtr (long CtrCod)
{ {
char Query[512]; char Query[128];
/***** Get number of degrees in a centre from database *****/ /***** Get number of degrees in a centre from database *****/
sprintf (Query,"SELECT COUNT(*) FROM degrees" sprintf (Query,"SELECT COUNT(*) FROM degrees WHERE CtrCod='%ld'",
" WHERE CtrCod='%ld'",
CtrCod); CtrCod);
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of degrees in a centre"); return (unsigned) DB_QueryCOUNT (Query,"can not get the number of degrees in a centre");
} }