public static function createInstance($pdo = null)
 {
     $pdo = $pdo ?: [];
     if (is_array($pdo)) {
         $dsn = 'mysql:charset=utf8;dbname=' . $pdo['database'];
         if (!empty($pdo['socket'])) {
             $dsn .= ';unix_socket=' . $pdo['socket'];
         } else {
             $dsn .= ';host=' . ($pdo['host'] ?: 'localhost');
             $dsn .= ';port=' . ($pdo['port'] ?: 3306);
         }
         $pdo = new PDO($dsn, $pdo['username'], $pdo['password']);
     }
     return parent::createInstance($pdo);
 }
 public static function createInstance($pdo = null)
 {
     $pdo = $pdo ?: [];
     if (is_array($pdo)) {
         $pdoConfig = $pdo;
         $dsn = 'pgsql:options=\'--client_encoding=UTF8\';dbname=' . $pdoConfig['database'];
         $dsn .= ';host=' . ($pdoConfig['host'] ?: 'localhost');
         $dsn .= ';port=' . ($pdoConfig['port'] ?: 5432);
         if (!empty($pdoConfig['application_name'])) {
             $dsn .= ';application_name=' . $pdoConfig['application_name'];
         }
         $pdo = new PDO($dsn, $pdoConfig['username'], $pdoConfig['password']);
         if (!empty($pdoConfig['search_path'])) {
             $pdo->query('SET search_path = "' . implode('","', $pdoConfig['search_path']) . '"')->closeCursor();
         }
     }
     return parent::createInstance($pdo);
 }