Version 16.155.14

This commit is contained in:
Antonio Cañas Vargas 2017-03-12 19:43:17 +01:00
parent 6b643a722b
commit 64ddb2ef1f
4 changed files with 38 additions and 34 deletions

View File

@ -596,8 +596,8 @@ CREATE TABLE IF NOT EXISTS institutions (
CtyCod INT NOT NULL, CtyCod 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 TEXT NOT NULL, FullName VARCHAR(2047) COLLATE latin1_spanish_ci NOT NULL,
WWW VARCHAR(255) NOT NULL, WWW VARCHAR(255) NOT NULL,
UNIQUE INDEX(InsCod), UNIQUE INDEX(InsCod),
INDEX(CtyCod), INDEX(CtyCod),

View File

@ -207,13 +207,18 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.155.13 (2017-03-12)" #define Log_PLATFORM_VERSION "SWAD 16.155.14 (2017-03-12)"
#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.14:Mar 11, 2017 Adjusting size of database fields. (? lines)
2 changes necessary in database:
ALTER TABLE institutions CHANGE COLUMN ShortName ShortName VARCHAR(511) COLLATE latin1_spanish_ci NOT NULL;
ALTER TABLE institutions CHANGE COLUMN FullName FullName VARCHAR(2047) COLLATE latin1_spanish_ci NOT NULL;
Version 16.155.13:Mar 11, 2017 Adjusting size of database fields. (216734 lines) Version 16.155.13:Mar 11, 2017 Adjusting size of database fields. (216734 lines)
1 change necessary in database: 1 change necessary in database:
ALTER TABLE holidays CHANGE COLUMN Name Name VARCHAR(2047) NOT NULL; ALTER TABLE holidays CHANGE COLUMN Name Name VARCHAR(2047) NOT NULL;

View File

@ -1283,30 +1283,30 @@ mysql> DESCRIBE holidays;
/***** Table institutions *****/ /***** Table institutions *****/
/* /*
mysql> DESCRIBE institutions; mysql> DESCRIBE institutions;
+-----------------+--------------+------+-----+---------+----------------+ +-----------------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra | | Field | Type | Null | Key | Default | Extra |
+-----------------+--------------+------+-----+---------+----------------+ +-----------------+---------------+------+-----+---------+----------------+
| InsCod | int(11) | NO | PRI | NULL | auto_increment | | InsCod | int(11) | NO | PRI | NULL | auto_increment |
| CtyCod | int(11) | NO | MUL | NULL | | | CtyCod | 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 | text | NO | | NULL | | | FullName | varchar(2047) | NO | | NULL | |
| WWW | varchar(255) | NO | | NULL | | | WWW | varchar(255) | NO | | NULL | |
+-----------------+--------------+------+-----+---------+----------------+ +-----------------+---------------+------+-----+---------+----------------+
7 rows in set (0.00 sec) 7 rows in set (0,00 sec)
*/ */
DB_CreateTable ("CREATE TABLE IF NOT EXISTS institutions (" DB_CreateTable ("CREATE TABLE IF NOT EXISTS institutions ("
"InsCod INT NOT NULL AUTO_INCREMENT," "InsCod INT NOT NULL AUTO_INCREMENT,"
"CtyCod INT NOT NULL," "CtyCod 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 TEXT 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(InsCod)," "UNIQUE INDEX(InsCod),"
"INDEX(CtyCod)," "INDEX(CtyCod),"
"INDEX(Status))"); "INDEX(Status))");
/***** Table links *****/ /***** Table links *****/
/* /*

View File

@ -1209,8 +1209,7 @@ void Ins_GetShortNameOfInstitutionByCod (struct Instit *Ins)
if (Ins->InsCod != Cached.InsCod) // If not cached... if (Ins->InsCod != Cached.InsCod) // If not cached...
{ {
/***** Get the short name of an institution from database *****/ /***** Get the short name of an institution from database *****/
sprintf (Query,"SELECT ShortName FROM institutions" sprintf (Query,"SELECT ShortName FROM institutions WHERE InsCod='%ld'",
" WHERE InsCod ='%ld'",
Ins->InsCod); Ins->InsCod);
if (DB_QuerySELECT (Query,&mysql_res,"can not get the short name of an institution") == 1) if (DB_QuerySELECT (Query,&mysql_res,"can not get the short name of an institution") == 1)
{ {
@ -1240,7 +1239,7 @@ static void Ins_GetFullNameAndCtyOfInstitutionByCod (struct Instit *Ins,
char CtyName[Hie_MAX_BYTES_FULL_NAME + 1]) char CtyName[Hie_MAX_BYTES_FULL_NAME + 1])
{ {
extern const char *Txt_STR_LANG_ID[1 + Txt_NUM_LANGUAGES]; extern const char *Txt_STR_LANG_ID[1 + Txt_NUM_LANGUAGES];
char Query[256]; char Query[512];
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
static struct static struct
@ -1267,7 +1266,7 @@ static void Ins_GetFullNameAndCtyOfInstitutionByCod (struct Instit *Ins,
/***** Get the short name of an institution from database *****/ /***** Get the short name of an institution from database *****/
sprintf (Query,"SELECT institutions.FullName,countries.Name_%s" sprintf (Query,"SELECT institutions.FullName,countries.Name_%s"
" FROM institutions,countries" " FROM institutions,countries"
" WHERE institutions.InsCod ='%ld'" " WHERE institutions.InsCod='%ld'"
" AND institutions.CtyCod=countries.CtyCod", " AND institutions.CtyCod=countries.CtyCod",
Txt_STR_LANG_ID[Gbl.Prefs.Language],Ins->InsCod); Txt_STR_LANG_ID[Gbl.Prefs.Language],Ins->InsCod);
if (DB_QuerySELECT (Query,&mysql_res,"can not get the full name of an institution") == 1) if (DB_QuerySELECT (Query,&mysql_res,"can not get the full name of an institution") == 1)
@ -2018,7 +2017,7 @@ void Ins_ChangeInsWWWInConfig (void)
static void Ins_UpdateInsWWWDB (long InsCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1]) static void Ins_UpdateInsWWWDB (long InsCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1])
{ {
char Query[256 + Cns_MAX_BYTES_WWW]; char Query[128 + Cns_MAX_BYTES_WWW];
/***** Update database changing old WWW by new WWW *****/ /***** Update database changing old WWW by new WWW *****/
sprintf (Query,"UPDATE institutions SET WWW='%s' WHERE InsCod='%ld'", sprintf (Query,"UPDATE institutions SET WWW='%s' WHERE InsCod='%ld'",
@ -2034,7 +2033,7 @@ void Ins_ChangeInsStatus (void)
{ {
extern const char *Txt_The_status_of_the_institution_X_has_changed; extern const char *Txt_The_status_of_the_institution_X_has_changed;
struct Instit *Ins; struct Instit *Ins;
char Query[256]; char Query[128];
Ins_Status_t Status; Ins_Status_t Status;
Ins_StatusTxt_t StatusTxt; Ins_StatusTxt_t StatusTxt;
@ -2443,8 +2442,8 @@ unsigned Ins_GetNumInssInCty (long CtyCod)
char Query[128]; char Query[128];
/***** Get number of degrees of a place from database *****/ /***** Get number of degrees of a place from database *****/
sprintf (Query,"SELECT COUNT(*) FROM institutions" sprintf (Query,"SELECT COUNT(*) FROM institutions WHERE CtyCod='%ld'",
" WHERE CtyCod='%ld'",CtyCod); CtyCod);
return (unsigned) DB_QueryCOUNT (Query,"can not get the number of institutions in a country"); return (unsigned) DB_QueryCOUNT (Query,"can not get the number of institutions in a country");
} }
@ -2505,7 +2504,7 @@ unsigned Ins_GetNumInssWithCrss (const char *SubQuery)
unsigned Ins_GetNumInssWithUsrs (Rol_Role_t Role,const char *SubQuery) unsigned Ins_GetNumInssWithUsrs (Rol_Role_t Role,const char *SubQuery)
{ {
char Query[512]; char Query[1024];
/***** Get number of institutions with users from database *****/ /***** Get number of institutions with users from database *****/
sprintf (Query,"SELECT COUNT(DISTINCT institutions.InsCod)" sprintf (Query,"SELECT COUNT(DISTINCT institutions.InsCod)"