Last active
April 12, 2018 10:44
-
-
Save plankes-projects/d941f49bf74353f0b29700261192c639 to your computer and use it in GitHub Desktop.
query call
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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>); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment