forked from HvyIndustries/crane-php-stubs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
dba.php
338 lines (321 loc) · 9.58 KB
/
dba.php
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
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
<?php
// Start of dba v.
/**
* (PHP 4, PHP 5)<br/>
* Open database
* @link http://php.net/manual/en/function.dba-open.php
* @param string $path <p>
* Commonly a regular path in your filesystem.
* </p>
* @param string $mode <p>
* It is r for read access, w for
* read/write access to an already existing database, c
* for read/write access and database creation if it doesn't currently exist,
* and n for create, truncate and read/write access.
* The database is created in BTree mode, other modes (like Hash or Queue)
* are not supported.
* </p>
* <p>
* Additionally you can set the database lock method with the next char.
* Use l to lock the database with a .lck
* file or d to lock the databasefile itself. It is
* important that all of your applications do this consistently.
* </p>
* <p>
* If you want to test the access and do not want to wait for the lock
* you can add t as third character. When you are
* absolutely sure that you do not require database locking you can do
* so by using - instead of l or
* d. When none of d,
* l or - is used, dba will lock
* on the database file as it would with d.
* </p>
* <p>
* There can only be one writer for one database file. When you use dba on
* a web server and more than one request requires write operations they can
* only be done one after another. Also read during write is not allowed.
* The dba extension uses locks to prevent this. See the following table:
* <table>
* DBA locking
* <tr valign="top">
* <td>already open</td>
* <td><i>mode</i> = "rl"</td>
* <td><i>mode</i> = "rlt"</td>
* <td><i>mode</i> = "wl"</td>
* <td><i>mode</i> = "wlt"</td>
* <td><i>mode</i> = "rd"</td>
* <td><i>mode</i> = "rdt"</td>
* <td><i>mode</i> = "wd"</td>
* <td><i>mode</i> = "wdt"</td>
* </tr>
* <tr valign="top">
* <td>not open</td>
* <td>ok</td>
* <td>ok</td>
* <td>ok</td>
* <td>ok</td>
* <td>ok</td>
* <td>ok</td>
* <td>ok</td>
* <td>ok</td>
* </tr>
* <tr valign="top">
* <td><i>mode</i> = "rl"</td>
* <td>ok</td>
* <td>ok</td>
* <td>wait</td>
* <td>false</td>
* <td>illegal</td>
* <td>illegal</td>
* <td>illegal</td>
* <td>illegal</td>
* </tr>
* <tr valign="top">
* <td><i>mode</i> = "wl"</td>
* <td>wait</td>
* <td>false</td>
* <td>wait</td>
* <td>false</td>
* <td>illegal</td>
* <td>illegal</td>
* <td>illegal</td>
* <td>illegal</td>
* </tr>
* <tr valign="top">
* <td><i>mode</i> = "rd"</td>
* <td>illegal</td>
* <td>illegal</td>
* <td>illegal</td>
* <td>illegal</td>
* <td>ok</td>
* <td>ok</td>
* <td>wait</td>
* <td>false</td>
* </tr>
* <tr valign="top">
* <td><i>mode</i> = "wd"</td>
* <td>illegal</td>
* <td>illegal</td>
* <td>illegal</td>
* <td>illegal</td>
* <td>wait</td>
* <td>false</td>
* <td>wait</td>
* <td>false</td>
* </tr>
* </table>
* ok: the second call will be successfull.
* wait: the second call waits until <b>dba_close</b> is called for the first.
* false: the second call returns false.
* illegal: you must not mix "l" and "d" modifiers for <i>mode</i> parameter.
* </p>
* @param string $handler [optional] <p>
* The name of the handler which
* shall be used for accessing <i>path</i>. It is passed
* all optional parameters given to <b>dba_open</b> and
* can act on behalf of them.
* </p>
* @param mixed $_ [optional]
* @return resource a positive handle on success or <b>FALSE</b> on failure.
*/
function dba_open ($path, $mode, $handler = null, $_ = null) {}
/**
* (PHP 4, PHP 5)<br/>
* Open database persistently
* @link http://php.net/manual/en/function.dba-popen.php
* @param string $path <p>
* Commonly a regular path in your filesystem.
* </p>
* @param string $mode <p>
* It is r for read access, w for
* read/write access to an already existing database, c
* for read/write access and database creation if it doesn't currently exist,
* and n for create, truncate and read/write access.
* </p>
* @param string $handler [optional] <p>
* The name of the handler which
* shall be used for accessing <i>path</i>. It is passed
* all optional parameters given to <b>dba_popen</b> and
* can act on behalf of them.
* </p>
* @param mixed $_ [optional]
* @return resource a positive handle on success or <b>FALSE</b> on failure.
*/
function dba_popen ($path, $mode, $handler = null, $_ = null) {}
/**
* (PHP 4, PHP 5)<br/>
* Close a DBA database
* @link http://php.net/manual/en/function.dba-close.php
* @param resource $handle <p>
* The database handler, returned by <b>dba_open</b> or
* <b>dba_popen</b>.
* </p>
* @return void No value is returned.
*/
function dba_close ($handle) {}
/**
* (PHP 4, PHP 5)<br/>
* Delete DBA entry specified by key
* @link http://php.net/manual/en/function.dba-delete.php
* @param string $key <p>
* The key of the entry which is deleted.
* </p>
* @param resource $handle <p>
* The database handler, returned by <b>dba_open</b> or
* <b>dba_popen</b>.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function dba_delete ($key, $handle) {}
/**
* (PHP 4, PHP 5)<br/>
* Check whether key exists
* @link http://php.net/manual/en/function.dba-exists.php
* @param string $key <p>
* The key the check is performed for.
* </p>
* @param resource $handle <p>
* The database handler, returned by <b>dba_open</b> or
* <b>dba_popen</b>.
* </p>
* @return bool <b>TRUE</b> if the key exists, <b>FALSE</b> otherwise.
*/
function dba_exists ($key, $handle) {}
/**
* (PHP 4, PHP 5)<br/>
* Fetch data specified by key
* @link http://php.net/manual/en/function.dba-fetch.php
* @param string $key <p>
* The key the data is specified by.
* </p>
* <p>
* When working with inifiles this function accepts arrays as keys
* where index 0 is the group and index 1 is the value name. See:
* <b>dba_key_split</b>.
* </p>
* @param resource $handle <p>
* The database handler, returned by <b>dba_open</b> or
* <b>dba_popen</b>.
* </p>
* @return string the associated string if the key/data pair is found, <b>FALSE</b>
* otherwise.
*/
function dba_fetch ($key, $handle) {}
/**
* (PHP 4, PHP 5)<br/>
* Insert entry
* @link http://php.net/manual/en/function.dba-insert.php
* @param string $key <p>
* The key of the entry to be inserted. If this key already exist in the
* database, this function will fail. Use <b>dba_replace</b>
* if you need to replace an existent key.
* </p>
* @param string $value <p>
* The value to be inserted.
* </p>
* @param resource $handle <p>
* The database handler, returned by <b>dba_open</b> or
* <b>dba_popen</b>.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function dba_insert ($key, $value, $handle) {}
/**
* (PHP 4, PHP 5)<br/>
* Replace or insert entry
* @link http://php.net/manual/en/function.dba-replace.php
* @param string $key <p>
* The key of the entry to be replaced.
* </p>
* @param string $value <p>
* The value to be replaced.
* </p>
* @param resource $handle <p>
* The database handler, returned by <b>dba_open</b> or
* <b>dba_popen</b>.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function dba_replace ($key, $value, $handle) {}
/**
* (PHP 4, PHP 5)<br/>
* Fetch first key
* @link http://php.net/manual/en/function.dba-firstkey.php
* @param resource $handle <p>
* The database handler, returned by <b>dba_open</b> or
* <b>dba_popen</b>.
* </p>
* @return string the key on success or <b>FALSE</b> on failure.
*/
function dba_firstkey ($handle) {}
/**
* (PHP 4, PHP 5)<br/>
* Fetch next key
* @link http://php.net/manual/en/function.dba-nextkey.php
* @param resource $handle <p>
* The database handler, returned by <b>dba_open</b> or
* <b>dba_popen</b>.
* </p>
* @return string the key on success or <b>FALSE</b> on failure.
*/
function dba_nextkey ($handle) {}
/**
* (PHP 4, PHP 5)<br/>
* Optimize database
* @link http://php.net/manual/en/function.dba-optimize.php
* @param resource $handle <p>
* The database handler, returned by <b>dba_open</b> or
* <b>dba_popen</b>.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function dba_optimize ($handle) {}
/**
* (PHP 4, PHP 5)<br/>
* Synchronize database
* @link http://php.net/manual/en/function.dba-sync.php
* @param resource $handle <p>
* The database handler, returned by <b>dba_open</b> or
* <b>dba_popen</b>.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function dba_sync ($handle) {}
/**
* (PHP 4 >= 4.3.0, PHP 5)<br/>
* List all the handlers available
* @link http://php.net/manual/en/function.dba-handlers.php
* @param bool $full_info [optional] <p>
* Turns on/off full information display in the result.
* </p>
* @return array an array of database handlers. If <i>full_info</i>
* is set to <b>TRUE</b>, the array will be associative with the handlers names as
* keys, and their version information as value. Otherwise, the result will be
* an indexed array of handlers names.
* </p>
* <p>
* When the internal cdb library is used you will see
* cdb and cdb_make.
*/
function dba_handlers ($full_info = false) {}
/**
* (PHP 4 >= 4.3.0, PHP 5)<br/>
* List all open database files
* @link http://php.net/manual/en/function.dba-list.php
* @return array An associative array, in the form resourceid => filename.
*/
function dba_list () {}
/**
* (PHP 5)<br/>
* Splits a key in string representation into array representation
* @link http://php.net/manual/en/function.dba-key-split.php
* @param mixed $key <p>
* The key in string representation.
* </p>
* @return mixed an array of the form array(0 => group, 1 =>
* value_name). This function will return <b>FALSE</b> if
* <i>key</i> is <b>NULL</b> or <b>FALSE</b>.
*/
function dba_key_split ($key) {}
// End of dba v.
?>