Get database type (MySQL, MariaDB)
@return string
973225
public function getDatabaseType($default = 'MySQL')
    {
        $connection = $this->getDbalConnection();
        if (!$connection) {
            return $default;
        }

        $version = $this->getDatabaseVersion();
        if (preg_match('/mariadb/i', $version)) {
            return 'MariaDB';
        }

        return $default;
    }
619093
public static function getDefaultDB()
    {
        if (self::$defaultDBName === null) {
            // Determine default database name.
            self::$defaultDBName = isset(self::$configuration['datasources']['default']) && is_scalar(self::$configuration['datasources']['default']) ? self::$configuration['datasources']['default'] : self::DEFAULT_NAME;
        }

        return self::$defaultDBName;
    }
1069780
public static function getMysqlVersion() {
		
		$conn = self::getDbConnection();
		
        $data = $conn->fetchArray('SELECT VERSION()');
        if ($data[0]) {
            $my_ver = $data[0];
        } else {
			$data = $conn->fetchArray('SHOW VARIABLES LIKE \'version\'');
            if ($data[0]) {
				$my_ver = $data[0];
			}
        }
    
        if (!isset($my_ver)) $my_ver = '3.21.0';
    	return preg_replace('/[a-z\-]+/i', '', strtolower($my_ver));
    }
977761
public function getColumnType()
    {
        if (!($type = $this->links->get('simpleType'))) {
            $type = $this->links->get('userType');
        }

        return $type;
    }
166368
public function getSql() {
        $sql = "CREATE TABLE IF NOT EXISTS {$this->getTable()} (";
        $column = $this->_data;
        if (!empty($this->primaryKey)) {
            $column[] = "PRIMARY KEY (`{$this->primaryKey}`)";
        }
        foreach ($this->checks as $key => $item) {
            $column[] = (!is_integer($key) ? "CONSTRAINT `{$key}` " : null)." CHECK ({$item})";
        }
        foreach ($this->index as $key => $item) {
            $column[] = (count($item) > 2 ? 'UNIQUE ': null). "INDEX `{$key}` (`{$item[0]}` {$item['1']})";
        }
        foreach ($this->foreignKey as $key => $item) {
            $column[] = "CONSTRAINT `{$key}` FOREIGN KEY (`{$item[0]}`) REFERENCES `{$item[1]}` (`{$item[2]}`) ON DELETE {$item[2]} ON UPDATE {$item[3]}";
        }
        $sql .= implode(',', $column).") ENGINE={$this->engine}";
        if ($this->aiBegin > 1) {
            $sql .= ' AUTO_INCREMENT='.$this->aiBegin;
        }
        return $sql." DEFAULT CHARSET={$this->charset} COMMENT='{$this->comment}';";
    }
418935
public function getTypes()
    {
        if (!$this->columns && $this->length()) {
            foreach ($this->getColumns() as $col) {
                $this->types[$col] = 'string';
            }
        }

        return $this->types;
    }
559739
public function getResultingType() : \Dms\Core\Persistence\Db\Schema\Type\Type
    {
        if (in_array($this->operator, [self::ADD, self::SUBTRACT])) {
            return $this->left->getResultingType();
        } else {
            return new Boolean();
        }
    }
722578
public static function database()
    {
        $args = func_get_args();
        //
        switch ($args[0]) {
            case 'mysql': return self::mysql($args[1], $args[2], $args[3], $args[4], $args[5]); break;

            default:
                // code...
                break;
        }
    }
768795
public function getDatabase()
    {
        if(!isset($this->_database))
        {
            $query = $this->getObject('lib:database.query.select')
                ->columns('DATABASE()');

            $this->_database = $this->select($query, KDatabase::FETCH_FIELD);
        }
        return $this->_database;
    }
262580
public function getServerType()
    {
        $serverSoft = $_SERVER['SERVER_SOFTWARE'];

        preg_match('/^(.*?)\//i', $serverSoft, $match);
        if (empty($match[1])) {
            preg_match('/^(.*)\/?/i', $serverSoft, $match);
        }
        $serverName = strtolower( trim($match[1]) );

        return $serverName;
    }
