helly           Sun Nov 20 07:39:05 2005 EDT

  Modified files:              
    /php-src/ext/dba    dba.c dba_db4.c 
    /php-src/ext/dba/tests      dba_db4.phpt dba_handler.inc 
  Log:
  - Do locking in lib rather then on streams
  
  
http://cvs.php.net/diff.php/php-src/ext/dba/dba.c?r1=1.111&r2=1.112&ty=u
Index: php-src/ext/dba/dba.c
diff -u php-src/ext/dba/dba.c:1.111 php-src/ext/dba/dba.c:1.112
--- php-src/ext/dba/dba.c:1.111 Wed Aug  3 10:06:53 2005
+++ php-src/ext/dba/dba.c       Sun Nov 20 07:39:00 2005
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: dba.c,v 1.111 2005/08/03 14:06:53 sniper Exp $ */
+/* $Id: dba.c,v 1.112 2005/11/20 12:39:00 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.16&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.16
--- php-src/ext/dba/dba_db4.c:1.15      Wed Aug  3 10:06:54 2005
+++ php-src/ext/dba/dba_db4.c   Sun Nov 20 07:39:01 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.16 2005/11/20 12:39:01 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.5&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.5
--- 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  Sun Nov 20 07:39:04 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.14&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.14
--- 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       Sun Nov 20 07:39:04 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

Reply via email to