From: Paul Marquess Date: Tue, 14 Jan 1997 12:47:40 +0000 (+0000) Subject: Refresh DB_File to 1.10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a0b8c8c13b377533a792c02987f7129f1884ba85;p=p5sagit%2Fp5-mst-13.2.git 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> --- diff --git a/ext/DB_File/DB_File.pm b/ext/DB_File/DB_File.pm index fe9c34d..ff746cf 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. 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, L, L, L, L diff --git a/ext/DB_File/DB_File.xs b/ext/DB_File/DB_File.xs index a13eaa6..a938ffb 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) )