Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added functionality - specify port (Code provided) #4

Open
GoogleCodeExporter opened this issue Apr 17, 2015 · 0 comments
Open

Added functionality - specify port (Code provided) #4

GoogleCodeExporter opened this issue Apr 17, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

Something that is very useful for me (and I'd imagine many other people) is the 
ability to specify a port (either as part of the hostname or as a separate arg.)

Anyway, I put this functionality in (just as part of the hostname), so thought 
I'd fire the code over in case you wanted to include it (although granted it's 
only 4 lines!!)

Anyway, the only change is in MyDiff_Database::connect:

  public function connect()
  {
    if($this->_db === null)
    {
    $server = explode(":",$this->server);
      $connect = array(
        'host' => $server[0],
        'dbname' => $this->name,
        'username' => $this->username,
        'password' => $this->password,
      );
    if (isset($server[1])){
        $connect['port'] = $server[1]; 
    }

      $this->_db = Zend_Db::factory($this->adapter, $connect);
      $this->_db->getConnection();
    }

    return $this;
  }

------

Cheers,

Liam

Original issue reported on code.google.com by [email protected] on 25 Mar 2011 at 1:01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant