当前位置: 首页>>代码示例>>PHP>>正文


PHP pg_lo_read函数代码示例

本文整理汇总了PHP中pg_lo_read函数的典型用法代码示例。如果您正苦于以下问题:PHP pg_lo_read函数的具体用法?PHP pg_lo_read怎么用?PHP pg_lo_read使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pg_lo_read函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: DB_lo_read

function DB_lo_read($contest, $id, $s = -1)
{
    if (strcmp(phpversion(), '4.2.0') < 0) {
        if ($s < 0) {
            $str = '';
            while (($buf = pg_loread($id, 100000)) != false) {
                $str .= $buf;
            }
        } else {
            $str = pg_loread($id, $s);
        }
    } else {
        if ($s < 0) {
            $str = '';
            while (($buf = pg_lo_read($id, 100000)) != false) {
                $str .= $buf;
            }
        } else {
            $str = pg_lo_read($id, $s);
        }
    }
    if (($str2 = DB_unlock($contest, $str)) === false) {
        return $str;
    }
    return $str2;
}
开发者ID:joffilyfe,项目名称:boca,代码行数:26,代码来源:db.php

示例2: read

 public function read($len)
 {
     if ($this->_id === false) {
         return '';
     }
     if (!($e = $this->_firstUse())) {
         return $e;
     }
     $data = @pg_lo_read($this->_blob, $len);
     if ($data === false) {
         return $this->_raiseError('read');
     }
     return $data;
 }
开发者ID:vbo,项目名称:DB_Adapter,代码行数:14,代码来源:Blob.php

示例3: read

 function read($len)
 {
     if ($this->id === false) {
         return '';
         // wr-only blob
     }
     if (!($e = $this->_firstUse())) {
         return $e;
     }
     $data = pg_lo_read($this->blob, $len);
     if ($data === false) {
         return $this->_setDbError('read');
     }
     return $data;
 }
开发者ID:Ambalus,项目名称:DbSimple,代码行数:15,代码来源:Blob.php

示例4: copy_db_image

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());
    }
}
开发者ID:JazzHandsCMDB,项目名称:jazzhands,代码行数:18,代码来源:picture.php

示例5: BlobDecode

 function BlobDecode($blob, $maxsize = false, $hastrans = true)
 {
     if (!$this->GuessOID($blob)) {
         return $blob;
     }
     if ($hastrans) {
         pg_query($this->_connectionID, 'begin');
     }
     $fd = @pg_lo_open($this->_connectionID, $blob, 'r');
     if ($fd === false) {
         if ($hastrans) {
             pg_query($this->_connectionID, 'commit');
         }
         return $blob;
     }
     if (!$maxsize) {
         $maxsize = $this->maxblobsize;
     }
     $realblob = @pg_lo_read($fd, $maxsize);
     @pg_loclose($fd);
     if ($hastrans) {
         pg_query($this->_connectionID, 'commit');
     }
     return $realblob;
 }
开发者ID:nicolas34732,项目名称:address_book,代码行数:25,代码来源:adodb-postgres64.inc.php

示例6: large_object_fetch

 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;
 }
开发者ID:voitto,项目名称:dbscript,代码行数:33,代码来源:postgresql.php

示例7: stream_read

 function stream_read($length)
 {
     return pg_lo_read($this->handle, $length);
 }
开发者ID:quangbt2005,项目名称:vhost-kis,代码行数:4,代码来源:PgLOB.php

示例8: descargar

 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='ingpol123'");
     //$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);
 }
开发者ID:gesaodin,项目名称:ipsfa-bss,代码行数:53,代码来源:Login.php

示例9: DB_lo_read

function DB_lo_read($fp, $len)
{
    if (strcmp(phpversion(), '4.2.0') < 0) {
        return pg_loread($fp, $len);
    } else {
        return pg_lo_read($fp, $len);
    }
}
开发者ID:sbaldrich,项目名称:boca,代码行数:8,代码来源:getextdata.php

示例10: read

 public function read($len = 8192)
 {
     return pg_lo_read($this->_lo, $len);
 }
开发者ID:mai7star,项目名称:fake,代码行数:4,代码来源:PostgreSQLLOB.php

示例11: stream_read

 function stream_read($length)
 {
     return pg_lo_read($this->loh, $length);
 }
开发者ID:garybulin,项目名称:php7,代码行数:4,代码来源:PgLobStream.php

示例12: list

   list($oid) = sscanf( $req, 'blob_delete %u' );
   $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);
开发者ID:xiaoguizhidao,项目名称:magento,代码行数:31,代码来源:emsproxy.php

示例13: pg_exec

pg_exec($db, "begin");
$oid = pg_lo_create($db);
if (!$oid) {
    echo "pg_lo_create() error\n";
}
$handle = pg_lo_open($db, $oid, "w");
if (!$handle) {
    echo "pg_lo_open() error\n";
}
pg_lo_write($handle, "large object data\n");
pg_lo_close($handle);
pg_exec($db, "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");
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:05large_object.php

示例14: data

 /**
  * Get the data stored in the large object resource.
  * @param void
  * @return mixed
  */
 public function data()
 {
     if (isset($this->filePath)) {
         return file_get_contents($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');
         $result = '';
         while ($data = pg_lo_read($handle)) {
             $result .= $data;
         }
         pg_lo_close($handle);
         $pg->query(new Query('COMMIT'));
         return $result;
     }
     throw \LogicException("Shouldn't ever get tripped");
 }
开发者ID:squareproton,项目名称:bond,代码行数:23,代码来源:PgLargeObject.php

示例15: BlobDecode

 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;
 }
开发者ID:klgrimley,项目名称:CIT-313,代码行数:25,代码来源:adodb-postgres64.inc.php


注:本文中的pg_lo_read函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。