berkeley db set_re_source method -
12-13-2006
, 01:16 PM
hi guys
i want to use a flat text backing file for a existing huge recno db.
i am trying to use the set_re_source method, but i am not successfull
with this,
this is my code
///////////////////////////////////////////////////////////////
using namespace std;
int main(int argc, char **argv)
{
DB *dbp;
DBT key, data;
int ret, tret;
char *dbfile = argv[1];
DBC* curs;
if (argc != 2) {
fprintf(stderr, "usage: %s <neoflow_file>\n", argv[0]);
exit(1);
}
if(ret = db_create(&dbp, NULL, 0) == 0) {
cout<< "step1: creating successfull" << endl;
}
if ((ret= dbp->set_re_source(dbp, "/home/soudi/backFile.txt")) == 0) {
cout<< "step2: backing file successfull"<<endl;
exit(1);
}
if(ret = dbp->open(dbp, NULL,dbfile, NULL, DB_RECNO, DB_RDONLY, 0) !=
0) {
cout<< "step3: openning not successfull" << endl;
exit(1);
}
memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data));
if ((tret = dbp->close(dbp, 0)) != 0 ) {
cout<< "step4: closing not successfull" << endl;
exit(1);
}
return 0;
}
////////////////////////////////////////////////////
Can someone give me some hints please?
thanks
soudi |