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->getServiceService()->getModel()->orderBy("service_payment_date", "DESC");
$this->mode = $params['mode']; $this->mode = $params['mode'];
//Query문 Rest여부 -> 같은조건에 Count 받고, 결과값을 받고 싶을때는 setReset(false) //Query문 Rest여부 -> 같은조건에 Count 받고, 결과값을 받고 싶을때는 continue()
$this->getServiceService()->getModel()->setReset(false); $this->getServiceService()->getModel()->setContinue(true);
$this->total = $this->getServiceService()->getCount(); $this->total = $this->getServiceService()->getCount();
$this->entities = $this->getServiceService()->getEntities(); $this->entities = $this->getServiceService()->getEntities();
// $total = count($temps); // $total = count($temps);

View File

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