Permalink
Browse files

Make parentheses-for-union-queries specific to MySQL

  • Loading branch information...
kuppuswamy committed Jun 19, 2017
1 parent aeb7bb7 commit c9c6dd08a37533711ad9fd24c4c52d7f5ff66300
@@ -424,9 +424,9 @@ trait JdbcStatementBuilderComponent { self: JdbcProfile =>
b"\}"
case Union(left, right, all) =>
b"\{"
buildFrom(left, None, false)
buildFrom(left, None, true)
if(all) b"\nunion all " else b"\nunion "
buildFrom(right, None, false)
buildFrom(right, None, true)
b"\}"
case SimpleLiteral(w) => b += w
case s: SimpleExpression => s.toSQL(this)
@@ -186,6 +186,12 @@ trait MySQLProfile extends JdbcProfile { profile =>
case RowNum(sym, true) => b"(@`$sym := @`$sym + 1)"
case RowNum(sym, false) => b"@`$sym"
case RowNumGen(sym, init) => b"@`$sym := $init"
case Union(left, right, all) =>
b"\{"
buildFrom(left, None, false)
if(all) b"\nunion all " else b"\nunion "
buildFrom(right, None, false)
b"\}"
case _ => super.expr(n, skipParens)
}

0 comments on commit c9c6dd0

Please sign in to comment.