public function getDataMatchingRatios() { //TODO: here need to check the ratios might calculated already, so just need to pool them out form database. $checkDataMatchingQueryMaker = new CheckdataMatchingQueryMaker($this->from, $this->to); $countOfNotMachedInFromQuery = $checkDataMatchingQueryMaker->getCountOfNotMachedInFromQuery(); $countOfNotMachedInToQuery = $checkDataMatchingQueryMaker->getCountOfNotMachedInToQuery(); $countOfDistinctInFromQuery = $checkDataMatchingQueryMaker->getCountOfDistinctInFromQuery(); $countOfDistinctInToQuery = $checkDataMatchingQueryMaker->getCountOfDistinctInToQuery(); //var_dump($countOfNotMachedInFromQuery, $countOfNotMachedInToQuery, $countOfDistinctInFromQuery, $countOfDistinctInToQuery); $MSSQLHandler = new MSSQLHandler(MSSQLWLS_DB_USER, MSSQLWLS_DB_PASSWORD, MSSQLWLS_DB_NAME, MSSQLWLS_DB_HOST, MSSQLWLS_DB_PORT, null, null); $countOfNotMachedInFrom = $MSSQLHandler->ExecuteQuery($countOfNotMachedInFromQuery); $countOfNotMachedInTo = $MSSQLHandler->ExecuteQuery($countOfNotMachedInToQuery); $countOfDistinctInFrom = $MSSQLHandler->ExecuteQuery($countOfDistinctInFromQuery); $countOfDistinctInTo = $MSSQLHandler->ExecuteQuery($countOfDistinctInToQuery); //var_dump($countOfNotMachedInFrom, $countOfNotMachedInTo, $countOfDistinctInFrom, $countOfDistinctInTo); $result = new stdClass(); $result->countOfNotMachedInFromQuery = $countOfNotMachedInFromQuery; $result->countOfNotMachedInToQuery = $countOfNotMachedInToQuery; $result->countOfDistinctInFromQuery = $countOfDistinctInFromQuery; $result->countOfDistinctInToQuery = $countOfDistinctInToQuery; $result->countOfNotMachedInFrom = $countOfNotMachedInFrom[0]['ct']; $result->countOfNotMachedInTo = $countOfNotMachedInTo[0]['ct']; $result->countOfDistinctInFrom = $countOfDistinctInFrom[0]['ct']; $result->countOfDistinctInTo = $countOfDistinctInTo[0]['ct']; //var_dump($result->countOfNotMachedInFrom, $result->countOfNotMachedInTo, $result->countOfDistinctInFrom, $result->countOfDistinctInTo); //var_dump(is_numeric($result->countOfDistinctInFrom), is_numeric($result->countOfNotMachedInFrom)); if (is_numeric($result->countOfDistinctInFrom) && is_numeric($result->countOfNotMachedInFrom) && $result->countOfDistinctInFrom != "0") { $result->dataMatchingFromRatio = (floatval($result->countOfDistinctInFrom) - floatval($result->countOfNotMachedInFrom)) / floatval($result->countOfDistinctInFrom); } else { $result->dataMatchingFromRatio = "NULL"; } if (is_numeric($result->countOfDistinctInTo) && is_numeric($result->countOfNotMachedInTo) && $result->countOfDistinctInTo != "0") { $result->dataMatchingToRatio = (floatval($result->countOfDistinctInTo) - floatval($result->countOfNotMachedInTo)) / floatval($result->countOfDistinctInTo); } else { $result->dataMatchingToRatio = "NULL"; } $this->storeRatiosInDB($result->dataMatchingFromRatio, $result->dataMatchingToRatio); return $result; }
public function dropLinkedServerIfExists($linkedServerName) { $MSSQLHandler = new MSSQLHandler(MSSQLWLS_DB_USER, MSSQLWLS_DB_PASSWORD, MSSQLWLS_DB_NAME, MSSQLWLS_DB_HOST, MSSQLWLS_DB_PORT, null, null); $MSSQLHandler->dropLinkedServerIfExists($linkedServerName); }
public function testTotalNumberTuplesInTable() { $mysqlHandler = new MSSQLHandler($this->user, $this->password, $this->database, $this->host, $this->port); $rows = $mysqlHandler->GetTotalNumberTuplesInTable('LM'); $this->assertGreaterThan(10, $rows); }