Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check return values when connecting to/creating a database #2

Merged
merged 6 commits into from
Sep 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions convert.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,29 @@ int main(int argc, char* argv[]){


DB_ * x = new Libdb();
x->connect_database(src);
if (!x->connect_database(src)) {
// error is printed in the connect_database function
delete x;
return 1;
matejmatuska marked this conversation as resolved.
Show resolved Hide resolved
}
DB_ *b;
if (lmdb)
b = new LMDB_();
else
b = new GDBM_();
b->create_database(dst);
if (!b->create_database(dst)) {
std::cerr<<"Failed to create destination database\n";
delete x;
delete b;
return 1;
}
if (!b->fill_database(x)){
std::cerr<<"database filling failed\n";
delete x;
delete b;
matejmatuska marked this conversation as resolved.
Show resolved Hide resolved
return 1;
}
b->close_db();
b->close_db();
delete x;
delete b;
return 0;
Expand Down