diff options
author | deva <deva> | 2010-06-10 07:03:06 +0000 |
---|---|---|
committer | deva <deva> | 2010-06-10 07:03:06 +0000 |
commit | 198b0d886817f2c5bc97cfd11857d4b314dffae3 (patch) | |
tree | 4fc2d51de46ab69b9e67149abf0ab6a332032f27 /server/src/sessionparser.cc | |
parent | 730eb796bbce6f124be9194f1565b7dda1daddf1 (diff) |
Add transaction support on database pr. pracro session. Makes it possible to discard all edited macros.
Diffstat (limited to 'server/src/sessionparser.cc')
-rw-r--r-- | server/src/sessionparser.cc | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/server/src/sessionparser.cc b/server/src/sessionparser.cc index ba3693d..0edb26a 100644 --- a/server/src/sessionparser.cc +++ b/server/src/sessionparser.cc @@ -34,6 +34,7 @@ SessionParser::SessionParser() done = false; totalbytes = 0; inresume = false; + indatabase = false; } SessionParser::~SessionParser() @@ -45,6 +46,10 @@ void SessionParser::characterData(std::string &data) if(inresume) { entries[entries.size()-1].resume += data; } + + if(indatabase) { + database += data; + } } void SessionParser::startTag(std::string name, @@ -61,6 +66,11 @@ void SessionParser::startTag(std::string name, userid = attributes["userid"]; } + if(name == "database") { + dbtype = attributes["type"]; + indatabase = true; + } + if(name == "entry") { Entry e; e.index = atoi(attributes["index"].c_str()); @@ -78,6 +88,9 @@ void SessionParser::endTag(std::string name) if(name == "resume") { inresume = false; } + if(name == "database") { + indatabase = false; + } } void SessionParser::parseError(const char *buf, size_t len, @@ -87,11 +100,13 @@ void SessionParser::parseError(const char *buf, size_t len, lineno, error.c_str()); std::string xml; - xml.append(buf, len); + if(buf && len) xml.append(buf, len); PRACRO_ERR(sessionparser, "\tBuffer %u bytes: [%s]\n", len, xml.c_str()); + fflush(stderr); + throw std::exception(); } |