316728
public function getServerType()
	{
		if (empty($this->serverType))
		{
			$name = $this->getName();

			if (stristr($name, 'mysql') !== false)
			{
				$this->serverType = 'mysql';
			}
			elseif (stristr($name, 'postgre') !== false)
			{
				$this->serverType = 'postgresql';
			}
			elseif (stristr($name, 'pgsql') !== false)
			{
				$this->serverType = 'postgresql';
			}
			elseif (stristr($name, 'oracle') !== false)
			{
				$this->serverType = 'oracle';
			}
			elseif (stristr($name, 'sqlite') !== false)
			{
				$this->serverType = 'sqlite';
			}
			elseif (stristr($name, 'sqlsrv') !== false)
			{
				$this->serverType = 'mssql';
			}
			elseif (stristr($name, 'sqlazure') !== false)
			{
				$this->serverType = 'mssql';
			}
			elseif (stristr($name, 'mssql') !== false)
			{
				$this->serverType = 'mssql';
			}
			else
			{
				$this->serverType = $name;
			}
		}

		return $this->serverType;
	}
1281707
public function listDatabases()
    {
        $sql = $this->_platform->getListDatabasesSQL();

        $databases = $this->_conn->fetchAll($sql);

        return $this->_getPortableDatabasesList($databases);
    }
394340
public static function getType() : int
    {
        // Return the cached result if it's already available.
        if (null !== static::$type) {
            return static::$type;
        }

        $os = strtolower(php_uname("s"));

        // Check in order of likeliness.
        if (false !== strpos($os, 'unix')) {
            return static::$type = self::TYPE_UNIX;
        }

        if (0 === strpos($os, 'win')) {
            return static::$type = self::TYPE_WINDOWS;
        }

        if (false !== strpos($os, 'bsd')) {
            return static::$type = self::TYPE_BSD;
        }

        if (false !== strpos($os, 'darwin')) {
            return static::$type = self::TYPE_DARWIN;
        }

        if (false !== strpos($os, 'cygwin')) {
            return static::$type = self::TYPE_CYGWIN;
        }

        // Use the default otherwise.
        return static::$type = self::TYPE_UNIX;
    }
369598
public function detectTypes(){
		$table = $this->getTable();
		$this->performed || $this->run();

		// Try fetch from cache
		$types = (array) $this->connection->getCache()->fetch($table . '_detectedTypes');

		if(empty($types)){
			try{
				$types = $this->connection->getDriver()->getColumnTypes($this->resultSet, $table);
			} catch(NeevoException $e){
				return $this;
			}
		}

		foreach((array) $types as $col => $type){
			$this->columnTypes[$col] = $this->resolveType($type);
		}

		$this->connection->getCache()->store($table . '_detectedTypes', $this->columnTypes);
		return $this;
	}
1135753
public function getXMLDBFieldType($type) {

        $result = XMLDB_TYPE_INCORRECT;

        switch (strtolower($type)) {
            case 'int':
                $result = XMLDB_TYPE_INTEGER;
                break;
            case 'number':
                $result = XMLDB_TYPE_NUMBER;
                break;
            case 'float':
                $result = XMLDB_TYPE_FLOAT;
                break;
            case 'char':
                $result = XMLDB_TYPE_CHAR;
                break;
            case 'text':
                $result = XMLDB_TYPE_TEXT;
                break;
            case 'binary':
                $result = XMLDB_TYPE_BINARY;
                break;
            case 'datetime':
                $result = XMLDB_TYPE_DATETIME;
                break;
        }
        // Return the normalized XMLDB_TYPE
        return $result;
    }
970597
function GetPhpType()
	{
		$rt = $this->Type;
		switch ($this->Type)
		{
			case "smallint":
			case "bigint":
			case "tinyint":
			case "mediumint":
				$rt = "int";
				break;
			case "varchar":
			case "text":
			case "tinytext":
				$rt = "string";
				break;
			case "date":
			case "datetime":
				$rt = "date";
				break;
			case "decimal":
			case "float":
				$rt = "float";
				break;
			default;
				break;
		}

		return $rt;
	}
1225536
public function getTypes()
    {
        $types = $this->config()->get('types');

        if ($this->allowed_types) {
            // Prioritise local field over global settings
            $allowed_types = $this->allowed_types;
        }
        if ($allowed_types = $this->config()->get('allowed_types')) {
           foreach ($allowed_types as $type) {
                if (!array_key_exists($type, $types)) {
                    user_error("{$type} is not a valid link type");
                }
            }

            foreach (array_diff_key($types, array_flip($allowed_types)) as $key => $value) {
                unset($types[$key]);
            }
        }
        $this->extend('updateTypes', $types);
        return $types;
    }