This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
DB_File 1.807
authorPaul Marquess <paul.marquess@btinternet.com>
Sat, 1 Nov 2003 13:50:12 +0000 (13:50 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Sat, 1 Nov 2003 20:01:54 +0000 (20:01 +0000)
From: "Paul Marquess" <Paul.Marquess@btinternet.com>
Message-ID: <AIEAJICLCBDNAAOLLOKLOENMPAAA.Paul.Marquess@btinternet.com>

p4raw-id: //depot/perl@21615

ext/DB_File/Changes
ext/DB_File/DB_File.pm
ext/DB_File/DB_File.xs
ext/DB_File/dbinfo
ext/DB_File/t/db-hash.t
ext/DB_File/t/db-recno.t

index c9f33b2..848d26a 100644 (file)
@@ -1,4 +1,11 @@
 
+1.807 1st November 2003
+
+   * Fixed minor typos on pod documetation - reported by Jeremy Mates &
+     Mark Jason Dominus.
+
+   * dbinfo updated to report when a database is encrypted.
+
 1.806 22nd October 2002
 
    * Fixed problem when trying to build with a multi-threaded perl.
index fa94a39..54e0b52 100644 (file)
@@ -1,10 +1,10 @@
 # DB_File.pm -- Perl 5 interface to Berkeley DB 
 #
-# written by Paul Marquess (Paul.Marquess@btinternet.com)
+# written by Paul Marquess (pmqs@cpan.org)
 # last modified 22nd October 2002
-# version 1.806
+# version 1.807
 #
-#     Copyright (c) 1995-2002 Paul Marquess. All rights reserved.
+#     Copyright (c) 1995-2003 Paul Marquess. All rights reserved.
 #     This program is free software; you can redistribute it and/or
 #     modify it under the same terms as Perl itself.
 
@@ -165,7 +165,7 @@ our ($db_version, $use_XSLoader, $splice_end_array);
 use Carp;
 
 
-$VERSION = "1.806" ;
+$VERSION = "1.807" ;
 
 {
     local $SIG{__WARN__} = sub {$splice_end_array = "@_";};
@@ -2252,7 +2252,7 @@ compile properly on IRIX 5.3.
 
 =head1 COPYRIGHT
 
-Copyright (c) 1995-2002 Paul Marquess. All rights reserved. This program
+Copyright (c) 1995-2003 Paul Marquess. All rights reserved. This program
 is free software; you can redistribute it and/or modify it under the
 same terms as Perl itself.
 
@@ -2284,7 +2284,7 @@ L<dbmfilter>
 =head1 AUTHOR
 
 The DB_File interface was written by Paul Marquess
-E<lt>Paul.Marquess@btinternet.comE<gt>.
+E<lt>pmqs@cpan.org<gt>.
 Questions about the DB system itself may be addressed to
 E<lt>db@sleepycat.com<gt>.
 
index aa5d135..3f097de 100644 (file)
@@ -2,13 +2,13 @@
 
  DB_File.xs -- Perl 5 interface to Berkeley DB 
 
- written by Paul Marquess <Paul.Marquess@btinternet.com>
+ written by Paul Marquess <pmqs@cpan.org>
  last modified 22nd October 2002
- version 1.806
+ version 1.807
 
  All comments/suggestions/problems are welcome
 
-     Copyright (c) 1995-2002 Paul Marquess. All rights reserved.
+     Copyright (c) 1995-2003 Paul Marquess. All rights reserved.
      This program is free software; you can redistribute it and/or
      modify it under the same terms as Perl itself.
 
                 Support for 4.1.X added.
                 Filter code can now cope with read-only $_
         1.806 - recursion detection beefed up.
+        1.807 - no change
 
 */
 
index af2c45f..421d36c 100644 (file)
@@ -4,10 +4,10 @@
 #                        a database file
 #
 # Author:      Paul Marquess  <Paul.Marquess@btinternet.com>
-# Version:     1.03 
-# Date         17th September 2000
+# Version:     1.05 
+# Date         1sh November 2003
 #
-#     Copyright (c) 1998-2002 Paul Marquess. All rights reserved.
+#     Copyright (c) 1998-2003 Paul Marquess. All rights reserved.
 #     This program is free software; you can redistribute it and/or
 #     modify it under the same terms as Perl itself.
 
@@ -22,39 +22,39 @@ my %Data =
                          Type     => "Btree",
                          Versions => 
                                {
-                                 1     => "Unknown (older than 1.71)",
-                                 2     => "Unknown (older than 1.71)",
-                                 3     => "1.71 -> 1.85, 1.86",
-                                 4     => "Unknown",
-                                 5     => "2.0.0 -> 2.3.0",
-                                 6     => "2.3.1 -> 2.7.7",
-                                 7     => "3.0.x",
-                                 8     => "3.1.x -> 4.0.x",
-                                 9     => "4.1.x or greater",
+                                 1     => [0, "Unknown (older than 1.71)"],
+                                 2     => [0, "Unknown (older than 1.71)"],
+                                 3     => [0, "1.71 -> 1.85, 1.86"],
+                                 4     => [0, "Unknown"],
+                                 5     => [0, "2.0.0 -> 2.3.0"],
+                                 6     => [0, "2.3.1 -> 2.7.7"],
+                                 7     => [0, "3.0.x"],
+                                 8     => [0, "3.1.x -> 4.0.x"],
+                                 9     => [1, "4.1.x or greater"],
                                }
                        },
        0x061561 =>     {
                          Type     => "Hash",
                          Versions =>
                                {
-                                 1     => "Unknown (older than 1.71)",
-                                 2     => "1.71 -> 1.85",
-                                 3     => "1.86",
-                                 4     => "2.0.0 -> 2.1.0",
-                                 5     => "2.2.6 -> 2.7.7",
-                                 6     => "3.0.x",
-                                 7     => "3.1.x -> 4.0.x",
-                                 8     => "4.1.x or greater",
+                                 1     => [0, "Unknown (older than 1.71)"],
+                                 2     => [0, "1.71 -> 1.85"],
+                                 3     => [0, "1.86"],
+                                 4     => [0, "2.0.0 -> 2.1.0"],
+                                 5     => [0, "2.2.6 -> 2.7.7"],
+                                 6     => [0, "3.0.x"],
+                                 7     => [0, "3.1.x -> 4.0.x"],
+                                 8     => [1, "4.1.x or greater"],
                                }
                        },
        0x042253 =>     {
                          Type     => "Queue",
                          Versions =>
                                {
-                                 1     => "3.0.x",
-                                 2     => "3.1.x",
-                                 3     => "3.2.x -> 4.0.x",
-                                 4     => "4.1.x or greater",
+                                 1     => [0, "3.0.x"],
+                                 2     => [0, "3.1.x"],
+                                 3     => [0, "3.2.x -> 4.0.x"],
+                                 4     => [1, "4.1.x or greater"],
                                }
                        },
        ) ;
