Skip to content
This repository has been archived by the owner on Sep 19, 2022. It is now read-only.

Commit

Permalink
Merge pull request #84 from dBucik/public_read_methods
Browse files Browse the repository at this point in the history
feat: 🎸 Make methods for reading DB public
  • Loading branch information
dBucik authored Aug 12, 2022
2 parents e28d4ac + 957c87e commit 33e47e8
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions lib/DatabaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,34 @@ public function aggregate()
}
}

public function read($query, $params): PDOStatement
{
return $this->conn->read($query, $params);
}

public function isPgsql(): bool
{
return $this->conn->getDriver() === 'pgsql';
}

public function isMysql(): bool
{
return $this->conn->getDriver() === 'mysql';
}

public function escapeCol($col_name): string
{
return $this->escape_char . $col_name . $this->escape_char;
}

public function escapeCols($col_names): string
{
return $this->escape_char . implode(
$this->escape_char . ',' . $this->escape_char,
$col_names
) . $this->escape_char;
}

private function insertLogin($entities, $userId, $date)
{
foreach (Config::SIDES as $side) {
Expand All @@ -265,11 +293,6 @@ private function insertLogin($entities, $userId, $date)
}
}

private function escapeCol($col_name): string
{
return $this->escape_char . $col_name . $this->escape_char;
}

private function writeLogin($date, $ids, $user): bool
{
if (empty($user)) {
Expand Down Expand Up @@ -475,14 +498,6 @@ private function prependColon($str): string
return ':' . $str;
}

private function escapeCols($col_names): string
{
return $this->escape_char . implode(
$this->escape_char . ',' . $this->escape_char,
$col_names
) . $this->escape_char;
}

private function getAggregateGroupBy($ids): string
{
$columns = ['day'];
Expand Down Expand Up @@ -532,21 +547,6 @@ private function getSpName($request)
return $displayName;
}

private function read($query, $params): PDOStatement
{
return $this->conn->read($query, $params);
}

private function isPgsql(): bool
{
return $this->conn->getDriver() === 'pgsql';
}

private function isMysql(): bool
{
return $this->conn->getDriver() === 'mysql';
}

private function unknownDriver()
{
Logger::error(self::DEBUG_PREFIX . 'unsupported DB driver \'' . $this->conn->getDriver());
Expand Down

0 comments on commit 33e47e8

Please sign in to comment.