_connect example

if (empty($URI_PARTS["query"]))
            $URI_PARTS["query"] = '';
        if (empty($URI_PARTS["path"]))
            $URI_PARTS["path"] = '';

        switch(strtolower($URI_PARTS["scheme"]))
        {
            case "http":
                $this->host = $URI_PARTS["host"];
                if(!empty($URI_PARTS["port"]))
                    $this->port = $URI_PARTS["port"];
                if($this->_connect($fp))
                {
                    if($this->_isproxy)
                    {
                        // using proxy, send entire URI                         $this->_httprequest($URI,$fp,$URI,$this->_httpmethod);
                    }
                    else
                    {
                        $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : "");
                        // no proxy, send only the path                         $this->_httprequest($path$fp$URI$this->_httpmethod);
                    }
protected function _connect()
    {
        if ($this->_connection) {
            return;
        }

        if (!empty($this->_config['charset'])) {
            $initCommand = "SET NAMES '" . $this->_config['charset'] . "'";
            $this->_config['driver_options'][1002] = $initCommand; // 1002 = PDO::MYSQL_ATTR_INIT_COMMAND         }

        parent::_connect();
    }

    /** * @return string */
    public function getQuoteIdentifierSymbol()
    {
        return "`";
    }

    /** * Returns a list of the tables in the database. * * @return array */
if($this->_connected)
            if(!$this->_settimeout($this->_ftp_control_sock)) return FALSE;
        return TRUE;
    }

    function connect($server=NULL) {
        if(!empty($server)) {
            if(!$this->SetServer($server)) return false;
        }
        if($this->_ready) return true;
        $this->SendMsg('Local OS : '.$this->OS_FullName[$this->OS_local]);
        if(!($this->_ftp_control_sock = $this->_connect($this->_host, $this->_port))) {
            $this->SendMSG("Error : Cannot connect to remote host \"".$this->_fullhost." :".$this->_port."\"");
            return FALSE;
        }
        $this->SendMSG("Connected to remote host \"".$this->_fullhost.":".$this->_port."\". Waiting for greeting.");
        do {
            if(!$this->_readmsg()) return FALSE;
            if(!$this->_checkCode()) return FALSE;
            $this->_lastaction=time();
        } while($this->_code<200);
        $this->_ready=true;
        $syst=$this->systype();
        


    /** * Prepares an SQL statement. * * @param string $sql The SQL statement with placeholders. * @param array $bind An array of data to bind to the placeholders. * @return PDOStatement */
    public function prepare($sql)
    {
        $this->_connect();
        $stmtClass = $this->_defaultStmtClass;
        if (!class_exists($stmtClass)) {
            Zend_Loader::loadClass($stmtClass);
        }
        $stmt = new $stmtClass($this$sql);
        $stmt->setFetchMode($this->_fetchMode);
        return $stmt;
    }

    /** * Gets the last ID generated automatically by an IDENTITY/AUTOINCREMENT column. * * As a convention, on RDBMS brands that support sequences * (e.g. Oracle, PostgreSQL, DB2), this method forms the name of a sequence * from the arguments and returns the last id generated by that sequence. * On RDBMS brands that support IDENTITY/AUTOINCREMENT columns, this method * returns the last value generated for such a column, and the table name * argument is disregarded. * * On RDBMS brands that don't support sequences, $tableName and $primaryKey * are ignored. * * @param string $tableName OPTIONAL Name of table. * @param string $primaryKey OPTIONAL Name of primary key column. * @return string */

    protected function _connect()
    {
        /** * if we already have a PDO object, no need to re-connect. */
        if ($this->_connection) {
            return;
        }

        parent::_connect();

        $retval = $this->_connection->exec('PRAGMA full_column_names=0');
        if ($retval === false) {
            $error = $this->_connection->errorInfo();
            /** @see Zend_Db_Adapter_Exception */
            throw new Zend_Db_Adapter_Exception($error[2]);
        }

        $retval = $this->_connection->exec('PRAGMA short_column_names=1');
        if ($retval === false) {
            $error = $this->_connection->errorInfo();
            

    }

    /** * Returns the underlying database connection object or resource. * If not presently connected, this initiates the connection. * * @return object|resource|null */
    public function getConnection()
    {
        $this->_connect();

        return $this->_connection;
    }

    /** * Returns the configuration variables in this adapter. * * @return array */
    public function getConfig()
    {
        
parent::__construct($host$port);
    }


    /** * Connect to the server with the parameters given in the constructor. * * @return boolean */
    public function connect()
    {
        return $this->_connect($this->_transport . '://' . $this->_host . ':'. $this->_port);
    }


    /** * Initiate HELO/EHLO sequence and set flag to indicate valid smtp session * * @param string $host The client hostname or IP address (default: 127.0.0.1) * @throws Zend_Mail_Protocol_Exception * @return void */
    public function helo($host = '127.0.0.1')
    {
Home | Imprint | This part of the site doesn't use cookies.