public function initiate() { if (!is_string($this->getQuery())) { throw new DbControlException("No query to initiate!"); } $query = $this->getQuery(); if (func_num_args() > 0) { $arguments = func_get_args(); for ($i = 1; $i <= count($arguments); $i++) { try { if (!strstr($query, "<{$i}>")) { throw new DbControlException("Number of replacement elements in query does not corresponds the number of parametres in initiate."); } $query = str_ireplace("<{$i}>", $arguments[$i - 1], $query); } catch (Exception $e) { throw new DbControlException($e->getMessage() . "\nCheck the count of initiate parameters."); } } } if (preg_match('/<\\d+>/', $query)) { throw new DbControlException("Number of replacement elements does not corresponds the number of parametres in initiate. \n" . $query); } try { self::$queryCount++; /*if (stristr($query, "`lft` FROM `photogalleriesImages")) { throw new LBoxException($query); }*/ $this->debug($query); $result = $this->dbStateHandler->getDbPlatform()->query($query); if ($this->isLogOn()) { $this->log("Query succesfully done.\n" . $query); } if ($result) { if (is_resource($result)) { $resultStateHandler = $this->dbStateHandler->getCopy(); if ($this->noCache) { return new DbResultNoCache($result, $resultStateHandler); } return new DbResult($result, $resultStateHandler); } else { return $result; } } } catch (Exception $e) { throw $e; } }