helly Thu Dec 8 14:35:06 2005 EDT
Modified files: (Branch: PHP_5_1)
/php-src/ext/dba dba.c dba_db4.c
/php-src/ext/dba/tests dba_db4.phpt dba_handler.inc
Log:
- MFH Change dba/db4 to use its own locking
http://cvs.php.net/diff.php/php-src/ext/dba/dba.c?r1=1.111.2.2&r2=1.111.2.3&ty=u
Index: php-src/ext/dba/dba.c
diff -u php-src/ext/dba/dba.c:1.111.2.2 php-src/ext/dba/dba.c:1.111.2.3
--- php-src/ext/dba/dba.c:1.111.2.2 Mon Dec 5 21:25:19 2005
+++ php-src/ext/dba/dba.c Thu Dec 8 14:35:01 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dba.c,v 1.111.2.2 2005/12/06 02:25:19 sniper Exp $ */
+/* $Id: dba.c,v 1.111.2.3 2005/12/08 19:35:01 helly Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -250,7 +250,7 @@
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 */
http://cvs.php.net/diff.php/php-src/ext/dba/dba_db4.c?r1=1.15&r2=1.15.2.1&ty=u
Index: php-src/ext/dba/dba_db4.c
diff -u php-src/ext/dba/dba_db4.c:1.15 php-src/ext/dba/dba_db4.c:1.15.2.1
--- php-src/ext/dba/dba_db4.c:1.15 Wed Aug 3 10:06:54 2005
+++ php-src/ext/dba/dba_db4.c Thu Dec 8 14:35:03 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: dba_db4.c,v 1.15 2005/08/03 14:06:54 sniper Exp $ */
+/* $Id: dba_db4.c,v 1.15.2.1 2005/12/08 19:35:03 helly Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -77,14 +77,15 @@
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]);
http://cvs.php.net/diff.php/php-src/ext/dba/tests/dba_db4.phpt?r1=1.4&r2=1.4.4.1&ty=u
Index: php-src/ext/dba/tests/dba_db4.phpt
diff -u php-src/ext/dba/tests/dba_db4.phpt:1.4
php-src/ext/dba/tests/dba_db4.phpt:1.4.4.1
--- php-src/ext/dba/tests/dba_db4.phpt:1.4 Thu Dec 18 15:10:24 2003
+++ php-src/ext/dba/tests/dba_db4.phpt Thu Dec 8 14:35:05 2005
@@ -9,6 +9,7 @@
<?php
$handler = 'db4';
require_once('test.inc');
+ $lock_flag = ''; // lock in library
require_once('dba_handler.inc');
?>
===DONE===
@@ -17,22 +18,7 @@
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) {
http://cvs.php.net/diff.php/php-src/ext/dba/tests/dba_handler.inc?r1=1.13&r2=1.13.2.1&ty=u
Index: php-src/ext/dba/tests/dba_handler.inc
diff -u php-src/ext/dba/tests/dba_handler.inc:1.13
php-src/ext/dba/tests/dba_handler.inc:1.13.2.1
--- php-src/ext/dba/tests/dba_handler.inc:1.13 Thu Aug 19 04:04:20 2004
+++ php-src/ext/dba/tests/dba_handler.inc Thu Dec 8 14:35:05 2005
@@ -73,7 +73,7 @@
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);
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php