bool InsertJobinformationEx(MySqlConnection connection, IInfoProvider2 dbq) { //HELPER VARIABLES IDataJobinformationCollection jobInfo = dbq.createJobCollection(); MySqlCommand command = new MySqlCommand(_query_34, connection); try { command.Parameters.AddWithValue("CharId", jobInfo.CharacterId); command.Parameters.AddWithValue("JobInformation", jobInfo.Joblevels); return command.ExecuteNonQuery() > 0; } catch (Exception e) { __dbtracelog.WriteError("Database", e.Message); return false; } }
//Third generation methods jobs bool LoadJobinformationEx(MySqlConnection connection, IInfoProvider2 dbq, bool continueOnError) { IDataJobinformationCollection jobInfo = dbq.createJobCollection(); MySqlCommand command = new MySqlCommand(_query_32, connection); MySqlDataReader reader = null; command.Parameters.AddWithValue("CharId", jobInfo.CharacterId); try { reader = command.ExecuteReader(CommandBehavior.SingleResult); while (reader.Read()) { if (reader.IsDBNull(0) == false) reader.GetBytes(0, 0, jobInfo.Joblevels, 0, 15); else for (int i = 0; i < 15; i++) jobInfo.Joblevels[i] = 1; return true; } __dbtracelog.WriteError("Database", "player job-data of player with id {0} is missing", jobInfo.CharacterId); return continueOnError; } catch (Exception e) { __dbtracelog.WriteError("Database", e.Message); return false; } finally { if (reader != null) reader.Close(); } }