internal void AddResultInfo(MatrixTestResult matResult) { if (matResult.IsMonoTouch) { HasMTResults = true; _csResult = matResult.CSTestResult; _pInvokeResult = matResult.CTestResult; _mtBLAS = matResult.BLASTestResult; } else { HasObjCResults = true; _objCResult = matResult.CTestResult; _objCBLAS = matResult.BLASTestResult; } }
public int AddPerformanceMatrixTestResult(MatrixTestResult result) { int databaseId = -1; System.Data.Odbc.OdbcConnection conn = createSQLConnection(); System.Data.Odbc.OdbcTransaction transaction = null; try { string mySelectQuery = string.Format("SELECT `id` FROM `PerformanceMatrixTestResults` WHERE `DBDeviceId` ={0} AND `isMonoTouch` ={1}", result.DeviceDatabaseId, result.IsMonoTouch ? 1 : 0); conn.Open(); System.Data.Odbc.OdbcCommand mySelectCommand = new System.Data.Odbc.OdbcCommand(mySelectQuery, conn); System.Data.Odbc.OdbcDataReader reader = mySelectCommand.ExecuteReader(); if (reader.Read()) { System.Data.Odbc.OdbcCommand myUpdateCommand = new System.Data.Odbc.OdbcCommand(mySelectQuery, conn); databaseId = Convert.ToInt32(reader["id"]); string myUpdateQuery = string.Format(@" update `billholmes54`.`PerformanceMatrixTestResults` set `CSTestResult` = case when `CSTestResult` < {1} then '{1}' else CSTestResult end, `CTestResult` = case when `CTestResult` < {2} then '{2}' else CTestResult end, `BLASTestResult` = case when `BLASTestResult` < {3} then '{3}' else BLASTestResult end where id = {0}", databaseId, result.CSTestResult, result.CTestResult, result.BLASTestResult); myUpdateCommand.CommandText = myUpdateQuery; myUpdateCommand.ExecuteNonQuery(); } else { transaction = conn.BeginTransaction(); System.Data.Odbc.OdbcCommand myInsertCommand = new System.Data.Odbc.OdbcCommand(mySelectQuery, conn, transaction); string myInsertQuery = string.Format(@"INSERT INTO `billholmes54`.`PerformanceMatrixTestResults` (`id`, `DBDeviceId`, `CSTestResult`, `CTestResult`, `BLASTestResult`, `isMonoTouch`) VALUES (NULL, '{0}', '{1}', '{2}', '{3}', '{4}');", result.DeviceDatabaseId, result.CSTestResult, result.CTestResult, result.BLASTestResult, result.IsMonoTouch ? "1" : "0"); myInsertCommand.CommandText = myInsertQuery; myInsertCommand.ExecuteNonQuery(); myInsertCommand.CommandText = "select last_insert_id();"; databaseId = Convert.ToInt32(myInsertCommand.ExecuteScalar()); transaction.Commit(); } } catch (Exception) { if (transaction != null) transaction.Rollback(); throw; } finally { conn.Close(); } return databaseId; }