/** * * @param boolean $dry do not execute query * @return array * @throws DatabaseQueryExecuteException */ private function runQueries($dry = false) { $results = []; try { if ($this->useTransaction && !$dry) { $this->adapter->startTransaction(); $this->executedQueries[] = '::start transaction'; } foreach ($this->queries as $query) { if (!$dry) { $result = $this->adapter->execute($query); $results[] = $result; } $this->executedQueries[] = $query instanceof PDOStatement ? $query->queryString : $query; } if ($this->useTransaction && !$dry) { $this->adapter->commit(); $this->executedQueries[] = '::commit'; } } catch (DatabaseQueryExecuteException $e) { if ($this->useTransaction) { $this->dbRollback(); } $this->queries = []; throw $e; } $this->queries = []; return $results; }