dbTalk Databases Forums  

DB->put when key exists in a secondary database

comp.databases.berkeley-db comp.databases.berkeley-db


Discuss DB->put when key exists in a secondary database in the comp.databases.berkeley-db forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Frode Nordahl
 
Posts: n/a

Default DB->put when key exists in a secondary database - 11-27-2005 , 11:22 AM






Hello,

I'm writing a application that sets up a Environment with a primary and
several secondary databases. Most of the secondary databasse are set up
with DB_DUPSORT, but I want to avoid duplicates in one of them. The
environment is protected by transactions.

However, when I insert data in the primary database, DB->put returns EINVAL.

For now, all is well since I only have one secondary database which
enforces uniqueness.

But what was I to do if I wanted multiple secondary databases with
uniqueness enforced? How would I find out what secondary database(s)
caused DB->put to return EINVAL?

Are there other and better ways to enforce uniqueness on secondary databases?

--
Frode Nordahl


Reply With Quote
  #2  
Old   
ron.cohen@gmail.com
 
Posts: n/a

Default Re: DB->put when key exists in a secondary database - 11-28-2005 , 10:10 AM






Hi Frode,

As a first step you should turn on verbose errors as described
elsewhere in this newsgroup and here:

http://dev.sleepycat.com/resources/f...io n%3Dsearch

That should give you a better error message and hopefully help you
identify where the problem is. Let me know if after turning on verbose
errors, you still can't find the source of the problem.

Ron


Reply With Quote
  #3  
Old   
Frode Nordahl
 
Posts: n/a

Default Re: DB->put when key exists in a secondary database - 11-28-2005 , 03:38 PM



On 2005-11-28 17:10:24 +0100, ron.cohen (AT) gmail (DOT) com said:
Quote:
As a first step you should turn on verbose errors as described
elsewhere in this newsgroup and here:

http://dev.sleepycat.com/resources/f...io n%3Dsearch
That
Quote:
should give you a better error message and hopefully help you
identify where the problem is. Let me know if after turning on verbose
errors, you still can't find the source of the problem.
Thank you for your reply!

I think I was a bit too much inside my mind when I phrased the first
question :-)

My test program inserts two records with different primary key, and the
same data. I have multiple secondary databases, one of them is not
configured to support duplicates. So this will obviously fail.

When turning on error logging I get the following:
"Put results in a non-unique secondary key in an index not configured
to support
duplicates"

This is what I expected to get.

As of now I only have one secondary database not configured to support
duplicates, so I check for EINVAL on DB->put, and handle things
accordingly. But I may run into a situation where DB->put returns
EINVAL for a different error, or I may need multiple secondary
databases that enforce uniqueness.

My question is: Is it possible to identify which secondary database the
key allready exists in?

--
Frode Nordahl



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.