DBA_HND(db3, DBA_LOCK_ALL) /* No lock in lib */
#endif
#if DBA_DB4
- DBA_HND(db4, DBA_LOCK_ALL) /* No lock in lib */
+ DBA_HND(db4, DBA_LOCK_EXT) /* Locking done in library itself */
#endif
#if DBA_INIFILE
DBA_HND(inifile, DBA_STREAM_OPEN|DBA_LOCK_ALL|DBA_CAST_AS_FD) /* No lock in lib */
info->mode == DBA_WRITER ? 0 :
info->mode == DBA_TRUNC ? DB_CREATE | DB_TRUNCATE : -1;
- if (info->flags & DBA_PERSISTENT) {
- gmode |= DB_THREAD;
- }
-
if (gmode == -1) {
return FAILURE; /* not possible */
}
+ gmode |= DB_INIT_LOCK;
+ if (info->flags & DBA_PERSISTENT) {
+ gmode |= DB_THREAD;
+ }
+
if (info->argc > 0) {
convert_to_long_ex(info->argv[0]);
filemode = Z_LVAL_PP(info->argv[0]);
<?php
$handler = 'db4';
require_once('test.inc');
+ $lock_flag = ''; // lock in library
require_once('dba_handler.inc');
?>
===DONE===
3NYNYY
Content String 2
Content 2 replaced
-Read during write: not allowed
-Content 2 replaced 2nd time
-The 6th value
-array(3) {
- ["key number 6"]=>
- string(13) "The 6th value"
- ["key2"]=>
- string(27) "Content 2 replaced 2nd time"
- ["key5"]=>
- string(23) "The last content string"
-}
---NO-LOCK--
-3NYNYY
-Content String 2
-Content 2 replaced
-Read during write: not allowed
+Read during write: allowed
Content 2 replaced 2nd time
The 6th value
array(3) {
if (!empty($dba_reader)) {
dba_close($dba_reader);
}
- if (($db_file = dba_popen($db_filename, 'r'.($handler!='gdbm'?'-':''), $handler))!==FALSE) {
+ if (($db_file = dba_popen($db_filename, 'r'.($lock_flag==''?'':'-'), $handler))!==FALSE) {
if ($handler == 'dbm') {
dba_close($db_file);
}