$row2 = $result[0]; // skip date is greater (generated after last result) if ($row2['lastChangeDate'] >= $row['resLastChangeDate']) { echo 'S'; continue; } // so go update! } else { // create $row2 = ['userAgent_id' => $row['userAgent_id']]; } $date = new \DateTime(null, new \DateTimeZone('UTC')); $row2['lastChangeDate'] = $date->format('Y-m-d H:i:s'); $row2['resultCount'] = $row['resultCount']; $row2['resultFound'] = $row['resultFound']; $row2 = hydrateResult($row2, $row); if (!isset($row2['uevId'])) { $row2['uevId'] = Uuid::uuid4()->toString(); $conn->insert('userAgentEvaluation', $row2); } else { $conn->update('userAgentEvaluation', $row2, ['uevId' => $row2['uevId']]); } echo '.'; if ($i % 100 === 0) { $conn->commit(); $conn->beginTransaction(); } $i++; } if ($conn->getTransactionNestingLevel() !== 0) { $conn->commit();
$result = $conn->fetchAll($sql); if (count($result) === 1) { $row2 = $result[0]; // skip date is greater (generated after last result) if ($row2['lastChangeDate'] >= $row['resLastChangeDate']) { echo 'S'; continue; } // so go update! } else { // create $row2 = ['result_id' => $row['resId']]; } $date = new \DateTime(null, new \DateTimeZone('UTC')); $row2['lastChangeDate'] = $date->format('Y-m-d H:i:s'); $row2 = hydrateResult($row2, $row, $resultGrouped); if (!isset($row2['revId'])) { $row2['revId'] = Uuid::uuid4()->toString(); $conn->insert('resultEvaluation', $row2); } else { $conn->update('resultEvaluation', $row2, ['revId' => $row2['revId']]); } echo '.'; if ($i % 100 === 0) { $conn->commit(); $conn->beginTransaction(); } $i++; } if ($conn->getTransactionNestingLevel() !== 0) { $conn->commit();
echo $ex->getMessage() . PHP_EOL; continue; } $end = microtime(true); $row2['resProviderVersion'] = $provider->getVersion(); $row2['resParseTime'] = $end - $start; $date = new \DateTime(null, new \DateTimeZone('UTC')); $row2['resLastChangeDate'] = $date->format('Y-m-d H:i:s'); /* * Hydrate the result */ if ($result === null) { $row2['resResultFound'] = 0; } else { $row2['resResultFound'] = 1; $row2 = hydrateResult($row2, $result); } /* * Persist */ if (!isset($row2['resId'])) { $row2['resId'] = Uuid::uuid4()->toString(); $conn->insert('result', $row2); } else { $conn->update('result', $row2, ['resId' => $row2['resId']]); } echo '.'; } if ($currenUserAgent % 100 === 0) { $conn->commit(); $conn->beginTransaction();