function DB_lo_close($id) { if (strcmp(phpversion(), '4.2.0') < 0) { return pg_loclose($id); } else { return pg_lo_close($id); } }
function stream_close() { if (pg_lo_close($this->loh)) { return pg_query($this->dbh, 'COMMIT'); } else { pg_query($this->dbh, 'ROLLBACK'); return false; } }
function close() { if (!($e = $this->_firstUse())) { return $e; } if ($this->blob) { $id = pg_lo_close($this->blob); if ($id === false) { return $this->_setDbError('close'); } $this->blob = null; } else { $id = null; } $this->database->commit(); return $this->id ? $this->id : $id; }
public function close() { if (!($e = $this->_firstUse())) { return $e; } if ($this->_blob) { $id = @pg_lo_close($this->_blob); if ($id === false) { return $this->_raiseError('close'); } $this->_blob = null; } else { $id = null; } $this->_database->commit(); return $this->_id ? $this->_id : $id; }
function copy_db_image($dbconn, $row, $wfd, $header = null) { $oid = $row['image_blob']; $type = $row['image_type']; if (isset($header)) { header("Content-type: image/" . $row['image_type']); } $fd = pg_lo_open($dbconn, $oid, 'r'); if ($fd) { $str = pg_lo_read($fd, 8192); do { fwrite($wfd, $str, strlen($str)); } while ($str = pg_lo_read($fd, 8192)); pg_lo_close($fd); } else { error_log("Unable to open oid {$oid} in db: " . pg_last_error()); } }
public function descargar() { ini_set("max_execution_time ", "60000"); ini_set("max_input_time ", "60000"); ini_set("memory_limit", "2000M"); /** */ $link_170_SELECT = pg_Connect("host=192.168.12.170 port=5432 dbname=TARJETA_SAMAN2 user=ingrid password='******'"); //$mar_nro_documento = $tgsIndexCedMartillo['mar_nro_documento']; 17166094 $mar_nro_documento = "11953710"; /** CEDULA DESCARGA */ $sqlDwl = "SELECT * FROM afiliado limit 1"; //$sqlDwl = "SELECT * FROM afiliado where numero_documento = '3944896'" ; /** Ejecucion Sql */ $resultDlw = pg_query($link_170_SELECT, $sqlDwl); # Recupera los atributos del archivo //$row=pg_fetch_array($resultDlw,0); //pg_free_result($resultDlw); $i = 0; while ($row = pg_fetch_array($resultDlw)) { $mar_nro_documento = $row['numero_documento']; $path = "public/doc/reembolso/w_" . $mar_nro_documento . ".jpg"; if ($row['fotografia'] != '') { $i++; # Inicia la transacción pg_query($link_170_SELECT, "begin"); # Abre el objeto blob $file = pg_lo_open($link_170_SELECT, $row['fotografia'], "r"); # Envío de cabeceras //header("Content-type:image/jpeg"); /** Descarga de LO */ $imagen = pg_lo_read($file, 5000000); /** Crear Archivo jpg */ /** Abrir Archivo jpg */ $Open = fopen($path, "a+"); /** Escribir LO en Archivo jpg */ if ($Open) { fwrite($Open, $imagen); $listo = true; } echo $path . "<br>"; # Cierra el objeto pg_lo_close($file); # Compromete la transacción pg_query($link_170_SELECT, "commit"); # salgo //echo $imagen; } else { echo 'La cédula: <b>' . $mar_nro_documento . "</b>. No posee fotografia en la BD... <br>"; } } echo "Total de Fotos Procesadas: <b>" . $i . "</b>"; pg_close($link_170_SELECT); }
$clcertidaoweb->cerhtml = "x"; $clcertidaoweb->cerweb = 'true'; $clcertidaoweb->incluir(); $erro_msg = $clcertidaoweb->erro_msg; if ($clcertidaoweb->erro_status == 0) { $sqlerro = true; db_msgbox("Erro ao gerar certidao. ERRO: " . $erro_msg); exit; } /** * Grava arquivo da certidao também na tabela certidao */ $clcertidao->p50_arquivo = $oidgrava; $clcertidao->alterar($clcertidao->p50_sequencial); $objeto = pg_lo_open($conn, $oidgrava, "w"); if ($objeto != false) { $erro = pg_lo_write($objeto, $dados); pg_lo_close($objeto); } else { $sqlerro = true; } } db_fim_transacao($sqlerro); } if (file_exists($arqpdf)) { header('Content-Description: File Transfer'); header('Content-Type: application/pdf'); header('Content-Disposition: attachment; filename=' . $arqpdf); header('Content-Length: ' . filesize($arqpdf)); readfile($arqpdf); }
?> <br><br> Vencimento: <?php echo db_formatar($cerdtvenc, 'd'); ?> </div> <?php } else { Header('Content-Type: application/pdf'); header("Expires: Mon, 26 Jul 2001 05:00:00 GMT"); // Date in the pas header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modifie header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); // HTTP/1.0 header("Cache-control: private"); db_fieldsmemory($result, 0); pg_exec("begin"); $loid = pg_lo_open($cercertidao, "r"); pg_lo_read_all($loid); pg_lo_close($loid); pg_exec("commit"); //OR END } } elseif (strcmp($dtat, $dtvenc) > "0") { //passou 90 dias include "certidaovencida.php"; }
function download() { /* * *************************************************** */ /* TYPE SAVE */ /* * *************************************************** */ $sis_tipcarga = 1; // $pasaje_viatico = new tab_pasaje_viatico(); // // A BD if ($sis_tipcarga == 2) { $error = ""; /* if (isset ( $_COOKIE [session_name ()] )) { if (session_is_registered ( 'USU_ID' )) { */ if (isset($_POST['dov_id_open'])) { $dov_id = $_POST['dov_id_open']; } else { $dov_id = VAR3; } if ($dov_id != '') { $documento_viaje = new tab_documento_viaje(); $rowe = $documento_viaje->dbSelectBySQL("SELECT * FROM tab_documento_viaje WHERE dov_id = '" . $dov_id . "'"); if (count($rowe) == 1) { $sql = "SELECT\r\n tab_documento_viaje.dov_id,\r\n tab_documento_viaje.fil_nomoriginal,\r\n tab_documento_viaje.fil_nomcifrado,\r\n tab_documento_viaje.fil_tamano,\r\n tab_documento_viaje.fil_extension,\r\n tab_documento_viaje.fil_tipo,\r\n coalesce(tab_documento_viajebin.fil_contenido,'-1') as fil_contenido\r\n FROM\r\n tab_documento_viaje\r\n Inner Join tab_documento_viajebin ON tab_documento_viaje.dov_id = tab_documento_viajebin.dov_id WHERE tab_documento_viajebin.dov_id = '" . $dov_id . "'"; $r_files = $documento_viaje->dbSelectBySQLArchive($sql); // $link = $pasaje_viatico->connect(); $sql = "select dov_id, nombre, mime, size, coalesce(archivo_oid,'-1') as archivo_oid, coalesce(archivo_bytea,'-1') as archivo_bytea from tab_documento_viaje where dov_id={$dov_id}"; $result = pg_query($link, $sql); if (!$result || pg_num_rows($result) < 1) { header("Location: index.php"); exit; } $row = pg_fetch_array($result, 0); pg_free_result($result); if ($row['archivo_bytea'] == -1 && $row['archivo_oid'] == -1) { die('No existe el archivo para mostrar o bajar'); } pg_query($link, "begin"); $file = pg_lo_open($link, $row['archivo_oid'], "r"); header("Cache-control: private"); header("Content-type: {$row['mime']}"); //if($f==1) header("Content-Disposition: attachment; filename=\"$row[nombre]\""); header("Content-length: {$row['size']}"); header("Expires: " . gmdate("D, d M Y H:i:s", mktime(date("H") + 2, date("i"), date("s"), date("m"), date("d"), date("Y"))) . " GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); pg_lo_read_all($file); pg_lo_close($file); pg_query($link, "commit"); pg_close($link); } else { $error = "No existe el archivo."; } } else { $error = 'No existe el archivo.'; } } else { // A SERVER $error = ""; if (isset($_POST['dov_id_open'])) { $dov_id = $_POST['dov_id_open']; } else { $dov_id = VAR3; } if ($dov_id != '') { // $link = $pasaje_viatico->connect(); $sql = "SELECT dov_id, \r\n pav_id, \r\n dov_nombre, \r\n dov_mime, \r\n dov_size, \r\n coalesce(dov_archivo_oid,'-1') as archivo_oid, \r\n coalesce(dov_archivo_bytea,'-1') as archivo_bytea \r\n FROM tab_documento_viaje \r\n WHERE dov_id = {$dov_id} "; $result = pg_query($link, $sql); if (!$result || pg_num_rows($result) < 1) { header("Location: index.php"); exit; } $row = pg_fetch_array($result, 0); // Data Parameters $nombreDirectorio = ""; $tsistema = new tab_sistema(); $sql = "SELECT *\r\n FROM tab_sistema"; $rows2 = $tsistema->dbselectBySQL($sql); if (count($rows2) >= 1) { $sis_tipcarga = $rows2[0]->sis_tipcarga; $sis_tammax = $rows2[0]->sis_tammax; $nombreDirectorio = $rows2[0]->sis_ruta; } $archivopdf = $nombreDirectorio . $row[2]; $len = filesize($archivopdf); //$archivopdf = PATH_DOMAIN ."/". $nombreDirectorio . $row[1]; //$len = filesize($archivopdf); header("Cache-control: private"); //header("Content-type: $row[mime]"); header("Content-type: {$row['3']}"); //header("Content-Disposition: attachment; filename='".$archivopdf."'"); header("Content-length: {$len}"); header("Expires: " . gmdate("D, d M Y H:i:s", mktime(date("H") + 2, date("i"), date("s"), date("m"), date("d"), date("Y"))) . " GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); readfile($archivopdf); pg_free_result($result); pg_close($link); } } if ($error != '') { echo $error; } }
function Close() { if (version_compare(phpversion(), "4.2.0", "ge") > 0) { if (!$this->oid) { echo "{$this->error}<br>\n"; } else { $this->result = pg_result_status($this->result); $this->error = pg_lo_close($this->oid); } } }
function large_object_fetch($oid, $return = false) { trigger_before('large_object_fetch', $this, $this); //$result = pg_query($this->conn,"SELECT $field FROM $table WHERE $"); //if (!$result) { trigger_error("Error in select file OID", E_USER_ERROR ); } //$oid = pg_result($result,0,$fieldname); //if (!$oid) { trigger_error("Error in file OID result", E_USER_ERROR ); } $result = @pg_query($this->conn, "BEGIN"); if (!$result) { trigger_error("error starting l_o_f transaction: " . @pg_last_error($this->conn), E_USER_ERROR); } $handle = @pg_lo_open($this->conn, $oid, "r"); if (!$handle) { trigger_error("error in l_o_f/l_o_o: " . @pg_last_error($this->conn), E_USER_ERROR); } if ($return === true) { return @pg_lo_read($handle, $this->max_blob_length); } else { @pg_lo_read_all($handle); } if (!$buffer) { trigger_error("error in l_o_read_all: " . @pg_last_error($this->conn), E_USER_ERROR); } $result = @pg_lo_close($handle); if (!$result) { trigger_error("error in l_o_close: " . @pg_last_error($this->conn), E_USER_ERROR); } $result = @pg_query($this->conn, "COMMIT"); if (!$result) { trigger_error("error committing l_o_f transaction: " . @pg_last_error($this->conn), E_USER_ERROR); } return $return; }
/** * Output the data stored in the large object resource to stdout. * @param void * @return void */ public function stream() { // filesystem if (isset($this->filePath)) { return readfile($this->filePath); } elseif ($this->oid) { $pg = $this->oid->pg; $pg->query(new Query('BEGIN')); $handle = pg_lo_open($pg->resource->get(), $this->oid->oid, 'r'); pg_lo_read_all($handle); pg_lo_close($handle); $pg->query(new Query('COMMIT')); return null; } throw \LogicException("Shouldn't ever get tripped"); }
function stream_close() { if (pg_lo_close($this->handle)) { return pg_query($this->conn, 'COMMIT'); } else { pg_query($this->conn, 'ROLLBACK'); return false; } }
$oid = pg_lo_unlink($oid) or pgerr('lo_unlink failed'); } elseif( substr($req,0,10) == 'blob_write' ) { list($oid) = sscanf( $req, 'blob_write %s ' ); $bin = substr($req,12+strlen($oid)); $obj = pg_lo_open($oid,'w') or pgerr( 'lo_open failed' ); $res = pg_lo_write($obj,$bin) or pgerr( 'lo_write failed' ); pg_lo_close($obj); dump($res); } elseif( substr($req,0,9) == 'blob_read' ) { list($oid) = sscanf( $req, 'blob_read %u' ); $obj = pg_lo_open($oid,'r') or pgerr( 'lo_open failed' ); pg_lo_seek($obj,0,PGSQL_SEEK_END); $len = pg_lo_tell($obj); pg_lo_seek($obj,0,PGSQL_SEEK_SET); $res = pg_lo_read($obj,$len) or pgerr( 'lo_read failed' ); pg_lo_close($obj); dump($res); } else { $result = pg_query($req) or pgerr("error at request: $req"); if( pg_result_status($result) == PGSQL_COMMAND_OK ) { dump( 0 ); dump( pg_affected_rows($result) ); dump( pg_last_oid($result) ); pg_free_result($result); } elseif( pg_result_status($result) == PGSQL_EMPTY_QUERY ) { dump( 0 ); dump( 0 ); pg_free_result($result); } elseif( pg_result_status($result) == PGSQL_TUPLES_OK ) { $width = pg_num_fields($result); $height = pg_num_rows($result);
function download() { /* * *************************************************** */ /* TYPE SAVE */ /* * *************************************************** */ $sis_tipcarga = 1; // $archivo_digital = new tab_archivo_digital(); // // A BD if ($sis_tipcarga == 2) { $error = ""; /* if (isset ( $_COOKIE [session_name ()] )) { if (session_is_registered ( 'USU_ID' )) { */ if (isset($_POST['fil_id_open'])) { $fil_id = $_POST['fil_id_open']; } else { $fil_id = VAR3; } if ($fil_id != '') { $archivo = new tab_archivo(); $rowe = $archivo->dbSelectBySQL("SELECT * FROM tab_archivo WHERE fil_id = '" . $fil_id . "'"); if ($rowe[0]->fil_confidencialidad != '3') { $rowa = $archivo->dbSelectBySQL("SELECT * FROM tab_archivo WHERE fil_id = '" . $fil_id . "'"); $archivobin = new tab_archivobin(); $row = $archivobin->dbSelectBySQLField("SELECT fil_contenido FROM tab_archivobin WHERE fil_id = '" . $fil_id . "'"); if (count($row) == 1 || count($rowa) == 1) { $sql = "SELECT\r\n\t\t\t\t\t\t\ttab_archivo.fil_id,\r\n\t\t\t\t\t\t\ttab_archivo.fil_nomoriginal,\r\n\t\t\t\t\t\t\ttab_archivo.fil_nomcifrado,\r\n\t\t\t\t\t\t\ttab_archivo.fil_tamano,\r\n\t\t\t\t\t\t\ttab_archivo.fil_extension,\r\n\t\t\t\t\t\t\ttab_archivo.fil_tipo,\r\n\t\t\t\t\t\t\tcoalesce(tab_archivobin.fil_contenido,'-1') as fil_contenido\r\n\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\ttab_archivo\r\n\t\t\t\t\t\t\tInner Join tab_archivobin ON tab_archivo.fil_id = tab_archivobin.fil_id WHERE tab_archivobin.fil_id = '" . $fil_id . "'"; $r_files = $archivo->dbSelectBySQLArchive($sql); // $link = $archivo_digital->connect(); $sql = "select fil_id, nombre, mime, size, coalesce(archivo_oid,'-1') as archivo_oid, coalesce(archivo_bytea,'-1') as archivo_bytea from tab_archivo_digital where fil_id={$fil_id}"; $result = pg_query($link, $sql); if (!$result || pg_num_rows($result) < 1) { header("Location: index.php"); exit; } $row = pg_fetch_array($result, 0); pg_free_result($result); if ($row['archivo_bytea'] == -1 && $row['archivo_oid'] == -1) { die('No existe el archivo para mostrar o bajar'); } pg_query($link, "begin"); $file = pg_lo_open($link, $row['archivo_oid'], "r"); header("Cache-control: private"); header("Content-type: {$row['mime']}"); //if($f==1) header("Content-Disposition: attachment; filename=\"$row[nombre]\""); header("Content-length: {$row['size']}"); header("Expires: " . gmdate("D, d M Y H:i:s", mktime(date("H") + 2, date("i"), date("s"), date("m"), date("d"), date("Y"))) . " GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); pg_lo_read_all($file); pg_lo_close($file); pg_query($link, "commit"); pg_close($link); } else { $error = "No existe el archivo."; } } else { if (isset($_POST['pass_open']) && $_POST['pass_open'] != '') { $usuario = new tab_usuario(); $row_usu = $usuario->dbselectByField("usu_id", $_SESSION['USU_ID']); $usuario = $row_usu[0]; if ($usuario->getUsu_leer_doc() == '1' && $usuario->getUsu_pass_leer() == md5($_POST['pass_open'])) { $archivo = new tab_archivo(); $rowa = $archivo->dbSelectBySQLField("SELECT * FROM tab_archivo WHERE fil_id = '" . $fil_id . "'"); $archivobin = new tab_archivobin(); $row = $archivobin->dbSelectBySQLField("SELECT fil_contenido FROM tab_archivobin WHERE fil_id = '" . $fil_id . "'"); if (count($row) == 1 || count($rowa) == 1) { $sql = "SELECT\r\n\t\t\t\t\t\t\t\t\ttab_archivo.fil_id,\r\n\t\t\t\t\t\t\t\t\ttab_archivo.fil_nomoriginal,\r\n\t\t\t\t\t\t\t\t\ttab_archivo.fil_nomcifrado,\r\n\t\t\t\t\t\t\t\t\ttab_archivo.fil_tamano,\r\n\t\t\t\t\t\t\t\t\ttab_archivo.fil_extension,\r\n\t\t\t\t\t\t\t\t\ttab_archivo.fil_tipo,\r\n\t\t\t\t\t\t\t\t\ttab_archivobin.fil_contenido\r\n\t\t\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t\t\ttab_archivo\r\n\t\t\t\t\t\t\t\t\tInner Join tab_archivobin ON tab_archivo.fil_id = tab_archivobin.fil_id WHERE tab_archivobin.fil_id = '" . $fil_id . "'"; $r_files = $archivo->dbSelectBySQLArchive($sql); header('Content-type:' . $r_files[0]->fil_tipo); echo $r_files[0]->fil_contenido; } else { $error = "No existe el archivo."; } } else { $error = 'Password incorrecto.'; } } else { $error = 'No tiene permisos para ver este archivo.'; } } } else { $error = 'No existe el archivo.'; } } else { // A SERVER $error = ""; if (isset($_POST['fil_id_open'])) { $fil_id = $_POST['fil_id_open']; } else { $fil_id = VAR3; } if ($fil_id != '') { // $link = $archivo_digital->connect(); $sql = "select fil_id, nombre, mime, size, coalesce(archivo_oid,'-1') as archivo_oid, coalesce(archivo_bytea,'-1') as archivo_bytea from tab_archivo_digital where fil_id={$fil_id}"; $result = pg_query($link, $sql); if (!$result || pg_num_rows($result) < 1) { header("Location: index.php"); exit; } $row = pg_fetch_array($result, 0); // Data Parameters $nombreDirectorio = ""; $tsistema = new tab_sistema(); $sql = "SELECT *\r\n FROM tab_sistema"; $rows2 = $tsistema->dbselectBySQL($sql); if (count($rows2) >= 1) { $sis_tipcarga = $rows2[0]->sis_tipcarga; $sis_tammax = $rows2[0]->sis_tammax; $nombreDirectorio = $rows2[0]->sis_ruta; } $archivopdf = $nombreDirectorio . $row[1]; $len = filesize($archivopdf); //$archivopdf = PATH_DOMAIN ."/". $nombreDirectorio . $row[1]; //$len = filesize($archivopdf); header("Cache-control: private"); //header("Content-type: $row[mime]"); header("Content-type: {$row['2']}"); //header("Content-Disposition: attachment; filename='".$archivopdf."'"); header("Content-length: {$len}"); header("Expires: " . gmdate("D, d M Y H:i:s", mktime(date("H") + 2, date("i"), date("s"), date("m"), date("d"), date("Y"))) . " GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); readfile($archivopdf); pg_free_result($result); pg_close($link); } } if ($error != '') { echo $error; } }
function mostraFoto($aluid) { $sql = "select fot_foto from alunosfotos where fot_aluid = {$aluid}"; //echo $sql; $rs = pg_exec($sql); $row = pg_fetch_row($rs, 0); pg_query("begin"); $loid = pg_lo_open($row[0], "r"); $foto = pg_lo_read_all($loid); pg_lo_close($loid); pg_query("commit"); }
echo "open/read/tell/seek/close LO\n"; pg_exec($db, "begin"); $handle = pg_lo_open($db, $oid, "w"); pg_lo_read($handle, 100); pg_lo_tell($handle); pg_lo_seek($handle, 2); pg_lo_close($handle); pg_exec($db, "commit"); echo "open/read_all/close LO\n"; pg_exec($db, "begin"); $handle = pg_lo_open($db, $oid, "w"); pg_lo_read_all($handle); if (pg_last_error()) { echo "pg_lo_read_all() error\n" . pg_last_error(); } pg_lo_close($handle); pg_exec($db, "commit"); echo "unlink LO\n"; pg_exec($db, "begin"); pg_lo_unlink($db, $oid) or print "pg_lo_unlink() error 1\n"; pg_exec($db, "commit"); // more pg_lo_unlink() tests echo "Test without connection\n"; pg_exec($db, "begin"); $oid = pg_lo_create($db) or print "pg_lo_create() error\n"; pg_lo_unlink($oid) or print "pg_lo_unlink() error 2\n"; pg_exec($db, "commit"); echo "Test with string oid value\n"; pg_exec($db, "begin"); $oid = pg_lo_create($db) or print "pg_lo_create() error\n"; pg_lo_unlink($db, (string) $oid) or print "pg_lo_unlink() error 3\n";
protected function _execute() { $los =& $this->_driver->los; $params = array(); if ($this->_bound_params) { foreach ($this->_bound_params as $k => &$p) { $param =& $p[0]; switch ($p[1]) { case PDO::PARAM_LOB: if (is_resource($param)) { if (isset($los[$param])) { $pos = ftell($param); rewind($param); $lo_stream = $los[(int) $param][1]; while (!feof($param)) { pg_lo_write($lo_stream, fread($param, 8192)); } pg_lo_close($lo_stream); fseek($param, $pos); $params[$k] = $los[(int) $param][0]; } else { $buffer =& $params[$k]; while (!feof($param)) { $buffer .= fread($param, 8192); } } } else { $params[$k] =& $param; } break; case PDO::PARAM_BOOL: $params[$k] = $param ? 'TRUE' : 'FALSE'; break; default: $params[$k] =& $param; break; } } } if (!($result = @pg_execute($this->_link, $this->_result_name, $params))) { $this->_set_stmt_error(null, PDO::ERRMODE_SILENT, 'execute'); return false; } $this->_result = $result; return true; }
/** * */ function lo_close($handle) { return pg_lo_close($handle); }
function UpdateBlobFile($table, $column, $path, $where, $blobtype = 'BLOB') { pg_exec($this->_connectionID, "begin"); $fd = fopen($path, 'r'); $contents = fread($fd, filesize($path)); fclose($fd); $oid = pg_lo_create($this->_connectionID); $handle = pg_lo_open($this->_connectionID, $oid, 'w'); pg_lo_write($handle, $contents); pg_lo_close($handle); // $oid = pg_lo_import ($path); pg_exec($this->_connectionID, "commit"); $rs = ADOConnection::UpdateBlob($table, $column, $oid, $where, $blobtype); $rez = !empty($rs); return $rez; }
function BlobDecode($blob, $maxsize = false, $hastrans = true) { if (!$this->GuessOID($blob)) { return $blob; } if ($hastrans) { @pg_exec($this->_connectionID, "begin"); } $fd = @pg_lo_open($this->_connectionID, $blob, "r"); if ($fd === false) { if ($hastrans) { @pg_exec($this->_connectionID, "commit"); } return $blob; } if (!$maxsize) { $maxsize = $this->maxblobsize; } $realblob = @pg_lo_read($fd, $maxsize); @pg_lo_close($fd); if ($hastrans) { @pg_exec($this->_connectionID, "commit"); } return $realblob; }