// Function from file: message_server.dm public void save_all_data_to_sql( ) { dynamic round_id = null; DBQuery query = null; string sqlrowlist = null; FeedbackVariable FV = null; DBQuery query_insert = null; if (!(this.feedback != null)) { return; } this.round_end_data_gathering(); GlobalFuncs.establish_db_connection(); if (!GlobalVars.dbcon.IsConnected()) { return; } query = GlobalVars.dbcon.NewQuery("SELECT MAX(round_id) AS round_id FROM " + GlobalFuncs.format_table_name("feedback")); query.Execute(); while (query.NextRow()) { round_id = query.item[1]; } if (!Lang13.Bool(Lang13.IsNumber(round_id))) { round_id = String13.ParseNumber(round_id); } round_id++; sqlrowlist = ""; foreach (dynamic _a in Lang13.Enumerate(this.feedback, typeof(FeedbackVariable))) { FV = _a; if (sqlrowlist != "") { sqlrowlist += ", "; } sqlrowlist += "(null, Now(), " + round_id + ", \"" + GlobalFuncs.sanitizeSQL(FV.get_variable()) + "\", " + FV.get_value() + ", \"" + GlobalFuncs.sanitizeSQL(FV.get_details()) + "\")"; } if (sqlrowlist == "") { return; } query_insert = GlobalVars.dbcon.NewQuery("INSERT DELAYED IGNORE INTO " + GlobalFuncs.format_table_name("feedback") + " VALUES " + sqlrowlist); query_insert.Execute(); return; }
// Function from file: message_server.dm public FeedbackVariable find_feedback_datum(string variable = null) { FeedbackVariable FV = null; FeedbackVariable FV2 = null; foreach (dynamic _a in Lang13.Enumerate(this.feedback, typeof(FeedbackVariable))) { FV = _a; if (FV.get_variable() == variable) { return(FV); } } FV2 = new FeedbackVariable(variable); this.feedback.Add(FV2); return(FV2); }