Update DB drivers
This commit is contained in:
parent
8418606d83
commit
cdea5ce590
3 changed files with 15 additions and 12 deletions
|
@ -69,7 +69,7 @@ class Mysql
|
|||
*/
|
||||
public function __call(string $name, array $args)
|
||||
{
|
||||
throw new PDOException("Method '{$name}' not found in DB driver.");
|
||||
throw new PDOException("Method '{$name}' not found in DB driver");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,8 +77,8 @@ class Mysql
|
|||
*/
|
||||
protected function nameCheck(string $str): void
|
||||
{
|
||||
if (\preg_match('%[^a-zA-Z0-9_]%', $str)) {
|
||||
throw new PDOException("Name '{$str}' have bad characters.");
|
||||
if (\preg_match('%[^\w]%', $str)) {
|
||||
throw new PDOException("Name '{$str}' have bad characters");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ class Mysql
|
|||
} elseif (\is_bool($data)) {
|
||||
return $data ? 'true' : 'false';
|
||||
} else {
|
||||
throw new PDOException('Invalid data type for DEFAULT.');
|
||||
throw new PDOException('Invalid data type for DEFAULT');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ class Pgsql
|
|||
*/
|
||||
public function __call(string $name, array $args)
|
||||
{
|
||||
throw new PDOException("Method '{$name}' not found in DB driver.");
|
||||
throw new PDOException("Method '{$name}' not found in DB driver");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,8 +84,8 @@ class Pgsql
|
|||
*/
|
||||
protected function nameCheck(string $str): void
|
||||
{
|
||||
if (\preg_match('%[^a-zA-Z0-9_]%', $str)) {
|
||||
throw new PDOException("Name '{$str}' have bad characters.");
|
||||
if (\preg_match('%[^\w]%', $str)) {
|
||||
throw new PDOException("Name '{$str}' have bad characters");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ class Pgsql
|
|||
} elseif (\is_bool($data)) {
|
||||
return $data ? 'true' : 'false';
|
||||
} else {
|
||||
throw new PDOException('Invalid data type for DEFAULT.');
|
||||
throw new PDOException('Invalid data type for DEFAULT');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -67,9 +67,12 @@ class Sqlite
|
|||
*/
|
||||
public function __call(string $name, array $args)
|
||||
{
|
||||
throw new PDOException("Method '{$name}' not found in DB driver.");
|
||||
throw new PDOException("Method '{$name}' not found in DB driver");
|
||||
}
|
||||
|
||||
/**
|
||||
* Проверяет минимально допустимую версию
|
||||
*/
|
||||
protected function vComp(string $version): bool
|
||||
{
|
||||
return \version_compare($this->db->getAttribute(PDO::ATTR_SERVER_VERSION), $version, '>=');
|
||||
|
@ -80,8 +83,8 @@ class Sqlite
|
|||
*/
|
||||
protected function nameCheck(string $str): void
|
||||
{
|
||||
if (\preg_match('%[^a-zA-Z0-9_]%', $str)) {
|
||||
throw new PDOException("Name '{$str}' have bad characters.");
|
||||
if (\preg_match('%[^\w]%', $str)) {
|
||||
throw new PDOException("Name '{$str}' have bad characters");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,7 +144,7 @@ class Sqlite
|
|||
} elseif (\is_bool($data)) {
|
||||
return $data ? 'true' : 'false';
|
||||
} else {
|
||||
throw new PDOException('Invalid data type for DEFAULT.');
|
||||
throw new PDOException('Invalid data type for DEFAULT');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue