dboo::odb::commit_all
void commit_all();
commit_all()
Saves all objects marked as updated to the database.
Parameters
(none)
Return value
(none)
Exceptions
Example
#include <dboo/rfx.h>
#include <dboo/odb.h>
class A {
public:
inline static dboo::cls<A> cls{"A"};
static void dboo_class_init(dboo::cls<A>& c) {
c.member(&A::var1, "var1");
}
private:
int var1;
};
int main() {
dboo::odb db;
db.connect("localhost", 8823,
"my_database",
"usr132",
"password");
auto a = new A();
auto b = new A();
auto c = new A();
db.updated(a);
db.updated(b);
db.commit_all(); // commits a and b but not c
return 0;
}
const dboo = require('dboo');
const config = require('config');
dboo.argv(process.argv);
dbConfig = config.get('dbConfig');
class UserId {
userId = "";
screenName = "";
constructor(userid = "", screenName = "") {
this.userId = userid;
this.screenName = screenName;
}
};
exports.UserId = UserId;
dboo.class(UserId,
[{"userId": dboo.string},
{"screenName": dboo.string},
]
);
dboo.init();
const db = new dboo.odb();
db.connect(dbConfig.host, Number(dbConfig.port),
dbConfig.dbName, dbConfig.webUserName,
dbConfig.webUserPwd);
let a = new UserId();
let b = new UserId();
let c = new UserId();
db.updated(a);
db.updated(b);
db.commit_all(); // commits a and b but not c