示例#1
0
 /**
  * Sets new map items by array
  *
  * @param 	array 	$map	Array with initial data:
  * 							Any element is a hash: 
  * 								holder		>	string
  * 								requered	>	bool
  * 								glue		>	string
  * 
  * @return RM_ReportScript_Map
  */
 public function setMapByArray(array $map)
 {
     foreach ($map as $item) {
         $this->addMapItem($this->_mapper->createMapItem($item));
     }
     return $this;
 }
示例#2
0
 /**
  * Adds command to queue.
  *
  * @param 	RM_ReportScript_Queue 	$queue
  * @return RM_ReportScript_Queue
  */
 public function addToQueue(RM_ReportScript_Queue $queue = NULL)
 {
     if (isNull($queue)) {
         $queue = $this->_mapper->createQueue();
     }
     $this->_mapper->addCommandToQueue($queue, $this);
     return $queue;
 }
示例#3
0
 public function _checkStatus()
 {
     $this->_status = $this->_mapper->getStatusForQueue($this);
     if ($this->_status != $this->status_id) {
         $this->status_id = $this->_status;
         $this->save();
     }
 }
示例#4
0
 /**
  * @see RM_Store_Object::delete
  */
 public function delete()
 {
     if (count($this->_mapper->getCompositeListForScript($this)) > 0) {
         throw new RM_Validator_Exception(M('Base')->error('has_depended_composite'));
     }
     parent::delete();
     if (!isNull($this->_map)) {
         $this->_mapper->deleteMap($this);
     }
     return TRUE;
 }
示例#5
0
 protected function _trace($script, $time = NULL)
 {
     if ($this->_mapper->trace()) {
         if ($time) {
             $message = sprintf("Execution time: %s\n%s", $time, $script);
         } else {
             $message = sprintf("Script failed: %s", $script);
         }
         M('Trace')->trace("ReportScript[mysql]", $message);
     }
 }
示例#6
0
 /**
  * Returns queue for queued command
  *
  * @return	RM_ReportScript_Queue
  */
 public function getQueue()
 {
     return $this->_mapper->loadQueueById($this->queue_id);
 }
示例#7
0
 /**
  * Returns null script
  *
  * @return RM_ReportScrip_Null_Script
  */
 public function getNullScript($executer = 'mysql', $composite = FALSE)
 {
     return $this->_mapper->getNullObject('script', array('script_type' => $composite ? 'c' : 's', 'executer' => $executer));
 }