[pybsddb] BDB Indexing and Joined Cursor issue

Sury Soni ssoni at nextdigital.com
Wed Oct 22 00:53:08 CEST 2008


Hi Jesus,

I am having issue using python binding.

I summarise my issue again as follows:

1. I have 1 master database (BTREE)

2. 3 secondary databases, where part of primary database key strings
makes key for secondary db.

3. When I search (pget with flag=DB_SET_RANGE) for some pattern on
master database using secondary databases (indexes), 

3.1 First I need to get cursor (cur = dbs.cursor(), where dbs is
secondary database handle, I have three of them), then set cursors
position on each secondary database cursor using
cur.pget(key=queries[i], flags=DB_SET_RANGE). My problem is here. I will
revisit.
3.2 Then, all successful cursors from previous step need to be joined on
master database to get actual (key,value) pairs from master database.


So, referring back to point 3.1, how do I determine from python binding
that pget() has not found any matching items and has not set cursor to
any first item. So my cursor is still uninitialized for some cases. But,
I am not able to determine this other that trying to use cur.current()
and catching the following exception. 

DBInvalidArgError: (22, 'Invalid argument -- Cursor position must be set
before performing this operation')

I need to determine this because, I cannot join these secondary database
cursors on master database if they are uninitialized, since it will hang
my application or core dumps. So, may be join() function also need to
throw some specific exception on this error. This can be easily
determined from C API using return error code.

What I have missed in these functions (pget and join) is that error code
is lost (abstracted) and we cannot do anything to identify those errors
and resolve the problem programmatically.

I hope my question is clear again, if not from previous emails.

Please advice if there is any work-around available to resolve my
problem without need to fix the existing python binding.

Regards,

Surya

-----Original Message-----
From: pybsddb-bounces at argo.es [mailto:pybsddb-bounces at argo.es] On Behalf
Of Jesus Cea
Sent: Wednesday, 22 October 2008 4:33 AM
To: Python bindings for Oracle Berkeley DB
Subject: Re: [pybsddb] BDB Indexing and Joined Cursor issue

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sury Soni wrote:
> I am having issue in using joined cursor for indexed database.

Could you possibly write a minimal testcase?. Is this a bug of BDB or
the python bindings?.

- --
Jesus Cea Avion                         _/_/      _/_/_/        _/_/_/
jcea at jcea.es - http://www.jcea.es/     _/_/    _/_/  _/_/    _/_/  _/_/
jabber / xmpp:jcea at jabber.org         _/_/    _/_/          _/_/_/_/_/
.                              _/_/  _/_/    _/_/          _/_/  _/_/
"Things are not so easy"      _/_/  _/_/    _/_/  _/_/    _/_/  _/_/
"My name is Dump, Core Dump"   _/_/_/        _/_/_/      _/_/  _/_/
"El amor es poner tu felicidad en la felicidad de otro" - Leibniz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQCVAwUBSP4SQJlgi5GaxT1NAQLyZAQAmb5Iey1ojDqFyfxXmqJtS17XSgtWhkZB
q3M9zgdlr0BElm0Lk3gFb9Ma55E7u5xoAu7NK4Hay85TRwurU8KMQyNpiq7onCp2
EwFsvS4ZZxRHkSCkDvLkB+vIJLcAlnrc45Osh0xNDQymNMm6IHbGPgpSy39/bDqc
eU9YJHoO3wQ=
=Y7rs
-----END PGP SIGNATURE-----
_______________________________________________
pybsddb mailing list
pybsddb at argo.es
http://mailman.argo.es/listinfo/pybsddb
http://www.argo.es/~jcea/programacion/pybsddb.htm



More information about the pybsddb mailing list