forked from php/doc-ja
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexamples.xml
104 lines (91 loc) · 2.63 KB
/
examples.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: ea63eee345d123174f7d87e19df92880e0fdb02f Maintainer: takagi Status: ready -->
<!-- CREDITS: hirokawa -->
<chapter xml:id="dba.examples" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.examples;
<section xml:id="dba.example">
<title>基本的な例</title>
<para>
<example>
<title>DBA の例</title>
<programlisting role="php">
<![CDATA[
<?php
$id = dba_open("/tmp/test.db", "n", "db2");
if (!$id) {
echo "dba_open failed\n";
exit;
}
dba_replace("key", "This is an example!", $id);
if (dba_exists("key", $id)) {
echo dba_fetch("key", $id);
dba_delete("key", $id);
}
dba_close($id);
?>
]]>
</programlisting>
</example>
</para>
<para>
DBA はバイナリセーフであり、いかなる制限も受けません。しかし、
使用するデータベースの実装による全ての制約を継承します。
</para>
<para>
全てのファイルベースのデータベースは、完全に使用可能なものについて
新規に作成されたデータベースのファイルモードを設定する手段を、
提供する必要があります。
ファイルモードは、通常 <function>dba_open</function> または
<function>dba_popen</function> に 4 番目の引数として渡されます。
</para>
<para>
<function>dba_firstkey</function> および
<function>dba_nextkey</function> 関数を用いて全てのエントリに
連続的にアクセスすることができます。アクセスする際にデータベースを
変更できない可能性があります。
</para>
<para>
<example>
<title>データベースへのアクセス</title>
<programlisting role="php">
<![CDATA[
<?php
// データベースをオープンする
$key = dba_firstkey($id);
while ($key !== false) {
if (true) { // 他の操作を後で行うためにキーを記憶する
$handle_later[] = $key;
}
$key = dba_nextkey($id);
}
foreach ($handle_later as $val) {
dba_delete($val, $id);
}
?>
]]>
</programlisting>
</example>
</para>
</section>
</chapter>
<!-- 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
-->