mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-08 05:18:40 +00:00
Simplify database type enum
This commit is contained in:
parent
b04f2f0577
commit
5f0c1b9a13
|
|
@ -101,7 +101,7 @@ abstract class ConnectionAbstract implements ConnectionInterface
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function getType() : int
|
public function getType() : string
|
||||||
{
|
{
|
||||||
return $this->type;
|
return $this->type;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,12 +57,11 @@ class ConnectionFactory
|
||||||
*/
|
*/
|
||||||
public static function create(array $dbdata) : ConnectionInterface
|
public static function create(array $dbdata) : ConnectionInterface
|
||||||
{
|
{
|
||||||
// todo: replace string with enum
|
|
||||||
switch ($dbdata['db']) {
|
switch ($dbdata['db']) {
|
||||||
case 'mysql':
|
case DatabaseType::MYSQL:
|
||||||
return new MysqlConnection($dbdata);
|
return new MysqlConnection($dbdata);
|
||||||
break;
|
break;
|
||||||
case 'mssql':
|
case DatabaseType::SQLSRV:
|
||||||
return new SqlServerConnection($dbdata);
|
return new SqlServerConnection($dbdata);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,9 @@ use phpOMS\Datatypes\Enum;
|
||||||
*/
|
*/
|
||||||
abstract class DatabaseType extends Enum
|
abstract class DatabaseType extends Enum
|
||||||
{
|
{
|
||||||
/* public */ const MYSQL = 0; /* MySQL */
|
/* public */ const MYSQL = 'mysql'; /* MySQL */
|
||||||
/* public */ const SQLITE = 1; /* SQLITE */
|
/* public */ const SQLITE = 'sqlite'; /* SQLITE */
|
||||||
/* public */ const PGSQL = 2; /* PostgreSQL */
|
/* public */ const PGSQL = 2; /* PostgreSQL */
|
||||||
/* public */ const ORACLE = 3; /* Oracle */
|
/* public */ const ORACLE = 3; /* Oracle */
|
||||||
/* public */ const SQLSRV = 4; /* Microsoft SQL Server */
|
/* public */ const SQLSRV = 'mssql'; /* Microsoft SQL Server */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user