Skip to content

Commit

Permalink
Merge pull request darkerz7#57 from Rushaway/sql
Browse files Browse the repository at this point in the history
chore(EW-LM): Upgrade to utf8mb4
  • Loading branch information
darkerz7 authored Oct 28, 2024
2 parents ed3c088 + a1f687a commit 812fa01
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions addons/sourcemod/scripting/entwatch_logs_manager.sp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#define REQUIRE_PLUGIN

#define DB_ENTWATCH_SECTION "EntWatch"
#define DB_ENTWATCH_CHARSET "utf8mb4"
#define DB_ENTWATCH_COLLATION "utf8mb4_unicode_ci"

ConVar g_hCvar_System_Server,
g_hCvar_Item_Server,
Expand Down Expand Up @@ -71,7 +73,7 @@ public Plugin myinfo =
name = "EntWatch Logs Manager",
author = "DarkerZ[RUS], .Rushaway",
description = "Allows you to manage logs from the plugin EntWatch.",
version = "1.DZ.2",
version = "1.DZ.3",
url = "dark-skill.ru"
};

Expand Down Expand Up @@ -229,7 +231,7 @@ void DB_ConnectCallBack(Database hDatabase, const char[] sError, any data)
g_hDB = hDatabase;
LogMessage("[EW-LM DB] Successful connection to DB");
DB_CreateTables(); // Create Tables
g_hDB.SetCharset("utf8"); // Set Charset UTF8
g_hDB.SetCharset(DB_ENTWATCH_CHARSET); // Set Charset UTF8
}

void DB_CreateTables()
Expand All @@ -254,9 +256,9 @@ void DB_CreateTables()
`map` varchar(32) NOT NULL, \
`message` varchar(128), \
`other` varchar(32), \
`reason` varchar(64), \
`reason` varchar(64), \
`timestamp` int NOT NULL, \
PRIMARY KEY (id))");
PRIMARY KEY (id)) CHARACTER SET %s COLLATE %s;", DB_ENTWATCH_CHARSET, DB_ENTWATCH_COLLATION);
T_CreateTables.AddQuery(sSQL_Query);
SQL_ExecuteTransaction(g_hDB, T_CreateTables, DB_SQLCreateTables_Success, DB_SQLCreateTables_Error, _, DBPrio_High);
} else if(strcmp(sConnectDriverDB, "sqlite") == 0)
Expand All @@ -277,8 +279,8 @@ void DB_CreateTables()
`map` varchar(32) NOT NULL, \
`message` varchar(128), \
`other` varchar(32), \
`reason` varchar(64), \
`timestamp` INTEGER NOT NULL)");
`reason` varchar(64), \
`timestamp` INTEGER NOT NULL) CHARACTER SET %s COLLATE %s;", DB_ENTWATCH_CHARSET, DB_ENTWATCH_COLLATION);
T_CreateTables.AddQuery(sSQL_Query);
SQL_ExecuteTransaction(g_hDB, T_CreateTables, DB_SQLCreateTables_Success, DB_SQLCreateTables_Error, _, DBPrio_High);
} else
Expand Down

0 comments on commit 812fa01

Please sign in to comment.