mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-05 08:15:25 +02:00
Version 20.45.2: Mar 08, 2021 Countries database table renamed.
This commit is contained in:
parent
eda9c23757
commit
0b763bd132
112
sql/swad.sql
112
sql/swad.sql
|
@ -165,26 +165,6 @@ CREATE TABLE IF NOT EXISTS buildings (
|
||||||
UNIQUE INDEX(BldCod),
|
UNIQUE INDEX(BldCod),
|
||||||
INDEX(CtrCod));
|
INDEX(CtrCod));
|
||||||
--
|
--
|
||||||
-- Table ctr_centers: centers (faculties, schools...)
|
|
||||||
--
|
|
||||||
CREATE TABLE IF NOT EXISTS ctr_centers (
|
|
||||||
CtrCod INT NOT NULL AUTO_INCREMENT,
|
|
||||||
InsCod INT NOT NULL,
|
|
||||||
PlcCod INT NOT NULL DEFAULT -1,
|
|
||||||
Status TINYINT NOT NULL DEFAULT 0,
|
|
||||||
RequesterUsrCod INT NOT NULL DEFAULT -1,
|
|
||||||
Latitude DOUBLE PRECISION NOT NULL DEFAULT 0,
|
|
||||||
Longitude DOUBLE PRECISION NOT NULL DEFAULT 0,
|
|
||||||
Altitude DOUBLE PRECISION NOT NULL DEFAULT 0,
|
|
||||||
ShortName VARCHAR(511) COLLATE latin1_spanish_ci NOT NULL,
|
|
||||||
FullName VARCHAR(2047) COLLATE latin1_spanish_ci NOT NULL,
|
|
||||||
WWW VARCHAR(255) NOT NULL,
|
|
||||||
PhotoAttribution TEXT NOT NULL,
|
|
||||||
UNIQUE INDEX(CtrCod),
|
|
||||||
INDEX(InsCod),
|
|
||||||
INDEX(PlcCod),
|
|
||||||
INDEX(Status));
|
|
||||||
--
|
|
||||||
-- Table chat: stores number of users in each chat room (this table is not used now)
|
-- Table chat: stores number of users in each chat room (this table is not used now)
|
||||||
--
|
--
|
||||||
CREATE TABLE IF NOT EXISTS chat (
|
CREATE TABLE IF NOT EXISTS chat (
|
||||||
|
@ -224,42 +204,6 @@ CREATE TABLE IF NOT EXISTS connected (
|
||||||
INDEX(RoleInLastCrs),
|
INDEX(RoleInLastCrs),
|
||||||
INDEX(LastCrsCod));
|
INDEX(LastCrsCod));
|
||||||
--
|
--
|
||||||
-- Table countries: stores the countries
|
|
||||||
--
|
|
||||||
CREATE TABLE IF NOT EXISTS countries (
|
|
||||||
CtyCod INT NOT NULL,
|
|
||||||
Alpha2 CHAR(2) NOT NULL,
|
|
||||||
MapAttribution TEXT NOT NULL,
|
|
||||||
Name_ca VARCHAR(767) NOT NULL,
|
|
||||||
Name_de VARCHAR(767) NOT NULL,
|
|
||||||
Name_en VARCHAR(767) NOT NULL,
|
|
||||||
Name_es VARCHAR(767) NOT NULL,
|
|
||||||
Name_fr VARCHAR(767) NOT NULL,
|
|
||||||
Name_gn VARCHAR(767) NOT NULL,
|
|
||||||
Name_it VARCHAR(767) NOT NULL,
|
|
||||||
Name_pl VARCHAR(767) NOT NULL,
|
|
||||||
Name_pt VARCHAR(767) NOT NULL,
|
|
||||||
WWW_ca VARCHAR(255) NOT NULL,
|
|
||||||
WWW_de VARCHAR(255) NOT NULL,
|
|
||||||
WWW_en VARCHAR(255) NOT NULL,
|
|
||||||
WWW_es VARCHAR(255) NOT NULL,
|
|
||||||
WWW_fr VARCHAR(255) NOT NULL,
|
|
||||||
WWW_gn VARCHAR(255) NOT NULL,
|
|
||||||
WWW_it VARCHAR(255) NOT NULL,
|
|
||||||
WWW_pl VARCHAR(255) NOT NULL,
|
|
||||||
WWW_pt VARCHAR(255) NOT NULL,
|
|
||||||
UNIQUE INDEX(CtyCod),
|
|
||||||
UNIQUE INDEX(Alpha2),
|
|
||||||
INDEX(Name_ca),
|
|
||||||
INDEX(Name_de),
|
|
||||||
INDEX(Name_en),
|
|
||||||
INDEX(Name_es),
|
|
||||||
INDEX(Name_fr),
|
|
||||||
INDEX(Name_gn),
|
|
||||||
INDEX(Name_it),
|
|
||||||
INDEX(Name_pl),
|
|
||||||
INDEX(Name_pt));
|
|
||||||
--
|
|
||||||
-- Table crs_courses: stores the courses/subjects
|
-- Table crs_courses: stores the courses/subjects
|
||||||
--
|
--
|
||||||
CREATE TABLE IF NOT EXISTS crs_courses (
|
CREATE TABLE IF NOT EXISTS crs_courses (
|
||||||
|
@ -409,6 +353,62 @@ CREATE TABLE IF NOT EXISTS crs_usr_requests (
|
||||||
UNIQUE INDEX(CrsCod,UsrCod),
|
UNIQUE INDEX(CrsCod,UsrCod),
|
||||||
INDEX(UsrCod));
|
INDEX(UsrCod));
|
||||||
--
|
--
|
||||||
|
-- Table ctr_centers: centers (faculties, schools...)
|
||||||
|
--
|
||||||
|
CREATE TABLE IF NOT EXISTS ctr_centers (
|
||||||
|
CtrCod INT NOT NULL AUTO_INCREMENT,
|
||||||
|
InsCod INT NOT NULL,
|
||||||
|
PlcCod INT NOT NULL DEFAULT -1,
|
||||||
|
Status TINYINT NOT NULL DEFAULT 0,
|
||||||
|
RequesterUsrCod INT NOT NULL DEFAULT -1,
|
||||||
|
Latitude DOUBLE PRECISION NOT NULL DEFAULT 0,
|
||||||
|
Longitude DOUBLE PRECISION NOT NULL DEFAULT 0,
|
||||||
|
Altitude DOUBLE PRECISION NOT NULL DEFAULT 0,
|
||||||
|
ShortName VARCHAR(511) COLLATE latin1_spanish_ci NOT NULL,
|
||||||
|
FullName VARCHAR(2047) COLLATE latin1_spanish_ci NOT NULL,
|
||||||
|
WWW VARCHAR(255) NOT NULL,
|
||||||
|
PhotoAttribution TEXT NOT NULL,
|
||||||
|
UNIQUE INDEX(CtrCod),
|
||||||
|
INDEX(InsCod),
|
||||||
|
INDEX(PlcCod),
|
||||||
|
INDEX(Status));
|
||||||
|
--
|
||||||
|
-- Table cty_countrs: stores the countries
|
||||||
|
--
|
||||||
|
CREATE TABLE IF NOT EXISTS cty_countrs (
|
||||||
|
CtyCod INT NOT NULL,
|
||||||
|
Alpha2 CHAR(2) NOT NULL,
|
||||||
|
MapAttribution TEXT NOT NULL,
|
||||||
|
Name_ca VARCHAR(767) NOT NULL,
|
||||||
|
Name_de VARCHAR(767) NOT NULL,
|
||||||
|
Name_en VARCHAR(767) NOT NULL,
|
||||||
|
Name_es VARCHAR(767) NOT NULL,
|
||||||
|
Name_fr VARCHAR(767) NOT NULL,
|
||||||
|
Name_gn VARCHAR(767) NOT NULL,
|
||||||
|
Name_it VARCHAR(767) NOT NULL,
|
||||||
|
Name_pl VARCHAR(767) NOT NULL,
|
||||||
|
Name_pt VARCHAR(767) NOT NULL,
|
||||||
|
WWW_ca VARCHAR(255) NOT NULL,
|
||||||
|
WWW_de VARCHAR(255) NOT NULL,
|
||||||
|
WWW_en VARCHAR(255) NOT NULL,
|
||||||
|
WWW_es VARCHAR(255) NOT NULL,
|
||||||
|
WWW_fr VARCHAR(255) NOT NULL,
|
||||||
|
WWW_gn VARCHAR(255) NOT NULL,
|
||||||
|
WWW_it VARCHAR(255) NOT NULL,
|
||||||
|
WWW_pl VARCHAR(255) NOT NULL,
|
||||||
|
WWW_pt VARCHAR(255) NOT NULL,
|
||||||
|
UNIQUE INDEX(CtyCod),
|
||||||
|
UNIQUE INDEX(Alpha2),
|
||||||
|
INDEX(Name_ca),
|
||||||
|
INDEX(Name_de),
|
||||||
|
INDEX(Name_en),
|
||||||
|
INDEX(Name_es),
|
||||||
|
INDEX(Name_fr),
|
||||||
|
INDEX(Name_gn),
|
||||||
|
INDEX(Name_it),
|
||||||
|
INDEX(Name_pl),
|
||||||
|
INDEX(Name_pt));
|
||||||
|
--
|
||||||
-- Table debug: used for debugging purposes
|
-- Table debug: used for debugging purposes
|
||||||
--
|
--
|
||||||
CREATE TABLE IF NOT EXISTS debug (
|
CREATE TABLE IF NOT EXISTS debug (
|
||||||
|
|
|
@ -600,17 +600,21 @@ TODO: Salvador Romero Cort
|
||||||
|
|
||||||
TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria.
|
TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria.
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 20.45.1 (2021-03-07)"
|
#define Log_PLATFORM_VERSION "SWAD 20.45.2 (2021-03-08)"
|
||||||
#define CSS_FILE "swad20.45.css"
|
#define CSS_FILE "swad20.45.css"
|
||||||
#define JS_FILE "swad20.6.2.js"
|
#define JS_FILE "swad20.6.2.js"
|
||||||
/*
|
/*
|
||||||
Version 20.45.1: Mar 06, 2021 Institutions database table renamed. (307120 lines)
|
TODO: Rename CENTRE to CENTER in help wiki.
|
||||||
|
|
||||||
|
Version 20.45.2: Mar 08, 2021 Institutions database table renamed. (307156 lines)
|
||||||
|
1 change necessary in database:
|
||||||
|
RENAME TABLE countries TO cty_countrs;
|
||||||
|
|
||||||
|
Version 20.45.1: Mar 07, 2021 Institutions database table renamed. (307120 lines)
|
||||||
1 change necessary in database:
|
1 change necessary in database:
|
||||||
RENAME TABLE institutions TO ins_instits;
|
RENAME TABLE institutions TO ins_instits;
|
||||||
|
|
||||||
TODO: Rename CENTRE to CENTER in help wiki.
|
Version 20.45: Mar 07, 2021 Centers database table renamed.
|
||||||
|
|
||||||
Version 20.45: Mar 06, 2021 Centers database table renamed.
|
|
||||||
All variables and files related to centers renamed. (307106 lines)
|
All variables and files related to centers renamed. (307106 lines)
|
||||||
1 change necessary in database:
|
1 change necessary in database:
|
||||||
RENAME TABLE centres TO ctr_centers;
|
RENAME TABLE centres TO ctr_centers;
|
||||||
|
|
121
swad_country.c
121
swad_country.c
|
@ -129,11 +129,11 @@ void Cty_SeeCtyWithPendingInss (void)
|
||||||
"SELECT ins_instits.CtyCod,"
|
"SELECT ins_instits.CtyCod,"
|
||||||
"COUNT(*)"
|
"COUNT(*)"
|
||||||
" FROM ins_instits,"
|
" FROM ins_instits,"
|
||||||
"countries"
|
"cty_countrs"
|
||||||
" WHERE (ins_instits.Status & %u)<>0"
|
" WHERE (ins_instits.Status & %u)<>0"
|
||||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
" AND ins_instits.CtyCod=cty_countrs.CtyCod"
|
||||||
" GROUP BY ins_instits.CtyCod"
|
" GROUP BY ins_instits.CtyCod"
|
||||||
" ORDER BY countries.Name_%s",
|
" ORDER BY cty_countrs.Name_%s",
|
||||||
(unsigned) Ins_STATUS_BIT_PENDING,
|
(unsigned) Ins_STATUS_BIT_PENDING,
|
||||||
Lan_STR_LANG_ID[Gbl.Prefs.Language]);
|
Lan_STR_LANG_ID[Gbl.Prefs.Language]);
|
||||||
break;
|
break;
|
||||||
|
@ -760,8 +760,11 @@ void Cty_GetBasicListOfCountries (void)
|
||||||
|
|
||||||
/***** Get countries from database *****/
|
/***** Get countries from database *****/
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get countries",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get countries",
|
||||||
"SELECT CtyCod,Alpha2,Name_%s"
|
"SELECT CtyCod," // row[0]
|
||||||
" FROM countries ORDER BY Name_%s",
|
"Alpha2," // row[1]
|
||||||
|
"Name_%s" // row[2]
|
||||||
|
" FROM cty_countrs"
|
||||||
|
" ORDER BY Name_%s",
|
||||||
Lan_STR_LANG_ID[Gbl.Prefs.Language],
|
Lan_STR_LANG_ID[Gbl.Prefs.Language],
|
||||||
Lan_STR_LANG_ID[Gbl.Prefs.Language]);
|
Lan_STR_LANG_ID[Gbl.Prefs.Language]);
|
||||||
if (NumRows) // Countries found...
|
if (NumRows) // Countries found...
|
||||||
|
@ -850,12 +853,12 @@ void Cty_GetFullListOfCountries (void)
|
||||||
Lan <= (Lan_Language_t) Lan_NUM_LANGUAGES;
|
Lan <= (Lan_Language_t) Lan_NUM_LANGUAGES;
|
||||||
Lan++)
|
Lan++)
|
||||||
{
|
{
|
||||||
snprintf (StrField,sizeof (StrField),"countries.Name_%s,",Lan_STR_LANG_ID[Lan]);
|
snprintf (StrField,sizeof (StrField),"cty_countrs.Name_%s,",Lan_STR_LANG_ID[Lan]);
|
||||||
Str_Concat (SubQueryNam1,StrField,sizeof (SubQueryNam1) - 1);
|
Str_Concat (SubQueryNam1,StrField,sizeof (SubQueryNam1) - 1);
|
||||||
snprintf (StrField,sizeof (StrField),"Name_%s,",Lan_STR_LANG_ID[Lan]);
|
snprintf (StrField,sizeof (StrField),"Name_%s,",Lan_STR_LANG_ID[Lan]);
|
||||||
Str_Concat (SubQueryNam2,StrField,sizeof (SubQueryNam2) - 1);
|
Str_Concat (SubQueryNam2,StrField,sizeof (SubQueryNam2) - 1);
|
||||||
|
|
||||||
snprintf (StrField,sizeof (StrField),"countries.WWW_%s,",Lan_STR_LANG_ID[Lan]);
|
snprintf (StrField,sizeof (StrField),"cty_countrs.WWW_%s,",Lan_STR_LANG_ID[Lan]);
|
||||||
Str_Concat (SubQueryWWW1,StrField,sizeof (SubQueryWWW1) - 1);
|
Str_Concat (SubQueryWWW1,StrField,sizeof (SubQueryWWW1) - 1);
|
||||||
snprintf (StrField,sizeof (StrField),"WWW_%s,",Lan_STR_LANG_ID[Lan]);
|
snprintf (StrField,sizeof (StrField),"WWW_%s,",Lan_STR_LANG_ID[Lan]);
|
||||||
Str_Concat (SubQueryWWW2,StrField,sizeof (SubQueryWWW2) - 1);
|
Str_Concat (SubQueryWWW2,StrField,sizeof (SubQueryWWW2) - 1);
|
||||||
|
@ -868,14 +871,22 @@ void Cty_GetFullListOfCountries (void)
|
||||||
|
|
||||||
/* Query database */
|
/* Query database */
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get countries",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get countries",
|
||||||
"(SELECT countries.CtyCod,countries.Alpha2,"
|
"(SELECT cty_countrs.CtyCod," // row[0]
|
||||||
"%s%sCOUNT(*) AS NumUsrs"
|
"cty_countrs.Alpha2," // row[1]
|
||||||
" FROM countries,usr_data"
|
"%s" // row[...]
|
||||||
" WHERE countries.CtyCod=usr_data.CtyCod"
|
"%s" // row[...]
|
||||||
" GROUP BY countries.CtyCod)"
|
"COUNT(*) AS NumUsrs" // row[...]
|
||||||
|
" FROM cty_countrs,"
|
||||||
|
"usr_data"
|
||||||
|
" WHERE cty_countrs.CtyCod=usr_data.CtyCod"
|
||||||
|
" GROUP BY cty_countrs.CtyCod)"
|
||||||
" UNION "
|
" UNION "
|
||||||
"(SELECT CtyCod,Alpha2,%s%s0 AS NumUsrs"
|
"(SELECT CtyCod," // row[0]
|
||||||
" FROM countries"
|
"Alpha2," // row[1]
|
||||||
|
"%s" // row[...]
|
||||||
|
"%s" // row[...]
|
||||||
|
"0 AS NumUsrs" // row[...]
|
||||||
|
" FROM cty_countrs"
|
||||||
" WHERE CtyCod NOT IN"
|
" WHERE CtyCod NOT IN"
|
||||||
" (SELECT DISTINCT CtyCod FROM usr_data))"
|
" (SELECT DISTINCT CtyCod FROM usr_data))"
|
||||||
" ORDER BY %s",
|
" ORDER BY %s",
|
||||||
|
@ -958,10 +969,12 @@ void Cty_WriteSelectorOfCountry (void)
|
||||||
"[%s]",Txt_Country);
|
"[%s]",Txt_Country);
|
||||||
|
|
||||||
/***** Get countries from database *****/
|
/***** Get countries from database *****/
|
||||||
NumCtys = (unsigned) DB_QuerySELECT (&mysql_res,"can not get countries",
|
NumCtys = (unsigned)
|
||||||
"SELECT DISTINCT CtyCod,Name_%s"
|
DB_QuerySELECT (&mysql_res,"can not get countries",
|
||||||
" FROM countries"
|
"SELECT DISTINCT CtyCod," // row[0]
|
||||||
" ORDER BY countries.Name_%s",
|
"Name_%s" // row[1]
|
||||||
|
" FROM cty_countrs"
|
||||||
|
" ORDER BY Name_%s",
|
||||||
Lan_STR_LANG_ID[Gbl.Prefs.Language],
|
Lan_STR_LANG_ID[Gbl.Prefs.Language],
|
||||||
Lan_STR_LANG_ID[Gbl.Prefs.Language]);
|
Lan_STR_LANG_ID[Gbl.Prefs.Language]);
|
||||||
|
|
||||||
|
@ -1066,8 +1079,10 @@ bool Cty_GetDataOfCountryByCod (struct Cty_Countr *Cty)
|
||||||
|
|
||||||
/***** Get data of a country from database *****/
|
/***** Get data of a country from database *****/
|
||||||
NumRows = DB_QuerySELECT (&mysql_res,"can not get data of a country",
|
NumRows = DB_QuerySELECT (&mysql_res,"can not get data of a country",
|
||||||
"SELECT Alpha2,Name_%s,WWW_%s"
|
"SELECT Alpha2," // row[0]
|
||||||
" FROM countries"
|
"Name_%s," // row[1]
|
||||||
|
"WWW_%s" // row[2]
|
||||||
|
" FROM cty_countrs"
|
||||||
" WHERE CtyCod='%03ld'",
|
" WHERE CtyCod='%03ld'",
|
||||||
Lan_STR_LANG_ID[Gbl.Prefs.Language],
|
Lan_STR_LANG_ID[Gbl.Prefs.Language],
|
||||||
Lan_STR_LANG_ID[Gbl.Prefs.Language],
|
Lan_STR_LANG_ID[Gbl.Prefs.Language],
|
||||||
|
@ -1137,7 +1152,9 @@ void Cty_GetCountryName (long CtyCod,Lan_Language_t Language,
|
||||||
Gbl.Cache.CountryName.Language = Language;
|
Gbl.Cache.CountryName.Language = Language;
|
||||||
|
|
||||||
if (DB_QuerySELECT (&mysql_res,"can not get the name of a country",
|
if (DB_QuerySELECT (&mysql_res,"can not get the name of a country",
|
||||||
"SELECT Name_%s FROM countries WHERE CtyCod='%03ld'",
|
"SELECT Name_%s" // row[0]
|
||||||
|
" FROM cty_countrs"
|
||||||
|
" WHERE CtyCod='%03ld'",
|
||||||
Lan_STR_LANG_ID[Language],CtyCod)) // Country found...
|
Lan_STR_LANG_ID[Language],CtyCod)) // Country found...
|
||||||
{
|
{
|
||||||
/* Get row */
|
/* Get row */
|
||||||
|
@ -1359,7 +1376,8 @@ void Cty_RemoveCountry (void)
|
||||||
|
|
||||||
/***** Remove country *****/
|
/***** Remove country *****/
|
||||||
DB_QueryDELETE ("can not remove a country",
|
DB_QueryDELETE ("can not remove a country",
|
||||||
"DELETE FROM countries WHERE CtyCod='%03ld'",
|
"DELETE FROM cty_countrs"
|
||||||
|
" WHERE CtyCod='%03ld'",
|
||||||
Cty_EditingCty->CtyCod);
|
Cty_EditingCty->CtyCod);
|
||||||
|
|
||||||
/***** Flush cache *****/
|
/***** Flush cache *****/
|
||||||
|
@ -1457,7 +1475,8 @@ static bool Cty_CheckIfNumericCountryCodeExists (long CtyCod)
|
||||||
/***** Get number of countries with a name from database *****/
|
/***** Get number of countries with a name from database *****/
|
||||||
return (DB_QueryCOUNT ("can not check if the numeric code"
|
return (DB_QueryCOUNT ("can not check if the numeric code"
|
||||||
" of a country already existed",
|
" of a country already existed",
|
||||||
"SELECT COUNT(*) FROM countries"
|
"SELECT COUNT(*)"
|
||||||
|
" FROM cty_countrs"
|
||||||
" WHERE CtyCod='%03ld'",
|
" WHERE CtyCod='%03ld'",
|
||||||
CtyCod) != 0);
|
CtyCod) != 0);
|
||||||
}
|
}
|
||||||
|
@ -1471,7 +1490,8 @@ static bool Cty_CheckIfAlpha2CountryCodeExists (const char Alpha2[2 + 1])
|
||||||
/***** Get number of countries with a name from database *****/
|
/***** Get number of countries with a name from database *****/
|
||||||
return (DB_QueryCOUNT ("can not check if the alphabetic code"
|
return (DB_QueryCOUNT ("can not check if the alphabetic code"
|
||||||
" of a country already existed",
|
" of a country already existed",
|
||||||
"SELECT COUNT(*) FROM countries"
|
"SELECT COUNT(*)"
|
||||||
|
" FROM cty_countrs"
|
||||||
" WHERE Alpha2='%s'",
|
" WHERE Alpha2='%s'",
|
||||||
Alpha2) != 0);
|
Alpha2) != 0);
|
||||||
}
|
}
|
||||||
|
@ -1487,9 +1507,12 @@ static bool Cty_CheckIfCountryNameExists (Lan_Language_t Language,const char *Na
|
||||||
/***** Get number of countries with a name from database *****/
|
/***** Get number of countries with a name from database *****/
|
||||||
return (DB_QueryCOUNT ("can not check if the name"
|
return (DB_QueryCOUNT ("can not check if the name"
|
||||||
" of a country already existed",
|
" of a country already existed",
|
||||||
"SELECT COUNT(*) FROM countries"
|
"SELECT COUNT(*)"
|
||||||
" WHERE Name_%s='%s' AND CtyCod<>'%03ld'",
|
" FROM cty_countrs"
|
||||||
Lan_STR_LANG_ID[Language],Name,CtyCod) != 0);
|
" WHERE Name_%s='%s'"
|
||||||
|
" AND CtyCod<>'%03ld'",
|
||||||
|
Lan_STR_LANG_ID[Language],Name,
|
||||||
|
CtyCod) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1500,8 +1523,11 @@ static void Cty_UpdateCtyNameDB (long CtyCod,const char *FieldName,const char *N
|
||||||
{
|
{
|
||||||
/***** Update country changing old name by new name */
|
/***** Update country changing old name by new name */
|
||||||
DB_QueryUPDATE ("can not update the name of a country",
|
DB_QueryUPDATE ("can not update the name of a country",
|
||||||
"UPDATE countries SET %s='%s' WHERE CtyCod='%03ld'",
|
"UPDATE cty_countrs"
|
||||||
FieldName,NewCtyName,CtyCod);
|
" SET %s='%s'"
|
||||||
|
" WHERE CtyCod='%03ld'",
|
||||||
|
FieldName,NewCtyName,
|
||||||
|
CtyCod);
|
||||||
|
|
||||||
/***** Flush cache *****/
|
/***** Flush cache *****/
|
||||||
Cty_FlushCacheCountryName ();
|
Cty_FlushCacheCountryName ();
|
||||||
|
@ -1535,7 +1561,8 @@ void Cty_ChangeCtyWWW (void)
|
||||||
|
|
||||||
/***** Update the table changing old WWW by new WWW *****/
|
/***** Update the table changing old WWW by new WWW *****/
|
||||||
DB_QueryUPDATE ("can not update the web of a country",
|
DB_QueryUPDATE ("can not update the web of a country",
|
||||||
"UPDATE countries SET WWW_%s='%s'"
|
"UPDATE cty_countrs"
|
||||||
|
" SET WWW_%s='%s'"
|
||||||
" WHERE CtyCod='%03ld'",
|
" WHERE CtyCod='%03ld'",
|
||||||
Lan_STR_LANG_ID[Language],NewWWW,Cty_EditingCty->CtyCod);
|
Lan_STR_LANG_ID[Language],NewWWW,Cty_EditingCty->CtyCod);
|
||||||
Str_Copy (Cty_EditingCty->WWW[Language],NewWWW,
|
Str_Copy (Cty_EditingCty->WWW[Language],NewWWW,
|
||||||
|
@ -1866,7 +1893,7 @@ static void Cty_CreateCountry (void)
|
||||||
Str_Concat (SubQueryWWW2,"'",sizeof (SubQueryWWW2) - 1);
|
Str_Concat (SubQueryWWW2,"'",sizeof (SubQueryWWW2) - 1);
|
||||||
}
|
}
|
||||||
DB_QueryINSERT ("can not create country",
|
DB_QueryINSERT ("can not create country",
|
||||||
"INSERT INTO countries"
|
"INSERT INTO cty_countrs"
|
||||||
" (CtyCod,Alpha2,MapAttribution%s%s)"
|
" (CtyCod,Alpha2,MapAttribution%s%s)"
|
||||||
" VALUES"
|
" VALUES"
|
||||||
" ('%03ld','%s',''%s%s)",
|
" ('%03ld','%s',''%s%s)",
|
||||||
|
@ -1888,7 +1915,7 @@ unsigned Cty_GetCachedNumCtysInSys (void)
|
||||||
FigCch_UNSIGNED,&NumCtys))
|
FigCch_UNSIGNED,&NumCtys))
|
||||||
{
|
{
|
||||||
/***** Get current number of countries from database and update cache *****/
|
/***** Get current number of countries from database and update cache *****/
|
||||||
NumCtys = (unsigned) DB_GetNumRowsTable ("countries");
|
NumCtys = (unsigned) DB_GetNumRowsTable ("cty_countrs");
|
||||||
FigCch_UpdateFigureIntoCache (FigCch_NUM_CTYS,Hie_Lvl_SYS,-1L,
|
FigCch_UpdateFigureIntoCache (FigCch_NUM_CTYS,Hie_Lvl_SYS,-1L,
|
||||||
FigCch_UNSIGNED,&NumCtys);
|
FigCch_UNSIGNED,&NumCtys);
|
||||||
}
|
}
|
||||||
|
@ -1911,10 +1938,10 @@ unsigned Cty_GetCachedNumCtysWithInss (void)
|
||||||
/***** Get current number of countries with institutions from cache *****/
|
/***** Get current number of countries with institutions from cache *****/
|
||||||
NumCtysWithInss = (unsigned)
|
NumCtysWithInss = (unsigned)
|
||||||
DB_QueryCOUNT ("can not get number of countries with institutions",
|
DB_QueryCOUNT ("can not get number of countries with institutions",
|
||||||
"SELECT COUNT(DISTINCT countries.CtyCod)"
|
"SELECT COUNT(DISTINCT cty_countrs.CtyCod)"
|
||||||
" FROM countries,"
|
" FROM cty_countrs,"
|
||||||
"ins_instits"
|
"ins_instits"
|
||||||
" WHERE countries.CtyCod=ins_instits.CtyCod");
|
" WHERE cty_countrs.CtyCod=ins_instits.CtyCod");
|
||||||
FigCch_UpdateFigureIntoCache (FigCch_NUM_CTYS_WITH_INSS,Hie_Lvl_SYS,-1L,
|
FigCch_UpdateFigureIntoCache (FigCch_NUM_CTYS_WITH_INSS,Hie_Lvl_SYS,-1L,
|
||||||
FigCch_UNSIGNED,&NumCtysWithInss);
|
FigCch_UNSIGNED,&NumCtysWithInss);
|
||||||
}
|
}
|
||||||
|
@ -1937,11 +1964,11 @@ unsigned Cty_GetCachedNumCtysWithCtrs (void)
|
||||||
/***** Get current number of countries with centers from database and update cache *****/
|
/***** Get current number of countries with centers from database and update cache *****/
|
||||||
NumCtysWithCtrs = (unsigned)
|
NumCtysWithCtrs = (unsigned)
|
||||||
DB_QueryCOUNT ("can not get number of countries with centers",
|
DB_QueryCOUNT ("can not get number of countries with centers",
|
||||||
"SELECT COUNT(DISTINCT countries.CtyCod)"
|
"SELECT COUNT(DISTINCT cty_countrs.CtyCod)"
|
||||||
" FROM countries,"
|
" FROM cty_countrs,"
|
||||||
"ins_instits,"
|
"ins_instits,"
|
||||||
"ctr_centers"
|
"ctr_centers"
|
||||||
" WHERE countries.CtyCod=ins_instits.CtyCod"
|
" WHERE cty_countrs.CtyCod=ins_instits.CtyCod"
|
||||||
" AND ins_instits.InsCod=ctr_centers.InsCod");
|
" AND ins_instits.InsCod=ctr_centers.InsCod");
|
||||||
FigCch_UpdateFigureIntoCache (FigCch_NUM_CTYS_WITH_CTRS,Hie_Lvl_SYS,-1L,
|
FigCch_UpdateFigureIntoCache (FigCch_NUM_CTYS_WITH_CTRS,Hie_Lvl_SYS,-1L,
|
||||||
FigCch_UNSIGNED,&NumCtysWithCtrs);
|
FigCch_UNSIGNED,&NumCtysWithCtrs);
|
||||||
|
@ -1963,12 +1990,12 @@ unsigned Cty_GetCachedNumCtysWithDegs (void)
|
||||||
{
|
{
|
||||||
NumCtysWithDegs = (unsigned)
|
NumCtysWithDegs = (unsigned)
|
||||||
DB_QueryCOUNT ("can not get number of countries with degrees",
|
DB_QueryCOUNT ("can not get number of countries with degrees",
|
||||||
"SELECT COUNT(DISTINCT countries.CtyCod)"
|
"SELECT COUNT(DISTINCT cty_countrs.CtyCod)"
|
||||||
" FROM countries,"
|
" FROM cty_countrs,"
|
||||||
"ins_instits,"
|
"ins_instits,"
|
||||||
"ctr_centers,"
|
"ctr_centers,"
|
||||||
"deg_degrees"
|
"deg_degrees"
|
||||||
" WHERE countries.CtyCod=ins_instits.CtyCod"
|
" WHERE cty_countrs.CtyCod=ins_instits.CtyCod"
|
||||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod");
|
" AND ctr_centers.CtrCod=deg_degrees.CtrCod");
|
||||||
FigCch_UpdateFigureIntoCache (FigCch_NUM_CTYS_WITH_DEGS,Hie_Lvl_SYS,-1L,
|
FigCch_UpdateFigureIntoCache (FigCch_NUM_CTYS_WITH_DEGS,Hie_Lvl_SYS,-1L,
|
||||||
|
@ -1993,13 +2020,13 @@ unsigned Cty_GetCachedNumCtysWithCrss (void)
|
||||||
/***** Get current number of countries with courses from database and update cache *****/
|
/***** Get current number of countries with courses from database and update cache *****/
|
||||||
NumCtysWithCrss = (unsigned)
|
NumCtysWithCrss = (unsigned)
|
||||||
DB_QueryCOUNT ("can not get number of countries with courses",
|
DB_QueryCOUNT ("can not get number of countries with courses",
|
||||||
"SELECT COUNT(DISTINCT countries.CtyCod)"
|
"SELECT COUNT(DISTINCT cty_countrs.CtyCod)"
|
||||||
" FROM countries,"
|
" FROM cty_countrs,"
|
||||||
"ins_instits,"
|
"ins_instits,"
|
||||||
"ctr_centers,"
|
"ctr_centers,"
|
||||||
"deg_degrees,"
|
"deg_degrees,"
|
||||||
"crs_courses"
|
"crs_courses"
|
||||||
" WHERE countries.CtyCod=ins_instits.CtyCod"
|
" WHERE cty_countrs.CtyCod=ins_instits.CtyCod"
|
||||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||||
" AND deg_degrees.DegCod=crs_courses.DegCod");
|
" AND deg_degrees.DegCod=crs_courses.DegCod");
|
||||||
|
@ -2032,14 +2059,14 @@ unsigned Cty_GetCachedNumCtysWithUsrs (Rol_Role_t Role,const char *SubQuery,
|
||||||
/***** Get current number of countries with users from database and update cache *****/
|
/***** Get current number of countries with users from database and update cache *****/
|
||||||
NumCtysWithUsrs = (unsigned)
|
NumCtysWithUsrs = (unsigned)
|
||||||
DB_QueryCOUNT ("can not get number of countries with users",
|
DB_QueryCOUNT ("can not get number of countries with users",
|
||||||
"SELECT COUNT(DISTINCT countries.CtyCod)"
|
"SELECT COUNT(DISTINCT cty_countrs.CtyCod)"
|
||||||
" FROM countries,"
|
" FROM cty_countrs,"
|
||||||
"ins_instits,"
|
"ins_instits,"
|
||||||
"ctr_centers,"
|
"ctr_centers,"
|
||||||
"deg_degrees,"
|
"deg_degrees,"
|
||||||
"crs_courses,"
|
"crs_courses,"
|
||||||
"crs_usr"
|
"crs_usr"
|
||||||
" WHERE %scountries.CtyCod=ins_instits.CtyCod"
|
" WHERE %scty_countrs.CtyCod=ins_instits.CtyCod"
|
||||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||||
|
|
|
@ -583,7 +583,9 @@ static void CtyCfg_GetMapAttr (long CtyCod,char **MapAttribution)
|
||||||
|
|
||||||
/***** Get photo attribution from database *****/
|
/***** Get photo attribution from database *****/
|
||||||
if (DB_QuerySELECT (&mysql_res,"can not get photo attribution",
|
if (DB_QuerySELECT (&mysql_res,"can not get photo attribution",
|
||||||
"SELECT MapAttribution FROM countries WHERE CtyCod=%ld",
|
"SELECT MapAttribution"
|
||||||
|
" FROM cty_countrs"
|
||||||
|
" WHERE CtyCod=%ld",
|
||||||
CtyCod))
|
CtyCod))
|
||||||
{
|
{
|
||||||
/* Get row */
|
/* Get row */
|
||||||
|
@ -631,7 +633,8 @@ void CtyCfg_ChangeCtyMapAttr (void)
|
||||||
|
|
||||||
/***** Update the table changing old attribution by new attribution *****/
|
/***** Update the table changing old attribution by new attribution *****/
|
||||||
DB_QueryUPDATE ("can not update the map attribution of a country",
|
DB_QueryUPDATE ("can not update the map attribution of a country",
|
||||||
"UPDATE countries SET MapAttribution='%s'"
|
"UPDATE cty_countrs"
|
||||||
|
" SET MapAttribution='%s'"
|
||||||
" WHERE CtyCod='%03ld'",
|
" WHERE CtyCod='%03ld'",
|
||||||
NewMapAttribution,Gbl.Hierarchy.Cty.CtyCod);
|
NewMapAttribution,Gbl.Hierarchy.Cty.CtyCod);
|
||||||
|
|
||||||
|
|
204
swad_database.c
204
swad_database.c
|
@ -420,45 +420,6 @@ mysql> DESCRIBE buildings;
|
||||||
"UNIQUE INDEX(BldCod),"
|
"UNIQUE INDEX(BldCod),"
|
||||||
"INDEX(CtrCod))");
|
"INDEX(CtrCod))");
|
||||||
|
|
||||||
/***** Table ctr_centers *****/
|
|
||||||
/*
|
|
||||||
mysql> DESCRIBE ctr_centers;
|
|
||||||
+------------------+---------------+------+-----+---------+----------------+
|
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
|
||||||
+------------------+---------------+------+-----+---------+----------------+
|
|
||||||
| CtrCod | int(11) | NO | PRI | NULL | auto_increment |
|
|
||||||
| InsCod | int(11) | NO | MUL | NULL | |
|
|
||||||
| PlcCod | int(11) | NO | MUL | -1 | |
|
|
||||||
| Status | tinyint(4) | NO | MUL | 0 | |
|
|
||||||
| RequesterUsrCod | int(11) | NO | | -1 | |
|
|
||||||
| Latitude | double | NO | | 0 | |
|
|
||||||
| Longitude | double | NO | | 0 | |
|
|
||||||
| Altitude | double | NO | | 0 | |
|
|
||||||
| ShortName | varchar(511) | NO | | NULL | |
|
|
||||||
| FullName | varchar(2047) | NO | | NULL | |
|
|
||||||
| WWW | varchar(255) | NO | | NULL | |
|
|
||||||
| PhotoAttribution | text | NO | | NULL | |
|
|
||||||
+------------------+---------------+------+-----+---------+----------------+
|
|
||||||
12 rows in set (0.00 sec)
|
|
||||||
*/
|
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS ctr_centers ("
|
|
||||||
"CtrCod INT NOT NULL AUTO_INCREMENT,"
|
|
||||||
"InsCod INT NOT NULL,"
|
|
||||||
"PlcCod INT NOT NULL,"
|
|
||||||
"Status TINYINT NOT NULL DEFAULT 0,"
|
|
||||||
"RequesterUsrCod INT NOT NULL DEFAULT -1,"
|
|
||||||
"Latitude DOUBLE PRECISION NOT NULL DEFAULT 0,"
|
|
||||||
"Longitude DOUBLE PRECISION NOT NULL DEFAULT 0,"
|
|
||||||
"Altitude DOUBLE PRECISION NOT NULL DEFAULT 0,"
|
|
||||||
"ShortName VARCHAR(511) COLLATE latin1_spanish_ci NOT NULL," // Cns_HIERARCHY_MAX_BYTES_SHRT_NAME
|
|
||||||
"FullName VARCHAR(2047) COLLATE latin1_spanish_ci NOT NULL," // Cns_HIERARCHY_MAX_BYTES_FULL_NAME
|
|
||||||
"WWW VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
|
||||||
"PhotoAttribution TEXT NOT NULL," // Med_MAX_BYTES_ATTRIBUTION
|
|
||||||
"UNIQUE INDEX(CtrCod),"
|
|
||||||
"INDEX(InsCod),"
|
|
||||||
"INDEX(PlcCod),"
|
|
||||||
"INDEX(Status))");
|
|
||||||
|
|
||||||
/***** Table chat *****/
|
/***** Table chat *****/
|
||||||
/*
|
/*
|
||||||
mysql> DESCRIBE chat;
|
mysql> DESCRIBE chat;
|
||||||
|
@ -541,69 +502,6 @@ mysql> DESCRIBE connected;
|
||||||
"INDEX(RoleInLastCrs),"
|
"INDEX(RoleInLastCrs),"
|
||||||
"INDEX(LastCrsCod))");
|
"INDEX(LastCrsCod))");
|
||||||
|
|
||||||
/***** Table countries *****/
|
|
||||||
/*
|
|
||||||
mysql> DESCRIBE countries;
|
|
||||||
+----------------+--------------+------+-----+---------+-------+
|
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
|
||||||
+----------------+--------------+------+-----+---------+-------+
|
|
||||||
| CtyCod | int(11) | NO | PRI | NULL | |
|
|
||||||
| Alpha2 | char(2) | NO | UNI | NULL | |
|
|
||||||
| MapAttribution | text | NO | | NULL | |
|
|
||||||
| Name_ca | varchar(767) | NO | MUL | NULL | |
|
|
||||||
| Name_de | varchar(767) | NO | MUL | NULL | |
|
|
||||||
| Name_en | varchar(767) | NO | MUL | NULL | |
|
|
||||||
| Name_es | varchar(767) | NO | MUL | NULL | |
|
|
||||||
| Name_fr | varchar(767) | NO | MUL | NULL | |
|
|
||||||
| Name_gn | varchar(767) | NO | MUL | NULL | |
|
|
||||||
| Name_it | varchar(767) | NO | MUL | NULL | |
|
|
||||||
| Name_pl | varchar(767) | NO | MUL | NULL | |
|
|
||||||
| Name_pt | varchar(767) | NO | MUL | NULL | |
|
|
||||||
| WWW_ca | varchar(255) | NO | | NULL | |
|
|
||||||
| WWW_de | varchar(255) | NO | | NULL | |
|
|
||||||
| WWW_en | varchar(255) | NO | | NULL | |
|
|
||||||
| WWW_es | varchar(255) | NO | | NULL | |
|
|
||||||
| WWW_fr | varchar(255) | NO | | NULL | |
|
|
||||||
| WWW_gn | varchar(255) | NO | | NULL | |
|
|
||||||
| WWW_it | varchar(255) | NO | | NULL | |
|
|
||||||
| WWW_pl | varchar(255) | NO | | NULL | |
|
|
||||||
| WWW_pt | varchar(255) | NO | | NULL | |
|
|
||||||
+----------------+--------------+------+-----+---------+-------+
|
|
||||||
21 rows in set (0,00 sec)
|
|
||||||
*/
|
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS countries ("
|
|
||||||
"CtyCod INT NOT NULL,"
|
|
||||||
"Alpha2 CHAR(2) NOT NULL,"
|
|
||||||
"MapAttribution TEXT NOT NULL," // Med_MAX_BYTES_ATTRIBUTION
|
|
||||||
"Name_ca VARCHAR(767) NOT NULL," // Cty_MAX_BYTES_NAME
|
|
||||||
"Name_de VARCHAR(767) NOT NULL," // Cty_MAX_BYTES_NAME
|
|
||||||
"Name_en VARCHAR(767) NOT NULL," // Cty_MAX_BYTES_NAME
|
|
||||||
"Name_es VARCHAR(767) NOT NULL," // Cty_MAX_BYTES_NAME
|
|
||||||
"Name_fr VARCHAR(767) NOT NULL," // Cty_MAX_BYTES_NAME
|
|
||||||
"Name_gn VARCHAR(767) NOT NULL," // Cty_MAX_BYTES_NAME
|
|
||||||
"Name_it VARCHAR(767) NOT NULL," // Cty_MAX_BYTES_NAME
|
|
||||||
"Name_pl VARCHAR(767) NOT NULL," // Cty_MAX_BYTES_NAME
|
|
||||||
"Name_pt VARCHAR(767) NOT NULL," // Cty_MAX_BYTES_NAME
|
|
||||||
"WWW_ca VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
|
||||||
"WWW_de VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
|
||||||
"WWW_en VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
|
||||||
"WWW_es VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
|
||||||
"WWW_fr VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
|
||||||
"WWW_gn VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
|
||||||
"WWW_it VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
|
||||||
"WWW_pl VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
|
||||||
"WWW_pt VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
|
||||||
"UNIQUE INDEX(CtyCod),UNIQUE INDEX(Alpha2),"
|
|
||||||
"INDEX(Name_ca),"
|
|
||||||
"INDEX(Name_de),"
|
|
||||||
"INDEX(Name_en),"
|
|
||||||
"INDEX(Name_es),"
|
|
||||||
"INDEX(Name_fr),"
|
|
||||||
"INDEX(Name_gn),"
|
|
||||||
"INDEX(Name_it),"
|
|
||||||
"INDEX(Name_pl),"
|
|
||||||
"INDEX(Name_pt))"); // ISO 3166-1 country codes
|
|
||||||
|
|
||||||
/***** Table crs_courses *****/
|
/***** Table crs_courses *****/
|
||||||
/*
|
/*
|
||||||
mysql> DESCRIBE crs_courses;
|
mysql> DESCRIBE crs_courses;
|
||||||
|
@ -910,6 +808,108 @@ mysql> DESCRIBE crs_usr_requests;
|
||||||
"UNIQUE INDEX(CrsCod,UsrCod),"
|
"UNIQUE INDEX(CrsCod,UsrCod),"
|
||||||
"INDEX(UsrCod))");
|
"INDEX(UsrCod))");
|
||||||
|
|
||||||
|
/***** Table ctr_centers *****/
|
||||||
|
/*
|
||||||
|
mysql> DESCRIBE ctr_centers;
|
||||||
|
+------------------+---------------+------+-----+---------+----------------+
|
||||||
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
|
+------------------+---------------+------+-----+---------+----------------+
|
||||||
|
| CtrCod | int(11) | NO | PRI | NULL | auto_increment |
|
||||||
|
| InsCod | int(11) | NO | MUL | NULL | |
|
||||||
|
| PlcCod | int(11) | NO | MUL | -1 | |
|
||||||
|
| Status | tinyint(4) | NO | MUL | 0 | |
|
||||||
|
| RequesterUsrCod | int(11) | NO | | -1 | |
|
||||||
|
| Latitude | double | NO | | 0 | |
|
||||||
|
| Longitude | double | NO | | 0 | |
|
||||||
|
| Altitude | double | NO | | 0 | |
|
||||||
|
| ShortName | varchar(511) | NO | | NULL | |
|
||||||
|
| FullName | varchar(2047) | NO | | NULL | |
|
||||||
|
| WWW | varchar(255) | NO | | NULL | |
|
||||||
|
| PhotoAttribution | text | NO | | NULL | |
|
||||||
|
+------------------+---------------+------+-----+---------+----------------+
|
||||||
|
12 rows in set (0.00 sec)
|
||||||
|
*/
|
||||||
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS ctr_centers ("
|
||||||
|
"CtrCod INT NOT NULL AUTO_INCREMENT,"
|
||||||
|
"InsCod INT NOT NULL,"
|
||||||
|
"PlcCod INT NOT NULL,"
|
||||||
|
"Status TINYINT NOT NULL DEFAULT 0,"
|
||||||
|
"RequesterUsrCod INT NOT NULL DEFAULT -1,"
|
||||||
|
"Latitude DOUBLE PRECISION NOT NULL DEFAULT 0,"
|
||||||
|
"Longitude DOUBLE PRECISION NOT NULL DEFAULT 0,"
|
||||||
|
"Altitude DOUBLE PRECISION NOT NULL DEFAULT 0,"
|
||||||
|
"ShortName VARCHAR(511) COLLATE latin1_spanish_ci NOT NULL," // Cns_HIERARCHY_MAX_BYTES_SHRT_NAME
|
||||||
|
"FullName VARCHAR(2047) COLLATE latin1_spanish_ci NOT NULL," // Cns_HIERARCHY_MAX_BYTES_FULL_NAME
|
||||||
|
"WWW VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
||||||
|
"PhotoAttribution TEXT NOT NULL," // Med_MAX_BYTES_ATTRIBUTION
|
||||||
|
"UNIQUE INDEX(CtrCod),"
|
||||||
|
"INDEX(InsCod),"
|
||||||
|
"INDEX(PlcCod),"
|
||||||
|
"INDEX(Status))");
|
||||||
|
|
||||||
|
/***** Table cty_countrs *****/
|
||||||
|
/*
|
||||||
|
mysql> DESCRIBE cty_countrs;
|
||||||
|
+----------------+--------------+------+-----+---------+-------+
|
||||||
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
|
+----------------+--------------+------+-----+---------+-------+
|
||||||
|
| CtyCod | int(11) | NO | PRI | NULL | |
|
||||||
|
| Alpha2 | char(2) | NO | UNI | NULL | |
|
||||||
|
| MapAttribution | text | NO | | NULL | |
|
||||||
|
| Name_ca | varchar(767) | NO | MUL | NULL | |
|
||||||
|
| Name_de | varchar(767) | NO | MUL | NULL | |
|
||||||
|
| Name_en | varchar(767) | NO | MUL | NULL | |
|
||||||
|
| Name_es | varchar(767) | NO | MUL | NULL | |
|
||||||
|
| Name_fr | varchar(767) | NO | MUL | NULL | |
|
||||||
|
| Name_gn | varchar(767) | NO | MUL | NULL | |
|
||||||
|
| Name_it | varchar(767) | NO | MUL | NULL | |
|
||||||
|
| Name_pl | varchar(767) | NO | MUL | NULL | |
|
||||||
|
| Name_pt | varchar(767) | NO | MUL | NULL | |
|
||||||
|
| WWW_ca | varchar(255) | NO | | NULL | |
|
||||||
|
| WWW_de | varchar(255) | NO | | NULL | |
|
||||||
|
| WWW_en | varchar(255) | NO | | NULL | |
|
||||||
|
| WWW_es | varchar(255) | NO | | NULL | |
|
||||||
|
| WWW_fr | varchar(255) | NO | | NULL | |
|
||||||
|
| WWW_gn | varchar(255) | NO | | NULL | |
|
||||||
|
| WWW_it | varchar(255) | NO | | NULL | |
|
||||||
|
| WWW_pl | varchar(255) | NO | | NULL | |
|
||||||
|
| WWW_pt | varchar(255) | NO | | NULL | |
|
||||||
|
+----------------+--------------+------+-----+---------+-------+
|
||||||
|
21 rows in set (0,00 sec)
|
||||||
|
*/
|
||||||
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS cty_countrs ("
|
||||||
|
"CtyCod INT NOT NULL,"
|
||||||
|
"Alpha2 CHAR(2) NOT NULL,"
|
||||||
|
"MapAttribution TEXT NOT NULL," // Med_MAX_BYTES_ATTRIBUTION
|
||||||
|
"Name_ca VARCHAR(767) NOT NULL," // Cty_MAX_BYTES_NAME
|
||||||
|
"Name_de VARCHAR(767) NOT NULL," // Cty_MAX_BYTES_NAME
|
||||||
|
"Name_en VARCHAR(767) NOT NULL," // Cty_MAX_BYTES_NAME
|
||||||
|
"Name_es VARCHAR(767) NOT NULL," // Cty_MAX_BYTES_NAME
|
||||||
|
"Name_fr VARCHAR(767) NOT NULL," // Cty_MAX_BYTES_NAME
|
||||||
|
"Name_gn VARCHAR(767) NOT NULL," // Cty_MAX_BYTES_NAME
|
||||||
|
"Name_it VARCHAR(767) NOT NULL," // Cty_MAX_BYTES_NAME
|
||||||
|
"Name_pl VARCHAR(767) NOT NULL," // Cty_MAX_BYTES_NAME
|
||||||
|
"Name_pt VARCHAR(767) NOT NULL," // Cty_MAX_BYTES_NAME
|
||||||
|
"WWW_ca VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
||||||
|
"WWW_de VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
||||||
|
"WWW_en VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
||||||
|
"WWW_es VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
||||||
|
"WWW_fr VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
||||||
|
"WWW_gn VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
||||||
|
"WWW_it VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
||||||
|
"WWW_pl VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
||||||
|
"WWW_pt VARCHAR(255) NOT NULL," // Cns_MAX_BYTES_WWW
|
||||||
|
"UNIQUE INDEX(CtyCod),UNIQUE INDEX(Alpha2),"
|
||||||
|
"INDEX(Name_ca),"
|
||||||
|
"INDEX(Name_de),"
|
||||||
|
"INDEX(Name_en),"
|
||||||
|
"INDEX(Name_es),"
|
||||||
|
"INDEX(Name_fr),"
|
||||||
|
"INDEX(Name_gn),"
|
||||||
|
"INDEX(Name_it),"
|
||||||
|
"INDEX(Name_pl),"
|
||||||
|
"INDEX(Name_pt))"); // ISO 3166-1 country codes
|
||||||
|
|
||||||
/***** Table deg_types *****/
|
/***** Table deg_types *****/
|
||||||
/*
|
/*
|
||||||
mysql> DESCRIBE deg_types;
|
mysql> DESCRIBE deg_types;
|
||||||
|
|
|
@ -959,12 +959,12 @@ static void Ins_GetShrtNameAndCtyOfInstitution (struct Ins_Instit *Ins,
|
||||||
|
|
||||||
if (DB_QuerySELECT (&mysql_res,"can not get short name and country"
|
if (DB_QuerySELECT (&mysql_res,"can not get short name and country"
|
||||||
" of an institution",
|
" of an institution",
|
||||||
"SELECT ins_instits.ShortName,"
|
"SELECT ins_instits.ShortName," // row[0]
|
||||||
"countries.Name_%s"
|
"cty_countrs.Name_%s" // row[1]
|
||||||
" FROM ins_instits,"
|
" FROM ins_instits,"
|
||||||
"countries"
|
"cty_countrs"
|
||||||
" WHERE ins_instits.InsCod=%ld"
|
" WHERE ins_instits.InsCod=%ld"
|
||||||
" AND ins_instits.CtyCod=countries.CtyCod",
|
" AND ins_instits.CtyCod=cty_countrs.CtyCod",
|
||||||
Lan_STR_LANG_ID[Gbl.Prefs.Language],Ins->InsCod) == 1)
|
Lan_STR_LANG_ID[Gbl.Prefs.Language],Ins->InsCod) == 1)
|
||||||
{
|
{
|
||||||
/* Get row */
|
/* Get row */
|
||||||
|
|
|
@ -354,7 +354,7 @@ static void Sch_SearchInDB (void)
|
||||||
RangeQuery[0] = '\0';
|
RangeQuery[0] = '\0';
|
||||||
break;
|
break;
|
||||||
case Hie_Lvl_CTY:
|
case Hie_Lvl_CTY:
|
||||||
sprintf (RangeQuery," AND countries.CtyCod=%ld",
|
sprintf (RangeQuery," AND cty_countrs.CtyCod=%ld",
|
||||||
Gbl.Hierarchy.Cty.CtyCod);
|
Gbl.Hierarchy.Cty.CtyCod);
|
||||||
break;
|
break;
|
||||||
case Hie_Lvl_INS:
|
case Hie_Lvl_INS:
|
||||||
|
@ -464,9 +464,10 @@ static unsigned Sch_SearchCountriesInDB (const char *RangeQuery)
|
||||||
if (Sch_BuildSearchQuery (SearchQuery,FieldName,NULL,NULL))
|
if (Sch_BuildSearchQuery (SearchQuery,FieldName,NULL,NULL))
|
||||||
{
|
{
|
||||||
/***** Query database and list institutions found *****/
|
/***** Query database and list institutions found *****/
|
||||||
NumCtys = (unsigned) DB_QuerySELECT (&mysql_res,"can not get countries",
|
NumCtys = (unsigned)
|
||||||
"SELECT CtyCod"
|
DB_QuerySELECT (&mysql_res,"can not get countries",
|
||||||
" FROM countries"
|
"SELECT CtyCod" // row[0]
|
||||||
|
" FROM cty_countrs"
|
||||||
" WHERE %s%s"
|
" WHERE %s%s"
|
||||||
" ORDER BY Name_%s",
|
" ORDER BY Name_%s",
|
||||||
SearchQuery,RangeQuery,
|
SearchQuery,RangeQuery,
|
||||||
|
@ -503,13 +504,14 @@ static unsigned Sch_SearchInstitutionsInDB (const char *RangeQuery)
|
||||||
/***** Query database and list institutions found *****/
|
/***** Query database and list institutions found *****/
|
||||||
NumInss = (unsigned)
|
NumInss = (unsigned)
|
||||||
DB_QuerySELECT (&mysql_res,"can not get institutions",
|
DB_QuerySELECT (&mysql_res,"can not get institutions",
|
||||||
"SELECT ins_instits.InsCod"
|
"SELECT ins_instits.InsCod" // row[0]
|
||||||
" FROM ins_instits,"
|
" FROM ins_instits,"
|
||||||
"countries"
|
"cty_countrs"
|
||||||
" WHERE %s"
|
" WHERE %s"
|
||||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
" AND ins_instits.CtyCod=cty_countrs.CtyCod"
|
||||||
"%s"
|
"%s"
|
||||||
" ORDER BY ins_instits.FullName,countries.Name_%s",
|
" ORDER BY ins_instits.FullName,"
|
||||||
|
"cty_countrs.Name_%s",
|
||||||
SearchQuery,RangeQuery,
|
SearchQuery,RangeQuery,
|
||||||
Lan_STR_LANG_ID[Gbl.Prefs.Language]);
|
Lan_STR_LANG_ID[Gbl.Prefs.Language]);
|
||||||
Ins_ListInssFound (&mysql_res,NumInss);
|
Ins_ListInssFound (&mysql_res,NumInss);
|
||||||
|
@ -541,13 +543,13 @@ static unsigned Sch_SearchCentersInDB (const char *RangeQuery)
|
||||||
/***** Query database and list centers found *****/
|
/***** Query database and list centers found *****/
|
||||||
NumCtrs = (unsigned)
|
NumCtrs = (unsigned)
|
||||||
DB_QuerySELECT (&mysql_res,"can not get centers",
|
DB_QuerySELECT (&mysql_res,"can not get centers",
|
||||||
"SELECT ctr_centers.CtrCod"
|
"SELECT ctr_centers.CtrCod" // row[0]
|
||||||
" FROM ctr_centers,"
|
" FROM ctr_centers,"
|
||||||
"ins_instits,"
|
"ins_instits,"
|
||||||
"countries"
|
"cty_countrs"
|
||||||
" WHERE %s"
|
" WHERE %s"
|
||||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
" AND ins_instits.CtyCod=cty_countrs.CtyCod"
|
||||||
"%s"
|
"%s"
|
||||||
" ORDER BY ctr_centers.FullName,"
|
" ORDER BY ctr_centers.FullName,"
|
||||||
"ins_instits.FullName",
|
"ins_instits.FullName",
|
||||||
|
@ -580,14 +582,15 @@ static unsigned Sch_SearchDegreesInDB (const char *RangeQuery)
|
||||||
/***** Query database and list degrees found *****/
|
/***** Query database and list degrees found *****/
|
||||||
NumDegs = (unsigned)
|
NumDegs = (unsigned)
|
||||||
DB_QuerySELECT (&mysql_res,"can not get degrees",
|
DB_QuerySELECT (&mysql_res,"can not get degrees",
|
||||||
"SELECT deg_degrees.DegCod"
|
"SELECT deg_degrees.DegCod" // row[0]
|
||||||
" FROM deg_degrees,"
|
" FROM deg_degrees,"
|
||||||
"ctr_centers,"
|
"ctr_centers,"
|
||||||
"ins_instits,countries"
|
"ins_instits,"
|
||||||
|
"cty_countrs"
|
||||||
" WHERE %s"
|
" WHERE %s"
|
||||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
" AND ins_instits.CtyCod=cty_countrs.CtyCod"
|
||||||
"%s"
|
"%s"
|
||||||
" ORDER BY deg_degrees.FullName,"
|
" ORDER BY deg_degrees.FullName,"
|
||||||
"ins_instits.FullName",
|
"ins_instits.FullName",
|
||||||
|
@ -629,12 +632,12 @@ static unsigned Sch_SearchCoursesInDB (const char *RangeQuery)
|
||||||
"deg_degrees,"
|
"deg_degrees,"
|
||||||
"ctr_centers,"
|
"ctr_centers,"
|
||||||
"ins_instits,"
|
"ins_instits,"
|
||||||
"countries"
|
"cty_countrs"
|
||||||
" WHERE %s"
|
" WHERE %s"
|
||||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
" AND ins_instits.CtyCod=cty_countrs.CtyCod"
|
||||||
"%s"
|
"%s"
|
||||||
" ORDER BY crs_courses.FullName,"
|
" ORDER BY crs_courses.FullName,"
|
||||||
"ins_instits.FullName,"
|
"ins_instits.FullName,"
|
||||||
|
@ -716,11 +719,11 @@ static unsigned Sch_SearchOpenDocumentsInDB (const char *RangeQuery)
|
||||||
"deg_degrees,"
|
"deg_degrees,"
|
||||||
"ctr_centers,"
|
"ctr_centers,"
|
||||||
"ins_instits,"
|
"ins_instits,"
|
||||||
"countries"
|
"cty_countrs"
|
||||||
" WHERE files.Public='Y' AND %s"
|
" WHERE files.Public='Y' AND %s"
|
||||||
" AND files.FileBrowser IN (%u,%u)"
|
" AND files.FileBrowser IN (%u,%u)"
|
||||||
" AND files.Cod=ins_instits.InsCod"
|
" AND files.Cod=ins_instits.InsCod"
|
||||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
" AND ins_instits.CtyCod=cty_countrs.CtyCod"
|
||||||
"%s"
|
"%s"
|
||||||
" UNION "
|
" UNION "
|
||||||
"SELECT files.FilCod," // Center
|
"SELECT files.FilCod," // Center
|
||||||
|
@ -739,12 +742,12 @@ static unsigned Sch_SearchOpenDocumentsInDB (const char *RangeQuery)
|
||||||
"deg_degrees,"
|
"deg_degrees,"
|
||||||
"ctr_centers,"
|
"ctr_centers,"
|
||||||
"ins_instits,"
|
"ins_instits,"
|
||||||
"countries"
|
"cty_countrs"
|
||||||
" WHERE files.Public='Y' AND %s"
|
" WHERE files.Public='Y' AND %s"
|
||||||
" AND files.FileBrowser IN (%u,%u)"
|
" AND files.FileBrowser IN (%u,%u)"
|
||||||
" AND files.Cod=ctr_centers.CtrCod"
|
" AND files.Cod=ctr_centers.CtrCod"
|
||||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
" AND ins_instits.CtyCod=cty_countrs.CtyCod"
|
||||||
"%s"
|
"%s"
|
||||||
" UNION "
|
" UNION "
|
||||||
"SELECT files.FilCod," // Degree
|
"SELECT files.FilCod," // Degree
|
||||||
|
@ -762,13 +765,13 @@ static unsigned Sch_SearchOpenDocumentsInDB (const char *RangeQuery)
|
||||||
"deg_degrees,"
|
"deg_degrees,"
|
||||||
"ctr_centers,"
|
"ctr_centers,"
|
||||||
"ins_instits,"
|
"ins_instits,"
|
||||||
"countries"
|
"cty_countrs"
|
||||||
" WHERE files.Public='Y' AND %s"
|
" WHERE files.Public='Y' AND %s"
|
||||||
" AND files.FileBrowser IN (%u,%u)"
|
" AND files.FileBrowser IN (%u,%u)"
|
||||||
" AND files.Cod=deg_degrees.DegCod"
|
" AND files.Cod=deg_degrees.DegCod"
|
||||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
" AND ins_instits.CtyCod=cty_countrs.CtyCod"
|
||||||
"%s"
|
"%s"
|
||||||
" UNION "
|
" UNION "
|
||||||
"SELECT files.FilCod," // Course
|
"SELECT files.FilCod," // Course
|
||||||
|
@ -787,14 +790,14 @@ static unsigned Sch_SearchOpenDocumentsInDB (const char *RangeQuery)
|
||||||
"deg_degrees,"
|
"deg_degrees,"
|
||||||
"ctr_centers,"
|
"ctr_centers,"
|
||||||
"ins_instits,"
|
"ins_instits,"
|
||||||
"countries"
|
"cty_countrs"
|
||||||
" WHERE files.Public='Y' AND %s"
|
" WHERE files.Public='Y' AND %s"
|
||||||
" AND files.FileBrowser IN (%u,%u)"
|
" AND files.FileBrowser IN (%u,%u)"
|
||||||
" AND files.Cod=crs_courses.CrsCod"
|
" AND files.Cod=crs_courses.CrsCod"
|
||||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
" AND ins_instits.CtyCod=cty_countrs.CtyCod"
|
||||||
"%s"
|
"%s"
|
||||||
") AS selected_files"
|
") AS selected_files"
|
||||||
" WHERE PathFromRoot<>''"
|
" WHERE PathFromRoot<>''"
|
||||||
|
@ -903,14 +906,14 @@ static unsigned Sch_SearchDocumentsInMyCoursesInDB (const char *RangeQuery)
|
||||||
"deg_degrees,"
|
"deg_degrees,"
|
||||||
"ctr_centers,"
|
"ctr_centers,"
|
||||||
"ins_instits,"
|
"ins_instits,"
|
||||||
"countries"
|
"cty_countrs"
|
||||||
" WHERE files.FilCod IN (SELECT FilCod FROM my_files_crs) AND %s"
|
" WHERE files.FilCod IN (SELECT FilCod FROM my_files_crs) AND %s"
|
||||||
" AND files.FileBrowser IN (%u,%u,%u,%u)"
|
" AND files.FileBrowser IN (%u,%u,%u,%u)"
|
||||||
" AND files.Cod=crs_courses.CrsCod"
|
" AND files.Cod=crs_courses.CrsCod"
|
||||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
" AND ins_instits.CtyCod=cty_countrs.CtyCod"
|
||||||
"%s"
|
"%s"
|
||||||
" UNION "
|
" UNION "
|
||||||
"SELECT files.FilCod,"
|
"SELECT files.FilCod,"
|
||||||
|
@ -931,7 +934,7 @@ static unsigned Sch_SearchDocumentsInMyCoursesInDB (const char *RangeQuery)
|
||||||
"deg_degrees,"
|
"deg_degrees,"
|
||||||
"ctr_centers,"
|
"ctr_centers,"
|
||||||
"ins_instits,"
|
"ins_instits,"
|
||||||
"countries"
|
"cty_countrs"
|
||||||
" WHERE files.FilCod IN (SELECT FilCod FROM my_files_grp) AND %s"
|
" WHERE files.FilCod IN (SELECT FilCod FROM my_files_grp) AND %s"
|
||||||
" AND files.FileBrowser IN (%u,%u,%u,%u)"
|
" AND files.FileBrowser IN (%u,%u,%u,%u)"
|
||||||
" AND files.Cod=crs_grp.GrpCod"
|
" AND files.Cod=crs_grp.GrpCod"
|
||||||
|
@ -940,7 +943,7 @@ static unsigned Sch_SearchDocumentsInMyCoursesInDB (const char *RangeQuery)
|
||||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
" AND ins_instits.CtyCod=cty_countrs.CtyCod"
|
||||||
"%s"
|
"%s"
|
||||||
") AS selected_files"
|
") AS selected_files"
|
||||||
" WHERE PathFromRoot<>''"
|
" WHERE PathFromRoot<>''"
|
||||||
|
@ -1016,11 +1019,11 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
|
||||||
"deg_degrees,"
|
"deg_degrees,"
|
||||||
"ctr_centers,"
|
"ctr_centers,"
|
||||||
"ins_instits,"
|
"ins_instits,"
|
||||||
"countries"
|
"cty_countrs"
|
||||||
" WHERE files.PublisherUsrCod=%ld AND %s"
|
" WHERE files.PublisherUsrCod=%ld AND %s"
|
||||||
" AND files.FileBrowser IN (%u,%u)"
|
" AND files.FileBrowser IN (%u,%u)"
|
||||||
" AND files.Cod=ins_instits.InsCod"
|
" AND files.Cod=ins_instits.InsCod"
|
||||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
" AND ins_instits.CtyCod=cty_countrs.CtyCod"
|
||||||
"%s"
|
"%s"
|
||||||
" UNION "
|
" UNION "
|
||||||
"SELECT files.FilCod," // Center
|
"SELECT files.FilCod," // Center
|
||||||
|
@ -1039,12 +1042,12 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
|
||||||
"deg_degrees,"
|
"deg_degrees,"
|
||||||
"ctr_centers,"
|
"ctr_centers,"
|
||||||
"ins_instits,"
|
"ins_instits,"
|
||||||
"countries"
|
"cty_countrs"
|
||||||
" WHERE files.PublisherUsrCod=%ld AND %s"
|
" WHERE files.PublisherUsrCod=%ld AND %s"
|
||||||
" AND files.FileBrowser IN (%u,%u)"
|
" AND files.FileBrowser IN (%u,%u)"
|
||||||
" AND files.Cod=ctr_centers.CtrCod"
|
" AND files.Cod=ctr_centers.CtrCod"
|
||||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
" AND ins_instits.CtyCod=cty_countrs.CtyCod"
|
||||||
"%s"
|
"%s"
|
||||||
" UNION "
|
" UNION "
|
||||||
"SELECT files.FilCod," // Degree
|
"SELECT files.FilCod," // Degree
|
||||||
|
@ -1063,13 +1066,13 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
|
||||||
"deg_degrees,"
|
"deg_degrees,"
|
||||||
"ctr_centers,"
|
"ctr_centers,"
|
||||||
"ins_instits,"
|
"ins_instits,"
|
||||||
"countries"
|
"cty_countrs"
|
||||||
" WHERE files.PublisherUsrCod=%ld AND %s"
|
" WHERE files.PublisherUsrCod=%ld AND %s"
|
||||||
" AND files.FileBrowser IN (%u,%u)"
|
" AND files.FileBrowser IN (%u,%u)"
|
||||||
" AND files.Cod=deg_degrees.DegCod"
|
" AND files.Cod=deg_degrees.DegCod"
|
||||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
" AND ins_instits.CtyCod=cty_countrs.CtyCod"
|
||||||
"%s"
|
"%s"
|
||||||
" UNION "
|
" UNION "
|
||||||
"SELECT files.FilCod," // Course
|
"SELECT files.FilCod," // Course
|
||||||
|
@ -1088,14 +1091,14 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
|
||||||
"deg_degrees,"
|
"deg_degrees,"
|
||||||
"ctr_centers,"
|
"ctr_centers,"
|
||||||
"ins_instits,"
|
"ins_instits,"
|
||||||
"countries"
|
"cty_countrs"
|
||||||
" WHERE files.PublisherUsrCod=%ld AND %s"
|
" WHERE files.PublisherUsrCod=%ld AND %s"
|
||||||
" AND files.FileBrowser IN (%u,%u,%u,%u)"
|
" AND files.FileBrowser IN (%u,%u,%u,%u)"
|
||||||
" AND files.Cod=crs_courses.CrsCod"
|
" AND files.Cod=crs_courses.CrsCod"
|
||||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
" AND ins_instits.CtyCod=cty_countrs.CtyCod"
|
||||||
"%s"
|
"%s"
|
||||||
" UNION "
|
" UNION "
|
||||||
"SELECT files.FilCod," // Group
|
"SELECT files.FilCod," // Group
|
||||||
|
@ -1116,7 +1119,7 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
|
||||||
"deg_degrees,"
|
"deg_degrees,"
|
||||||
"ctr_centers,"
|
"ctr_centers,"
|
||||||
"ins_instits,"
|
"ins_instits,"
|
||||||
"countries"
|
"cty_countrs"
|
||||||
" WHERE files.PublisherUsrCod=%ld AND %s"
|
" WHERE files.PublisherUsrCod=%ld AND %s"
|
||||||
" AND files.FileBrowser IN (%u,%u,%u,%u)"
|
" AND files.FileBrowser IN (%u,%u,%u,%u)"
|
||||||
" AND files.Cod=crs_grp.GrpCod"
|
" AND files.Cod=crs_grp.GrpCod"
|
||||||
|
@ -1125,7 +1128,7 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
|
||||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
" AND ins_instits.CtyCod=cty_countrs.CtyCod"
|
||||||
"%s"
|
"%s"
|
||||||
" UNION "
|
" UNION "
|
||||||
"SELECT files.FilCod," // Briefcase
|
"SELECT files.FilCod," // Briefcase
|
||||||
|
|
12
swad_user.c
12
swad_user.c
|
@ -2201,22 +2201,22 @@ unsigned Usr_GetCtysFromUsr (long UsrCod,MYSQL_RES **mysql_res)
|
||||||
return
|
return
|
||||||
(unsigned) DB_QuerySELECT (mysql_res,"can not get the countries"
|
(unsigned) DB_QuerySELECT (mysql_res,"can not get the countries"
|
||||||
" a user belongs to",
|
" a user belongs to",
|
||||||
"SELECT countries.CtyCod,"
|
"SELECT cty_countrs.CtyCod," // row[0]
|
||||||
"MAX(crs_usr.Role)"
|
"MAX(crs_usr.Role)" // row[1]
|
||||||
" FROM crs_usr,"
|
" FROM crs_usr,"
|
||||||
"crs_courses,"
|
"crs_courses,"
|
||||||
"deg_degrees,"
|
"deg_degrees,"
|
||||||
"ctr_centers,"
|
"ctr_centers,"
|
||||||
"ins_instits,"
|
"ins_instits,"
|
||||||
"countries"
|
"cty_countrs"
|
||||||
" WHERE crs_usr.UsrCod=%ld"
|
" WHERE crs_usr.UsrCod=%ld"
|
||||||
" AND crs_usr.CrsCod=crs_courses.CrsCod"
|
" AND crs_usr.CrsCod=crs_courses.CrsCod"
|
||||||
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
" AND crs_courses.DegCod=deg_degrees.DegCod"
|
||||||
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
" AND deg_degrees.CtrCod=ctr_centers.CtrCod"
|
||||||
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
" AND ctr_centers.InsCod=ins_instits.InsCod"
|
||||||
" AND ins_instits.CtyCod=countries.CtyCod"
|
" AND ins_instits.CtyCod=cty_countrs.CtyCod"
|
||||||
" GROUP BY countries.CtyCod"
|
" GROUP BY cty_countrs.CtyCod"
|
||||||
" ORDER BY countries.Name_%s",
|
" ORDER BY cty_countrs.Name_%s",
|
||||||
UsrCod,Lan_STR_LANG_ID[Gbl.Prefs.Language]);
|
UsrCod,Lan_STR_LANG_ID[Gbl.Prefs.Language]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user