mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-05 07:45:37 +08:00
29 lines
742 B
PHP
29 lines
742 B
PHP
<?php
|
|
|
|
|
|
namespace ZM\MySQL;
|
|
|
|
|
|
use Doctrine\DBAL\Query\QueryBuilder;
|
|
use ZM\Exception\DbException;
|
|
|
|
class MySQLQueryBuilder extends QueryBuilder
|
|
{
|
|
private $wrapper;
|
|
|
|
public function __construct(MySQLWrapper $wrapper) {
|
|
parent::__construct($wrapper->getConnection());
|
|
$this->wrapper = $wrapper;
|
|
}
|
|
|
|
/**
|
|
* @return int|MySQLStatementWrapper
|
|
* @throws DbException
|
|
*/
|
|
public function execute() {
|
|
if ($this->getType() === self::SELECT) {
|
|
return $this->wrapper->executeQuery($this->getSQL(), $this->getParameters(), $this->getParameterTypes());
|
|
}
|
|
return $this->wrapper->executeStatement($this->getSQL(), $this->getParameters(), $this->getParameterTypes());
|
|
}
|
|
} |