1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.ibatis.jdbc;
17
18
19
20
21
22
23 @Deprecated
24 public class SelectBuilder {
25
26 private static final ThreadLocal<SQL> localSQL = new ThreadLocal<SQL>();
27
28 static {
29 BEGIN();
30 }
31
32 private SelectBuilder() {
33
34 }
35
36 public static void BEGIN() {
37 RESET();
38 }
39
40 public static void RESET() {
41 localSQL.set(new SQL());
42 }
43
44 public static void SELECT(String columns) {
45 sql().SELECT(columns);
46 }
47
48 public static void SELECT_DISTINCT(String columns) {
49 sql().SELECT_DISTINCT(columns);
50 }
51
52 public static void FROM(String table) {
53 sql().FROM(table);
54 }
55
56 public static void JOIN(String join) {
57 sql().JOIN(join);
58 }
59
60 public static void INNER_JOIN(String join) {
61 sql().INNER_JOIN(join);
62 }
63
64 public static void LEFT_OUTER_JOIN(String join) {
65 sql().LEFT_OUTER_JOIN(join);
66 }
67
68 public static void RIGHT_OUTER_JOIN(String join) {
69 sql().RIGHT_OUTER_JOIN(join);
70 }
71
72 public static void OUTER_JOIN(String join) {
73 sql().OUTER_JOIN(join);
74 }
75
76 public static void WHERE(String conditions) {
77 sql().WHERE(conditions);
78 }
79
80 public static void OR() {
81 sql().OR();
82 }
83
84 public static void AND() {
85 sql().AND();
86 }
87
88 public static void GROUP_BY(String columns) {
89 sql().GROUP_BY(columns);
90 }
91
92 public static void HAVING(String conditions) {
93 sql().HAVING(conditions);
94 }
95
96 public static void ORDER_BY(String columns) {
97 sql().ORDER_BY(columns);
98 }
99
100 public static String SQL() {
101 try {
102 return sql().toString();
103 } finally {
104 RESET();
105 }
106 }
107
108 private static SQL sql() {
109 return localSQL.get();
110 }
111
112 }