/// <summary> /// Finds the character details of a character per given characterid /// </summary> /// <param name="CharId"></param> /// <param name="details"></param> /// <returns></returns> public bool FindCharacterDetails(MySqlConnection connection, uint CharId, out CharDetails details) { MySqlCommand command = new MySqlCommand(); MySqlDataReader reader = null; command.Connection = connection; command.CommandText = "SELECT `CharFace`,`Jexp`,`Map` FROM `characters` WHERE CharId=?CharId LIMIT 1;"; command.Parameters.AddWithValue("CharId", CharId); bool result = false; details = new CharDetails(); try { reader = command.ExecuteReader(); while (reader.Read()) { result = true; details.FaceDetails = new byte[11]; reader.GetBytes(0, 0, details.FaceDetails, 0, 11); details.Jexp = reader.GetUInt32(1); details.Map = reader.GetByte(2); } } catch (MySqlException e) { Trace.WriteLine(e.Message, "Database"); return false; } finally { if (reader != null) reader.Close(); } return result; }
/// <summary> /// Finds the character details of a character per given characterid /// </summary> /// <param name="CharId"></param> /// <param name="details"></param> /// <returns></returns> public bool FindCharacterDetails(uint CharId, out CharDetails details) { return InternalDatabaseProvider.FindCharacterDetails(CharId, out details); }
/// <Safe>Yes</Safe> bool IDatabase.FindCharacterDetails(uint CharId, out CharDetails details) { MySqlConnection connection = ConnectionPool.Request(); try { return FindCharacterDetails(connection, CharId, out details); } catch (Exception) { details = new CharDetails(); Trace.TraceWarning("Unhandeled database error"); return false; } finally { //Release resources ConnectionPool.Release(connection); } }