@@ -65,17 +65,26 @@ print "testing file $ARGV[0]...\n\n" ;
 open (F, "<$ARGV[0]") or die "Cannot open file $ARGV[0]: $!\n" ;
 
 my $buff ;
-read F, $buff, 20 ;
+read F, $buff, 30 ;
 
-my (@info) = unpack("NNNNN", $buff) ;
-my (@info1) = unpack("VVVVV", $buff) ;
-my ($magic, $version, $endian) ;
 
-if ($Data{$info[0]}) # first try DB 1.x format
+my (@info) = unpack("NNNNNNC", $buff) ;
+my (@info1) = unpack("VVVVVVC", $buff) ;
+my ($magic, $version, $endian, $encrypt) ;
+
+if ($Data{$info[0]}) # first try DB 1.x format, big endian
 {
     $magic = $info[0] ;
     $version = $info[1] ;
-    $endian  = "Unknown" ;
+    $endian  = "Big Endian" ;
+    $encrypt = "Not Supported";
+}
+elsif ($Data{$info1[0]}) # first try DB 1.x format, little endian
+{
+    $magic = $info1[0] ;
+    $version = $info1[1] ;
+    $endian  = "Little Endian" ;
+    $encrypt = "Not Supported";
 }
 elsif ($Data{$info[3]}) # next DB 2.x big endian
 {
@@ -96,8 +105,15 @@ my $type = $Data{$magic} ;
 $magic = sprintf "%06X", $magic ;
 
 my $ver_string = "Unknown" ;
-$ver_string = $type->{Versions}{$version}
-       if defined $type->{Versions}{$version} ;
+
+if ( defined $type->{Versions}{$version} )
+{
+     $ver_string = $type->{Versions}{$version}[1];
+     if ($type->{Versions}{$version}[0] )
+       { $encrypt = $info[6] ? "Enabled" : "Disabled" }
+     else
+       { $encrypt = "Not Supported" }
+}
 
 print <<EOM ;
 File Type:             Berkeley DB $type->{Type} file.
@@ -105,6 +121,7 @@ File Version ID:    $version
 Built with Berkeley DB:        $ver_string
 Byte Order:            $endian
 Magic:                 $magic
+Encryption:             $encrypt
 EOM
 
 close F ;
index 7dba15d..5f687a7 100755 (executable)
@@ -937,6 +937,7 @@ ok(128,1);
     ok(137, $warn_count == 0);
     $warn_count = 0;
 
+    untie %hash1;
     unlink $Dfile;
 }
 
index b7f8038..f2cd97b 100755 (executable)
@@ -104,7 +104,7 @@ sub bad_one
        print STDERR <<EOM ;
 #
 # Some older versions of Berkeley DB version 1 will fail db-recno
-# tests 61, 63, 64, and 65.
+# tests 61, 63, 64 and 65.
 EOM
         if ($^O eq 'darwin'
            && $Config{db_version_major} == 1