Closed ApertureDevelopment closed 2 years ago
INSERT INTO `tbl_mrsync` (user_id, rank, server_group)
SELECT tbl_users.p_user_id, ?, tbl_server_grp.p_group_id
FROM tbl_users, tbl_server_grp
WHERE
tbl_users.steamid=? AND tbl_users.steamid64=?
AND
tbl_server_grp.group_name=?
ON DUPLICATE KEY UPDATE rank=VALUES(rank);
https://github.com/Aperture-Development/MSync-2/blob/master/lua/msync/server/modules/sv_mbsync.lua#L123 and https://github.com/Aperture-Development/MSync-2/blob/master/lua/msync/server/modules/sv_mbsync.lua#L203 ( compare UserTbl id in an OR notation instead ) and https://github.com/Aperture-Development/MSync-2/blob/master/lua/msync/server/modules/sv_mbsync.lua#L686 ( no check for steamid64 )
INSERT INTO `tbl_mbsync` (user_id, admin_id, reason, date_unix, length_unix, server_group)
SELECT UserTbl.p_user_id, AdminTbl.p_user_id, ?, ?, ?, tbl_server_grp.p_group_id
FROM tbl_users AS UserTbl, tbl_users AS AdminTbl
WHERE
UserTbl.steamid=? AND
UserTbl.steamid64=?
AND
AdminTbl.steamid=? AND
AdminTbl.steamid64=?
AND
tbl_server_grp.group_name=?;
https://github.com/Aperture-Development/MSync-2/blob/master/lua/msync/server/sv_mysql.lua#L208
INSERT INTO `tbl_msync_servers` (server_name, ip, port, server_group)
SELECT ?, ?, ?, tbl_server_grp.p_group_id
FROM tbl_server_grp
WHERE
group_name=?
ON DUPLICATE KEY UPDATE server_name=VALUES(server_name), server_group=VALUES(server_group);
A bug was just discovered within the nested SQL statements. It appears that the current nested selects for the insert queries are all not working with a regular mysql database.
This syntax:
is only MariaDB specific and does not work with MySQL 8. The proper syntax to use for the example given above would be