Berkeley DB - dbp->get problem ...
From: Greg Sovaridis <g.sovaridis_at_viveo-cognitive-system.com>
Date: Wed, 21 Aug 2002 17:00:34 +0100
Message-ID: <3d63ab0a$0$289$ba620e4c_at_news.skynet.be>
Hi dudes ...
Date: Wed, 21 Aug 2002 17:00:34 +0100
Message-ID: <3d63ab0a$0$289$ba620e4c_at_news.skynet.be>
Hi dudes ...
I'm trying to use the Berkeley DB library since 2 days now. When I create a DB and add records to it, I can retrieve whatever I want ...
But once I close the database, reopen it and tried to read records from it with the same code, the dbp->get call fails with error 22 which says invalid argument.
Here's my sample code:
for (loop = 95; 90 < loop; loop--) { sprintf(strKey, "%07lu", loop); key.data = &loop; key.size = sizeof(loop); data.data = strData; data.size = strlen(strData); ret = dbp->get(dbp, NULL, &key, &data, 0); switch(ret) { case DB_NOTFOUND: printf("Retrieve Error: Record Not Found\n"); break; case DB_RUNRECOVERY: break; case 0: ((char *) data.data)[data.size - 1] = 0; printf("Retrieve OK: %s\n", (char *) data.data); break; default: printf("Retrieve Error: %s\n", db_strerror(ret)); break; } }
Any idea will help ...
Greg Received on Wed Aug 21 2002 - 18:00:34 CEST