bsddb for k, v in db.items(): do order the numbers ?

martijn at gamecreators.nl martijn at gamecreators.nl
Mon Mar 7 11:12:07 EST 2005


uhm i'm trying to make a very simple but large database:

Let's say I want these fields : |name|age|country|

Then I can't do this because I use the same key

db["name"] = 'piet'
db["age"] = '20'
db["country"] = 'nl'
#    same keys so it wil overwrite
db["name"] = 'jan'
db["age"] = '40'
db["country"] = 'eng'

But how does other people use bsddb then ?
- with a hidden |int like below ?

db["name|0"] = 'jan'
db["age|1"] = '40'
db["country|2"] = 'eng'

- do a little math to
first is name
sec is age
third is country

db["0"] = 'jan'
db["1"] = '40'
db["2"] = 'eng'

pointer=0
for k, v in db.items():
  if pointer =3:
    poiner = 0
    #next 3 fields

----------------------
I like bsddb because of the speed and it can handle big files,
but what is the normal way of using it ?

Thanks for helping




More information about the Python-list mailing list