has_errors()) { throw new Exception("DB Errors: " . implode("\n
", $db->get_errors())); } $res = $db->query($sql); while ($r = $db->fetch($res)) { $rows[] = $r; } echo $sql; echo'
';print_r($rows);echo'
'; die('OK'); } public function runAction() { SE_Layout::gora(); SE_Layout::menu(); $this->_callProcedure(); ?>
Zaktualizowano `CRM_LISTA_ZASOBOW`.`ID_ZASOB_BASE`
_callProcedure(); die('Zaktualizowano `CRM_LISTA_ZASOBOW`.`ID_ZASOB_BASE`'); } private function _callProcedure() { $sql = <<0, FIND_ID_ZASOB_BASE(`ALIAS_ID`), `ID`); SQL; /* update fields: * `CRM_LISTA_ZASOBOW`.`path` * `CRM_WSKAZNIK`.`path_CRM_LISTA_ZASOBOW` */ $db = DB::getDB(); if ($db->has_errors()) { throw new Exception("DB Errors: " . implode("\n
", $db->get_errors())); } $res = $db->query($sql); if ($db->has_errors()) { throw new Exception("DB Errors: " . implode("\n
", $db->get_errors())); } } public function reinstallAction() { $this->reinstall(); die('OK'); } public function reinstall() { $sqlList = array(); $sqlList['RemoveFunction'] = "DROP FUNCTION IF EXISTS `FIND_ID_ZASOB_BASE`"; $sqlList['InstallFunction'] = << 0 THEN SET @ID_ZASOB_BASE = @ALIAS_ID; END IF; SET @LOOP_LIMIT = @LOOP_LIMIT - 1; UNTIL @LOOP_LIMIT <= 0 END REPEAT; RETURN @ID_ZASOB_BASE; END SQL_FUNCTION; $db = DB::getDB(); if ($db->has_errors()) { throw new Exception("DB Errors: " . implode("\n
", $db->get_errors())); } foreach ($sqlList as $sqlName => $sql) { $res = $db->query($sql); if ($db->has_errors()) { throw new Exception("DB Errors at sql '{$sqlName}': " . implode("\n
", $db->get_errors())); } } } /* Table 'DB.P5-MSG:Route_FixZasobPath:WARNING: Update all paths' doesn't exist Table 'DB.P5-MSG:Route_FixZasobPath:ERROR: Loop detected ID=P_ID' doesn't exist Table 'DB.P5-MSG:Route_FixZasobPath:ERROR: Parent item not exists' doesn't exist Table 'DB.P5-MSG:Route_FixZasobPath:ERROR: Loop detected in path' doesn't exist */ public function parseMessageFromStorage($msg) { switch ($msg) { case 'WARNING: Update all paths': { $msg = "Zaktualizuj ścieżki zasobów!"; break; } case 'ERROR: Loop detected ID=P_ID': { $msg = "Nr rekordu nadrzędnego musi różnić się od nr rekordu"; break; } case 'ERROR: Parent item not exists': { $msg = "Nie istnieje rekord o numerze podanym jako nr nadrzędny"; break; } case 'ERROR: Loop detected in path': { $msg = "Nieprawidłowy nr nadrzędny"; break; } } return $msg; } public function parseMessageFromMsgsSystem($msg) { switch ($msg) { case 'Update all paths': { $msg = "Zaktualizuj ścieżki zasobów"; break; } } return $msg; } public function runByMessageFromMsgsSystem($msg, &$execNotes) { switch ($msg) { case 'Update all paths': { $execNotes .= 'call procedure... '; $this->_callProcedure(); $execNotes .= ' done'; break; } } } }