This commit is contained in:
2025-08-05 18:33:19 +03:00
parent 06d92863ee
commit 3161fcf4dd
21 changed files with 1449 additions and 83 deletions

View File

@@ -42,4 +42,14 @@
* Операция подсчета количества.
*/
case Count = 4;
/**
* Операция создания таблицы в базе данных.
*/
case CreateTable = 5;
/**
* Операция удаления таблицы в базе данных.
*/
case DropTable = 6;
}

View File

@@ -3,6 +3,11 @@
namespace goodboyalex\php_db_components_pack\enums;
use goodboyalex\php_components_pack\traits\EnumExtensionsTrait;
use goodboyalex\php_db_components_pack\classes\tm_drivers\MSSQLTableManager;
use goodboyalex\php_db_components_pack\classes\tm_drivers\MySQLTableManager;
use goodboyalex\php_db_components_pack\classes\tm_drivers\OracleDBTableManager;
use goodboyalex\php_db_components_pack\classes\tm_drivers\PostgreSQLTableManager;
use goodboyalex\php_db_components_pack\classes\tm_drivers\SQLiteTableManager;
/**
* Перечисление типов в БД.
@@ -46,4 +51,27 @@
* Массив/объект.
*/
case ARRAY = 5;
/**
* Переводит значение из типа DBType в тип, пригодный в СУБД.
*
* @param DBDriver $driver Тип драйвера СУБД.
* @param DBType $value Тип данных.
*
* @return string SQL-тип.
*/
public static function ToSQLType (DBDriver $driver, DBType $value): string
{
// Получаю систему управления таблицами БД
$dbDrv = match ($driver) {
DBDriver::MySQL => new MySQLTableManager(),
DBDriver::MSSQL => new MSSQLTableManager(),
DBDriver::PostgreSQL => new PostgreSQLTableManager(),
DBDriver::OracleDB => new OracleDBTableManager(),
DBDriver::SQLite => new SQLiteTableManager()
};
// Получаю тип
return $dbDrv->TypeConversation[$value->GetValue()];
}
}