helly           Sun Nov 10 17:56:30 2002 EDT

  Modified files:              
    /php4/ext/dba/tests dba_gdbm.phpt dba_handler.inc test.inc 
  Log:
  Add $lock_flag which allows to change lock behaviour for both 'l' and 'd'
  Remember gdbm has its own locking so 't' does not work here - maybe a
  warning is needed for that, too.
  
  
Index: php4/ext/dba/tests/dba_gdbm.phpt
diff -u php4/ext/dba/tests/dba_gdbm.phpt:1.2 php4/ext/dba/tests/dba_gdbm.phpt:1.3
--- php4/ext/dba/tests/dba_gdbm.phpt:1.2        Wed Nov  6 06:18:00 2002
+++ php4/ext/dba/tests/dba_gdbm.phpt    Sun Nov 10 17:56:29 2002
@@ -9,6 +9,7 @@
 <?php
        require_once('test.inc');
        $handler = 'gdbm';
+       $lock_flag = ''; // lock in library
        require_once('dba_handler.inc');
 ?>
 --EXPECT--
Index: php4/ext/dba/tests/dba_handler.inc
diff -u php4/ext/dba/tests/dba_handler.inc:1.5 php4/ext/dba/tests/dba_handler.inc:1.6
--- php4/ext/dba/tests/dba_handler.inc:1.5      Sun Nov 10 17:07:17 2002
+++ php4/ext/dba/tests/dba_handler.inc  Sun Nov 10 17:56:29 2002
@@ -1,7 +1,7 @@
 <?php
        echo "database handler: $handler\n";
        @unlink($db_filename);
-       if (($db_file = @dba_open($db_filename, "nl", $handler))!==FALSE) {
+       if (($db_file = dba_open($db_filename, 'n'.$lock_flag, $handler))!==FALSE) {
                dba_insert("key1", "Content String 1", $db_file);
                dba_insert("key2", "Content String 2", $db_file);
                dba_insert("key3", "Third Content String", $db_file);
@@ -27,8 +27,8 @@
        } else {
                echo "Error creating database\n";
        }
-       $db_writer = @dba_open($db_filename, "wl", $handler);
-       if (($dba_reader = @dba_open($db_filename, "rlt", $handler))===false) {
+       $db_writer = dba_open($db_filename, 'w'.$lock_flag, $handler);
+       if (($dba_reader = dba_open($db_filename, 'r'.$lock_flag.($lock_flag ? 't' : 
+''), $handler))===false) {
                echo "Cannot read during write operation\n";
        } else {
                echo "Read during write permitted\n";
@@ -44,7 +44,7 @@
        } else {
                die("Error reopening database\n");
        }
-       if (($db_file = @dba_open($db_filename, "rd", $handler))!==FALSE) {
+       if (($db_file = dba_open($db_filename, 'r'.$lock_flag, $handler))!==FALSE) {
                $key = dba_firstkey($db_file);
                $res = array();
                while($key) {
Index: php4/ext/dba/tests/test.inc
diff -u php4/ext/dba/tests/test.inc:1.5 php4/ext/dba/tests/test.inc:1.6
--- php4/ext/dba/tests/test.inc:1.5     Wed Nov  6 07:01:37 2002
+++ php4/ext/dba/tests/test.inc Sun Nov 10 17:56:29 2002
@@ -10,4 +10,5 @@
        } else {
                $handler = $handler[0];
        }
+       $lock_flag = 'l';
 ?>



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to