dbTalk Databases Forums  

berkeley db set_re_source method

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


Discuss berkeley db set_re_source method in the comp.databases.berkeley-db forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
svedavarz@hotmail.com
 
Posts: n/a

Default 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


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

Default Re: berkeley db set_re_source method - 12-14-2006 , 02:34 AM






* svedavarz (AT) hotmail (DOT) com wrote, On 13.12.2006 20:16:
Quote:
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
[snip]

Quote:
if(ret = dbp->open(dbp, NULL,dbfile, NULL, DB_RECNO, DB_RDONLY, 0) !=
0) {
Shouldn't you add a couple of () here? ;-)

[snip]
HTH
Boa


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