dboo::odb::backup_database

void backup_database(std::ostream& outstream, backup_options options = backup_options::none);
backup_database( filepath )

Backs up the database on specified output stream (C++) or to the specified filepath (Node.js). No transaction information is stored. The client must be logged in to the database that is being backed up.

Parameters

outstream

Output stream where to put the backup.

options

Specifies output format:

backup_option

Explanation

binary

All object data are stored in binary form.

json

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::ofstream out{"mydata.bak"};
    db.backup_database(out, backup_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.backup_database("mydata.bak");