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


PHP pg_unescape_bytea函数代码示例

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


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

示例1: molecule_image

function molecule_image($params)
{
    header("Content-type: image/PNG");
    include "../config/config.php";
    $chembl_id = $params[0];
    $image_not_found_file = "{$app2base}/static/images/app/inf.png";
    // Double check CHEMBL ID format
    if (preg_match("/^chembl\\d+\$/i", $chembl_id, $matches) == 0) {
        header('Content-Length: ' . filesize($image_not_found_file));
        readfile($image_not_found_file);
        exit(0);
    }
    // Get image from database
    $db = pg_connect("user={$db_user} dbname={$db_name} host={$db_host} port={$db_port}");
    $sqlImage = "SELECT mp.image from mol_pictures mp, molecule_dictionary md where md.molregno=mp.molregno and md.chembl_id=upper('{$chembl_id}')";
    $result_p = pg_query($db, $sqlImage);
    $row = pg_fetch_array($result_p);
    // Print image
    if ($row) {
        print pg_unescape_bytea($row[image]);
    } else {
        header('Content-Length: ' . filesize($image_not_found_file));
        readfile($image_not_found_file);
        exit(0);
    }
}
开发者ID:asimansubera,项目名称:mychembl_webapp,代码行数:26,代码来源:external_utils.php

示例2: get_image_by_imageid

function get_image_by_imageid($imageid)
{
    /*global $DB;
    
    		$st = sqlite3_query($DB['DB'], 'select * from images where imageid='.$imageid);
    		info(implode(',',sqlite3_fetch_array($st)));
    		info(sqlite3_column_type($st,3));
    		info(SQLITE3_INTEGER.','.SQLITE3_FLOAT.','.SQLITE3_TEXT.','.SQLITE3_BLOB.','.SQLITE3_NULL);
    		return 0;*/
    global $DB;
    $result = DBselect('select * from images where imageid=' . $imageid);
    $row = DBfetch($result);
    if ($row) {
        if ($DB['TYPE'] == "ORACLE") {
            if (!isset($row['image'])) {
                return 0;
            }
            $row['image'] = $row['image']->load();
        } else {
            if ($DB['TYPE'] == "POSTGRESQL") {
                $row['image'] = pg_unescape_bytea($row['image']);
            } else {
                if ($DB['TYPE'] == "SQLITE3") {
                    $row['image'] = pack('H*', $row['image']);
                }
            }
        }
        return $row;
    } else {
        return 0;
    }
}
开发者ID:rennhak,项目名称:zabbix,代码行数:32,代码来源:images.inc.php

示例3: execute

 public function execute($bindValues = array(), $additionalParameters = array(), $query = null)
 {
     $query = $this->getQuery();
     if (!empty($this->binaries)) {
         for ($i = 0, $c = count($this->binaries); $i < $c; $i++) {
             $query = str_replace("__sbl_binary" . ($i + 1), $this->binaries[$i]->getData(), $query);
         }
     }
     $result = parent::execute($bindValues, $additionalParameters, $query);
     if (!$this->isSelect() || empty($result)) {
         return $result;
     }
     $binaryColumns = array();
     foreach ($this->metadata->getColumns() as $column) {
         if ($column->isBinary()) {
             $binaryColumns[] = $column->name;
         }
     }
     if (!empty($binaryColumns)) {
         foreach ($result as &$row) {
             foreach ($binaryColumns as $colName) {
                 if (isset($row[$colName])) {
                     $row[$colName] = pg_unescape_bytea($row[$colName]);
                 }
             }
         }
     }
     return $result;
 }
开发者ID:reoring,项目名称:sabel,代码行数:29,代码来源:Statement.php

示例4: stripSlashesBinary

 /**
  * @param String str
  * @return String
  */
 public function stripSlashesBinary($str)
 {
     if ($this->postgreDbVersion < 9) {
         return pg_unescape_bytea($str);
     }
     return hex2bin(substr($str, 2));
 }
开发者ID:ryanblanchard,项目名称:Dashboard,代码行数:11,代码来源:PostgreFunctions.php

