/** * make execute return the result instead of a bool * * @param array $input * @return \OC_DB_StatementWrapper|int */ public function execute($input = array()) { if (OC_Config::getValue("log_query", false)) { $params_str = str_replace("\n", " ", var_export($input, true)); OC_Log::write('core', 'DB execute with arguments : ' . $params_str, OC_Log::DEBUG); } $this->lastArguments = $input; if (count($input) > 0) { if (!isset($type)) { $type = OC_Config::getValue("dbtype", "sqlite"); } if ($type == 'mssql') { $input = $this->tryFixSubstringLastArgumentDataForMSSQL($input); } $result = $this->statement->execute($input); } else { $result = $this->statement->execute(); } if ($result === false) { return false; } if ($this->isManipulation) { return $this->statement->rowCount(); } else { return $this; } }
/** * {@inheritdoc} */ public function rewind() { if ($this->statement) { throw new InvalidMethodCallException('Cannot rewind a PDOStatement'); } $this->statement = $this->connection->prepare($this->query); $this->statement->execute($this->parameters); $this->next(); }
/** * Load data if it hasn't been loaded yet */ protected function loadData() { if (null === $this->data) { $this->stmt->execute(); $this->data = $this->stmt->fetchAll(\PDO::FETCH_ASSOC); } }
/** * make execute return the result instead of a bool * * @param array $input * @return \OC_DB_StatementWrapper|int */ public function execute($input = array()) { if (\OC::$server->getSystemConfig()->getValue("log_query", false)) { $params_str = str_replace("\n", " ", var_export($input, true)); \OCP\Util::writeLog('core', 'DB execute with arguments : ' . $params_str, \OCP\Util::DEBUG); } $this->lastArguments = $input; if (count($input) > 0) { $result = $this->statement->execute($input); } else { $result = $this->statement->execute(); } if ($result === false) { return false; } if ($this->isManipulation) { $count = $this->statement->rowCount(); return $count; } else { return $this; } }
protected function assertTableKeys($expected, Statement $query, $keyName) { $query->execute(); $users = array(); while ($row = $query->fetch()) { $users[] = $row[$keyName]; } $query->closeCursor(); $users = array_unique($users); sort($users); sort($expected); $this->assertEquals($expected, $users); }
/** * Executes the statement with the currently bound parameters. * * @param array|null $params * * @return boolean TRUE on success, FALSE on failure. * * @throws \Doctrine\DBAL\DBALException */ public function execute($params = null) { if (is_array($params)) { $this->params = $params; } $logger = $this->conn->getConfiguration()->getSQLLogger(); if ($logger) { $logger->startQuery($this->sql, $this->params, $this->types); } try { $stmt = $this->stmt->execute($params); } catch (\Exception $ex) { throw DBALException::driverExceptionDuringQuery($ex, $this->sql, $this->conn->resolveParams($this->params, $this->types)); } if ($logger) { $logger->stopQuery(); } $this->params = array(); $this->types = array(); return $stmt; }
/** * @param string $sql Consulta SQL a la base de datos * @param array $criteria Criterios de la consulta SQL adoptados en el WHERE * * @return Statement Retorna el objeto de DoctrineORM Statement * @throws DBALException Error de DoctrineORM * @throws Exception Error en el SQL */ protected function _query($sql = "", array $criteria = array()) { try { // Preparar el SQL $this->_stmt = $this->_connection->prepare($sql); // Agregar los parametros foreach ($criteria as $param => $value) { if (is_integer($param)) { $this->_stmt->bindValue($param + 1, $value); } if (is_string($param)) { $this->_stmt->bindParam($param, $value); } } // Ejecutar el SQL $this->_stmt->execute(); } catch (DBALException $dbalException) { #throw $dbalException; } if (in_array($this->_stmt->errorCode(), array_keys($this->_errors))) { throw new Exception($this->_errors[$this->_stmt->errorCode()] . " SQL: {$sql}"); } return $this->_stmt; }
/** * Performs a DELETE or UPDATE query to the database. * @param \Doctrine\DBAL\Driver\Statement $query * @param array $parameters * @return bool true if at least one row was modified, false otherwise */ protected function modify($query, $parameters) { $result = $query->execute($parameters); return $result === true && $query->rowCount() > 0; }
public function execute($params = null) { return $this->stmt->execute($params); }
public function execute($params = null) { return $this->wrapped->execute($params); }
function it_counts_complete_products_per_channels(Statement $statement) { $statement->execute()->willReturn(null); $statement->fetchAll()->willReturn(array(array('locale' => 'en_US', 'label' => 'ECommerce', 'total' => 0), array('locale' => 'fr_FR', 'label' => 'ECommerce', 'total' => 1), array('locale' => 'en_US', 'label' => 'Mobile', 'total' => 2))); $this->getCompleteProductsCountPerChannels()->shouldReturn(array(array('locale' => 'en_US', 'label' => 'ECommerce', 'total' => 0), array('locale' => 'fr_FR', 'label' => 'ECommerce', 'total' => 1), array('locale' => 'en_US', 'label' => 'Mobile', 'total' => 2))); }
/** * @param Statement $preparedStatement * @param array $productMedia * @param string $filename * * @return null */ protected function updateFileInfo(Statement $preparedStatement, array $productMedia, $filename) { $preparedStatement->execute([':originalFilename' => $productMedia['original_filename'], ':oldFileKey' => $filename]); }