Пример #1
0
 static function connect($params)
 {
     $dsn = "mysql:";
     if ($params->socket !== null) {
         $dsn .= "unix_socket=" . _hx_string_or_null($params->socket) . ";";
     } else {
         $dsn .= "host=" . _hx_string_or_null($params->host) . ";";
         if ($params->port !== null) {
             $dsn .= "port=" . _hx_string_rec($params->port, "") . ";";
         }
     }
     $dsn .= "dbname=" . _hx_string_or_null($params->database);
     return php_db_PDO::open($dsn, $params->user, $params->pass, null);
 }
Пример #2
0
 static function open($file)
 {
     return php_db_PDO::open("sqlite:" . _hx_string_or_null($file), null, null, null);
 }