示例5: fetch

 /**
  * 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;
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:35,代码来源:Images.php

示例6: getFilePath

 public static function getFilePath($oid, $postfix = "picture.jpg")
 {
     $file = 'app/cache/file/' . $oid . "_{$postfix}";
     $model = PgFileStore::getModel();
     $data = $model->getWithField("object_id", $oid);
     file_put_contents($file, pg_unescape_bytea($data[0]["data"]));
     return $file;
 }
开发者ID:rocksyne,项目名称:wyf,代码行数:8,代码来源:PgFileStore.php

示例7: db_stripslashesbinary

function db_stripslashesbinary($str)
{
	global $postgreDbVersion;
	if( $postgreDbVersion < 9 )	
		return pg_unescape_bytea($str);
		
	return hex2bin( substr($str, 2) );	
}
开发者ID:helbertfurbino,项目名称:sgmofinanceiro,代码行数:8,代码来源:dbfunctions.pg.php

示例8: _unquote

 function _unquote($s)
 {
     if (USE_BYTEA) {
         return pg_unescape_bytea($s);
     } else {
         return base64_decode($s);
     }
 }
开发者ID:neymanna,项目名称:fusionforge,代码行数:8,代码来源:PearDB_pgsql.php

示例9: binary_unsql

 function binary_unsql($bin)
 {
     if (is_resource($bin)) {
         $bin = stream_get_contents($bin);
     }
     if (DB::connection() instanceof \Illuminate\Database\PostgresConnection) {
         return pg_unescape_bytea($bin);
     }
     return $bin;
 }
开发者ID:LulzNews,项目名称:infinity-next,代码行数:10,代码来源:binary.php

示例10: profile_picture

function profile_picture($netid)
{
    init_db();
    $query = "SELECT * FROM images WHERE (netid='" . pg_escape_string($netid) . "' AND profile=true) OR image_id='1' ORDER BY image_id DESC";
    $results = pg_query($query);
    $raw_img = pg_unescape_bytea(pg_fetch_result($results, 0, "image"));
    pg_free_result($results);
    header("Content-type: image/jpeg");
    print $raw_img;
}
开发者ID:rde1024,项目名称:cwrufind,代码行数:10,代码来源:image.php

示例11: fetch_next

 private function fetch_next()
 {
     $row = pg_fetch_assoc($this->result);
     if ($this->blobs) {
         foreach ($this->blobs as $blob) {
             $row[$blob] = pg_unescape_bytea($row[$blob]);
         }
     }
     return $row;
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:10,代码来源:pgsql_native_moodle_recordset.php

示例12: zbx_unescape_image

function zbx_unescape_image($image)
{
    global $DB;
    $result = $image ? $image : 0;
    if ($DB['TYPE'] == ZBX_DB_POSTGRESQL) {
        $result = pg_unescape_bytea($image);
    } elseif ($DB['TYPE'] == ZBX_DB_SQLITE3) {
        $result = pack('H*', $image);
    }
    return $result;
}
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:11,代码来源:images.inc.php

示例13: _unquote

 function _unquote($s)
 {
     if (USE_BYTEA) {
         return pg_unescape_bytea($s);
     }
     if (function_exists('pg_escape_string')) {
         return $s;
     } else {
         return base64_decode($s);
     }
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:11,代码来源:PearDB_pgsql.php

示例14: unserialize

 public function unserialize($data)
 {
     $data = stream_get_contents($data);
     if (substr($data, 0, 4) != 'SERG') {
         return $data;
     }
     if (!$this->pdo_enabled) {
         $data = pg_unescape_bytea($data);
     }
     return parent::unserialize($data);
 }
开发者ID:OCMO,项目名称:movabletype,代码行数:11,代码来源:mtdb.postgres.php

示例15: zbx_unescape_image

function zbx_unescape_image($image)
{
    global $DB;
    $result = $image ? $image : 0;
    if ($DB['TYPE'] == "POSTGRESQL") {
        $result = pg_unescape_bytea($image);
    } else {
        if ($DB['TYPE'] == "SQLITE3") {
            $result = pack('H*', $image);
        }
    }
    return $result;
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:13,代码来源:images.inc.php


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