• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP pg_unescape_bytea函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: getImages

 function getImages()
 {
     global $conn;
     $query = "SELECT image FROM readings WHERE image IS NOT NULL";
     $result = pg_exec($conn, $query);
     $index = 0;
     while ($row = pg_fetch_assoc($result)) {
         // loop to store the data in an associative array.
         $derp[$index] = "data:image/jpeg;base64," . base64_encode(pg_unescape_bytea($row["image"]));
         $index++;
     }
     return $derp;
     //use pg_unescape_bytea to convert image to unescaped first
     // use imagecreatefromstring afterwards
 }
开发者ID:migalmeida,项目名称:setec-site,代码行数:15,代码来源:query.php


示例17: fetch_next

 private function fetch_next()
 {
     if (!$this->result) {
         return false;
     }
     if (!($row = pg_fetch_assoc($this->result))) {
         pg_free_result($this->result);
         $this->result = null;
         return false;
     }
     if ($this->blobs) {
         foreach ($this->blobs as $blob) {
             $row[$blob] = $row[$blob] !== null ? pg_unescape_bytea($row[$blob]) : null;
         }
     }
     return $row;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:17,代码来源:pgsql_native_moodle_recordset.php


示例18: auth_token_retrieve

function auth_token_retrieve($scope, $token)
{
    $data = db_getOne('
                    select data
                    from token
                    where scope = ? and token = ?', array($scope, $token));
    /* Madness. We have to unescape this, because the PEAR DB library isn't
     * smart enough to spot BYTEA columns and do it for us. */
    $data = pg_unescape_bytea($data);
    $pos = 0;
    $res = rabx_wire_rd(&$data, &$pos);
    if (rabx_is_error($res)) {
        $res = unserialize($data);
        if (is_null($res)) {
            err("Data for scope '{$scope}', token '{$token}' are not valid");
        }
    }
    return $res;
}
开发者ID:bruno,项目名称:openaustralia-app,代码行数:19,代码来源:auth.php


示例19: test_postgis

function test_postgis($name, $type, $geom, $connection, $format)
{
    global $table;
    // Let's insert into the database using GeomFromWKB
    $insert_string = pg_escape_bytea($geom->out($format));
    pg_query($connection, "INSERT INTO {$table} (name, type, geom) values ('{$name}', '{$type}', GeomFromWKB('{$insert_string}'))");
    // SELECT using asBinary PostGIS
    $result = pg_fetch_all(pg_query($connection, "SELECT asBinary(geom) as geom FROM {$table} WHERE name='{$name}'"));
    foreach ($result as $item) {
        $wkb = pg_unescape_bytea($item['geom']);
        // Make sure to unescape the hex blob
        $geom = geoPHP::load($wkb, $format);
        // We now a full geoPHP Geometry object
    }
    // SELECT and INSERT directly, with no wrapping functions
    $result = pg_fetch_all(pg_query($connection, "SELECT geom as geom FROM {$table} WHERE name='{$name}'"));
    foreach ($result as $item) {
        $wkb = pack('H*', $item['geom']);
        // Unpacking the hex blob
        $geom = geoPHP::load($wkb, $format);
        // We now have a geoPHP Geometry
        // Let's re-insert directly into postGIS
        // We need to unpack the WKB
        $unpacked = unpack('H*', $geom->out($format));
        $insert_string = $unpacked[1];
        pg_query($connection, "INSERT INTO {$table} (name, type, geom) values ('{$name}', '{$type}', '{$insert_string}')");
    }
    // SELECT and INSERT using as EWKT (ST_GeomFromEWKT and ST_AsEWKT)
    $result = pg_fetch_all(pg_query($connection, "SELECT ST_AsEWKT(geom) as geom FROM {$table} WHERE name='{$name}'"));
    foreach ($result as $item) {
        $wkt = $item['geom'];
        // Make sure to unescape the hex blob
        $geom = geoPHP::load($wkt, 'ewkt');
        // We now a full geoPHP Geometry object
        // Let's re-insert directly into postGIS
        $insert_string = $geom->out('ewkt');
        pg_query($connection, "INSERT INTO {$table} (name, type, geom) values ('{$name}', '{$type}', ST_GeomFromEWKT('{$insert_string}'))");
    }
}
开发者ID:drupdateio,项目名称:gvj,代码行数:39,代码来源:postgis.php


示例20: _baseConvertResult

 /**
  * General type conversion method
  *
  * @param mixed   $value refernce to a value to be converted
  * @param string  $type  specifies which type to convert to
  * @param boolean $rtrim [optional] when TRUE [default], apply rtrim() to text
  * @return object a MDB2 error on failure
  * @access protected
  */
 function _baseConvertResult($value, $type, $rtrim = true)
 {
     if (is_null($value)) {
         return null;
     }
     switch ($type) {
         case 'boolean':
             return $value == 't';
         case 'float':
             return doubleval($value);
         case 'date':
             return $value;
         case 'time':
             return substr($value, 0, strlen('HH:MM:SS'));
         case 'timestamp':
             return substr($value, 0, strlen('YYYY-MM-DD HH:MM:SS'));
         case 'blob':
             $value = pg_unescape_bytea($value);
             return parent::_baseConvertResult($value, $type, $rtrim);
     }
     return parent::_baseConvertResult($value, $type, $rtrim);
 }
开发者ID:Mayoh,项目名称:grupo-ha,代码行数:31,代码来源:pgsql.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP pg_version函数代码示例发布时间:2022-05-15
下一篇:
PHP pg_transaction_status函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap