1
0
mirror of https://github.com/php/doc-zh.git synced 2026-03-25 15:42:15 +01:00
Files
archived-doc-zh/reference/pgsql/functions/pg-lo-create.xml
魔王卷子 e11e1789b5 Update pgsql 15 (#726)
* Update pg-lo-create.xml

* Update pg-lo-open.xml

* Update pg-field-num.xml

* Update pg-field-size.xml

* Update pg-field-type.xml

* Update pg-free-result.xml

* Update pg-last-error.xml

* Update pg-last-oid.xml

* Update pg-lo-close.xml

* Update pg-lo-export.xml

* Update pg-lo-unlink.xml

* Update pg-lo-read-all.xml

* Update pg-lo-read.xml

* Update pg-lo-read.xml
2023-04-24 12:58:40 +08:00

133 lines
3.9 KiB
XML
Executable File
Raw Permalink 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.
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: c2eca73ef79ebe78cebb34053e41b565af504c4f Maintainer: dallas Status: ready -->
<!-- CREDITS: mowangjuanzi -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry xml:id="function.pg-lo-create" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>pg_lo_create</refname>
<refpurpose>新建大对象</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>pg_lo_create</methodname>
<methodparam choice="opt"><type>PgSql\Connection</type><parameter>connection</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter>object_id</parameter></methodparam>
</methodsynopsis>
<methodsynopsis>
<type>int</type><methodname>pg_lo_create</methodname>
<methodparam><type>mixed</type><parameter>object_id</parameter></methodparam>
</methodsynopsis>
<para>
<function>pg_lo_create</function> 新建大对象并返回大对象的 <varname>oid</varname>。不支持 PostgreSQL
访问模式 <constant>INV_READ</constant><constant>INV_WRITE</constant>
<constant>INV_ARCHIVE</constant>,创建的对象始终以读写方式访问。<constant>INV_ARCHIVE</constant> 已经从 PostgreSQL6.3 及以上版本)中移除。
</para>
<para>
要使用大对象接口,必须将其封装在一个事务块中。
</para>
<para>
不使用大对象接口(没有访问控制,使用起来很麻烦),试试 PostgreSQL 的 <varname>bytea</varname> 列类型和 <function>pg_escape_bytea</function>
</para>
<note>
<para>
本函数以前的名字为 <function>pg_locreate</function>
</para>
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
&pgsql.parameter.connection-with-unspecified-default;
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>object_id</parameter></term>
<listitem>
<para>
如果指定 <parameter>object_id</parameter>,该函数将尝试使用此 id 创建大对象,否则服务器将分配一个空闲对象
id。该参数依赖于 PostgreSQL 8.1 中首次出现的功能。
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
大对象 <varname>OID</varname>&return.falseforfailure;
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
&pgsql.changelog.connection-object;
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>pg_lo_create</function> 示例</title>
<programlisting role="php">
<![CDATA[
<?php
$database = pg_connect("dbname=jacarta");
pg_query($database, "begin");
$oid = pg_lo_create($database);
echo "$oid\n";
$handle = pg_lo_open($database, $oid, "w");
echo "$handle\n";
pg_lo_write($handle, "large object data");
pg_lo_close($handle);
pg_query($database, "commit");
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->