public query ( ) : Doctrine\DBAL\Driver\Statement | ||
Результат | Doctrine\DBAL\Driver\Statement |
public function query()
{
$this->connect();
$args = func_get_args();
$logger = $this->_config->getSQLLogger();
if ($logger) {
$logger->startQuery($args[0]);
}
try {
$statement = $this->_conn->query(...$args);
} catch (Exception $ex) {
throw DBALException::driverExceptionDuringQuery($this->_driver, $ex, $args[0]);
}
$statement->setFetchMode($this->defaultFetchMode);
if ($logger) {
$logger->stopQuery();
}
return $statement;
}
/** * @return array|null */ public function read() { if (is_null($this->stmt)) { $this->stmt = $this->connection->query("SELECT * FROM products"); } return $this->stmt->fetch(); }