Skip to content

Commit

Permalink
Adding start transaction and commit as keywords for mysql command tra…
Browse files Browse the repository at this point in the history
…cking. We happen to use different keywords for transactions than facebook does, this makes it work properly for us.

Summary: Closes facebook#7023

Reviewed By: paulbiss

Differential Revision: D3225855

fbshipit-source-id: b292a59d35e79bfd4ca189f4990c6faf4994ba1c
  • Loading branch information
joelastpass authored and Hhvm Bot committed Jul 2, 2016
1 parent cf1fef3 commit 0036e92
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions hphp/runtime/ext/mysql/mysql_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1430,13 +1430,14 @@ MySQLQueryReturn php_mysql_do_query(const String& query, const Variant& link_id,
}
} else {
preg_match("/^(?:(?:\\/\\*.*?\\*\\/)|\\(|\\s)*"
"(begin|commit|rollback|select)/is",
"(start transaction|begin|commit|rollback|select)/is",
query, &matches);
auto marray = matches.toArray();
size = marray.size();
if (size == 2) {
auto verb = toLower(marray[1].toString().slice());
rconn->m_xaction_count = ((verb == "begin") ? 1 : 0);
rconn->m_xaction_count = ((verb == "begin" ||
verb == "start transaction") ? 1 : 0);
ServerStats::Log(std::string("sql.query.") + verb, 1);
if (RuntimeOption::EnableStats && RuntimeOption::EnableSQLTableStats) {
MySqlStats::Record(verb);
Expand Down

0 comments on commit 0036e92

Please sign in to comment.