/** * fetches next row into this objects var's * * Note: it is ovverridden to deal with automatic unescaping of blob data on pgsql, * also dealing with the MDB2_PORTABILITY_RTRIM option which needs to be disabled * in order to retrieve correct binary data * * @access public * @return boolean on success */ function fetch() { $oDbh =& $this->getDatabaseConnection(); if (empty($oDbh)) { return false; } // When using PgSQL we need to disable MDB2_PORTABILITY_RTRIM portability option if ($pgsql = $oDbh->dbsyntax == 'pgsql') { $portability = $oDbh->getOption('portability'); if ($rtrim = $portability & MDB2_PORTABILITY_RTRIM) { $oDbh->setOption('portability', $portability ^ MDB2_PORTABILITY_RTRIM); } } // Fetch result $result = parent::fetch(); // Reset portability options, in case they have been modified if ($pgsql && $rtrim) { $oDbh->setOption('portability', $portability); } // Unescape data on PgSQL if ($pgsql && $result) { $this->contents = pg_unescape_bytea($this->contents); } return $result; }