dboo::odb::restore_database

void restore_database(std::istream& instream, restore_options options = restore_options::none);
restore_database( filepath )

Restores the database from specified input stream (C++) or file (Node.js). The client must be logged in to the database that is being restored. Existing objects in the database will not be erased, but may be updated if the same object ids exist in both database and backup.

Parameters

instream

Input stream where to put the backup.

options

Specifies input format:

backup_option

Explanation

binary

All object data are stored in binary form.

json

All object data are stored as json.

skip_types_from_file

All object data are stored as json.

filepath

Path to file where to store the backup.

Return value

(none)

Example

#include <dboo/odb.h>
#include <fstream>

int main() {

    dboo::odb db;

    db.connect("localhost", 8823,
              "my_database",
              "usr132",
              "password");

    std::ifstream in{"mydata.bak"};
    db.restore_database(in, restore_options::json);

    return 0;
}
const dboo = require('dboo');
const config = require('config');

dboo.argv(process.argv);

dbConfig = config.get('dbConfig');

dboo.init(); // Class declarations must come before init!

const db = new dboo.odb();
db.connect(dbConfig.host, Number(dbConfig.port),
            dbConfig.dbName, dbConfig.webUserName,
            dbConfig.webUserPwd);

db.restore_database("mydata.bak");