Skip to content

Commit 5d16410

Browse files
committed
add $column parameter in query() method
1 parent 2fe4cce commit 5d16410

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/QueryBuilder.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public function all(): array
176176
*/
177177
public function one(): array
178178
{
179-
$this->query($this->sql, $this->params, self::FETCH_ONE);
179+
$this->query($this->sql, $this->params, 0, self::FETCH_ONE);
180180
return $this->result;
181181
}
182182

@@ -185,7 +185,7 @@ public function one(): array
185185
*/
186186
public function go(): int
187187
{
188-
$this->query($this->sql, $this->params, self::NO_FETCH);
188+
$this->query($this->sql, $this->params, 0, self::NO_FETCH);
189189
return $this->pdo->lastInsertId();
190190
}
191191

@@ -443,10 +443,11 @@ private function prepareSorting(string $field = '', string $sort = ''): array
443443
/**
444444
* @param string $sql
445445
* @param array $params
446-
* @param bool $one
446+
* @param int|string $column
447+
* @param int $fetch
447448
* @return $this
448449
*/
449-
public function query(string $sql = '', array $params = [], int $fetch = self::FETCH_ALL): QueryBuilder
450+
public function query(string $sql = '', array $params = [], $column = 0, int $fetch = self::FETCH_ALL): QueryBuilder
450451
{
451452
$this->setError();
452453

@@ -478,7 +479,7 @@ public function query(string $sql = '', array $params = [], int $fetch = self::F
478479
} else if ($fetch === self::FETCH_ALL) {
479480
$this->result = $this->query->fetchAll();
480481
} else if ($fetch === self::FETCH_COLUMN) {
481-
$this->result = $this->query->fetchColumn();
482+
$this->result = $this->query->fetchColumn($column);
482483
}
483484

484485
if (is_array($this->result)) {

0 commit comments

Comments
 (0)