Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: database charset to utf8mb4 #19

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions addons/sourcemod/scripting/ConnectAnnounce.sp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

#pragma newdecls required

#define CHARSET "utf8mb4"
#define COLLATION "utf8mb4_unicode_ci"

#define MSGLENGTH 100
#define ANNOUNCER_DELAY 1.5
#define DATABASE_NAME "connect_announce"
Expand Down Expand Up @@ -78,7 +81,7 @@ public Plugin myinfo =
name = "Connect Announce",
author = "Neon + Botox + maxime1907 + .Rushaway",
description = "Connect Announcer",
version = "2.3.9",
version = "2.3.10",
url = ""
}

Expand Down Expand Up @@ -660,7 +663,7 @@ stock void DB_SetNames(Database db)
{
static int retries = 0;
char sQuery[MAX_SQL_QUERY_LENGTH];
Format(sQuery, sizeof(sQuery), "SET NAMES \"UTF8MB4\"");
Format(sQuery, sizeof(sQuery), "SET NAMES \"%s\"", CHARSET);

if (DB_Connect())
{
Expand Down Expand Up @@ -704,7 +707,8 @@ stock void DB_CreateTable(Database db)
`name` TEXT NOT NULL, \
`message` TEXT, \
PRIMARY KEY(`steamid`) \
)"
) CHARACTER SET %s COLLATE %s;"
, CHARSET, COLLATION
);
else
FormatEx(sQuery, sizeof(sQuery),
Expand All @@ -713,7 +717,8 @@ stock void DB_CreateTable(Database db)
`name` VARCHAR(32) NOT NULL, \
`message` VARCHAR(256), \
PRIMARY KEY(`steamid`) \
);"
) CHARACTER SET %s COLLATE %s;"
, CHARSET, COLLATION
);

if (DB_Connect())
Expand Down
Loading