FIX: check missing table #33
@ -5,6 +5,7 @@ use Incoviba\Common\Define\Connection;
|
|||||||
use Monolog\Handler\AbstractProcessingHandler;
|
use Monolog\Handler\AbstractProcessingHandler;
|
||||||
use Monolog\Level;
|
use Monolog\Level;
|
||||||
use Monolog\LogRecord;
|
use Monolog\LogRecord;
|
||||||
|
use PDOException;
|
||||||
use PDOStatement;
|
use PDOStatement;
|
||||||
|
|
||||||
class MySQL extends AbstractProcessingHandler
|
class MySQL extends AbstractProcessingHandler
|
||||||
@ -69,13 +70,21 @@ QUERY;
|
|||||||
private function checkTableExists(): bool
|
private function checkTableExists(): bool
|
||||||
{
|
{
|
||||||
$query = "SHOW TABLES LIKE 'monolog'";
|
$query = "SHOW TABLES LIKE 'monolog'";
|
||||||
$result = $this->connection->query($query);
|
try {
|
||||||
|
$result = $this->connection->query($query);
|
||||||
|
} catch (PDOException) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return $result->rowCount() > 0;
|
return $result->rowCount() > 0;
|
||||||
}
|
}
|
||||||
private function checkTableDeprecatedExists(): bool
|
private function checkTableDeprecatedExists(): bool
|
||||||
{
|
{
|
||||||
$query = "SHOW TABLES LIKE 'monolog_deprecated'";
|
$query = "SHOW TABLES LIKE 'monolog_deprecated'";
|
||||||
$result = $this->connection->query($query);
|
try {
|
||||||
|
$result = $this->connection->query($query);
|
||||||
|
} catch (PDOException) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return $result->rowCount() > 0;
|
return $result->rowCount() > 0;
|
||||||
}
|
}
|
||||||
private function createTable(): void
|
private function createTable(): void
|
||||||
|
Reference in New Issue
Block a user