try { ////////////////////////////////////////////////// // // Read parameters // $iDataSourceId = ReadMandatoryParam($oP, 'data_source_id', 'raw_data'); $sSynchronize = ReadParam($oP, 'synchronize'); $sSep = ReadParam($oP, 'separator', 'raw_data'); $sQualifier = ReadParam($oP, 'qualifier', 'raw_data'); $sCharSet = ReadParam($oP, 'charset', 'raw_data'); $sDateFormat = ReadParam($oP, 'date_format', 'raw_data'); $sOutput = ReadParam($oP, 'output'); // $sReportLevel = ReadParam($oP, 'reportlevel'); $sSimulate = ReadParam($oP, 'simulate'); $sComment = ReadParam($oP, 'comment', 'raw_data'); $sNoStopOnImportError = ReadParam($oP, 'no_stop_on_import_error'); if (strtolower(trim($sSep)) == 'tab') { $sSep = "\t"; } $oLoadStartDate = new DateTime(); // Now // Note about date formatting: These MySQL settings are read-only... and in fact unused :-( // SET SESSION date_format = '%d/%m/%Y'; // SET SESSION datetime_format = '%d/%m/%Y %H:%i:%s'; // Therefore, we have to allow users to transform the format according to a given specification: date_format ////////////////////////////////////////////////// // // Statistics // $iCountErrors = 0; $iCountCreations = 0;
$aWarnings = array(); ////////////////////////////////////////////////// // // Read parameters // $sClass = ReadMandatoryParam($oP, 'class', 'raw_data'); // do not filter as a valid class, we want to produce the report "wrong class" ourselves $sSep = ReadParam($oP, 'separator', 'raw_data'); $sQualifier = ReadParam($oP, 'qualifier', 'raw_data'); $sCharSet = ReadParam($oP, 'charset', 'raw_data'); $sDateFormat = ReadParam($oP, 'date_format', 'raw_data'); $sOutput = ReadParam($oP, 'output', 'string'); $sReconcKeys = ReadParam($oP, 'reconciliationkeys', 'raw_data'); $sSimulate = ReadParam($oP, 'simulate'); $sComment = ReadParam($oP, 'comment', 'raw_data'); $bLocalize = ReadParam($oP, 'no_localize') != 1; if (strtolower(trim($sSep)) == 'tab') { $sSep = "\t"; } ////////////////////////////////////////////////// // // Check parameters format/consistency // if (strlen($sCSVData) == 0) { throw new BulkLoadException("Missing data - at least one line is expected"); } if (!MetaModel::IsValidClass($sClass)) { throw new BulkLoadException("Unknown class: '{$sClass}'"); } if (strlen($sSep) > 1) { throw new BulkLoadException("Separator is limited to one character, found '{$sSep}'");