Version 20.51.19: Mar 19, 2021 Rooms database table renamed.

This commit is contained in:
acanas 2021-03-19 09:32:19 +01:00
parent 36ad9e55e1
commit dc6a870602
8 changed files with 129 additions and 105 deletions

View File

@ -1243,9 +1243,9 @@ CREATE TABLE IF NOT EXISTS prj_usr (
UsrCod INT NOT NULL, UsrCod INT NOT NULL,
UNIQUE INDEX(PrjCod,RoleInProject,UsrCod)); UNIQUE INDEX(PrjCod,RoleInProject,UsrCod));
-- --
-- Table rooms: stores the rooms associated to each center -- Table roo_rooms: stores the rooms associated to each center
-- --
CREATE TABLE IF NOT EXISTS rooms ( CREATE TABLE IF NOT EXISTS roo_rooms (
RooCod INT NOT NULL AUTO_INCREMENT, RooCod INT NOT NULL AUTO_INCREMENT,
CtrCod INT NOT NULL, CtrCod INT NOT NULL,
BldCod INT NOT NULL DEFAULT -1, BldCod INT NOT NULL DEFAULT -1,

View File

@ -6005,22 +6005,22 @@ int swad__getLocation (struct soap *soap,
"bld_buildings.BldCod," // row[ 6] "bld_buildings.BldCod," // row[ 6]
"bld_buildings.ShortName," // row[ 7] "bld_buildings.ShortName," // row[ 7]
"bld_buildings.FullName," // row[ 8] "bld_buildings.FullName," // row[ 8]
"rooms.Floor," // row[ 9] "roo_rooms.Floor," // row[ 9]
"rooms.RooCod," // row[10] "roo_rooms.RooCod," // row[10]
"rooms.ShortName," // row[11] "roo_rooms.ShortName," // row[11]
"rooms.FullName" // row[12] "roo_rooms.FullName" // row[12]
" FROM room_MAC," " FROM room_MAC,"
"rooms," "roo_rooms,"
"bld_buildings," "bld_buildings,"
"ctr_centers," "ctr_centers,"
"ins_instits" "ins_instits"
" WHERE room_MAC.MAC=%llu" " WHERE room_MAC.MAC=%llu"
" AND room_MAC.RooCod=rooms.RooCod" " AND room_MAC.RooCod=roo_rooms.RooCod"
" AND rooms.BldCod=bld_buildings.BldCod" " AND roo_rooms.BldCod=bld_buildings.BldCod"
" AND bld_buildings.CtrCod=ctr_centers.CtrCod" " AND bld_buildings.CtrCod=ctr_centers.CtrCod"
" AND ctr_centers.InsCod=ins_instits.InsCod" " AND ctr_centers.InsCod=ins_instits.InsCod"
" ORDER BY rooms.Capacity DESC," // Get the biggest room " ORDER BY roo_rooms.Capacity DESC," // Get the biggest room
"rooms.ShortName" "roo_rooms.ShortName"
" LIMIT 1", " LIMIT 1",
MACnum); MACnum);
@ -6072,9 +6072,11 @@ int swad__sendMyLocation (struct soap *soap,
DB_QueryINSERTandReturnCode ("can not save current location", DB_QueryINSERTandReturnCode ("can not save current location",
"INSERT INTO room_check_in" "INSERT INTO room_check_in"
" (UsrCod,RooCod,CheckInTime)" " (UsrCod,RooCod,CheckInTime)"
" SELECT %ld,RooCod,NOW()" " SELECT %ld,"
" FROM rooms" "RooCod,"
" WHERE RooCod=%d", // Check that room exists "NOW()"
" FROM roo_rooms"
" WHERE RooCod=%d", // Check that room exists
Gbl.Usrs.Me.UsrDat.UsrCod,roomCode); Gbl.Usrs.Me.UsrDat.UsrCod,roomCode);
/***** Return notification code *****/ /***** Return notification code *****/
@ -6146,16 +6148,16 @@ int swad__getLastLocation (struct soap *soap,
"bld_buildings.BldCod," // row[ 6] "bld_buildings.BldCod," // row[ 6]
"bld_buildings.ShortName," // row[ 7] "bld_buildings.ShortName," // row[ 7]
"bld_buildings.FullName," // row[ 8] "bld_buildings.FullName," // row[ 8]
"rooms.Floor," // row[ 9] "roo_rooms.Floor," // row[ 9]
"rooms.RooCod," // row[10] "roo_rooms.RooCod," // row[10]
"rooms.ShortName," // row[11] "roo_rooms.ShortName," // row[11]
"rooms.FullName," // row[12] "roo_rooms.FullName," // row[12]
"UNIX_TIMESTAMP(room_check_in.CheckInTime)" // row[13] "UNIX_TIMESTAMP(room_check_in.CheckInTime)" // row[13]
" FROM room_check_in," " FROM room_check_in,"
"rooms," "roo_rooms,"
"bld_buildings," "bld_buildings,"
"ctr_centers," "ctr_centers,"
"ins_instits" "ins_instits"
" WHERE room_check_in.UsrCod=%d" " WHERE room_check_in.UsrCod=%d"
" AND room_check_in.ChkCod=" " AND room_check_in.ChkCod="
"(SELECT ChkCod" "(SELECT ChkCod"
@ -6163,8 +6165,8 @@ int swad__getLastLocation (struct soap *soap,
" WHERE UsrCod=%d" " WHERE UsrCod=%d"
" ORDER BY ChkCod DESC" " ORDER BY ChkCod DESC"
" LIMIT 1)" // Faster than SELECT MAX " LIMIT 1)" // Faster than SELECT MAX
" AND room_check_in.RooCod=rooms.RooCod" " AND room_check_in.RooCod=roo_rooms.RooCod"
" AND rooms.BldCod=bld_buildings.BldCod" " AND roo_rooms.BldCod=bld_buildings.BldCod"
" AND bld_buildings.CtrCod=ctr_centers.CtrCod" " AND bld_buildings.CtrCod=ctr_centers.CtrCod"
" AND ctr_centers.InsCod=ins_instits.InsCod", " AND ctr_centers.InsCod=ins_instits.InsCod",
userCode,userCode); userCode,userCode);
@ -6211,10 +6213,10 @@ static void API_GetDataOfLocation (struct soap *soap,
bld_buildings.BldCod // row[ 6] bld_buildings.BldCod // row[ 6]
bld_buildings.ShortName // row[ 7] bld_buildings.ShortName // row[ 7]
bld_buildings.FullName // row[ 8] bld_buildings.FullName // row[ 8]
rooms.Floor // row[ 9] roo_rooms.Floor // row[ 9]
rooms.RooCod // row[10] roo_rooms.RooCod // row[10]
rooms.ShortName // row[11] roo_rooms.ShortName // row[11]
rooms.FullName // row[12] roo_rooms.FullName // row[12]
UNIX_TIMESTAMP(room_check_in.CheckInTime) // row[13] (optional) UNIX_TIMESTAMP(room_check_in.CheckInTime) // row[13] (optional)
*/ */

View File

@ -1534,14 +1534,17 @@ static void Att_GetAndWriteNamesOfGrpsAssociatedToAttEvent (struct Att_Event *Ev
NumGrps = (unsigned) DB_QuerySELECT (&mysql_res,"can not get groups of an attendance event", NumGrps = (unsigned) DB_QuerySELECT (&mysql_res,"can not get groups of an attendance event",
"SELECT crs_grp_types.GrpTypName," "SELECT crs_grp_types.GrpTypName,"
"crs_grp.GrpName," "crs_grp.GrpName,"
"rooms.ShortName" "roo_rooms.ShortName"
" FROM (att_grp,crs_grp,crs_grp_types)" " FROM (att_grp,"
" LEFT JOIN rooms" "crs_grp,"
" ON crs_grp.RooCod=rooms.RooCod" "crs_grp_types)"
" LEFT JOIN roo_rooms"
" ON crs_grp.RooCod=roo_rooms.RooCod"
" WHERE att_grp.AttCod=%ld" " WHERE att_grp.AttCod=%ld"
" AND att_grp.GrpCod=crs_grp.GrpCod" " AND att_grp.GrpCod=crs_grp.GrpCod"
" AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod" " AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod"
" ORDER BY crs_grp_types.GrpTypName,crs_grp.GrpName", " ORDER BY crs_grp_types.GrpTypName,"
"crs_grp.GrpName",
Event->AttCod); Event->AttCod);
/***** Write heading *****/ /***** Write heading *****/

View File

@ -565,12 +565,11 @@ void Bld_RemoveBuilding (void)
Bld_GetDataOfBuildingByCod (Bld_EditingBuilding); Bld_GetDataOfBuildingByCod (Bld_EditingBuilding);
/***** Update rooms assigned to this building *****/ /***** Update rooms assigned to this building *****/
/* TODO: Uncomment when rooms be associated to building
DB_QueryUPDATE ("can not update building in groups", DB_QueryUPDATE ("can not update building in groups",
"UPDATE rooms SET BldCod=0" // 0 means another building "UPDATE roo_rooms"
" SET BldCod=0" // 0 means another building
" WHERE BldCod=%ld", " WHERE BldCod=%ld",
Bld_EditingBuilding->BldCod); Bld_EditingBuilding->BldCod);
*/
/***** Remove building *****/ /***** Remove building *****/
DB_QueryDELETE ("can not remove a building", DB_QueryDELETE ("can not remove a building",

View File

@ -607,6 +607,10 @@ TODO: FIX BUG, URGENT! En las fechas como par
TODO: Rename CENTRE to CENTER in help wiki. TODO: Rename CENTRE to CENTER in help wiki.
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
Version 20.51.19: Mar 19, 2021 Rooms database table renamed. (308059 lines)
1 change necessary in database:
RENAME TABLE rooms TO roo_rooms;
Version 20.51.19: Mar 19, 2021 Media database table renamed. (308033 lines) Version 20.51.19: Mar 19, 2021 Media database table renamed. (308033 lines)
1 change necessary in database: 1 change necessary in database:
RENAME TABLE media TO med_media; RENAME TABLE media TO med_media;

View File

@ -2592,24 +2592,24 @@ mysql> DESCRIBE prj_usr;
"UsrCod INT NOT NULL," "UsrCod INT NOT NULL,"
"UNIQUE INDEX(PrjCod,RoleInProject,UsrCod))"); "UNIQUE INDEX(PrjCod,RoleInProject,UsrCod))");
/***** Table rooms *****/ /***** Table roo_rooms *****/
/* /*
mysql> DESCRIBE rooms; mysql> DESCRIBE roo_rooms;
+-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+ +-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra | | Field | Type | Null | Key | Default | Extra |
+-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+ +-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+
| RooCod | int(11) | NO | PRI | NULL | auto_increment | | RooCod | int | NO | PRI | NULL | auto_increment |
| CtrCod | int(11) | NO | MUL | NULL | | | CtrCod | int | NO | MUL | NULL | |
| BldCod | int(11) | NO | | -1 | | | BldCod | int | NO | | -1 | |
| Floor | int(11) | NO | | 0 | | | Floor | int | NO | | 0 | |
| Type | enum('no_type','administration','auditorium','cafeteria','canteen','classroom','concierge','corridor','gym','hall','kindergarten','laboratory','library','office','outdoors','parking','pavilion','room','secretariat','seminar','shop','store','toilets','virtual','yard') | NO | | no_type | | | Type | enum('no_type','administration','auditorium','cafeteria','canteen','classroom','concierge','corridor','gym','hall','kindergarten','laboratory','library','office','outdoors','parking','pavilion','room','secretariat','seminar','shop','store','toilets','virtual','yard') | NO | | no_type | |
| ShortName | varchar(511) | NO | | NULL | | | ShortName | varchar(511) | NO | | NULL | |
| FullName | varchar(2047) | NO | | NULL | | | FullName | varchar(2047) | NO | | NULL | |
| Capacity | int(11) | NO | | NULL | | | Capacity | int | NO | | NULL | |
+-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+ +-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------+-----+---------+----------------+
8 rows in set (0.00 sec) 8 rows in set (0.00 sec)
*/ */
DB_CreateTable ("CREATE TABLE IF NOT EXISTS rooms (" DB_CreateTable ("CREATE TABLE IF NOT EXISTS roo_rooms ("
"RooCod INT NOT NULL AUTO_INCREMENT," "RooCod INT NOT NULL AUTO_INCREMENT,"
"CtrCod INT NOT NULL," "CtrCod INT NOT NULL,"
"BldCod INT NOT NULL DEFAULT -1," "BldCod INT NOT NULL DEFAULT -1,"

View File

@ -982,7 +982,7 @@ static void Grp_LockTables (void)
"crs_grp_usr WRITE," "crs_grp_usr WRITE,"
"crs_usr READ," "crs_usr READ,"
"crs_usr_last READ," "crs_usr_last READ,"
"rooms READ"); "roo_rooms READ");
Gbl.DB.LockedTables = true; Gbl.DB.LockedTables = true;
} }
@ -3068,13 +3068,13 @@ unsigned long Grp_GetGrpsOfType (long GrpTypCod,MYSQL_RES **mysql_res)
"SELECT crs_grp.GrpCod," "SELECT crs_grp.GrpCod,"
"crs_grp.GrpName," "crs_grp.GrpName,"
"crs_grp.RooCod," "crs_grp.RooCod,"
"rooms.ShortName," "roo_rooms.ShortName,"
"crs_grp.MaxStudents," "crs_grp.MaxStudents,"
"crs_grp.Open," "crs_grp.Open,"
"crs_grp.FileZones" "crs_grp.FileZones"
" FROM crs_grp" " FROM crs_grp"
" LEFT JOIN rooms" " LEFT JOIN roo_rooms"
" ON crs_grp.RooCod=rooms.RooCod" " ON crs_grp.RooCod=roo_rooms.RooCod"
" WHERE crs_grp.GrpTypCod=%ld" " WHERE crs_grp.GrpTypCod=%ld"
" ORDER BY crs_grp.GrpName", " ORDER BY crs_grp.GrpName",
GrpTypCod); GrpTypCod);
@ -3175,13 +3175,14 @@ void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat)
"crs_grp_types.Multiple," // row[3] "crs_grp_types.Multiple," // row[3]
"crs_grp.GrpName," // row[4] "crs_grp.GrpName," // row[4]
"crs_grp.RooCod," // row[5] "crs_grp.RooCod," // row[5]
"rooms.ShortName," // row[6] "roo_rooms.ShortName," // row[6]
"crs_grp.MaxStudents," // row[7] "crs_grp.MaxStudents," // row[7]
"crs_grp.Open," // row[8] "crs_grp.Open," // row[8]
"crs_grp.FileZones" // row[9] "crs_grp.FileZones" // row[9]
" FROM (crs_grp,crs_grp_types)" " FROM (crs_grp,"
" LEFT JOIN rooms" "crs_grp_types)"
" ON crs_grp.RooCod=rooms.RooCod" " LEFT JOIN roo_rooms"
" ON crs_grp.RooCod=roo_rooms.RooCod"
" WHERE crs_grp.GrpCod=%ld" " WHERE crs_grp.GrpCod=%ld"
" AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod", " AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod",
GrpDat->GrpCod); GrpDat->GrpCod);

