%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.torque.adapter.DBDerby |
|
|
1 | package org.apache.torque.adapter; |
|
2 | ||
3 | /* |
|
4 | * Copyright 2001-2005 The Apache Software Foundation. |
|
5 | * |
|
6 | * Licensed under the Apache License, Version 2.0 (the "License") |
|
7 | * you may not use this file except in compliance with the License. |
|
8 | * You may obtain a copy of the License at |
|
9 | * |
|
10 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
11 | * |
|
12 | * Unless required by applicable law or agreed to in writing, software |
|
13 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
15 | * See the License for the specific language governing permissions and |
|
16 | * limitations under the License. |
|
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 | 0 | { |
38 | 0 | } |
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 | 0 | 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 | 0 | return toUpperCase(str); |
63 | } |
|
64 | ||
65 | /** |
|
66 | * @see org.apache.torque.adapter.DB#getIDMethodType() |
|
67 | */ |
|
68 | public String getIDMethodType() |
|
69 | { |
|
70 | 0 | return NO_ID_METHOD; // @todo IDENTITY; |
71 | } |
|
72 | ||
73 | /** |
|
74 | * @see org.apache.torque.adapter.DB#getIDMethodSQL(Object obj) |
|
75 | */ |
|
76 | public String getIDMethodSQL(Object obj) |
|
77 | { |
|
78 | 0 | return ""; // @todo VALUES IDENTITY_VAL_LOCAL()"; |
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 | 0 | Statement statement = con.createStatement(); |
92 | 0 | StringBuffer stmt = new StringBuffer(); |
93 | 0 | stmt.append("LOCK TABLE ") |
94 | .append(table).append(" IN EXCLUSIVE MODE"); |
|
95 | 0 | statement.executeUpdate(stmt.toString()); |
96 | 0 | } |
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 | 0 | } |
109 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |