Create PDO connection
@param  array $params
@return \Pdo| \PDOException
199837
public function createPdoConnection(array $params = null)
    {
        if (!isset($params)) {
            $params = $this->getConfig()->get('database');
        }

        $platform = !empty($params['platform']) ? strtolower($params['platform']) : 'mysql';
        $port = empty($params['port']) ? '' : ';port=' . $params['port'];
        $dbname = empty($params['dbname']) ? '' : ';dbname=' . $params['dbname'];

        $options = array();

        if (isset($params['sslCA'])) {
            $options[PDO::MYSQL_ATTR_SSL_CA] = $params['sslCA'];
        }
        if (isset($params['sslCert'])) {
            $options[PDO::MYSQL_ATTR_SSL_CERT] = $params['sslCert'];
        }
        if (isset($params['sslKey'])) {
            $options[PDO::MYSQL_ATTR_SSL_KEY] = $params['sslKey'];
        }
        if (isset($params['sslCAPath'])) {
            $options[PDO::MYSQL_ATTR_SSL_CAPATH] = $params['sslCAPath'];
        }
        if (isset($params['sslCipher'])) {
            $options[PDO::MYSQL_ATTR_SSL_CIPHER] = $params['sslCipher'];
        }

        $dsn = $platform . ':host='.$params['host'].$port.$dbname;
        $dbh = new \PDO($dsn, $params['user'], $params['password'], $options);

        return $dbh;
    }
870691
public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) {
        if (!empty($this->connection)) return $this->connection;

        $metaData         = new MetaData();
        $this->connection = new Connection($params, $this, new RoutingTable($metaData->getEntityNamespaces()));
        return $this->connection;
    }
176310
public function addParams(array $params)
    {
        foreach ($params as $k => $v) {
            $this->addParam($k, $v);
        }
        return $this;
    }
1072807
protected function createPdoConnection($dsn, $username, $password, $options)
    {
        return new PDO($dsn, $username, $password, $options);
    }
1370789
public function connect($id, array $params)
    {
        if (isset($params['connection'])) {
            $connectionParams = $params['connection'];
        } else {
            $connectionParams = $params;
            $connectionParams['driver'] = str_replace('dbal_', '', $connectionParams['driver']);
        }

        $this->persistentConnect($connectionParams);

        return new common_persistence_SqlPersistence($params, $this);
    }
1298080
protected function send(array $params)
    {
        $this->connect();
        return $this->socket->send(join(Driver::SEP, array_map([$this->socket, 'encode'], $params)).Driver::EOL);
    }
1044090
public function loadResult($params=array()) {
		
		$this->openConnection();
		
		$res = NULL;

		try {

			$stat = $this->handler->prepare($this->query);
			$stat->execute((array)$params);
			
			// logger
			$count = $this->handler->query('SELECT FOUND_ROWS()')->fetchColumn();
			$this->logParamQuery($this->query, $count, $params);
			$res = $stat->fetch(\PDO::FETCH_COLUMN);	
		
		} catch (\PDOException $e) {

			$this->handleException($e, $params);

		}
		
		$stat->closeCursor();

		return $res;
		
	}
1184442
public function execute(string $query, array $params = []) : object
    {
        list($query, $params) = $this->expandParamArray($query, $params);

        if (!$this->pdo) {
            $this->createException("Did you forget to connect to the database?", $query, $params);
        }

        $this->stmt = $this->pdo->prepare($query);
        if (!$this->stmt) {
            $this->pdoException($query, $params);
        }

        if ($this->options["verbose"]) {
            echo $query . "\n";
            print_r($params);
        }

        $res = $this->stmt->execute($params);
        if (!$res) {
            $this->statementException($query, $params);
        }

        return $this;
    }
564072
private function _constructPdoDsn(array $params)
    {
        $dsn = 'mysql:';
        if (isset($params['host']) && $params['host'] != '') {
            $dsn .= 'host=' . $params['host'] . ';';
        }
        if (isset($params['port'])) {
            $dsn .= 'port=' . $params['port'] . ';';
        }
        if (isset($params['database'])) {
            $dsn .= 'dbname=' . $params['database'] . ';';
        }
        if (isset($params['unix_socket'])) {
            $dsn .= 'unix_socket=' . $params['unix_socket'] . ';';
        }
        if (isset($params['character_set'])) {
            // Let's use the new character_set parameter
            $charset = $params['character_set'];
        } elseif (isset($params['charset'])) {
            // Let's use the old charset parameter
            $charset = $params['charset'];
        } else {
            $charset = null;
        }
        if ($charset !== null) {
            $dsn .= 'charset=' . $charset . ';';
        }

        return $dsn;
    }
