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,
Status TINYINT NOT NULL DEFAULT 0,
RequesterUsrCod INT NOT NULL DEFAULT -1,
ShortName VARCHAR(32) NOT NULL,
FullName VARCHAR(127) NOT NULL,
ShortName VARCHAR(511) COLLATE latin1_spanish_ci NOT NULL,
FullName VARCHAR(2047) COLLATE latin1_spanish_ci NOT NULL,
WWW VARCHAR(255) NOT NULL,
UNIQUE INDEX(DegCod),
INDEX(CtrCod),

View File

@ -207,13 +207,18 @@
/****************************** 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 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.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)
1 change necessary in database:
ALTER TABLE deg_types CHANGE COLUMN DegTypName DegTypName VARCHAR(511) NOT NULL;

View File

@ -37,9 +37,9 @@
#define Cns_MAX_BYTES_WWW Cns_MAX_CHARS_WWW // 255
#define Cns_MAX_CHARS_IP (3 + 1 + 3 + 1 + 3 + 1 + 3) // 15: max. number of chars of an IP address
// Example: 255.255.255.255
// 3+1+3+1+3+1+3
// 123456789012345
// Example: 255.255.255.255
// 3+1+3+1+3+1+3
// 123456789012345
#define Cns_MAX_BYTES_IP Cns_MAX_CHARS_IP // 15
#define Cns_MAX_CHARS_DATE (4 + 1 + 2 + 1 + 2)

View File

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

View File

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

View File

@ -66,15 +66,15 @@ typedef enum
struct Degree
{
long DegTypCod; // Degree type code
long DegCod; // Degree code
long CtrCod; // Centre code
Deg_Status_t Status; // Degree status
long RequesterUsrCod; // User code of the person who requested the creation of this degree
long DegTypCod; // Degree type code
long DegCod; // Degree code
long CtrCod; // Centre code
Deg_Status_t Status; // Degree status
long RequesterUsrCod; // User code of the person who requested the creation of this degree
char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1]; // Short name of degree
char FullName[Hie_MAX_BYTES_FULL_NAME + 1]; // Full name of degree
char WWW[Cns_MAX_BYTES_WWW + 1];
struct Course *LstCrss; // List of courses in this degree
struct Course *LstCrss; // List of courses in this degree
};
struct ListDegrees