Changeset 22181 for branches/2.5/include


Ignore:
Timestamp:
Apr 12, 2013, 11:56:58 PM (12 years ago)
Author:
plg
Message:

bug 2865: mysqli can now handle socket and specific port number

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.5/include/dblayer/functions_mysqli.inc.php

    r21088 r22181  
    3737{
    3838  global $mysqli;
    39  
    40   $mysqli = new mysqli($host, $user, $password);
     39
     40  // exemples of $host
     41  //
     42  // $host = localhost
     43  // $host = 1.2.3.4:3405
     44  // $host = /path/to/socket
     45
     46  $port = null;
     47  $socket = null;
     48 
     49  if (strpos($host, '/') === 0)
     50  {
     51    $host = null;
     52    $socket = $host;
     53  }
     54  elseif (strpos($host, ':') !== false)
     55  {
     56    list($host, $port) = explode(':', $host);
     57  }
     58
     59  $dbname = null;
     60 
     61  $mysqli = new mysqli($host, $user, $password, $dbname, $port, $socket);
    4162  if (mysqli_connect_error())
    4263  {
Note: See TracChangeset for help on using the changeset viewer.