remove old bool support

This commit is contained in:
Shish 2020-10-27 01:50:39 +00:00
parent 754f0b2f39
commit 3ac7ab2cf3

View file

@ -3,9 +3,6 @@ abstract class SCORE
{ {
const AIPK = "SCORE_AIPK"; const AIPK = "SCORE_AIPK";
const INET = "SCORE_INET"; const INET = "SCORE_INET";
const BOOL_Y = "SCORE_BOOL_Y";
const BOOL_N = "SCORE_BOOL_N";
const BOOL = "SCORE_BOOL";
} }
abstract class DBEngine abstract class DBEngine
@ -13,9 +10,6 @@ abstract class DBEngine
/** @var null|string */ /** @var null|string */
public $name = null; public $name = null;
public $BOOL_Y = null;
public $BOOL_N = null;
public function init(PDO $db) public function init(PDO $db)
{ {
} }
@ -42,9 +36,6 @@ class MySQL extends DBEngine
/** @var string */ /** @var string */
public $name = DatabaseDriver::MYSQL; public $name = DatabaseDriver::MYSQL;
public $BOOL_Y = 'Y';
public $BOOL_N = 'N';
public function init(PDO $db) public function init(PDO $db)
{ {
$db->exec("SET NAMES utf8;"); $db->exec("SET NAMES utf8;");
@ -54,9 +45,6 @@ class MySQL extends DBEngine
{ {
$data = str_replace(SCORE::AIPK, "INTEGER PRIMARY KEY auto_increment", $data); $data = str_replace(SCORE::AIPK, "INTEGER PRIMARY KEY auto_increment", $data);
$data = str_replace(SCORE::INET, "VARCHAR(45)", $data); $data = str_replace(SCORE::INET, "VARCHAR(45)", $data);
$data = str_replace(SCORE::BOOL_Y, "'$this->BOOL_Y'", $data);
$data = str_replace(SCORE::BOOL_N, "'$this->BOOL_N'", $data);
$data = str_replace(SCORE::BOOL, "ENUM('Y', 'N')", $data);
return $data; return $data;
} }
@ -88,9 +76,6 @@ class PostgreSQL extends DBEngine
/** @var string */ /** @var string */
public $name = DatabaseDriver::PGSQL; public $name = DatabaseDriver::PGSQL;
public $BOOL_Y = "true";
public $BOOL_N = "false";
public function init(PDO $db) public function init(PDO $db)
{ {
if (array_key_exists('REMOTE_ADDR', $_SERVER)) { if (array_key_exists('REMOTE_ADDR', $_SERVER)) {
@ -107,9 +92,6 @@ class PostgreSQL extends DBEngine
{ {
$data = str_replace(SCORE::AIPK, "INTEGER NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY", $data); $data = str_replace(SCORE::AIPK, "INTEGER NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY", $data);
$data = str_replace(SCORE::INET, "INET", $data); $data = str_replace(SCORE::INET, "INET", $data);
$data = str_replace(SCORE::BOOL_Y, "true", $data);
$data = str_replace(SCORE::BOOL_N, "false", $data);
$data = str_replace(SCORE::BOOL, "BOOL", $data);
return $data; return $data;
} }
@ -190,10 +172,6 @@ class SQLite extends DBEngine
/** @var string */ /** @var string */
public $name = DatabaseDriver::SQLITE; public $name = DatabaseDriver::SQLITE;
public $BOOL_Y = 'Y';
public $BOOL_N = 'N';
public function init(PDO $db) public function init(PDO $db)
{ {
ini_set('sqlite.assoc_case', '0'); ini_set('sqlite.assoc_case', '0');
@ -214,9 +192,6 @@ class SQLite extends DBEngine
{ {
$data = str_replace(SCORE::AIPK, "INTEGER PRIMARY KEY", $data); $data = str_replace(SCORE::AIPK, "INTEGER PRIMARY KEY", $data);
$data = str_replace(SCORE::INET, "VARCHAR(45)", $data); $data = str_replace(SCORE::INET, "VARCHAR(45)", $data);
$data = str_replace(SCORE::BOOL_Y, "'$this->BOOL_Y'", $data);
$data = str_replace(SCORE::BOOL_N, "'$this->BOOL_N'", $data);
$data = str_replace(SCORE::BOOL, "CHAR(1)", $data);
return $data; return $data;
} }