src/ApplicationConfiguration.php
public function getDatabaseInfo($dbName = null)
    {
        if ($dbName && $this->_databaseInfo[$dbName]) {
            return $this->_databaseInfo[$dbName];
        }
        if (!$this->_xmlArr["APPLICATION"]["DATASOURCE"]) {
            $errMsg = MessageHelper::getMessage("SYS_ERROR_NODBINFO");
            trigger_error($errMsg, E_USER_ERROR);
        }
        $breakFlag = false;
        foreach ($this->_xmlArr["APPLICATION"]["DATASOURCE"]["DATABASE"] as $db) {
            if (isset($this->_xmlArr["APPLICATION"]["DATASOURCE"]["DATABASE"]['ATTRIBUTES'])) {
                $db = $this->_xmlArr["APPLICATION"]["DATASOURCE"]["DATABASE"];
                $breakFlag = true;
            }
            $tmp["Name"] = $db["ATTRIBUTES"]["NAME"];
            $tmp["Driver"] = $db["ATTRIBUTES"]["DRIVER"];
            $tmp["Server"] = $db["ATTRIBUTES"]["SERVER"];
            $tmp["DBName"] = $db["ATTRIBUTES"]["DBNAME"];
            $tmp["User"] = $db["ATTRIBUTES"]["USER"];
            $tmp["Password"] = $db["ATTRIBUTES"]["PASSWORD"];
            $tmp["Port"] = isset($db["ATTRIBUTES"]["PORT"]) ? $db["ATTRIBUTES"]["PORT"] : null;
            $tmp["Charset"] = isset($db["ATTRIBUTES"]["CHARSET"]) ? $db["ATTRIBUTES"]["CHARSET"] : null;
            $tmp["Options"] = isset($db["ATTRIBUTES"]["OPTIONS"]) ? $db["ATTRIBUTES"]["OPTIONS"] : null;
            
            $this->_databaseInfo[$tmp["Name"]] = $tmp;
            if ($breakFlag) {
                break;
            }
        }

        if ($dbName && $this->_databaseInfo[$dbName]) {
            return $this->_databaseInfo[$dbName];
        }
        if ($dbName && !isset($this->_databaseInfo[$dbName])) {
            $errMsg = MessageHelper::getMessage("DATA_INVALID_DBNAME", array($dbName, $dbName));
            trigger_error($errMsg, E_USER_ERROR);
        }
        if (!$dbName) {
            return $this->_databaseInfo;
        }
    }
public function getDatabaseInfo($dbName = null)
    {
        if ($dbName && $this->_databaseInfo[$dbName]) {
            return $this->_databaseInfo[$dbName];
        }
        if (!$this->_xmlArr["APPLICATION"]["DATASOURCE"]) {
            $errMsg = MessageHelper::getMessage("SYS_ERROR_NODBINFO");
            trigger_error($errMsg, E_USER_ERROR);
        }
        $breakFlag = false;
        foreach ($this->_xmlArr["APPLICATION"]["DATASOURCE"]["DATABASE"] as $db) {
            if (isset($this->_xmlArr["APPLICATION"]["DATASOURCE"]["DATABASE"]['ATTRIBUTES'])) {
                $db = $this->_xmlArr["APPLICATION"]["DATASOURCE"]["DATABASE"];
                $breakFlag = true;
            }
            $tmp["Name"] = $db["ATTRIBUTES"]["NAME"];
            $tmp["Driver"] = $db["ATTRIBUTES"]["DRIVER"];
            $tmp["Server"] = $db["ATTRIBUTES"]["SERVER"];
            $tmp["DBName"] = $db["ATTRIBUTES"]["DBNAME"];
            $tmp["User"] = $db["ATTRIBUTES"]["USER"];
            $tmp["Password"] = $db["ATTRIBUTES"]["PASSWORD"];
            $tmp["Port"] = isset($db["ATTRIBUTES"]["PORT"]) ? $db["ATTRIBUTES"]["PORT"] : null;
            $tmp["Charset"] = isset($db["ATTRIBUTES"]["CHARSET"]) ? $db["ATTRIBUTES"]["CHARSET"] : null;
            $tmp["Options"] = isset($db["ATTRIBUTES"]["OPTIONS"]) ? $db["ATTRIBUTES"]["OPTIONS"] : null;
            
            $this->_databaseInfo[$tmp["Name"]] = $tmp;
            if ($breakFlag) {
                break;
            }
        }

        if ($dbName && $this->_databaseInfo[$dbName]) {
            return $this->_databaseInfo[$dbName];
        }
        if ($dbName && !isset($this->_databaseInfo[$dbName])) {
            $errMsg = MessageHelper::getMessage("DATA_INVALID_DBNAME", array($dbName, $dbName));
            trigger_error($errMsg, E_USER_ERROR);
        }
        if (!$dbName) {
            return $this->_databaseInfo;
        }
    }
Returns the database info from <DataSource> defined in application.xml as an array.
Returned array is a 2D map.
(DBName1 => ["Name"], ["Driver"], ["Server"], ["DBName"], ["User"], {"Password"])
(DBName2 => ["Name"], ["Driver"], ["Server"], ["DBName"], ["User"], {"Password"])
(...)
If DBName is given, returns the record only related to the given DBName,
otherwise returns all records

@param string $dbName
@return array database information