mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
Fixed MySQL Syntax issues
This commit is contained in:
parent
7c9077beec
commit
270d4ce436
@ -30,10 +30,10 @@ namespace FFXIVClassic_Map_Server
|
||||
cmd.Parameters.AddWithValue("@sessionId", sessionId);
|
||||
using (MySqlDataReader Reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (Reader.Read())
|
||||
{
|
||||
id = Reader.GetUInt32("userId");
|
||||
}
|
||||
while (Reader.Read())
|
||||
{
|
||||
id = Reader.GetUInt32("userId");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (MySqlException e)
|
||||
@ -43,11 +43,11 @@ namespace FFXIVClassic_Map_Server
|
||||
finally
|
||||
{
|
||||
conn.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public static DBWorld GetServer(uint serverId)
|
||||
{
|
||||
using (var conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||
@ -56,7 +56,7 @@ namespace FFXIVClassic_Map_Server
|
||||
try
|
||||
{
|
||||
conn.Open();
|
||||
world = conn.Query<DBWorld>("SELECT * FROM servers WHERE id=@ServerId", new {ServerId = serverId}).SingleOrDefault();
|
||||
world = conn.Query<DBWorld>("SELECT * FROM servers WHERE id=@ServerId", new { ServerId = serverId }).SingleOrDefault();
|
||||
}
|
||||
catch (MySqlException e)
|
||||
{
|
||||
@ -69,7 +69,7 @@ namespace FFXIVClassic_Map_Server
|
||||
|
||||
return world;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Npc> GetNpcList()
|
||||
{
|
||||
@ -99,7 +99,7 @@ namespace FFXIVClassic_Map_Server
|
||||
using (var conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||
{
|
||||
Dictionary<uint, Item> gamedataItems = new Dictionary<uint, Item>();
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
conn.Open();
|
||||
@ -145,7 +145,7 @@ namespace FFXIVClassic_Map_Server
|
||||
{
|
||||
conn.Dispose();
|
||||
}
|
||||
|
||||
|
||||
return gamedataItems;
|
||||
}
|
||||
}
|
||||
@ -244,7 +244,7 @@ namespace FFXIVClassic_Map_Server
|
||||
|
||||
public static void SavePlayerPosition(Player player)
|
||||
{
|
||||
string query;
|
||||
string query;
|
||||
MySqlCommand cmd;
|
||||
|
||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||
@ -262,7 +262,7 @@ namespace FFXIVClassic_Map_Server
|
||||
currentZoneId = @zoneId
|
||||
WHERE id = @charaId
|
||||
";
|
||||
|
||||
|
||||
cmd = new MySqlCommand(query, conn);
|
||||
cmd.Parameters.AddWithValue("@charaId", player.actorId);
|
||||
cmd.Parameters.AddWithValue("@x", player.positionX);
|
||||
@ -371,9 +371,9 @@ namespace FFXIVClassic_Map_Server
|
||||
}
|
||||
|
||||
public static void LoadPlayerCharacter(Player player)
|
||||
{
|
||||
{
|
||||
string query;
|
||||
MySqlCommand cmd;
|
||||
MySqlCommand cmd;
|
||||
|
||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||
{
|
||||
@ -404,7 +404,7 @@ namespace FFXIVClassic_Map_Server
|
||||
restBonus,
|
||||
achievementPoints,
|
||||
playTime
|
||||
FROM characters WHERE id = @charId";
|
||||
FROM characters WHERE id = @charId";
|
||||
|
||||
cmd = new MySqlCommand(query, conn);
|
||||
cmd.Parameters.AddWithValue("@charId", player.actorId);
|
||||
@ -437,7 +437,7 @@ namespace FFXIVClassic_Map_Server
|
||||
player.playTime = reader.GetUInt32(19);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Get class levels
|
||||
query = @"
|
||||
SELECT
|
||||
@ -470,7 +470,7 @@ namespace FFXIVClassic_Map_Server
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
player.charaWork.battleSave.skillLevel[Player.CLASSID_PUG-1] = reader.GetInt16("pug");
|
||||
player.charaWork.battleSave.skillLevel[Player.CLASSID_PUG - 1] = reader.GetInt16("pug");
|
||||
player.charaWork.battleSave.skillLevel[Player.CLASSID_GLA - 1] = reader.GetInt16("gla");
|
||||
player.charaWork.battleSave.skillLevel[Player.CLASSID_MRD - 1] = reader.GetInt16("mrd");
|
||||
player.charaWork.battleSave.skillLevel[Player.CLASSID_ARC - 1] = reader.GetInt16("arc");
|
||||
@ -519,7 +519,7 @@ namespace FFXIVClassic_Map_Server
|
||||
player.charaWork.parameterSave.state_mainSkillLevel = player.charaWork.battleSave.skillLevel[reader.GetByte(4) - 1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Load appearance
|
||||
query = @"
|
||||
SELECT
|
||||
@ -662,7 +662,7 @@ namespace FFXIVClassic_Map_Server
|
||||
player.timers[i] = reader.GetUInt32(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Load Hotbar
|
||||
query = @"
|
||||
SELECT
|
||||
@ -675,11 +675,11 @@ namespace FFXIVClassic_Map_Server
|
||||
cmd.Parameters.AddWithValue("@charId", player.actorId);
|
||||
cmd.Parameters.AddWithValue("@classId", player.charaWork.parameterSave.state_mainSkill[0]);
|
||||
using (MySqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
int index = reader.GetUInt16(0);
|
||||
player.charaWork.command[index+32] = reader.GetUInt32(1);
|
||||
player.charaWork.command[index + 32] = reader.GetUInt32(1);
|
||||
player.charaWork.parameterSave.commandSlot_recastTime[index] = reader.GetUInt32(2);
|
||||
}
|
||||
}
|
||||
@ -692,7 +692,7 @@ namespace FFXIVClassic_Map_Server
|
||||
questData,
|
||||
questFlags
|
||||
FROM characters_quest_scenario WHERE characterId = @charId";
|
||||
|
||||
|
||||
cmd = new MySqlCommand(query, conn);
|
||||
cmd.Parameters.AddWithValue("@charId", player.actorId);
|
||||
using (MySqlDataReader reader = cmd.ExecuteReader())
|
||||
@ -777,7 +777,7 @@ namespace FFXIVClassic_Map_Server
|
||||
{
|
||||
int npcLSId = reader.GetUInt16(0);
|
||||
player.playerWork.npcLinkshellChatCalling[npcLSId] = reader.GetBoolean(1);
|
||||
player.playerWork.npcLinkshellChatExtra[npcLSId] = reader.GetBoolean(2);
|
||||
player.playerWork.npcLinkshellChatExtra[npcLSId] = reader.GetBoolean(2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -952,7 +952,7 @@ namespace FFXIVClassic_Map_Server
|
||||
cmd.Parameters.AddWithValue("@type", type);
|
||||
|
||||
using (MySqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
uint uniqueId = reader.GetUInt32(0);
|
||||
@ -999,7 +999,7 @@ namespace FFXIVClassic_Map_Server
|
||||
{
|
||||
conn.Open();
|
||||
|
||||
|
||||
|
||||
|
||||
string query = @"
|
||||
INSERT INTO server_items
|
||||
@ -1017,7 +1017,7 @@ namespace FFXIVClassic_Map_Server
|
||||
";
|
||||
|
||||
MySqlCommand cmd2 = new MySqlCommand(query2, conn);
|
||||
|
||||
|
||||
cmd.Parameters.AddWithValue("@itemId", itemId);
|
||||
cmd.Parameters.AddWithValue("@quality", quality);
|
||||
cmd.Parameters.AddWithValue("@itemType", itemType);
|
||||
@ -1053,12 +1053,12 @@ namespace FFXIVClassic_Map_Server
|
||||
{
|
||||
conn.Open();
|
||||
|
||||
string query = @"
|
||||
string query = @"
|
||||
UPDATE characters_inventory
|
||||
SET quantity = @quantity
|
||||
WHERE characterId = @charId AND slot = @slot AND inventoryType = @type;
|
||||
";
|
||||
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(query, conn);
|
||||
cmd.Parameters.AddWithValue("@charId", player.actorId);
|
||||
cmd.Parameters.AddWithValue("@quantity", quantity);
|
||||
@ -1098,7 +1098,7 @@ namespace FFXIVClassic_Map_Server
|
||||
|
||||
DELETE FROM server_items
|
||||
WHERE id = @serverItemId;
|
||||
";
|
||||
";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(query, conn);
|
||||
cmd.Parameters.AddWithValue("@charId", player.actorId);
|
||||
@ -1168,7 +1168,7 @@ namespace FFXIVClassic_Map_Server
|
||||
try
|
||||
{
|
||||
conn.Open();
|
||||
|
||||
|
||||
//Load Last 5 Completed
|
||||
string query = @"
|
||||
SELECT
|
||||
@ -1183,7 +1183,7 @@ namespace FFXIVClassic_Map_Server
|
||||
int count = 0;
|
||||
while (reader.Read())
|
||||
{
|
||||
uint id = reader.GetUInt32(0);
|
||||
uint id = reader.GetUInt32(0);
|
||||
latestAchievements[count++] = id;
|
||||
}
|
||||
}
|
||||
@ -1210,7 +1210,7 @@ namespace FFXIVClassic_Map_Server
|
||||
try
|
||||
{
|
||||
conn.Open();
|
||||
|
||||
|
||||
string query = @"
|
||||
SELECT packetOffsetId
|
||||
FROM characters_achievements
|
||||
@ -1222,7 +1222,7 @@ namespace FFXIVClassic_Map_Server
|
||||
using (MySqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
{
|
||||
uint offset = reader.GetUInt32(0);
|
||||
|
||||
if (offset < 0 || offset >= cheevosPacket.achievementFlags.Length)
|
||||
@ -1230,7 +1230,7 @@ namespace FFXIVClassic_Map_Server
|
||||
Program.Log.Error("SQL Error; achievement flag offset id out of range: " + offset);
|
||||
continue;
|
||||
}
|
||||
cheevosPacket.achievementFlags[offset] = true;
|
||||
cheevosPacket.achievementFlags[offset] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1262,10 +1262,7 @@ namespace FFXIVClassic_Map_Server
|
||||
INSERT INTO supportdesk_tickets
|
||||
(id, title, body, langCode)
|
||||
VALUES
|
||||
(@id, @title, @body, @langCode)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
questData = @questData, questFlags = @questFlags
|
||||
";
|
||||
(@id, @title, @body, @langCode)";
|
||||
|
||||
cmd = new MySqlCommand(query, conn);
|
||||
cmd.Parameters.AddWithValue("@id", gmTicket.ticketIssueIndex);
|
||||
@ -1286,7 +1283,7 @@ namespace FFXIVClassic_Map_Server
|
||||
}
|
||||
}
|
||||
|
||||
public static string[] getFAQNames(uint lanCode=1)
|
||||
public static string[] getFAQNames(uint lanCode = 1)
|
||||
{
|
||||
string[] faqs = null;
|
||||
List<string> raw = new List<string>();
|
||||
@ -1300,7 +1297,7 @@ namespace FFXIVClassic_Map_Server
|
||||
SELECT
|
||||
id,
|
||||
label,
|
||||
sort,
|
||||
sort
|
||||
FROM supportdesk_faqs
|
||||
ORDER BY sort";
|
||||
|
||||
@ -1329,7 +1326,7 @@ namespace FFXIVClassic_Map_Server
|
||||
return faqs;
|
||||
}
|
||||
|
||||
public static string getFAQBody(uint id, uint lanCode=1)
|
||||
public static string getFAQBody(uint id, uint lanCode = 1)
|
||||
{
|
||||
string body = string.Empty;
|
||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||
@ -1342,15 +1339,16 @@ namespace FFXIVClassic_Map_Server
|
||||
SELECT
|
||||
body
|
||||
FROM supportdesk_faqs
|
||||
WHERE id=" + id;
|
||||
WHERE id=@id";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(query, conn);
|
||||
cmd.Parameters.AddWithValue("@id", id);
|
||||
|
||||
using (MySqlDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
body = reader.GetString(2);
|
||||
body = reader.GetString(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1380,7 +1378,7 @@ namespace FFXIVClassic_Map_Server
|
||||
SELECT
|
||||
id,
|
||||
title,
|
||||
sort,
|
||||
sort
|
||||
FROM supportdesk_issues
|
||||
ORDER BY sort";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user