//convert table string to tableStrings, Takes 'Suite_TestType_Baseline' and splits into a TableStringsClass public static TableStrings TableStringToStrings(string tableString) { string[] splitName = tableString.Split('_'); TableStrings _tableStrings = new TableStrings(splitName[0], splitName[1], (splitName[2] == "Baseline" ? true : false)); return(_tableStrings); }
//convert tableStrings to table string, Takes a tablestrings class and outputs a string formatted like 'Suite_TestType_Baseline' public static string TableStringToStrings(TableStrings tableString) { string baseline = tableString.baseline ? "Baseline" : "Results"; string _tableString = tableString.suite + "_" + tableString.testType + "_" + baseline; return(_tableString); }
//Fetches a single baseline based of deets public static IEnumerator FetchBaseline(ResultsIOData inputData, Action <ResultsIOData> outdata) { ResultsIOData data = new ResultsIOData();//ResultsIOData to send back to resultsIO for local processing TableStrings ts = new TableStrings(inputData.suite, inputData.testType, true); string table = TableStringToStrings(ts); data.suite = inputData.suite; data.testType = inputData.testType; string platform = inputData.resultsRow[0].resultsColumn[inputData.fieldNames.FindIndex(x => x == "Platform")]; string api = inputData.resultsRow[0].resultsColumn[inputData.fieldNames.FindIndex(x => x == "API")]; string group = inputData.resultsRow[0].resultsColumn[inputData.fieldNames.FindIndex(x => x == "GroupName")]; string test = inputData.resultsRow[0].resultsColumn[inputData.fieldNames.FindIndex(x => x == "TestName")]; //This line controls how baselines are selected, right now only Platform and API are unique string query = String.Format("SELECT * FROM {0} WHERE platform='{1}' AND api='{2}' AND groupname='{3}' AND testname='{4}'", table, platform, api, group, test); RawData _rawData = new RawData(); IEnumerator i = SQLRequest(query, (value => { _rawData = value; })); while (i.MoveNext()) { yield return(null); } data.fieldNames.AddRange(_rawData.fields); //Grab the fields from the RawData for (int x = 0; x < _rawData.data.Count; x++) { ResultsIORow row = new ResultsIORow(); //create a new row row.resultsColumn.AddRange(_rawData.data[x]); //store the current row of values data.resultsRow.Add(row); //add it to the data to send back to resultsIO } outdata(data); }