View File

@ -533,23 +533,23 @@ void Roo_GetListRooms (struct Roo_Rooms *Rooms,
static const char *OrderBySubQuery[Roo_NUM_ORDERS] = static const char *OrderBySubQuery[Roo_NUM_ORDERS] =
{ {
[Roo_ORDER_BY_BUILDING ] = "bld_buildings.ShortName," [Roo_ORDER_BY_BUILDING ] = "bld_buildings.ShortName,"
"rooms.Floor," "roo_rooms.Floor,"
"rooms.ShortName", "roo_rooms.ShortName",
[Roo_ORDER_BY_FLOOR ] = "rooms.Floor," [Roo_ORDER_BY_FLOOR ] = "roo_rooms.Floor,"
"bld_buildings.ShortName," "bld_buildings.ShortName,"
"rooms.ShortName", "roo_rooms.ShortName",
[Roo_ORDER_BY_TYPE ] = "rooms.Type," [Roo_ORDER_BY_TYPE ] = "roo_rooms.Type,"
"bld_buildings.ShortName," "bld_buildings.ShortName,"
"rooms.Floor," "roo_rooms.Floor,"
"rooms.ShortName", "roo_rooms.ShortName",
[Roo_ORDER_BY_SHRT_NAME] = "rooms.ShortName," [Roo_ORDER_BY_SHRT_NAME] = "roo_rooms.ShortName,"
"rooms.FullName", "roo_rooms.FullName",
[Roo_ORDER_BY_FULL_NAME] = "rooms.FullName," [Roo_ORDER_BY_FULL_NAME] = "roo_rooms.FullName,"
"rooms.ShortName", "roo_rooms.ShortName",
[Roo_ORDER_BY_CAPACITY ] = "rooms.Capacity DESC," [Roo_ORDER_BY_CAPACITY ] = "roo_rooms.Capacity DESC,"
"bld_buildings.ShortName," "bld_buildings.ShortName,"
"rooms.Floor," "roo_rooms.Floor,"
"rooms.ShortName", "roo_rooms.ShortName",
}; };
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
@ -562,17 +562,18 @@ void Roo_GetListRooms (struct Roo_Rooms *Rooms,
{ {
case Roo_ALL_DATA: case Roo_ALL_DATA:
NumRows = DB_QuerySELECT (&mysql_res,"can not get rooms", NumRows = DB_QuerySELECT (&mysql_res,"can not get rooms",
"SELECT rooms.RooCod," // row[0] "SELECT roo_rooms.RooCod," // row[0]
"rooms.BldCod," // row[1] "roo_rooms.BldCod," // row[1]
"bld_buildings.ShortName," // row[2] "bld_buildings.ShortName," // row[2]
"rooms.Floor," // row[3] "roo_rooms.Floor," // row[3]
"rooms.Type," // row[4] "roo_rooms.Type," // row[4]
"rooms.ShortName," // row[5] "roo_rooms.ShortName," // row[5]
"rooms.FullName," // row[6] "roo_rooms.FullName," // row[6]
"rooms.Capacity" // row[7] "roo_rooms.Capacity" // row[7]
" FROM rooms LEFT JOIN bld_buildings" " FROM roo_rooms"
" ON rooms.BldCod=bld_buildings.BldCod" " LEFT JOIN bld_buildings"
" WHERE rooms.CtrCod=%ld" " ON roo_rooms.BldCod=bld_buildings.BldCod"
" WHERE roo_rooms.CtrCod=%ld"
" ORDER BY %s", " ORDER BY %s",
Gbl.Hierarchy.Ctr.CtrCod, Gbl.Hierarchy.Ctr.CtrCod,
OrderBySubQuery[Rooms->SelectedOrder]); OrderBySubQuery[Rooms->SelectedOrder]);
@ -580,11 +581,11 @@ void Roo_GetListRooms (struct Roo_Rooms *Rooms,
case Roo_ONLY_SHRT_NAME: case Roo_ONLY_SHRT_NAME:
default: default:
NumRows = DB_QuerySELECT (&mysql_res,"can not get rooms", NumRows = DB_QuerySELECT (&mysql_res,"can not get rooms",
"SELECT rooms.RooCod," // row[0] "SELECT roo_rooms.RooCod," // row[0]
"rooms.ShortName" // row[1] "roo_rooms.ShortName" // row[1]
" FROM rooms LEFT JOIN bld_buildings" " FROM roo_rooms LEFT JOIN bld_buildings"
" ON rooms.BldCod=bld_buildings.BldCod" " ON roo_rooms.BldCod=bld_buildings.BldCod"
" WHERE rooms.CtrCod=%ld" " WHERE roo_rooms.CtrCod=%ld"
" ORDER BY %s", " ORDER BY %s",
Gbl.Hierarchy.Ctr.CtrCod, Gbl.Hierarchy.Ctr.CtrCod,
OrderBySubQuery[Roo_ORDER_DEFAULT]); OrderBySubQuery[Roo_ORDER_DEFAULT]);
@ -668,16 +669,16 @@ static void Roo_GetDataOfRoomByCod (struct Roo_Room *Room)
/***** Get data of a room from database *****/ /***** Get data of a room from database *****/
NumRows = DB_QuerySELECT (&mysql_res,"can not get data of a room", NumRows = DB_QuerySELECT (&mysql_res,"can not get data of a room",
"SELECT rooms.BldCod," // row[0] "SELECT roo_rooms.BldCod," // row[0]
"bld_buildings.ShortName," // row[1] "bld_buildings.ShortName," // row[1]
"rooms.Floor," // row[2] "roo_rooms.Floor," // row[2]
"rooms.Type," // row[3] "roo_rooms.Type," // row[3]
"rooms.ShortName," // row[4] "roo_rooms.ShortName," // row[4]
"rooms.FullName," // row[5] "roo_rooms.FullName," // row[5]
"rooms.Capacity" // row[6] "roo_rooms.Capacity" // row[6]
" FROM rooms LEFT JOIN bld_buildings" " FROM roo_rooms LEFT JOIN bld_buildings"
" ON rooms.BldCod=bld_buildings.BldCod" " ON roo_rooms.BldCod=bld_buildings.BldCod"
" WHERE rooms.RooCod=%ld", " WHERE roo_rooms.RooCod=%ld",
Room->RooCod); Room->RooCod);
/***** Count number of rows in result *****/ /***** Count number of rows in result *****/
@ -1017,7 +1018,8 @@ void Roo_RemoveRoom (void)
/***** Remove room *****/ /***** Remove room *****/
DB_QueryDELETE ("can not remove a room", DB_QueryDELETE ("can not remove a room",
"DELETE FROM rooms WHERE RooCod=%ld", "DELETE FROM roo_rooms"
" WHERE RooCod=%ld",
Roo_EditingRoom->RooCod); Roo_EditingRoom->RooCod);
/***** Create message to show the change made *****/ /***** Create message to show the change made *****/
@ -1034,7 +1036,7 @@ void Roo_RemoveAllRoomsInCtr (long CtrCod)
{ {
/***** Remove all rooms in center *****/ /***** Remove all rooms in center *****/
DB_QueryDELETE ("can not remove rooms", DB_QueryDELETE ("can not remove rooms",
"DELETE FROM rooms" "DELETE FROM roo_rooms"
" WHERE CtrCod=%ld", " WHERE CtrCod=%ld",
CtrCod); CtrCod);
} }
@ -1076,7 +1078,9 @@ void Roo_ChangeBuilding (void)
{ {
/***** Update the table of rooms changing the old building for the new one *****/ /***** Update the table of rooms changing the old building for the new one *****/
DB_QueryUPDATE ("can not update the building of a room", DB_QueryUPDATE ("can not update the building of a room",
"UPDATE rooms SET BldCod=%ld WHERE RooCod=%ld", "UPDATE roo_rooms"
" SET BldCod=%ld"
" WHERE RooCod=%ld",
NewBldCod,Roo_EditingRoom->RooCod); NewBldCod,Roo_EditingRoom->RooCod);
/***** Get updated data of the room from database *****/ /***** Get updated data of the room from database *****/
@ -1124,7 +1128,9 @@ void Roo_ChangeFloor (void)
{ {
/***** Update the table of rooms changing the old floor for the new one *****/ /***** Update the table of rooms changing the old floor for the new one *****/
DB_QueryUPDATE ("can not update the capacity of a room", DB_QueryUPDATE ("can not update the capacity of a room",
"UPDATE rooms SET Floor=%d WHERE RooCod=%ld", "UPDATE roo_rooms"
" SET Floor=%d"
" WHERE RooCod=%ld",
NewFloor,Roo_EditingRoom->RooCod); NewFloor,Roo_EditingRoom->RooCod);
/***** Get updated data of the room from database *****/ /***** Get updated data of the room from database *****/
@ -1175,7 +1181,9 @@ void Roo_ChangeType (void)
{ {
/***** Update the table of rooms changing the old type for the new one *****/ /***** Update the table of rooms changing the old type for the new one *****/
DB_QueryUPDATE ("can not update the type of a room", DB_QueryUPDATE ("can not update the type of a room",
"UPDATE rooms SET Type='%s' WHERE RooCod=%ld", "UPDATE roo_rooms"
" SET Type='%s'"
" WHERE RooCod=%ld",
Roo_TypesDB[NewType], Roo_TypesDB[NewType],
Roo_EditingRoom->RooCod); Roo_EditingRoom->RooCod);
@ -1301,11 +1309,14 @@ static bool Roo_CheckIfRoomNameExists (const char *FieldName,const char *Name,lo
/***** Get number of rooms with a name from database *****/ /***** Get number of rooms with a name from database *****/
return (DB_QueryCOUNT ("can not check if the name of a room" return (DB_QueryCOUNT ("can not check if the name of a room"
" already existed", " already existed",
"SELECT COUNT(*) FROM rooms" "SELECT COUNT(*)"
" FROM roo_rooms"
" WHERE CtrCod=%ld" " WHERE CtrCod=%ld"
" AND %s='%s' AND RooCod<>%ld", " AND %s='%s'"
" AND RooCod<>%ld",
Gbl.Hierarchy.Ctr.CtrCod, Gbl.Hierarchy.Ctr.CtrCod,
FieldName,Name,RooCod) != 0); FieldName,Name,
RooCod) != 0);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1316,7 +1327,9 @@ static void Roo_UpdateRoomNameDB (long RooCod,const char *FieldName,const char *
{ {
/***** Update room changing old name by new name */ /***** Update room changing old name by new name */
DB_QueryUPDATE ("can not update the name of a room", DB_QueryUPDATE ("can not update the name of a room",
"UPDATE rooms SET %s='%s' WHERE RooCod=%ld", "UPDATE roo_rooms"
" SET %s='%s'"
" WHERE RooCod=%ld",
FieldName,NewRoomName,RooCod); FieldName,NewRoomName,RooCod);
} }
@ -1360,7 +1373,9 @@ void Roo_ChangeCapacity (void)
{ {
/***** Update the table of rooms changing the old capacity for the new one *****/ /***** Update the table of rooms changing the old capacity for the new one *****/
DB_QueryUPDATE ("can not update the capacity of a room", DB_QueryUPDATE ("can not update the capacity of a room",
"UPDATE rooms SET Capacity=%u WHERE RooCod=%ld", "UPDATE roo_rooms"
" SET Capacity=%u"
" WHERE RooCod=%ld",
NewCapacity,Roo_EditingRoom->RooCod); NewCapacity,Roo_EditingRoom->RooCod);
Roo_EditingRoom->Capacity = NewCapacity; Roo_EditingRoom->Capacity = NewCapacity;
@ -1602,7 +1617,7 @@ static void Roo_CreateRoom (struct Roo_Room *Room)
/***** Create a new room *****/ /***** Create a new room *****/
Room->RooCod = Room->RooCod =
DB_QueryINSERTandReturnCode ("can not create room", DB_QueryINSERTandReturnCode ("can not create room",
"INSERT INTO rooms" "INSERT INTO roo_rooms"
" (CtrCod,BldCod,Floor,Type,ShortName,FullName,Capacity)" " (CtrCod,BldCod,Floor,Type,ShortName,FullName,Capacity)"
" VALUES" " VALUES"
" (%ld,%ld,%d,'%s','%s','%s',%u)", " (%ld,%ld,%d,'%s','%s','%s',%u)",