dbms_primeidc_init...1

This commit is contained in:
최준흠 2025-04-09 15:55:14 +09:00
parent 578c2ec15e
commit c7c16bc640

View File

@ -8,6 +8,7 @@ use PDOStatement;
class QueryBuilder class QueryBuilder
{ {
private bool $_debug = false; private bool $_debug = false;
private bool $_reset = true;
protected PDO $pdo; protected PDO $pdo;
protected string $latestQuery = ""; protected string $latestQuery = "";
protected string $table = ''; protected string $table = '';
@ -27,6 +28,10 @@ class QueryBuilder
{ {
$this->_debug = $debug; $this->_debug = $debug;
} }
final public function setReset(bool $reset): void
{
$this->_reset = $reset;
}
final public function getLastQuery(): string final public function getLastQuery(): string
{ {
return $this->latestQuery; return $this->latestQuery;
@ -285,6 +290,10 @@ 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); $stmt = $this->execute($select);
if ($this->_reset) {
$this->where = [];
$this->bindings = [];
}
$results = $stmt->fetchAll(PDO::FETCH_ASSOC); $results = $stmt->fetchAll(PDO::FETCH_ASSOC);
return (int)($results[0]['cnt'] ?? 0); return (int)($results[0]['cnt'] ?? 0);
} }