Skip to content

Added functionality - specify port (Code provided) #4

Description

@GoogleCodeExporter
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 lwiltshi...@googlemail.com on 25 Mar 2011 at 1:01

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions