function connect() { if (strtoupper($this->dbType) != "MYSQL") { return false; } if ($this->isConnect) { return true; } $hostStr = ""; if (parent::getHost() != "") { $hostStr .= parent::getHost(); } else { return false; } if (parent::getPort() != 0) { $hostStr .= ":" . parent::getPort(); } $this->connection = mysql_connect($hostStr, parent::getUser(), parent::getPassword(), true); if (!$this->connection) { $this->isConnect = false; } else { $db_selected = mysql_select_db($this->_dbName, $this->connection); if (!$db_selected) { $this->isConnect = false; $this->disconnect(); } else { $this->isConnect = true; } } return $this->isConnect; }
function connect() { if (strtoupper($this->dbType) != "ORACLE") { return false; } if ($this->isConnect) { return true; } //echo "connect string = ".parent::getUser()."/".parent::getPassword()."@".$this->_sid."<br>"; $this->connection = ora_logon(parent::getUser() . "@" . $this->_sid, parent::getPassword()); if (!$this->connection) { $this->isConnect = false; } else { $this->isConnect = true; } return $this->isConnect; }
function connect() { if (strtoupper($this->dbType) != "OCI8") { return false; } if ($this->isConnect) { return true; } if ($this->_sid == "") { $this->connection = ocilogon(parent::getUser(), parent::getPassword()); } else { $this->connection = ocilogon(parent::getUser(), parent::getPassword(), $this->getSID()); } if (!$this->connection) { $this->isConnect = false; } else { $this->isConnect = true; } return $this->isConnect; }
function connect() { if (strtoupper($this->dbType) != "POSTGRES") { return false; } if ($this->isConnect) { return true; } $connectStr = ""; if (parent::getHost() != "") { $connectStr .= "host=" . parent::getHost() . " "; } else { return false; } if (parent::getPort() != 0) { $connectStr .= "port=" . parent::getPort() . " "; } if ($this->_dbName != "") { $connectStr .= "dbname=" . $this->_dbName . " "; } else { return false; } if (parent::getUser() != "") { $connectStr .= "user="******" "; } else { return false; } if (parent::getPassword() != "") { $connectStr .= "password="******" "; } $this->connection = pg_connect($connectStr); if (!$this->connection) { $this->isConnect = false; } else { $this->isConnect = true; } return $this->isConnect; }