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;