| 12
 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
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 
 |  <reference id="ref.dbm">
  <title>dbm Functions</title>
  <titleabbrev>DBM</titleabbrev>
  <partintro>
  <simpara>
   These functions allow you to store records stored in a dbm-style
   database. This type of database (supported by the Berkeley db,
   gdbm, and some system libraries, as well as a built-in flatfile
   library) stores key/value pairs (as opposed to the full-blown
   records supported by relational databases).
  </partintro>
  <refentry id="function.dbmopen">
   <refnamediv>
    <refname>dbmopen</refname>
    <refpurpose>opens a dbm database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>int <function>dbmopen</function></funcdef>
     <paramdef>string <parameter>filename</parameter></paramdef>
     <paramdef>int <parameter>flags</parameter></paramdef>
    </funcsynopsis>
    <para>
     The first argument is the full-path filename of the dbm file to be opened
     and the second is the file open mode which is one of "r", "n" or "w" for
     read-only, new (implies read-write) and read-write respectively.
    <para>
     Returns an identifer to be passed to the other dbm functions on success,
     or false on failure.
    <para>
     If ndbm support is used, ndbm will actually create filename.dir and
     filename.pag files. gdbm only uses one file, as does the internal flat-file
     support, and Berkeley db creates a filename.db file. Note that PHP does its
     own file locking in addition to any file locking that may be done by the dbm
     library itself. PHP does not delete the .lck files it creates. It uses these
     files simply as fixed inodes on which to do the file locking. For more
     information on dbm files, see your Unix man pages, or obtain GNU's gdbm from
     <filename role=url>ftp://prep.ai.mit.edu/pub/gnu</filename>.
   </refsect1>
  </refentry>
  <refentry id="function.dbmclose">
   <refnamediv>
    <refname>dbmclose</refname>
    <refpurpose>closes a dbm database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>bool <function>dbmclose</function></funcdef>
     <paramdef>int <parameter>dbm_identifier</parameter></paramdef>
    </funcsynopsis>
    <para>
     Unlocks and closes the specified database.
   </refsect1>
  </refentry>
  <refentry id="function.dbmexists">
   <refnamediv>
    <refname>dbmexists</refname>
    <refpurpose>tells if a value exists for a key in a dbm database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>bool <function>dbmexists</function></funcdef>
     <paramdef>int <parameter>dbm_identifier</parameter></paramdef>
     <paramdef>string <parameter>key</parameter></paramdef>
    </funcsynopsis>
    <para>
     Returns true if there is a value associated with the <parameter>key</parameter>.
   </refsect1>
  </refentry>
  <refentry id="function.dbmfetch">
   <refnamediv>
    <refname>dbmfetch</refname>
    <refpurpose>fetches a value for a key from a dbm database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>string <function>dbmfetch</function></funcdef>
     <paramdef>int <parameter>dbm_identifier</parameter></paramdef>
     <paramdef>string <parameter>key</parameter></paramdef>
    </funcsynopsis>
    <para>
     Returns the value associated with <parameter>key</parameter>.
   </refsect1>
  </refentry>
  <refentry id="function.dbminsert">
   <refnamediv>
    <refname>dbminsert</refname>
    <refpurpose>inserts a value for a key in a dbm database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>int <function>dbminsert</function></funcdef>
     <paramdef>int <parameter>dbm_identifier</parameter></paramdef>
     <paramdef>string <parameter>key</parameter></paramdef>
     <paramdef>string <parameter>value</parameter></paramdef>
    </funcsynopsis>
    <para>
     Adds the value to the database with the specified key.
    <para>
     Returns -1 if the database was opened read-only, 0 if the insert
     was successful, and 1 if the specified key already exists. (To replace
     the value, use <function>dbmreplace</function>.)
   </refsect1>
  </refentry>
  <refentry id="function.dbmreplace">
   <refnamediv>
    <refname>dbmreplace</refname>
    <refpurpose>replaces the value for a key in a dbm database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>bool <function>dbmreplace</function></funcdef>
     <paramdef>int <parameter>dbm_identifier</parameter></paramdef>
     <paramdef>string <parameter>key</parameter></paramdef>
     <paramdef>string <parameter>value</parameter></paramdef>
    </funcsynopsis>
    <para>
     Replaces the value for the specified key in the database.
    <para>
     This will also add the key to the database if it didn't already
     exist.
   </refsect1>
  </refentry>
  <refentry id="function.dbmdelete">
   <refnamediv>
    <refname>dbmdelete</refname>
    <refpurpose>deletes the value for a key from a dbm database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>bool <function>dbmdelete</function></funcdef>
     <paramdef>int <parameter>dbm_identifier</parameter></paramdef>
     <paramdef>string <parameter>key</parameter></paramdef>
    </funcsynopsis>
    <para>
     Deletes the value for <parameter>key</parameter> in the database.
    <para>
     Returns false if the key didn't exist in the database.
   </refsect1>
  </refentry>
  <refentry id="function.dbmfirstkey">
   <refnamediv>
    <refname>dbmfirstkey</refname>
    <refpurpose>retrieves the first key from a dbm database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>string <function>dbmfirstkey</function></funcdef>
     <paramdef>int <parameter>dbm_identifier</parameter></paramdef>
    </funcsynopsis>
    <para>
     Returns the first key in the database. Note that no particular order
     is guaranteed since the database may be built using a hash-table,
     which doesn't guarantee any ordering.
   </refsect1>
  </refentry>
  <refentry id="function.dbmnextkey">
   <refnamediv>
    <refname>dbmnextkey</refname>
    <refpurpose>retrieves the next key from a dbm database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>string <function>dbmnextkey</function></funcdef>
     <paramdef>int <parameter>dbm_identifier</parameter></paramdef>
     <paramdef>string <parameter>key</parameter></paramdef>
    </funcsynopsis>
    <para>
     Returns the next key after <parameter>key</parameter>. By calling
     <function>dbmfirstkey</function> followed by successive
     calls to <function>dbmnextkey</function> it is possible to
     visit every key/value pair in the dbm database. For example:
    <example>
     <title>Visiting every key/value pair in a dbm database.</title>
     <programlisting>
$key = dbmfirstkey($dbm_id);
while ($key) {
    echo "$key = " . dbmfetch($dbm_id, $key) . "\n";
    $key = dbmnextkey($dbm_id, $key);
}
     </programlisting>
    </example>
   </refsect1>
  </refentry>
  <refentry id="function.dblist">
   <refnamediv>
    <refname>dblist</refname>
    <refpurpose>describes the dbm-compatible library being used</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>string <function>dblist</function></funcdef>
     <paramdef>void</paramdef>
    </funcsynopsis>
   </refsect1>
  </refentry>
 </reference>
<!-- 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:"../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->
 |