Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $sslOption = null;
- if(isset($dbConfig['options'][\PDO::MYSQL_ATTR_SSL_CA])) {
- $sslOption = new ClientTlsContext();
- $sslOption->withCaFile($dbConfig['options'][\PDO::MYSQL_ATTR_SSL_CA]);
- }
- $host = $dbConfig['host'];
- $port = $dbConfig['port'];
- $user = $dbConfig['username'];
- $pass = $dbConfig['password'];
- $db = $dbConfig['database'];
- $timeout = $dbConfig['options'][\PDO::ATTR_TIMEOUT] ?? 30000;
- $config = ConnectionConfig::parseConnectionString("host=$host:$port;user=$user;pass=$pass;db=$db", $sslOption)
- ->withCharset($dbConfig['charset'], $dbConfig['collation']);
- $pool = new Pool($config, self::DEFAULT_MAX_CONNECTIONS, new TimeoutConnector($timeout));
- $pool->execute(<query>, <params>);
Add Comment
Please, Sign In to add comment