helly Wed Nov 6 07:01:38 2002 EDT Modified files: /php4/ext/dba/tests dba_handler.inc test.inc Log: -convert from dos to unix file Index: php4/ext/dba/tests/dba_handler.inc diff -u php4/ext/dba/tests/dba_handler.inc:1.2 php4/ext/dba/tests/dba_handler.inc:1.3 --- php4/ext/dba/tests/dba_handler.inc:1.2 Wed Nov 6 06:18:00 2002 +++ php4/ext/dba/tests/dba_handler.inc Wed Nov 6 07:01:36 2002 @@ -1,61 +1,61 @@ -<?php - echo "database handler: $handler\n"; - if (($db_file=dba_open($db_filename, "n", $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); - dba_insert("key4", "Another Content String", $db_file); - dba_insert("key5", "The last content string", $db_file); - dba_delete("key3", $db_file); - dba_delete("key1", $db_file); - $a = dba_firstkey($db_file); - $i=0; - while($a) { - $a = dba_nextkey($db_file); - $i++; - } - echo $i; - for ($i=1; $i<6; $i++) { - echo dba_exists("key$i", $db_file) ? "Y" : "N"; - } - echo "\n"; - echo dba_fetch("key2", $db_file)."\n"; - dba_replace("key2", "Content 2 replaced", $db_file); - echo dba_fetch("key2", $db_file)."\n"; - dba_close($db_file); - } else { - echo "Error creating database\n"; - } - $db_writer=dba_open($db_filename, "w", $handler); - if (($dba_reader=dba_open($db_filename, "r", $handler))===false) { - echo "Cannot read during write operation\n"; - } else { - echo "Read during write permitted\n"; - } - if ($db_writer!==FALSE) { - dba_insert("key number 6", "The 6th value", $db_writer); - dba_replace("key2", "Content 2 replaced 2nd time", $db_writer); - dba_delete("key4", $db_writer); - echo dba_fetch("key2", $db_writer)."\n"; - echo dba_fetch("key number 6", $db_writer)."\n"; - dba_close($db_writer); // when the writer is open at least db3 would fail because of buffered io. - } else { - die("Error reopening database\n"); - } - if (($db_file=dba_open($db_filename, "r", $handler))!==FALSE) { - $key = dba_firstkey($db_file); - $res = array(); - while($key) { - $res[$key] = dba_fetch($key, $db_file); - $key = dba_nextkey($db_file); - } - ksort($res); - var_dump($res); - dba_close($db_file); - } else { - echo "Error reading database\n"; - } - if ($dba_reader) { - dba_close($dba_reader); - } +<?php + echo "database handler: $handler\n"; + if (($db_file=dba_open($db_filename, "n", $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); + dba_insert("key4", "Another Content String", $db_file); + dba_insert("key5", "The last content string", $db_file); + dba_delete("key3", $db_file); + dba_delete("key1", $db_file); + $a = dba_firstkey($db_file); + $i=0; + while($a) { + $a = dba_nextkey($db_file); + $i++; + } + echo $i; + for ($i=1; $i<6; $i++) { + echo dba_exists("key$i", $db_file) ? "Y" : "N"; + } + echo "\n"; + echo dba_fetch("key2", $db_file)."\n"; + dba_replace("key2", "Content 2 replaced", $db_file); + echo dba_fetch("key2", $db_file)."\n"; + dba_close($db_file); + } else { + echo "Error creating database\n"; + } + $db_writer=dba_open($db_filename, "w", $handler); + if (($dba_reader=dba_open($db_filename, "r", $handler))===false) { + echo "Cannot read during write operation\n"; + } else { + echo "Read during write permitted\n"; + } + if ($db_writer!==FALSE) { + dba_insert("key number 6", "The 6th value", $db_writer); + dba_replace("key2", "Content 2 replaced 2nd time", $db_writer); + dba_delete("key4", $db_writer); + echo dba_fetch("key2", $db_writer)."\n"; + echo dba_fetch("key number 6", $db_writer)."\n"; + dba_close($db_writer); // when the writer is open at least db3 would +fail because of buffered io. + } else { + die("Error reopening database\n"); + } + if (($db_file=dba_open($db_filename, "r", $handler))!==FALSE) { + $key = dba_firstkey($db_file); + $res = array(); + while($key) { + $res[$key] = dba_fetch($key, $db_file); + $key = dba_nextkey($db_file); + } + ksort($res); + var_dump($res); + dba_close($db_file); + } else { + echo "Error reading database\n"; + } + if ($dba_reader) { + dba_close($dba_reader); + } ?> Index: php4/ext/dba/tests/test.inc diff -u php4/ext/dba/tests/test.inc:1.4 php4/ext/dba/tests/test.inc:1.5 --- php4/ext/dba/tests/test.inc:1.4 Wed Nov 6 06:18:00 2002 +++ php4/ext/dba/tests/test.inc Wed Nov 6 07:01:37 2002 @@ -1,13 +1,13 @@ -<?php - $db_filename = $db_file = dirname(__FILE__).'/test0.dbm'; - $handler = dba_handlers(); - // CDB currently supports only reading - if ($handler[0]=='cdb') { - if (count($handler)==1) { - die('CDB currently supports only reading '); - } - $handler = $handler[1]; - } else { - $handler = $handler[0]; - } -?> +<?php + $db_filename = $db_file = dirname(__FILE__).'/test0.dbm'; + $handler = dba_handlers(); + // CDB currently supports only reading + if ($handler[0]=='cdb') { + if (count($handler)==1) { + die('CDB currently supports only reading '); + } + $handler = $handler[1]; + } else { + $handler = $handler[0]; + } +?>
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php