コード例 #1
0
ファイル: Storage.php プロジェクト: laiello/oops-project
 /**
  * 
  * @param Oops_Process_Abstract $process
  * @return bool True on success
  * @throws Oops_Process_Exception
  */
 public function set($pid, $data)
 {
     if (!strlen($pid)) {
         throw new Oops_Process_Exception("Can not store process without id", OOPS_PROCESS_EXCEPTION_NO_PID);
     }
     if (!isset($data['class'])) {
         throw new Oops_Process_Exception("Proceess class not defined", OOPS_PROCESS_EXCEPTION_NO_CLASS);
     }
     $this->_cached[$pid] = $data;
     /**
      * First store process class and state
      */
     Oops_Sql_Common::replace($this->_tableProcesses, array('pid' => $pid, 'class' => $data['class'], 'currentState' => $data['currentState']));
     /**
      * Now let's store ticket
      */
     Oops_Sql_Common::insert($this->_tableProcessTickets, array('pid' => $pid, 'serialized' => $data['ticket']));
     /**
      * Finally store process variables
      */
     foreach ($data['variables'] as $name => $value) {
         list($class, $id, $serialized) = $this->_composeData($value);
         $variable = array('pid' => $pid, 'class' => $class, 'id' => $id, 'serialized' => $serialized);
         Oops_Sql_Common::replace($this->_tableProcessData, $variable);
     }
 }
コード例 #2
0
ファイル: Mysql.php プロジェクト: laiello/oops-project
 public function store($target, $sources)
 {
     try {
         foreach ($sources as $s) {
             Oops_Sql_Common::insert($this->_table, array('target' => $target, 'source' => $s));
         }
     } catch (Oops_Sql_Exception $e) {
         self::__install($this->_table);
         throw $e;
     }
 }