<div dir="ltr">FYI: The &quot;count()&quot; I talked about earlier should be &quot;get_current_size();&quot; at least, that&#39;s what I used.&nbsp; Sorry about that.<br><br>Before you call count () (not sure if that would work as expected) or get_current_size(), you probably need to call either set(...) or get(...) with DB_FIRST or DB_NEXT so your cursor is actually pointing to an existing record.<br>
<br>Included because it&#39;s useful info if you weren&#39;t aware of it; I typed this without reading your email carefully, go figure...<br>-------------------<br>Actually, I&#39;m pretty sure I hit this same snag; if it&#39;s the same thing I hit (which assumes this operation is being performed on a join cursor), it&#39;s the actual C API pybsddb is built on; it does not allow pget operations on said cursor:<br>
<br>&quot;The join cursor supports only the DBcursor-&gt;get and dbc_close cursor functions&quot;<br><a href="http://www.oracle.com/technology/documentation/berkeley-db/db/api_c/db_join.html">http://www.oracle.com/technology/documentation/berkeley-db/db/api_c/db_join.html</a><br>
-------------------<br><br><div class="gmail_quote">On Mon, Oct 20, 2008 at 8:37 PM, Sury Soni <span dir="ltr">&lt;<a href="mailto:ssoni@nextdigital.com">ssoni@nextdigital.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">















<div link="blue" vlink="blue" lang="EN-AU">

