Commit eb3a3937 authored by Julien Muchembled's avatar Julien Muchembled

mysql: add missing spaces in SQL + tiny optimization

The spaces are optional so it's cosmetics.
parent dc257fc7
...@@ -458,16 +458,16 @@ class MySQLDatabaseManager(MVCCDatabaseManager): ...@@ -458,16 +458,16 @@ class MySQLDatabaseManager(MVCCDatabaseManager):
return self.query("SELECT * FROM pt") return self.query("SELECT * FROM pt")
def _getLastTID(self, partition, max_tid=None): def _getLastTID(self, partition, max_tid=None):
x = "WHERE `partition`=%s" % partition sql = ("SELECT MAX(tid) as t FROM trans FORCE INDEX (PRIMARY)"
" WHERE `partition`=%s") % partition
if max_tid: if max_tid:
x += " AND tid<=%s" % max_tid sql += " AND tid<=%s" % max_tid
(tid,), = self.query( (tid,), = self.query(sql)
"SELECT MAX(tid) as t FROM trans FORCE INDEX (PRIMARY)" + x)
return tid return tid
def _getLastIDs(self, partition): def _getLastIDs(self, partition):
q = self.query q = self.query
x = "WHERE `partition`=%s" % partition x = " WHERE `partition`=%s" % partition
(oid,), = q("SELECT MAX(oid) FROM obj FORCE INDEX (PRIMARY)" + x) (oid,), = q("SELECT MAX(oid) FROM obj FORCE INDEX (PRIMARY)" + x)
(tid,), = q("SELECT MAX(tid) FROM obj FORCE INDEX (tid)" + x) (tid,), = q("SELECT MAX(tid) FROM obj FORCE INDEX (tid)" + x)
return tid, oid return tid, oid
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment