gyro/core/behaviour/commands/generics/execute.sql.cmd.php
Go to the documentation of this file.00001 <?php 00002 /** 00003 * Generic SQL execution command 00004 * 00005 * @author Gerd Riesselmann 00006 * @ingroup Behaviour 00007 */ 00008 class ExecuteSqlCommand extends CommandTransactional { 00009 /** 00010 * Constructor 00011 * 00012 * @param array|string $sql 00013 */ 00014 public function __construct($sql, $connection = DB::DEFAULT_CONNECTION) { 00015 parent::__construct($connection, $sql); 00016 } 00017 00018 /** 00019 * Executes commands 00020 * 00021 * @return Status 00022 */ 00023 protected function do_execute() { 00024 $sqls = Arr::force($this->get_params(), false); 00025 $ret = new Status(); 00026 foreach($sqls as $sql) { 00027 $ret->merge(DB::execute($sql, $this->get_instance())); 00028 if ($ret->is_error()) { 00029 break; 00030 } 00031 } 00032 return $ret; 00033 } 00034 }