<div>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Hi,</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Your idea is interesting. That should
work.</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">But, I am getting another small exception,
is there any work around this as well.</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p style="margin-left: 36pt;"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Exception
in search, case 0:&nbsp; (22, &#39;Invalid argument -- Cursor position must be set
before performing this operation&#39;)</span></font></p><div class="Ih2E3d">

<p style="margin-left: 36pt;"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Traceback
(most recent call last):</span></font></p>

</div><p style="margin-left: 36pt;"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp; File
&quot;/…/Replica.py&quot;, line 282, in search</span></font></p>

<p style="margin-left: 36pt;"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;&nbsp;&nbsp; if
cur.count()&gt;0:</span></font></p>

<p style="margin-left: 36pt;"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">DBInvalidArgError:
(22, &#39;Invalid argument -- Cursor position must be set before performing this
operation&#39;)</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">I am using before invoking cur.count(), </span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt;">&nbsp;</span></font></p>

<p style="margin-left: 36pt;"><font face="Courier New" size="2"><span style="font-size: 10pt;">cur.pget(key=queries[i],
flags=DB_SET_RANGE)</span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt;">&nbsp;</span></font></p>

<p><font color="#333399" face="Courier New" size="2"><span style="font-size: 10pt; color: rgb(51, 51, 153);">I can handle
this error, by catching this exception around. But seems like there is
something fundamentally wrong for this cursor implementation.</span></font></p>

<p><font color="#333399" face="Courier New" size="2"><span style="font-size: 10pt; color: rgb(51, 51, 153);">&nbsp;</span></font></p>

<p><font color="#333399" face="Courier New" size="2"><span style="font-size: 10pt; color: rgb(51, 51, 153);">Regards,</span></font></p>

<p><font color="#333399" face="Courier New" size="2"><span style="font-size: 10pt; color: rgb(51, 51, 153);">&nbsp;</span></font></p>

<p><font color="#333399" face="Courier New" size="2"><span style="font-size: 10pt; color: rgb(51, 51, 153);">Sury</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<div>

<div style="text-align: center;" align="center"><font face="Times New Roman" size="3"><span style="font-size: 12pt;" lang="EN-US">

<hr align="center" size="2" width="100%">

</span></font></div>

<p><b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;" lang="EN-US">From:</span></font></b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma;" lang="EN-US">
<a href="mailto:pybsddb-bounces@argo.es" target="_blank">pybsddb-bounces@argo.es</a> [mailto:<a href="mailto:pybsddb-bounces@argo.es" target="_blank">pybsddb-bounces@argo.es</a>] <b><span style="font-weight: bold;">On Behalf Of </span></b>phu<br>

<b><span style="font-weight: bold;">Sent:</span></b> Tuesday, 21 October 2008
12:11 PM<br>
<b><span style="font-weight: bold;">To:</span></b> Python bindings for Oracle
Berkeley DB<br>
<b><span style="font-weight: bold;">Subject:</span></b> Re: [pybsddb] BDB
Indexing and Joined Cursor issue</span></font><span lang="EN-US"></span></p>

</div><div><div></div><div class="Wj3C7c">

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&nbsp;</span></font></p>

<div>

<p style="margin-bottom: 12pt;"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">A workaround (which I had
to use) is to ensure that any cursor you&#39;re going to join has at least one
result (via count(), I think it was), only join those that do, and be sure to
test for the case of having no such cursors.</span></font></p>

<div>

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;">On Mon, Oct 20, 2008 at 7:57 PM, Sury Soni &lt;<a href="mailto:ssoni@nextdigital.com" target="_blank">ssoni@nextdigital.com</a>&gt; wrote:</span></font></p>


<div link="blue" vlink="purple">

<div>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Hi
All,</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">I
am having issue in using joined cursor for indexed database.</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">When,
there are no records for given joined cursor, ideally, jonedCursor.get(0)
should return None or raise some exception.</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">But,
in my case, I am getting </span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">(-30975,
&#39;DB_RUNRECOVERY: Fatal error, run database recovery -- PANIC: Invalid
argument&#39;)</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Traceback
(most recent call last):</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;
File &quot;dbNode.py&quot;, line 71, in next</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;&nbsp;&nbsp;
data = self.joinedCursor.get(0)</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Later,
</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Exception
in destroy:&nbsp; (-30975, &#39;DB_RUNRECOVERY: Fatal error, run database recovery
-- PANIC: fatal region error detected; run recovery&#39;)</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Traceback
(most recent call last):</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;
File &quot;dbNode.py&quot;, line 91, in destroy</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;&nbsp;&nbsp;
self.joinedCursor.close()</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Is
there any quick fix solution I can do?</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">If
these exceptions are getting raised due to some other replication related
issue, there is no mechanism I can get that error code and handle the error
accordingly.</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">When
I look into the source code, I can see following comments around this join
function wrapper API.</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;&nbsp;&nbsp;
/* FIXME: this is a buggy interface.&nbsp; The returned cursor</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
contains internal references to the passed in cursors</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
but does not hold python references to them or prevent</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
them from being closed prematurely.&nbsp; This can cause</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
python to crash when things are done in the wrong order. */</span></font></p>

<p><font color="silver" face="Arial" size="1"><span style="font-size: 9pt; font-family: Arial; color: silver;">____________________________________<br>
Sury Prakash Soni<br>
Developer</span></font><font color="silver"><span style="color: silver;"><br>
</span></font><font color="silver" face="Arial" size="1"><span style="font-size: 9pt; font-family: Arial; color: silver;">____________________________________<br>
<br>
<b><span style="font-weight: bold;">Next Digital<br>
</span></b>Level 8, 15 William St,
 Melbourne <br>
VIC 3000 Australia<br>
<b><i><span style="font-weight: bold; font-style: italic;">p</span></i></b> +61 3
8612 6888<br>
<b><i><span style="font-weight: bold; font-style: italic;">f</span></i></b>
&nbsp;+61 3 8612 6899<br>
<b><i><span style="font-weight: bold; font-style: italic;">m 0</span></i></b>433
661 327<br>
</span></font><font color="silver"><span style="color: silver;"><a href="mailto:ssoni@nextdigital.com" title="mailto:rmarshall@nextdigital.com
mailto:agoldman@nextdigital.com" target="_blank"><font title="mailto:rmarshall@nextdigital.com" color="#0066cc" face="Arial" size="1"><span title="mailto:rmarshall@nextdigital.com"><span style="font-size: 9pt; font-family: Arial; color: rgb(0, 102, 204);">ssoni@nextdigital.com</span></span></font></a></span></font><font color="#0066cc" face="Arial"><span style="font-family: Arial; color: rgb(0, 102, 204);"><br>

</span></font><font color="silver"><span style="color: silver;"><a href="http://www.nextdigital.com/" title="http://www.nextdigital.com/" target="_blank"><font title="http://www.nextdigital.com/" color="#0066cc" face="Arial" size="1"><span title="http://www.nextdigital.com/"><span style="font-size: 9pt; font-family: Arial; color: rgb(0, 102, 204);">www.nextdigital.com</span></span></font></a></span></font><font color="silver" face="Arial"><span style="font-family: Arial; color: silver;"><br>

</span></font><font color="silver" face="Arial" size="1"><span style="font-size: 9pt; font-family: Arial; color: silver;">____________________________________</span></font><font color="silver"><span style="color: silver;"><br>

<br>
</span></font><font color="gray" face="Arial" size="1"><span style="font-size: 7pt; font-family: Arial; color: gray;">This email and any attachments are intended only
for the use of the recipient and may be confidential and/or legally privileged.
Next Digital Group Pty Ltd (&quot;Next Digital&quot;) disclaims liability for
any errors, omissions, viruses, loss and/or damage arising from using, opening
or transmitting this email. If you are not the intended recipient you must not
use, interfere with, disclose, copy or retain this email and you should notify
the sender immediately by return email or by contacting Next Digital by
telephone on +61 3 8612 6888.</span></font></p>

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&nbsp;</span></font></p>

</div>

</div>

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;"><br>
_______________________________________________<br>
pybsddb mailing list<br>
<a href="mailto:pybsddb@argo.es" target="_blank">pybsddb@argo.es</a><br>
<a href="http://mailman.argo.es/listinfo/pybsddb" target="_blank">http://mailman.argo.es/listinfo/pybsddb</a><br>
<a href="http://www.argo.es/%7Ejcea/programacion/pybsddb.htm" target="_blank">http://www.argo.es/~jcea/programacion/pybsddb.htm</a></span></font></p>

</div>

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&nbsp;</span></font></p>

</div>

</div></div></div>

</div>


<br>_______________________________________________<br>
pybsddb mailing list<br>
<a href="mailto:pybsddb@argo.es">pybsddb@argo.es</a><br>
<a href="http://mailman.argo.es/listinfo/pybsddb" target="_blank">http://mailman.argo.es/listinfo/pybsddb</a><br>
<a href="http://www.argo.es/%7Ejcea/programacion/pybsddb.htm" target="_blank">http://www.argo.es/~jcea/programacion/pybsddb.htm</a><br></blockquote></div><br></div>