equal
deleted
inserted
replaced
|
1 /* Title: Pure/Tools/sql.scala |
|
2 Author: Makarius |
|
3 |
|
4 Support for SQL. |
|
5 */ |
|
6 |
|
7 package isabelle |
|
8 |
|
9 |
|
10 object SQL |
|
11 { |
|
12 /* concrete syntax */ |
|
13 |
|
14 def quote_char(c: Char): String = |
|
15 c match { |
|
16 case '\u0000' => "\\0" |
|
17 case '\'' => "\\'" |
|
18 case '\"' => "\\\"" |
|
19 case '\b' => "\\b" |
|
20 case '\n' => "\\n" |
|
21 case '\r' => "\\r" |
|
22 case '\t' => "\\t" |
|
23 case '\u001a' => "\\Z" |
|
24 case '\\' => "\\\\" |
|
25 case _ => c.toString |
|
26 } |
|
27 |
|
28 def quote_string(s: String): String = |
|
29 quote(s.map(quote_char(_)).mkString) |
|
30 |
|
31 def quote_ident(s: String): String = "`" + s + "`" |
|
32 } |