function importDataFromDumpFile($sid, DatabaseHandler $dbHandler, $userId, $filePath, $my_pligg_base_no_slash) { $ktrExeDao = new KTRExecutorDAO(); $tableNames = $dbHandler->loadTables(); $logIds = array(); foreach ($tableNames as $tableName) { $logIds[$tableName] = $ktrExeDao->addExecutionInfoTuple($sid, $tableName, $userId); } try { $dbImporter = DatabaseImporterFactory::createDatabaseImporter($dbHandler->getDriver(), $sid, $my_pligg_base_no_slash); $dbImporter->importDbData($filePath); foreach ($logIds as $logId) { $ktrExeDao->updateExecutionInfoStatus($logId, 'success'); } } catch (Exception $e) { foreach ($logIds as $logId) { $ktrExeDao->updateExecutionInfoStatus($logId, 'error'); $ktrExeDao->updateExecutionInfoErrorMessage($logId, $e->getMessage()); } } $queryEngine = new QueryEngine(); foreach ($logIds as $tableName => $logId) { $numProcessed = $queryEngine->GetTotalNumberTuplesInTableBySidAndNameFromExternalDB($sid, $tableName); $ktrExeDao->updateExecutionInfoTupleAfterPanTerminated($logId, 0, '', $numProcessed, 'success'); } }
function importDataFromDumpFile($sid, DatabaseHandler $dbHandler, $userId, $filePath) { $ktrExeDao = new KTRExecutorDAO(); $tables = $dbHandler->loadTables(); $logIds = array(); foreach ($tables as $table) { $logIds[] = $ktrExeDao->addExecutionInfoTuple($sid, $table, $userId); } try { $dbImporter = DatabaseImporterFactory::createDatabaseImporter($dbHandler->getDriver(), $sid, "colfusion"); $dbImporter->importDbData($filePath); foreach ($logIds as $logId) { $ktrExeDao->updateExecutionInfoTimeEnd($logId); $ktrExeDao->updateExecutionInfoStatus($logId, 'success'); } } catch (Exception $e) { foreach ($logIds as $logId) { $ktrExeDao->updateExecutionInfoStatus($logId, 'error'); $ktrExeDao->updateExecutionInfoErrorMessage($logId, $e->getMessage()); } } }