public function commit() { if (!$this->transaction) { return; } parent::commit(); $allCommands = array(); $allParams = array(); $allOptions = array('transaction' => true, 'action' => 'batch'); foreach ($this->buffer as $i => $buffer) { list($sql, $params, $options) = $buffer; $allCommands[$i] = $sql; $allParams[$i] = $params; $allOptions[$i] = $options; } $this->send($allCommands, $allParams, $allOptions); $this->buffer = array(); }