1 package org.apache.torque.adapter;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import java.sql.Connection;
20 import java.sql.SQLException;
21 import java.sql.Statement;
22
23 /***
24 * This is used to connect to an embedded Apache Derby Database using
25 * the supplied JDBC driver.
26 *
27 * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
28 * @version $Id: DBDerby.java 332796 2005-11-12 16:20:10Z tfischer $
29 */
30 public class DBDerby
31 extends DB
32 {
33 /***
34 * Empty constructor.
35 */
36 protected DBDerby()
37 {
38 }
39
40 /***
41 * This method is used to ignore case.
42 *
43 * @param str The string to transform to upper case.
44 * @return The upper case string.
45 */
46 public String toUpperCase(String str)
47 {
48 return new StringBuffer("UPPER(")
49 .append(str)
50 .append(")")
51 .toString();
52 }
53
54 /***
55 * This method is used to ignore case.
56 *
57 * @param str The string whose case to ignore.
58 * @return The string in a case that can be ignored.
59 */
60 public String ignoreCase(String str)
61 {
62 return toUpperCase(str);
63 }
64
65 /***
66 * @see org.apache.torque.adapter.DB#getIDMethodType()
67 */
68 public String getIDMethodType()
69 {
70 return NO_ID_METHOD;
71 }
72
73 /***
74 * @see org.apache.torque.adapter.DB#getIDMethodSQL(Object obj)
75 */
76 public String getIDMethodSQL(Object obj)
77 {
78 return "";
79 }
80
81 /***
82 * Locks the specified table.
83 *
84 * @param con The JDBC connection to use.
85 * @param table The name of the table to lock.
86 * @exception SQLException No Statement could be created or executed.
87 */
88 public void lockTable(Connection con, String table)
89 throws SQLException
90 {
91 Statement statement = con.createStatement();
92 StringBuffer stmt = new StringBuffer();
93 stmt.append("LOCK TABLE ")
94 .append(table).append(" IN EXCLUSIVE MODE");
95 statement.executeUpdate(stmt.toString());
96 }
97
98 /***
99 * Unlocks the specified table.
100 *
101 * @param con The JDBC connection to use.
102 * @param table The name of the table to unlock.
103 * @exception SQLException No Statement could be created or executed.
104 */
105 public void unlockTable(Connection con, String table)
106 throws SQLException
107 {
108 }
109 }