[ python-Bugs-1548332 ] whichdb too dumb
SourceForge.net
noreply at sourceforge.net
Tue Aug 29 07:51:11 CEST 2006
Bugs item #1548332, was opened at 2006-08-28 22:51
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1548332&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Extension Modules
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Curtis Doty (dotysan)
Assigned to: Nobody/Anonymous (nobody)
Summary: whichdb too dumb
Initial Comment:
On my system with db4, I noticed that whichdb doesn't
know anything about more recent database types created
by the bsddb module.
Python 2.4.3 (#1, Jun 13 2006, 11:46:08)
[GCC 4.1.1 20060525 (Red Hat 4.1.1-1)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>>
>>> from whichdb import *
>>> import bsddb
>>>
>>> dbfile= "hash"
>>> bsddb.hashopen( dbfile)
{}
>>> whichdb( dbfile)
'dbhash'
>>> # yay
...
>>> dbfile= "btree"
>>> bsddb.btopen( dbfile)
{}
>>> whichdb( dbfile)
''
>>> # bah
...
>>> dbfile= "recno"
>>> bsddb.rnopen( dbfile)
{}
>>> whichdb( dbfile)
''
>>> # humbug!
It looks like both these database types share:
#define DB_BTREEMAGIC 0x053162
So this might be a start:
--- Python-2.5c1/Lib/whichdb.py.orig 2005-02-05
22:57:08.000000000 -0800
+++ Python-2.5c1/Lib/whichdb.py 2006-08-28
13:46:57.000000000 -0700
@@ -109,6 +109,10 @@
if magic in (0x00061561, 0x61150600):
return "dbhash"
+ # Check for binary tree
+ if magic == 0x00053162:
+ return "btree"
+
# Unknown
return ""
But alas, I'm not clear on the best way to
differentiate between btree and recno.
The above example is on 2.4 but persists in 2.5.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1548332&group_id=5470
More information about the Python-bugs-list
mailing list