src/Pure/General/sql.scala
changeset 65668 366bc4e6a238
parent 65649 0818da4f67bb
child 65669 d2f19b4a16ae
     1.1 --- a/src/Pure/General/sql.scala	Mon May 01 13:39:27 2017 +0200
     1.2 +++ b/src/Pure/General/sql.scala	Mon May 01 15:42:26 2017 +0200
     1.3 @@ -37,11 +37,19 @@
     1.4      if (Long_Name.is_qualified(s)) s
     1.5      else quote(s.replace("\"", "\"\""))
     1.6  
     1.7 +  def enclose(s: String): String = "(" + s + ")"
     1.8    def enclosure(ss: Iterable[String]): String = ss.mkString("(", ", ", ")")
     1.9  
    1.10    def select(columns: List[Column], distinct: Boolean = false): String =
    1.11      "SELECT " + (if (distinct) "DISTINCT " else "") + commas(columns.map(_.sql)) + " FROM "
    1.12  
    1.13 +  def join(table1: Table, table2: Table, sql: String = "", outer: Boolean = false): String =
    1.14 +    table1.sql + (if (outer) " LEFT OUTER JOIN " else " INNER JOIN ") + table2.sql +
    1.15 +      (if (sql == "") "" else " ON " + sql)
    1.16 +
    1.17 +  def join_outer(table1: Table, table2: Table, sql: String = ""): String =
    1.18 +    join(table1, table2, sql, outer = true)
    1.19 +
    1.20  
    1.21    /* types */
    1.22