function rewind() { $this->PDOStatement = $this->pdo->prepare($this->sql . ' ' . $this->ordersql . ' ' . $this->limitsql); $this->PDOStatement->execute($this->params); $this->PDOStatement->setFetchMode(PDO::FETCH_ASSOC); $this->position = 0; }
public function init() { $selectQuery = $this->dbHandler->createSelectQuery(); $selectQuery->select('filepath')->from($this->dbHandler->quoteTable('ezimagefile')); $this->statement = $selectQuery->prepare(); $this->statement->execute(); }
/** * @param array|null $parameters * @param bool|null $disableQueryBuffering * @throws CM_Db_Exception * @return CM_Db_Result */ public function execute(array $parameters = null, $disableQueryBuffering = null) { $disableQueryBuffering = (bool) $disableQueryBuffering; $retryCount = 1; for ($try = 0; true; $try++) { try { if ($disableQueryBuffering) { $this->_client->setBuffered(false); } @$this->_pdoStatement->execute($parameters); if ($disableQueryBuffering) { $this->_client->setBuffered(true); } CM_Service_Manager::getInstance()->getDebug()->incStats('mysql', $this->getQueryString()); return new CM_Db_Result($this->_pdoStatement); } catch (PDOException $e) { if ($try < $retryCount && $this->_client->isConnectionLossError($e)) { $this->_client->disconnect(); $this->_client->connect(); $this->_reCreatePdoStatement(); continue; } throw new CM_Db_Exception('Cannot execute SQL statement', null, ['tries' => $try, 'originalExceptionMessage' => $e->getMessage(), 'query' => $this->_pdoStatement->queryString]); } } throw new CM_Db_Exception('Line should never be reached'); }
/** * @see \PDOStatement::execute */ public function execute(array $input_parameters = array()) { $start = microtime(true); $result = $this->statement->execute($input_parameters); $this->pdo->addLog(array('query' => $this->statement->queryString, 'time' => microtime(true) - $start, 'values' => array_merge($this->binds, $input_parameters))); return $result; }
public function __construct(Connection $connection, $queryString, array $params) { $time = microtime(TRUE); $this->connection = $connection; $this->supplementalDriver = $connection->getSupplementalDriver(); $this->queryString = $queryString; $this->params = $params; try { if (substr($queryString, 0, 2) === '::') { $connection->getPdo()->{substr($queryString, 2)}(); } elseif ($queryString !== NULL) { static $types = ['boolean' => PDO::PARAM_BOOL, 'integer' => PDO::PARAM_INT, 'resource' => PDO::PARAM_LOB, 'NULL' => PDO::PARAM_NULL]; $this->pdoStatement = $connection->getPdo()->prepare($queryString); foreach ($params as $key => $value) { $type = gettype($value); $this->pdoStatement->bindValue(is_int($key) ? $key + 1 : $key, $value, isset($types[$type]) ? $types[$type] : PDO::PARAM_STR); } $this->pdoStatement->setFetchMode(PDO::FETCH_ASSOC); $this->pdoStatement->execute(); } } catch (\PDOException $e) { $e = $this->supplementalDriver->convertException($e); $e->queryString = $queryString; throw $e; } $this->time = microtime(TRUE) - $time; }
/** * <b>Não é passado com os Joins</b> * * @return array[Objetos] */ public function findAll() { $sql = "SELECT * FROM {$this->Table}"; $this->Stmt = Conn::prepare($sql); $this->Stmt->execute(); return $this->Stmt->fetchAll(); }
/** * @return bool * * @todo probably we can unset query an params to free up memory */ protected function execute() { $this->statement = $this->dbh->prepare($this->query); // set fetchMode to assoc, it is easier to copy data from an array than an object $this->statement->setFetchMode(PDO::FETCH_ASSOC); return $this->statement->execute($this->params); }
/** * @see \Nanozen\Contracts\Providers\Database\DatabaseProviderContract::execute() * @return boolean */ public function execute(array $parameters = []) { if (is_null($this->query)) { throw new \Exception('Cannot invoke execute. Try using query or prepare/execute before fetch.'); } return $this->query->execute($parameters); }
/** * @param PDOStatement $stm * @param array $data * @return array */ protected function get_row(PDOStatement $stm, array $data = array()) { $data ? $stm->execute($data) : $stm->execute(); $stm->setFetchMode(PDO::FETCH_ASSOC); $var = $stm->fetch(); return $var; }
/** * Reexecutes recordset query with the same parameters * This function is called inside @see rewind() * */ protected function _refresh() { $this->_statement->execute($this->_params); if ($this->_statement->errorCode() !== '00000') { throw new DbException($this->_statement->errorInfo(), $this->_statement->queryString); } $this->_currentRowIndex = 0; }
/** * Executes a SQL statement * * @param string $sql * @param array $parameters * @param \PDO $connection * @param int $fetchMode * * @return int The number of affected rows */ public static function execute($sql, $parameters = null, $connection = null, $fetchMode = \PDO::FETCH_ASSOC) { static::$_statement = static::createStatement($sql, $connection, $fetchMode); if (empty($parameters)) { return static::$_statement->execute(); } return static::$_statement->execute($parameters); }
/** * @param \Generated\Shared\Transfer\ProductConcreteTransfer $productConcreteTransfer * * @return bool */ public function writeProduct(ProductConcreteTransfer $productConcreteTransfer) { $this->productStatement->execute([':sku' => $productConcreteTransfer->getSku(), ':isActive' => (int) $productConcreteTransfer->getIsActive(), ':attributes' => json_encode($productConcreteTransfer->getAttributes()), ':productAbstractSku' => $productConcreteTransfer->getProductAbstractSku()]); foreach ($productConcreteTransfer->getLocalizedAttributes() as $localizedAttributes) { $this->attributesStatement->execute([':productSku' => $productConcreteTransfer->getSku(), ':name' => $localizedAttributes->getName(), ':attributes' => json_encode($localizedAttributes->getAttributes()), ':fkLocale' => $this->localeTransfer->getIdLocale()]); } return true; }
/** * Execute the statement */ public function execute() { $start = microtime(true); $result = $this->statement->execute(); $time = microtime(true) - $start; DB::dbh()->log($this->postBindingStatement, round($time * 1000, 3)); return $result; }
/** * {@inheritdoc} */ public function execute($input_parameters = null) { $parameters = null === $input_parameters ? $this->binds : $input_parameters; $this->profiler->startQuery($this->statement->queryString, $parameters); $result = $this->statement->execute($input_parameters); $this->profiler->stopQuery(); return $result; }
public function execute($params = []) { if ($params) { $this->params = $params; } $this->stmt->execute($this->params); return $this; }
/** * @param int $zoom_level * @param int $x * @param int $y * @param string $data */ public function addTile($zoom_level, $x, $y, $data) { $this->addTileStmt->bindValue(':z', $zoom_level, \PDO::PARAM_INT); $this->addTileStmt->bindValue(':x', $x, \PDO::PARAM_INT); $this->addTileStmt->bindValue(':y', $y, \PDO::PARAM_INT); $this->addTileStmt->bindValue(':data', $data, \PDO::PARAM_LOB); $this->addTileStmt->execute(); }
/** * @param array $params * @return bool */ public function execute(array $params = []) { if (empty($params)) { return $this->stmt->execute(); } else { return $this->stmt->execute($params); } }
public function execute($params = array()) { if ($params) { $this->_params = $params; } $this->_statement->execute($this->_params); return $this; }
protected function doExecute() { try { return $this->stmt->execute(); } catch (\PDOException $ex) { throw new \SNDatabase\ConnectionFailedException($ex->errorInfo[2], $ex->getCode(), $ex); } }
public function rewind() { $this->statement = $this->pdo->prepare($this->staticQuery->getSql()); if ($this->statement->execute($this->staticQuery->getParameterList()) === false) { throw new StorageException('Query execution failed.'); } $this->next(); }
public function execute(array $params = array()) : DefaultDatabase { if ($params) { $this->_params = $params; } $this->_stmt->execute($this->_params); return $this; }
protected function insertEntry(array $parameters) { if ($this->insertEntry instanceof \PDOStatement) { $this->insertEntry->execute($parameters); return $this->insertEntry->fetchAll(); } else { throw new \RuntimeException("Insertion query not yet prepared!"); } }
/** * {@inheritdoc} */ public function getExchangeRate($sourceCurrencyCode, $targetCurrencyCode) { $this->statement->execute([$sourceCurrencyCode, $targetCurrencyCode]); $exchangeRate = $this->statement->fetchColumn(); if ($exchangeRate === false) { throw CurrencyConversionException::exchangeRateNotAvailable($sourceCurrencyCode, $targetCurrencyCode); } return $exchangeRate; }
/** * 执行可传递参数查询 * * @param array $param bind键值 * @throws \HuiLib\Error\Exception * @return \HuiLib\Db\Result */ public function execute($param = array()) { if ($this->innerStatment == NULL) { throw new \HuiLib\Error\Exception('execute查询,必须先调用Query::prepare'); } $this->innerStatment->execute($param); $this->lastBindParam = $param; return $this; }
private function getDruaplNodeIdByWpPostId($wpPostId) { $this->getDruaplNodeIdByWpPostIdStatement->execute(array(':wp_post_id' => $wpPostId)); $result = $this->getDruaplNodeIdByWpPostIdStatement->fetch(PDO::FETCH_ASSOC); if (!$result['nid']) { throw new Exception('No WP post ID: ' . $wpPostId); } return $result['nid']; }
protected function initQuery() { if ($this->rows instanceof \PDOStatement) { $this->cleanupResults(); } $this->rows = $this->fromDbHelper->getAdapter()->prepare($this->query . ' LIMIT ' . $this->start . ', ' . $this->loadAtOnce); $this->rows->execute(); $this->currentPosition = 0; }
/** * Execute the prepared SQL statement. * * @param array Optional. The input parameters. * @return mixed */ public function execute($params = NULL) { try { $this->statement->execute($params); } catch (PDOException $error) { return $error->getMessage(); } return NULL; }
/** * Execute the query statement */ protected function buildQuery() { if ($this->bindings) { $this->currentPDOStatement = $this->pdo->prepare($this->query); $status = $this->currentPDOStatement->execute($this->bindings); } else { $status = $this->currentPDOStatement = $this->pdo->query($this->query); } return $status; }
/** SELECT FOUND_ROWS() after query with SQL_CALC_FOUND_ROWS * @return int */ public function found_rows() { if (is_null($this->_fr_stmt)) { $this->_fr_stmt = $this->prepare('SELECT FOUND_ROWS();'); } $this->_fr_stmt->execute(); $rows_count = $this->_fr_stmt->fetchColumn(0); $this->_fr_stmt->closeCursor(); return $rows_count; }
private function Execute() { $this->Connect(); try { $this->update->execute(array_merge($this->dados, $this->places)); $this->result = true; } catch (PDOException $e) { echo "<b>Erro ao ler:</b> {$e->getMessage()}"; } }