diff --git a/sql/swad.sql b/sql/swad.sql index 104690b5d..d7e9172d1 100644 --- a/sql/swad.sql +++ b/sql/swad.sql @@ -173,7 +173,7 @@ CREATE TABLE IF NOT EXISTS centres ( -- Table chat: stored number of users in each chat room (this table is not used now) -- CREATE TABLE IF NOT EXISTS chat ( - RoomCode VARCHAR(255) NOT NULL, + RoomCode VARCHAR(16) NOT NULL, NumUsrs INT NOT NULL, UNIQUE INDEX(RoomCode)); -- diff --git a/swad_changelog.h b/swad_changelog.h index 7253ae0dc..326870507 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -204,13 +204,17 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.155.1 (2017-03-09)" +#define Log_PLATFORM_VERSION "SWAD 16.155.2 (2017-03-09)" #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.2: Mar 09, 2017 Adjusting size of database fields. (216596 lines) + 1 change necessary in database: +ALTER TABLE chat CHANGE COLUMN RoomCode RoomCode VARCHAR(16) NOT NULL; + Version 16.155.1: Mar 09, 2017 Adjusting size of database fields. (216593 lines) 2 changes necessary in database: ALTER TABLE centres CHANGE COLUMN ShortName ShortName VARCHAR(511) COLLATE latin1_spanish_ci NOT NULL; diff --git a/swad_chat.c b/swad_chat.c index 8c52d433c..2a3a26295 100644 --- a/swad_chat.c +++ b/swad_chat.c @@ -51,8 +51,8 @@ extern struct Globals Gbl; #define Cht_CHAT_MAX_LEVELS 3 -#define Cht_MAX_CHARS_ROOM_CODE 16 // Maximum number of chars of the code of a chat room -#define Cht_MAX_BYTES_ROOM_CODE Cht_MAX_CHARS_ROOM_CODE +#define Cht_MAX_CHARS_ROOM_CODE 16 // 16, maximum number of chars of the code of a chat room +#define Cht_MAX_BYTES_ROOM_CODE Cht_MAX_CHARS_ROOM_CODE // 16 #define Cht_MAX_CHARS_ROOM_SHRT_NAME (128 - 1) // 127, maximum number of chars of the short name of a chat room #define Cht_MAX_BYTES_ROOM_SHRT_NAME ((Cht_MAX_CHARS_ROOM_SHRT_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047 @@ -244,7 +244,7 @@ void Cht_ShowListOfChatRoomsWithUsrs (void) extern const char *Txt_Rooms_with_users; extern const char *Txt_CHAT_Room_code; extern const char *Txt_No_of_users; - char Query[512]; + char Query[256]; MYSQL_RES *mysql_res; MYSQL_ROW row; unsigned long NumRow,NumRows; @@ -350,7 +350,7 @@ void Cht_WriteParamsRoomCodeAndNames (const char *RoomCode,const char *RoomShrtN static unsigned Cht_GetNumUsrsInChatRoom (const char *RoomCode) { - char Query[512]; + char Query[128 + Cht_MAX_BYTES_ROOM_CODE]; MYSQL_RES *mysql_res; MYSQL_ROW row; unsigned NumUsrs = 0; diff --git a/swad_database.c b/swad_database.c index 5222bc32a..f621dd758 100644 --- a/swad_database.c +++ b/swad_database.c @@ -443,18 +443,18 @@ mysql> DESCRIBE centres; /***** Table chat *****/ /* mysql> DESCRIBE chat; -+----------+--------------+------+-----+---------+-------+ -| Field | Type | Null | Key | Default | Extra | -+----------+--------------+------+-----+---------+-------+ -| RoomCode | varchar(255) | NO | PRI | NULL | | -| NumUsrs | int(11) | NO | | NULL | | -+----------+--------------+------+-----+---------+-------+ -2 rows in set (0.00 sec) ++----------+-------------+------+-----+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++----------+-------------+------+-----+---------+-------+ +| RoomCode | varchar(16) | NO | PRI | NULL | | +| NumUsrs | int(11) | NO | | NULL | | ++----------+-------------+------+-----+---------+-------+ +2 rows in set (0,00 sec) */ DB_CreateTable ("CREATE TABLE IF NOT EXISTS chat ("\ - "RoomCode VARCHAR(255) NOT NULL," - "NumUsrs INT NOT NULL," - "UNIQUE INDEX(RoomCode))"); + "RoomCode VARCHAR(16) NOT NULL," // Cht_MAX_BYTES_ROOM_CODE + "NumUsrs INT NOT NULL," + "UNIQUE INDEX(RoomCode))"); /***** Table clicks_without_photo *****/ /*