dbTalk Databases Forums  

Singular behavior

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


Discuss Singular behavior in the comp.databases.berkeley-db forum.



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

Default Singular behavior - 11-07-2006 , 02:08 AM






Hi,
thanks for previous response...
i have observed a singular behavior...i have a DB with 220000
entry...the keys are in the range 15 - 220,000

If I get the key 2,000,000 the DB response correctly "no record found
for key 2,000,000" ...

but if i get the key 1 (or any minor 15) the DB response always with key
15 (the first in the DB)...

Reply With Quote
  #2  
Old   
Alex
 
Posts: n/a

Default Re: Singular behavior - 11-07-2006 , 02:31 AM







Minollo wrote:
Quote:
the keys are in the range 15 - 220,000

If I get the key 2,000,000 the DB response correctly "no record found
for key 2,000,000" ...

but if i get the key 1 (or any minor 15) the DB response always with key
15 (the first in the DB)...
Can you give us some more information?
* Are you sure that keys 1-14 are not in the DB?
* What is the format of the keys? Are you using integers? Strings?
* What method are you using to retrieve the key/data pairs? Could you
provide a sample of that code?
* Can you provide code that will reproduce this problem?

Thanks,
Alex



Reply With Quote
  #3  
Old   
Minollo
 
Posts: n/a

Default Re: Singular behavior - 11-07-2006 , 02:47 AM



Alex ha scritto:
Quote:
Can you give us some more information?
* Are you sure that keys 1-14 are not in the DB?
Yes...because i load a dB from file... and i sure that keys 1-14 not exist..

Quote:
* What is the format of the keys? Are you using integers? Strings?
key are long..

Quote:
* Can you provide code that will reproduce this problem?
This is my function for query a singular item:

....
long item = 1;
show_item_table1(table1DB, item);
....

int show_item_table1(MyDb &table1DB, long &item)
{
Dbc *cursorp;
try {
table1DB.getDb().cursor(NULL, &cursorp, 0);

Dbt key(&item,sizeof(long)) ;
Dbt data;

int ret = cursorp->get(&key, &data, DB_SET_RANGE);
if (!ret) {
do {
Table1Data table1Item(data.get_data());
table1Item.show();

} while(cursorp->get(&key, &data, DB_NEXT_DUP) == 0);
} else {
if (ret)
std::cerr << "\nNo records found for key: " << item;
}

} catch(DbException &e) {
table1DB.getDb().err(e.get_errno(), "Error in show_all_records");
cursorp->close();
throw e;
} catch(std::exception &e) {
cursorp->close();
throw e;
}

cursorp->close();
return (0);
}


Table1Item have 2 long members key e value;


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 - 2013, Jelsoft Enterprises Ltd.