dboo::init

namespace dboo {

    void init();

}
dboo.init ()

The dboo::init() function must be called before a database connection is done. It completes the registration of classes declared with the dboo_class_init().

In Node.js, it is important that all dboo.class() declarations have been made prior to the call to dboo.init(). Similarily, in C++, all the static cls<> objects must have been initialized before the call to dboo::init().

Parameters

(none)

Return value

(none)

Exceptions

Example

init.cpp

Try it

 1#include <dboo/odb.h>
 2#include <string>
 3
 4using namespace std::string_literals;
 5
 6int main() {
 7  dboo::init();
 8
 9  dboo::odb db;
10
11  db.connect("localhost"s, 8822,
12             "testdb"s,
13             "testuser"s,
14             "mypassword"s);
15}

init.js

Try it

 1const dboo = require('dboo');
 2dboo.argv(process.argv);
 3
 4const config = require('config');
 5
 6dbConfig = config.get('dbConfig');
 7
 8dboo.init();
 9
10const odb = new dboo.odb();
11odb.connect(dbConfig.host, Number(dbConfig.port),
12  dbConfig.dbName, dbConfig.webUserName,
13  dbConfig.webUserPwd);