# 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.
use Carp;
-$VERSION = "1.09" ;
+$VERSION = "1.10" ;
#typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE;
$DB_BTREE = new 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
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)>
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.
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.
*/
SV * compare ;
SV * prefix ;
SV * hash ;
+ int in_memory ;
union INFO info ;
} DB_File_type;
#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)
else if (RETVAL == 1) /* No key means empty file */
RETVAL = 0 ;
- return (RETVAL) ;
+ return ((I32)RETVAL) ;
}
static recno_t
/* 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) )