usage for c_put & c_get?? -
10-23-2006
, 05:10 AM
Hi, all.
I want to update a record during traversing all records.
so.. I write following code.
but i met an access violation..what's wrong?
Thanks for your reply, in advance...
===========================
DBT key, data;
DB_TXN *tid = NULL;
DBC *dbcp = NULL;
memset(&key, 0, sizeof(DBT));
memset(&data, 0, sizeof(DBT));
data.flags = DB_DBT_MALLOC;
ret = dbenv->txn_begin(dbenv, NULL, &tid, 0);
ret = dbp->cursor(dbp, tid, &dbcp, 0);
ret = dbcp->c_get(dbcp, &key, &data, DB_NEXT );
ret = dbcp->c_put(dbcp, &key, &data, DB_CURRENT); <--- A/V occurred.
For test, i update a record with same data DBT...
and all return values(ret) are checked...
traversing all records is okay, but when i add the last sentense, i met
the A/V error. |