867948
public function create(array $params = [])
    {
        $defaults = [
            'issue_id' => null,
            'project_id' => null,
            'spent_on' => null,
            'hours' => null,
            'activity_id' => null,
            'comments' => null,
        ];
        $params = $this->sanitizeParams($defaults, $params);

        if (
            (!isset($params['issue_id']) && !isset($params['project_id']))
         || !isset($params['hours'])
        ) {
            throw new \Exception('Missing mandatory parameters');
        }

        $xml = new \SimpleXMLElement('<?xml version="1.0"?><time_entry></time_entry>');
        foreach ($params as $k => $v) {
            if ('custom_fields' === $k && is_array($v)) {
                $this->attachCustomFieldXML($xml, $v);
            } else {
                $xml->addChild($k, $v);
            }
        }

        return $this->post('/time_entries.xml', $xml->asXML());
    }
589595
public function configure(array $params): void
    {
        $dbHelperClass = DBHelper\DriverGuesser::getDBHelper($params['driver']);

        // Set specific options
        $params['driverOptions'] = $dbHelperClass::getDriverOptions();
        $this->conn = DriverManager::getConnection($params, new DbalConfiguration());
        $this->conn->setFetchMode(\Doctrine\DBAL\FetchMode::ASSOCIATIVE);

        $this->dbHelper = new $dbHelperClass($this->conn);
    }
441975
protected function buildParams(array $params)
	{
		return array_merge(array(
			$this->database,
			$this->uid(),
			$this->password
		), $params);
	}
1195154
public function execute(array $params = [])
    {
        $this->formatSqlByParams($params);
        $result = $this->connection->query($this->sql);
        if ($result === false) {
            throw new MysqlException('Mysql execute error，connectError=' . $this->connection->connect_error . ' error=' . $this->connection->error);
        }

        $this->pushSqlToStack($this->sql);

        return $result;
    }
1069791
public function createWebsite(...$params)
    {
        $name      = \array_shift($params);
        $ipAddress = \array_shift($params);
        $https     = \array_shift($params);
        $domains   = \array_shift($params);

        if ($this->version === 1)
        {
            $siteApps = $params;

            return $this->createV1Website($name, $ipAddress, $https, $domains, ...$siteApps);
        }

        $certificate = \array_shift($params);
        $siteApps    = $params;

        return $this->createV2Website($name, $ipAddress, $https, $domains, $certificate, ...$siteApps);

    }
1058512
protected function createPdoConnection($dsn, $username, $password, $options)
    {
        if (class_exists(PDOConnection::class) && ! $this->isPersistentConnection($options)) {
            return new PDOConnection($dsn, $username, $password, $options);
        }

        return new PDO($dsn, $username, $password, $options);
    }
809115
public function createConnection()
    {
        $uri                = $this->pool->getConnectionAddress();
        $options            = $this->parseUri($uri);
        $options['timeout'] = $this->pool->getTimeout();

        /** @var DbPoolProperties $config */
        $config = $this->pool->getPoolConfig();

        $user    = $options['user'];
        $passwd  = $options['password'];
        $host    = $options['host'];
        $port    = $options['port'];
        $dbName  = $options['database'];
        $charset = $options['charset'];
        $timeout = $options['timeout'];

        // connect
        $pdoOptions       = [
            \PDO::ATTR_TIMEOUT    => $timeout,
            \PDO::ATTR_PERSISTENT => true,
        ];

        if ($config->isStrictType()) {
            $pdoOptions[\PDO::ATTR_STRINGIFY_FETCHES] = false;
            $pdoOptions[\PDO::ATTR_EMULATE_PREPARES]  = false;
        }

        $dsn              = "mysql:host=$host;port=$port;dbname=$dbName;charset=$charset";
        $this->connection = new \PDO($dsn, $user, $passwd, $pdoOptions);
        $this->connection->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
        $this->originDb = $dbName;
    }
1093292
public function create(array $params = [])
    {
        $defaults = [
            'name' => null,
            'identifier' => null,
            'description' => null,
        ];
        $params = $this->sanitizeParams($defaults, $params);

        if (
            !isset($params['name'])
         || !isset($params['identifier'])
        ) {
            throw new \Exception('Missing mandatory parameters');
        }

        $xml = $this->prepareParamsXml($params);

        return $this->post('/projects.xml', $xml->asXML());
    }