Basecoat\DB::setConnectParams PHP Method

setConnectParams() public method

Set database connection parameters. This does not establish a connection, only sets the parameters for a connection.
public setConnectParams ( mixed $host, string $username = null, string $password = null, string $db = null, string $label = 'n/a', array $attr = null )
$host mixed string (hostname) or associative array with parameter to use
$username string user name to use for login
$password string password to use for login
$db string optional database to select
$label string a "name" reference for the connection, used for profiling
$attr array connection attribute list (i.e. PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")
    public function setConnectParams($host, $username = null, $password = null, $db = null, $label = 'n/a', $attr = null)
    {
        if (is_array($host)) {
            $this->connectParams = array_merge(self::$connectDefaults, $host);
            $label = $this->connectParams['label'];
        } else {
            $this->connectParams = array('host' => $host, 'username' => $username, 'password' => $password, 'db' => $db, 'label' => $label, 'type' => 'mysql', 'attr' => $attr);
        }
        $this->connectionLabel = $label;
    }