1
0
mirror of https://github.com/php/doc-ja.git synced 2026-03-25 15:42:08 +01:00
Files
archived-doc-ja/reference/sqlite/functions/sqlite-popen.xml
TAKAGI Masahiro 4284d39ec2 s/サーバ[^ー]/サーバー/g
git-svn-id: https://svn.php.net/repository/phpdoc/ja/trunk@324072 c90b9560-bf6c-de11-be94-00142212c4b1
2012-03-10 01:47:36 +00:00

135 lines
5.4 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 96c9d88bad9a7d7d44bfb7f26c226df7ee9ddf26 Maintainer: hirokawa Status: ready -->
<!-- CREDITS: shimooka -->
<refentry xml:id="function.sqlite-popen" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>sqlite_popen</refname>
<refpurpose>
SQLiteデータベースへの持続的ハンドルをオープンする。存在しない場合
には、データベースを作成する
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>resource</type><methodname>sqlite_popen</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>mode</parameter><initializer>0666</initializer></methodparam>
<methodparam choice="opt"><type>string</type><parameter role="reference">error_message</parameter></methodparam>
</methodsynopsis>
<simpara>
この関数は<function>sqlite_open</function>と同じように動作しますが、
PHPの持続的リソース機能を使用するところが異なります。
パラメータの意味に関する詳細については、マニュアルの
<function>sqlite_open</function> を参照してください。
</simpara>
<para>
<function>sqlite_popen</function> は、まず、持続的ハンドルが指定し
<parameter>filename</parameter>に関してすでにオープンされているか
どうかを調べます。みつかった場合には、スクリプトのそのハンドルを返
し、それ以外は、データベースのハンドルを新規にオープンします。
</para>
<para>
この手法の利点は、持続性のあるWebサーバー SAPI(通常のCGIまたはCLI以外
の全てのSAPI)により処理される各ページについてデータベースやインデッ
クススキーマを再読み込みする性能上のコストを払うことがないことです。
</para>
<note>
<simpara>
持続的ハンドルを使用している時にデータベースが(crontab等の)バック
グラウンドプロセスにより更新され、このプロセスが上書きすることによ
り(消去して、再構築するか、カレントのバージョンを置換するために更
新後のバージョンを移動)データベースを再生成する場合、
古いバージョンのデータベースに関する持続的ハンドルが再利用されると
いった予測できない動作を引き起こす可能性があります。
</simpara>
<simpara>
この問題を回避するために、バックグラウンドプロセスが同じデータベー
スファイルをオープンするようにし、更新をトランザクションで行うよう
にしてください。
</simpara>
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>filename</parameter></term>
<listitem>
<para>
SQLite データベースのファイル名。もしこのファイルが存在しない場合、
SQLite はファイルを生成しようとします。
データを挿入したり、データベーススキーマを変更、
もしくはデータベースが存在しない場合にデータベースを生成する場合、
PHP はファイルに対する書き込み権限を持っている必要があります。
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>mode</parameter></term>
<listitem>
<para>
ファイルのモード。読み込み専用モードでデータベースをオープンするために
使用することを目的としています。現在、このパラメータは SQLite
ライブラリに無視されます。このモードのデフォルト値は、
8 進数値 <literal>0666</literal> で、これは推奨される値です。
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>error_message</parameter></term>
<listitem>
<para>
参照として渡され、エラーが発生した場合に
データベースがオープンできなかった原因を説明する
記述的なエラーメッセージを保持するために設定されます。
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
成功時にリソース (データベースハンドル)、失敗時に &false; を返します。
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlite_open</function></member>
<member><function>sqlite_close</function></member>
<member><function>sqlite_factory</function></member>
</simplelist>
</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
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
-->