function DB_lo_unlink($c, $id) { if (strcmp(phpversion(), '4.2.0') < 0) { return pg_lounlink($id, $c); } else { return pg_lo_unlink($c, $id); } }
/** * delete an OID * * @param integer $OID * @return mixed MDB2_OK on success or MDB2 Error Object on failure * @access public */ function deleteOID($OID) { $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; if (!@pg_lounlink($db->connection, $OID)) { return $db->raiseError(); } return MDB2_OK; }
function FreeBLOBValue($prepared_query, $blob, &$value, $success) { if (!$success) { pg_lounlink($this->connection, intval($value)); } }
function DB_lo_unlink($conn, $data) { if (($fp = DB_lo_open($conn, $data, "r")) === false) { return false; } DB_lo_close($fp); if (strcmp(phpversion(), '4.2.0') < 0) { return pg_lounlink($conn, $data); } else { return pg_lo_unlink($conn, $data); } }
/** * Convert a text value into a DBMS specific format that is suitable to * compose query statements. * * @param resource $prepared_query query handle from prepare() * @param $parameter * @param $lob * @return string text string that represents the given argument value in * a DBMS specific format. * @access private */ function _getLobValue($prepared_query, $parameter, $lob) { $connect = $this->connect(); if (MDB::isError($connect)) { return $connect; } if ($this->auto_commit && !@pg_exec($this->connection, 'BEGIN')) { return $this->raiseError(MDB_ERROR, NULL, NULL, '_getLobValue: error starting transaction'); } if ($lo = @pg_locreate($this->connection)) { if ($handle = @pg_loopen($this->connection, $lo, 'w')) { while (!$this->endOfLob($lob)) { $result = $this->readLob($lob, $data, $this->options['lob_buffer_length']); if (MDB::isError($result)) { break; } if (!@pg_lowrite($handle, $data)) { $result = $this->raiseError(MDB_ERROR, NULL, NULL, 'Get LOB field value: ' . @pg_errormessage($this->connection)); break; } } @pg_loclose($handle); if (!MDB::isError($result)) { $value = strval($lo); } } else { $result = $this->raiseError(MDB_ERROR, NULL, NULL, 'Get LOB field value: ' . @pg_errormessage($this->connection)); } if (MDB::isError($result)) { $result = @pg_lounlink($this->connection, $lo); } } else { $result = $this->raiseError(MDB_ERROR, NULL, NULL, 'Get LOB field value: ' . pg_ErrorMessage($this->connection)); } if ($this->auto_commit) { @pg_exec($this->connection, 'END'); } if (MDB::isError($result)) { return $result; } return $value; }
/** * Convert a text value into a DBMS specific format that is suitable to * compose query statements. * * @param resource $prepared_query query handle from prepare() * @param $parameter * @param $lob * @return string text string that represents the given argument value in * a DBMS specific format. * @access private */ function _quoteLOB($lob) { $db =& $GLOBALS['_MDB2_databases'][$this->db_index]; $connect = $db->connect(); if (MDB2::isError($connect)) { return $connect; } $prepared_query = $GLOBALS['_MDB2_LOBs'][$lob]->prepared_query; $parameter = $GLOBALS['_MDB2_LOBs'][$lob]->parameter; if ($db->auto_commit && !@pg_exec($db->connection, 'BEGIN')) { return $db->raiseError(MDB2_ERROR, null, null, 'error starting transaction'); } if ($lo = @pg_locreate($db->connection)) { if ($handle = @pg_loopen($db->connection, $lo, 'w')) { while (!$this->endOfLOB($lob)) { $result = $this->readLOB($lob, $data, $db->options['lob_buffer_length']); if (MDB2::isError($result)) { break; } if (!pg_lowrite($handle, $data)) { $result = $db->raiseError(); break; } } @pg_loclose($handle); if (!MDB2::isError($result)) { $value = strval($lo); } } else { $result = $db->raiseError(); } if (MDB2::isError($result)) { $result = @pg_lounlink($db->connection, $lo); } } else { $result = $db->raiseError(); } if ($db->auto_commit) { @pg_exec($db->connection, 'END'); } if (MDB2::isError($result)) { return $result; } return $value; }