about bsddb module

C

cocobear

How to deal with multiple databases in an file. I want to get the
content of several databases.

it's the code I wrote:

[cocobear@cocobear ~]$ python
Python 2.5.1 (r251:54863, Oct 30 2007, 13:54:11)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import bsddb
import os
import time

db_file = 'native.db'
db = bsddb.db.DB()
db.open(db_file,bsddb.db.DB_UNKNOWN,bsddb.db.DB_RDONLY)
dbs = db.keys()
db.open(db_file,dbs[0],bsddb.db.DB_UNKNOWN,bsddb.db.DB_RDONLY)
db.keys()
['\x01\x00\x00\x00', '\x02\x00\x00\x00', '\x03\x00\x00\x00',
'\x04\x00\x00\x00', '\x05\x00\x00\x00']
db.open(db_file,dbs[1],bsddb.db.DB_UNKNOWN,bsddb.db.DB_RDONLY)


the program stop here.
 
C

cocobear

How to deal with multiple databases in an file. I want to get the
content of several databases.

it's the code I wrote:

[cocobear@cocobear ~]$ python
Python 2.5.1 (r251:54863, Oct 30 2007, 13:54:11)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2
Type "help", "copyright", "credits" or "license" for more information.>>> importbsddb
import os
import time
db_file = 'native.db'
db =bsddb.db.DB()
db.open(db_file,bsddb.db.DB_UNKNOWN,bsddb.db.DB_RDONLY)
dbs = db.keys()
db.open(db_file,dbs[0],bsddb.db.DB_UNKNOWN,bsddb.db.DB_RDONLY)
db.keys()

['\x01\x00\x00\x00', '\x02\x00\x00\x00', '\x03\x00\x00\x00',
'\x04\x00\x00\x00', '\x05\x00\x00\x00']
db.open(db_file,dbs[1],bsddb.db.DB_UNKNOWN,bsddb.db.DB_RDONLY)

the program stop here.


Anybody can help me?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top