[pybsddb] BDB Indexing and Joined Cursor issue

Sury Soni ssoni at nextdigital.com
Tue Oct 21 07:43:29 CEST 2008


Sorry for not properly expressing my question.

My question is how I determine if individual cursor is non-empty or
cursor set to particular record. Once that determined, it can be put on
a common list and join() them all together, which is what I am doing in
my previous email code.

So, to determine individual cursor, I tried using count() which was
throwing exception and same with get_current_size(), as before calling
these functions, I am using pget() for each individual cursor to point
to first matching record on BTREE. So if records are not found for my
pattern key, then pointer on cursor is not set to any record. How could
I determine, if cursor is not yet positioned to some specific record,
before I can use that cursor to check count() or get_current_size() and
later use join().

I hope, I made my question clearer this time?

Regards,

Sury



From: pybsddb-bounces at argo.es [mailto:pybsddb-bounces at argo.es] On Behalf
Of phu
Sent: Tuesday, 21 October 2008 4:30 PM
To: Python bindings for Oracle Berkeley DB
Subject: Re: [pybsddb] BDB Indexing and Joined Cursor issue

If your question is how to avoid joining empty cursors, just create an
empty list and append your non-zero-count cursors to it; if you end up
with at least one cursor in your list, you can run your join (joining
one cursor should not cause errors, but you can either do that or just
use the single cursor, whichever you prefer).  If you end up with an
empty list, then you know you have no cursors which return values, and
should not attempt to either join or get from your cursors.  pget will
not be an option once you have joined, as joined cursors only support
get and close.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.jcea.es/pipermail/pybsddb/attachments/20081021/0f50aaeb/attachment.htm>


More information about the pybsddb mailing list