summaryrefslogtreecommitdiff
path: root/server/src/transactionhandler.cc
diff options
context:
space:
mode:
authordeva <deva>2011-02-04 13:34:40 +0000
committerdeva <deva>2011-02-04 13:34:40 +0000
commit6bae4fd17d2660d53279dac9287de52be2a00c6c (patch)
tree595f7aa65558735a3fc05062d39e95e88b026a51 /server/src/transactionhandler.cc
parente6a824034c742b9a414d32ecfbcc8531180f93dc (diff)
Database pool is now used instead of one connection per session. Admin interface supports session unlock.
Diffstat (limited to 'server/src/transactionhandler.cc')
-rw-r--r--server/src/transactionhandler.cc21
1 files changed, 12 insertions, 9 deletions
diff --git a/server/src/transactionhandler.cc b/server/src/transactionhandler.cc
index 6d0b922..32d37eb 100644
--- a/server/src/transactionhandler.cc
+++ b/server/src/transactionhandler.cc
@@ -54,9 +54,9 @@ static std::string handleCommits(Transaction &transaction, Environment &env,
std::string answer;
if(transaction.commits.size() > 0) {
- // AutoBorrower<Database*> borrower(env.dbpool);
- // Database *db = borrower.get();
- Database *db = session.database();
+ AutoBorrower<Database*> borrower(env.dbpool);
+ Database *db = borrower.get();
+ //Database *db = session.database();
Commits::iterator i = transaction.commits.begin();
while(i != transaction.commits.end()) {
@@ -69,7 +69,7 @@ static std::string handleCommits(Transaction &transaction, Environment &env,
std::string resume = resume_parser(*macro, commit);
commit.fields["journal.resume"] = resume;
session.isreadonly = false;
- db->commitTransaction(transaction, commit, *macro);
+ db->commitTransaction(transaction, commit, *macro, session.id());
if(resume != "") {
@@ -94,9 +94,9 @@ static std::string handleRequest(Transaction &transaction, Environment &env,
if(transaction.requests.size() > 0) {
- // AutoBorrower<Database*> borrower(env.dbpool);
- // Database *db = borrower.get();
- Database *db = session.database();
+ AutoBorrower<Database*> borrower(env.dbpool);
+ Database *db = borrower.get();
+ // Database *db = session.database();
Requests::iterator i = transaction.requests.begin();
while(i != transaction.requests.end()) {
@@ -133,6 +133,7 @@ static std::string handleRequest(Transaction &transaction, Environment &env,
bool completed = db->checkMacro(transaction.cpr,
macro.attributes["name"],
+ session.id(),
time(NULL)-Conf::db_max_ttl);
answer += " <macro uid=\"42\" completed=";
@@ -228,7 +229,8 @@ static std::string handleRequest(Transaction &transaction, Environment &env,
answer += " </scripts>\n";
}
- answer += widgetgenerator(transaction.cpr, *m, lqm, *db);
+ answer += widgetgenerator(transaction.cpr, session.id(),
+ *m, lqm, *db);
} else {
// only find macro title
MacroParser mp(env.macrolist.getLatestVersion(macro.attributes["name"]));
@@ -246,7 +248,8 @@ static std::string handleRequest(Transaction &transaction, Environment &env,
std::string state = "old";
std::string resume = db->getResume(transaction.cpr,
macro,
- time(NULL) - Conf::db_max_ttl);
+ time(NULL) - Conf::db_max_ttl,
+ session.id());
if(session.journal()->dirty(macro.attributes["name"])) {
state = "dirty";
} else {