Skip to content

Commit

Permalink
chore: database charset to utf8mb4 (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rushaway authored Oct 29, 2024
1 parent 8363ae5 commit 261f945
Showing 1 changed file with 9 additions and 4 deletions.
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

0 comments on commit 261f945

Please sign in to comment.