Skip to content
Snippets Groups Projects
Unverified Commit 33e47e87 authored by Dominik František Bučík's avatar Dominik František Bučík Committed by GitHub
Browse files

Merge pull request #84 from dBucik/public_read_methods

feat: :guitar: Make methods for reading DB public
parents e28d4acf 957c87e7
No related branches found
No related tags found
No related merge requests found
...@@ -242,6 +242,34 @@ class DatabaseCommand ...@@ -242,6 +242,34 @@ class DatabaseCommand
} }
} }
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) private function insertLogin($entities, $userId, $date)
{ {
foreach (Config::SIDES as $side) { foreach (Config::SIDES as $side) {
...@@ -265,11 +293,6 @@ class DatabaseCommand ...@@ -265,11 +293,6 @@ class DatabaseCommand
} }
} }
private function escapeCol($col_name): string
{
return $this->escape_char . $col_name . $this->escape_char;
}
private function writeLogin($date, $ids, $user): bool private function writeLogin($date, $ids, $user): bool
{ {
if (empty($user)) { if (empty($user)) {
...@@ -475,14 +498,6 @@ class DatabaseCommand ...@@ -475,14 +498,6 @@ class DatabaseCommand
return ':' . $str; 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 private function getAggregateGroupBy($ids): string
{ {
$columns = ['day']; $columns = ['day'];
...@@ -532,21 +547,6 @@ class DatabaseCommand ...@@ -532,21 +547,6 @@ class DatabaseCommand
return $displayName; 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() private function unknownDriver()
{ {
Logger::error(self::DEBUG_PREFIX . 'unsupported DB driver \'' . $this->conn->getDriver()); Logger::error(self::DEBUG_PREFIX . 'unsupported DB driver \'' . $this->conn->getDriver());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment