summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Marquess <pmarquess@bfsec.bt.co.uk>1997-01-14 12:47:40 +0000
committerChip Salzenberg <chip@atlantic.net>1997-01-16 07:24:00 +1200
commita0b8c8c13b377533a792c02987f7129f1884ba85 (patch)
tree1b0bc90b5b87fbed169d8f6d946a4c066917f689
parent16c18a900643a9692cf6c1aee568a156ccb6569b (diff)
downloadperl-a0b8c8c13b377533a792c02987f7129f1884ba85.tar.gz
Refresh DB_File to 1.10
this patch works around an incompatability that was introduced in Berkeley DB 1.86 p5p-msgid: <9701141247.AA21242@claudius.bfsec.bt.co.uk>
-rw-r--r--ext/DB_File/DB_File.pm32
-rw-r--r--ext/DB_File/DB_File.xs18
2 files changed, 41 insertions, 9 deletions
diff --git a/ext/DB_File/DB_File.pm b/ext/DB_File/DB_File.pm
index fe9c34dd14..ff746cf0f8 100644
--- a/ext/DB_File/DB_File.pm
+++ b/ext/DB_File/DB_File.pm
@@ -1,10 +1,10 @@
# DB_File.pm -- Perl 5 interface to Berkeley DB
#
# written by Paul Marquess (pmarquess@bfsec.bt.co.uk)
-# last modified 18th Dec 1996
-# version 1.09
+# last modified 14th Jan 1997
+# version 1.10
#
-# Copyright (c) 1995, 1996 Paul Marquess. All rights reserved.
+# Copyright (c) 1995, 1996, 1997 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.
@@ -146,7 +146,7 @@ use vars qw($VERSION @ISA @EXPORT $AUTOLOAD $DB_BTREE $DB_HASH $DB_RECNO) ;
use Carp;
-$VERSION = "1.09" ;
+$VERSION = "1.10" ;
#typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE;
$DB_BTREE = new DB_File::BTREEINFO ;
@@ -1564,6 +1564,11 @@ DB_File::BTREEINFO.
Changed default mode to 0666.
+=item 1.10
+
+Fixed fd method so that it still returns -1 for in-memory files when db
+1.86 is used.
+
=back
=head1 BUGS
@@ -1590,6 +1595,25 @@ If you are running IRIX, then get Berkeley DB from
F<http://reality.sgi.com/ariel>. It has the patches necessary to
compile properly on IRIX 5.3.
+As of January 1997, version 1.86 of Berkeley DB is available from the
+Berkeley DB home page. Although this release does fix a number of bugs
+that were present in 1.85 you should ba aware of the following
+information (taken from the Berkeley DB home page) before you consider
+using it:
+
+ DB version 1.86 includes a new implementation of the hash access
+ method that fixes a variety of hashing problems found in DB version
+ 1.85. We are making it available as an interim solution until DB
+ 2.0 is available.
+
+ PLEASE NOTE: the underlying file format for the hash access method
+ changed between version 1.85 and version 1.86, so you will have to
+ dump and reload all of your databases to convert from version 1.85
+ to version 1.86. If you do not absolutely require the fixes from
+ version 1.86, we strongly urge you to wait until DB 2.0 is released
+ before upgrading from 1.85.
+
+
=head1 SEE ALSO
L<perl(1)>, L<dbopen(3)>, L<hash(3)>, L<recno(3)>, L<btree(3)>
diff --git a/ext/DB_File/DB_File.xs b/ext/DB_File/DB_File.xs
index a13eaa6267..a938ffb09d 100644
--- a/ext/DB_File/DB_File.xs
+++ b/ext/DB_File/DB_File.xs
@@ -3,12 +3,12 @@
DB_File.xs -- Perl 5 interface to Berkeley DB
written by Paul Marquess (pmarquess@bfsec.bt.co.uk)
- last modified 18th Dec 1996
- version 1.09
+ last modified 14th Jan 1997
+ version 1.10
All comments/suggestions/problems are welcome
- Copyright (c) 1995, 1996 Paul Marquess. All rights reserved.
+ Copyright (c) 1995, 1996, 1997 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.
@@ -35,6 +35,8 @@
1.07 - Fixed bug with RECNO, where bval wasn't defaulting to "\n".
1.08 - No change to DB_File.xs
1.09 - Default mode for dbopen changed to 0666
+ 1.10 - Fixed fd method so that it still returns -1 for
+ in-memory files when db 1.86 is used.
*/
@@ -72,6 +74,7 @@ typedef struct {
SV * compare ;
SV * prefix ;
SV * hash ;
+ int in_memory ;
union INFO info ;
} DB_File_type;
@@ -88,7 +91,9 @@ typedef DBT DBTKEY ;
#define db_close(db) ((db->dbp)->close)(db->dbp)
#define db_del(db, key, flags) ((db->dbp)->del)(db->dbp, &key, flags)
-#define db_fd(db) ((db->dbp)->fd)(db->dbp)
+#define db_fd(db) (db->in_memory \
+ ? -1 \
+ : ((db->dbp)->fd)(db->dbp) )
#define db_put(db, key, value, flags) ((db->dbp)->put)(db->dbp, &key, &value, flags)
#define db_get(db, key, value, flags) ((db->dbp)->get)(db->dbp, &key, &value, flags)
#define db_seq(db, key, value, flags) ((db->dbp)->seq)(db->dbp, &key, &value, flags)
@@ -319,7 +324,7 @@ DB * db ;
else if (RETVAL == 1) /* No key means empty file */
RETVAL = 0 ;
- return (RETVAL) ;
+ return ((I32)RETVAL) ;
}
static recno_t
@@ -363,6 +368,9 @@ SV * sv ;
/* DGH - Next line added to avoid SEGV on existing hash DB */
CurrentDB = RETVAL;
+ /* fd for 1.86 hash in memory files doesn't return -1 like 1.85 */
+ RETVAL->in_memory = (name == NULL) ;
+
if (sv)
{
if (! SvROK(sv) )