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 code should be used for an Informix database pool.
25 *
26 * @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
27 * @author <a href="mailto:bpm@ec-group.com">Brian P Millett</a>
28 * @version $Id: DBInformix.java 239630 2005-08-24 12:25:32Z henning $
29 */
30 public class DBInformix extends DB
31 {
32 /***
33 * Empty constructor.
34 */
35 protected DBInformix()
36 {
37 }
38
39 /***
40 * This method is used to ignore case. Problem is that Informix
41 * does not have an UPPER function. So the best would be to do
42 * nothing.
43 *
44 * @param in The string to transform to upper case.
45 * @return The upper case string.
46 */
47 public String toUpperCase(String in)
48 {
49 return in;
50 }
51
52 /***
53 * This method is used to ignore case. Problem is that Informix
54 * does not have an UPPER function. So the best would be to do
55 * nothing.
56 *
57 * @param in The string whose case to ignore.
58 * @return The string in a case that can be ignored.
59 */
60 public String ignoreCase(String in)
61 {
62 return in;
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 null;
79 }
80
81 /***
82 * The method is used to lock a 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) throws SQLException
89 {
90 Statement statement = con.createStatement();
91
92 StringBuffer stmt = new StringBuffer();
93 stmt.append("LOCK TABLE ")
94 .append(table)
95 .append(" IN EXCLUSIVE MODE");
96
97 statement.executeQuery(stmt.toString());
98 }
99
100 /***
101 * The method is used to unlock a table.
102 *
103 * @param con The JDBC connection to use.
104 * @param table The name of the table to unlock.
105 * @exception SQLException No Statement could be created or executed.
106 */
107 public void unlockTable(Connection con, String table) throws SQLException
108 {
109
110
111
112 con.commit();
113 }
114 }