uTools-Manuals/docs/php/pg_escape_bytea.html
2019-04-08 23:22:26 +08:00

40 lines
2.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>转义 bytea 类型的二进制数据</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.pg-escape-bytea" class="refentry">
<div class="refnamediv">
<h1 class="refname">pg_escape_bytea</h1>
<p class="verinfo">(PHP 4 &gt;= 4.2.0, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">pg_escape_bytea</span> &mdash; <span class="dc-title">
转义 bytea 类型的二进制数据
</span></p>
</div>
<div class="refsect1 unknown-seealsp" id="refsect1-function.pg-escape-bytea-unknown-seealsp">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>pg_escape_bytea</strong></span>
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>
) : <span class="type">string</span></div>
<p class="para rdfs-comment">
<span class="function"><strong>pg_escape_bytea()</strong></span> 转义 bytea 数据类型的二进制字符串,返回转义后的字符串。
</p>
<blockquote class="note"><p><strong class="note">Note</strong>:
<p class="para">
当对 bytea 类型字段进行 SELECT 操作时PostgreSQL 返回前导 \ 的八进制字节值(例如 \032。用户需要自己将结果转换为二进制格式。
</p>
<p class="para">
本函数需要 PostgreSQL 7.2 或以上版本。在 PostgreSQL 7.2.0 和 7.2.1 版中如果使用了多字节支持bytea 类型必须被强制转换。例如 <em>INSERT INTO test_table (image) VALUES (&#039;$image_escaped&#039;::bytea);</em>。PostgreSQL 7.2.2 或以上版本不需要强制转换。异常情况是当客户端和后端字符编码不匹配时,可能会有多字节流错误。用户必须强制转换 bytea 以避免此错误。
</p>
</p></blockquote>
<p class="para">
参见 <span class="function"><a href="pg_unescape_bytea.html" class="function">pg_unescape_bytea()</a></span>
<span class="function"><a href="pg_escape_string.html" class="function">pg_escape_string()</a></span>
</p>
</div>
</div></div></div></body></html>