View Javadoc
1   /*
2    *    Copyright 2009-2022 the original author or authors.
3    *
4    *    Licensed under the Apache License, Version 2.0 (the "License");
5    *    you may not use this file except in compliance with the License.
6    *    You may obtain a copy of the License at
7    *
8    *       http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *    Unless required by applicable law or agreed to in writing, software
11   *    distributed under the License is distributed on an "AS IS" BASIS,
12   *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *    See the License for the specific language governing permissions and
14   *    limitations under the License.
15   */
16  package org.apache.ibatis.jdbc;
17  
18  /**
19   * @deprecated Use the {@link SQL} Class
20   *
21   * @author Jeff Butler
22   */
23  @Deprecated
24  public class SqlBuilder {
25  
26    private static final ThreadLocal<SQL> localSQL = new ThreadLocal<>();
27  
28    static {
29      BEGIN();
30    }
31  
32    private SqlBuilder() {
33      // Prevent Instantiation
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 UPDATE(String table) {
45      sql().UPDATE(table);
46    }
47  
48    public static void SET(String sets) {
49      sql().SET(sets);
50    }
51  
52    public static String SQL() {
53      try {
54        return sql().toString();
55      } finally {
56        RESET();
57      }
58    }
59  
60    public static void INSERT_INTO(String tableName) {
61      sql().INSERT_INTO(tableName);
62    }
63  
64    public static void VALUES(String columns, String values) {
65      sql().VALUES(columns, values);
66    }
67  
68    public static void SELECT(String columns) {
69      sql().SELECT(columns);
70    }
71  
72    public static void SELECT_DISTINCT(String columns) {
73      sql().SELECT_DISTINCT(columns);
74    }
75  
76    public static void DELETE_FROM(String table) {
77      sql().DELETE_FROM(table);
78    }
79  
80    public static void FROM(String table) {
81      sql().FROM(table);
82    }
83  
84    public static void JOIN(String join) {
85      sql().JOIN(join);
86    }
87  
88    public static void INNER_JOIN(String join) {
89      sql().INNER_JOIN(join);
90    }
91  
92    public static void LEFT_OUTER_JOIN(String join) {
93      sql().LEFT_OUTER_JOIN(join);
94    }
95  
96    public static void RIGHT_OUTER_JOIN(String join) {
97      sql().RIGHT_OUTER_JOIN(join);
98    }
99  
100   public static void OUTER_JOIN(String join) {
101     sql().OUTER_JOIN(join);
102   }
103 
104   public static void WHERE(String conditions) {
105     sql().WHERE(conditions);
106   }
107 
108   public static void OR() {
109     sql().OR();
110   }
111 
112   public static void AND() {
113     sql().AND();
114   }
115 
116   public static void GROUP_BY(String columns) {
117     sql().GROUP_BY(columns);
118   }
119 
120   public static void HAVING(String conditions) {
121     sql().HAVING(conditions);
122   }
123 
124   public static void ORDER_BY(String columns) {
125     sql().ORDER_BY(columns);
126   }
127 
128   private static SQL sql() {
129     return localSQL.get();
130   }
131 
132 }