dbms_primeidc_init...1

This commit is contained in:
최준흠 2025-04-09 16:07:26 +09:00
parent 72ee587799
commit e78595bf78
2 changed files with 13 additions and 15 deletions

View File

@ -86,8 +86,8 @@ class PaymentController extends ClientController
$this->getServiceService()->getModel()->orderBy("service_payment_date", "DESC");
$this->mode = $params['mode'];
//Query문 Rest여부 -> 같은조건에 Count 받고, 결과값을 받고 싶을때는 setReset(false)
$this->getServiceService()->getModel()->setReset(false);
//Query문 Rest여부 -> 같은조건에 Count 받고, 결과값을 받고 싶을때는 continue()
$this->getServiceService()->getModel()->setContinue(true);
$this->total = $this->getServiceService()->getCount();
$this->entities = $this->getServiceService()->getEntities();
// $total = count($temps);

View File

@ -8,7 +8,7 @@ use PDOStatement;
class QueryBuilder
{
private bool $_debug = false;
private bool $_reset = true;
private bool $_continue = false;
protected PDO $pdo;
protected string $latestQuery = "";
protected string $table = '';
@ -28,9 +28,9 @@ class QueryBuilder
{
$this->_debug = $debug;
}
final public function setReset(bool $reset): void
final public function setContinue(bool $continue): void
{
$this->_reset = $reset;
$this->_continue = $continue;
}
final public function getLastQuery(): string
{
@ -274,11 +274,14 @@ class QueryBuilder
$stmt->execute();
return $stmt;
}
final public function get(): array
final public function get(?string $select = null): array
{
$stmt = $this->execute();
$this->where = [];
$this->bindings = [];
$stmt = $this->execute($select);
if (!$this->_continue) {
$this->where = [];
$this->bindings = [];
}
$this->setContinue(false);
return $stmt->fetchAll(PDO::FETCH_ASSOC);
}
final public function first(): ?array
@ -289,12 +292,7 @@ class QueryBuilder
}
final public function count(string $select = "COUNT(*) as cnt"): int
{
$stmt = $this->execute($select);
if ($this->_reset) {
$this->where = [];
$this->bindings = [];
}
$results = $stmt->fetchAll(PDO::FETCH_ASSOC);
$results = $this->get($select);
return (int)($results[0]['cnt'] ?? 0);
}