Source Code Cross Referenced for DBInterbase.java in  » Database-ORM » Torque » org » apache » torque » adapter » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database ORM » Torque » org.apache.torque.adapter 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.apache.torque.adapter;
002:
003:        /*
004:         * Licensed to the Apache Software Foundation (ASF) under one
005:         * or more contributor license agreements.  See the NOTICE file
006:         * distributed with this work for additional information
007:         * regarding copyright ownership.  The ASF licenses this file
008:         * to you under the Apache License, Version 2.0 (the
009:         * "License"); you may not use this file except in compliance
010:         * with the License.  You may obtain a copy of the License at
011:         *
012:         *   http://www.apache.org/licenses/LICENSE-2.0
013:         *
014:         * Unless required by applicable law or agreed to in writing,
015:         * software distributed under the License is distributed on an
016:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017:         * KIND, either express or implied.  See the License for the
018:         * specific language governing permissions and limitations
019:         * under the License.
020:         */
021:
022:        import java.sql.Connection;
023:        import java.sql.SQLException;
024:        import java.sql.Statement;
025:        import java.util.Date;
026:        import java.text.SimpleDateFormat;
027:
028:        /**
029:         * This code should be used for an Interbase database pool.
030:         *
031:         * @author <a href="mailto:frank@opticode.co.za">Frank Conradie</a>
032:         * @version $Id: DBInterbase.java 476550 2006-11-18 16:08:37Z tfischer $
033:         */
034:        public class DBInterbase extends AbstractDBAdapter {
035:            /**
036:             * Serial version
037:             */
038:            private static final long serialVersionUID = -6709312389168248070L;
039:
040:            /**
041:             * The format in which interbase expects dates (with time).
042:             */
043:            private static final String DATE_FORMAT = "yyyy-MM-dd HH:MM:ss";
044:
045:            /**
046:             * This method is used to ignore case.
047:             *
048:             * @param in The string to transform to upper case.
049:             * @return The upper case string.
050:             */
051:            public String toUpperCase(String in) {
052:                return new StringBuffer("UPPER(").append(in).append(")")
053:                        .toString();
054:            }
055:
056:            /**
057:             * This method is used to ignore case.
058:             *
059:             * @param in The string whose case to ignore.
060:             * @return The string in a case that can be ignored.
061:             */
062:            public String ignoreCase(String in) {
063:                return new StringBuffer("UPPER(").append(in).append(")")
064:                        .toString();
065:            }
066:
067:            /**
068:             * This method is used to ignore case in an ORDER BY clause.
069:             * Usually it is the same as ignoreCase, but some databases
070:             * (Interbase for example) does not use the same SQL in ORDER BY
071:             * and other clauses.
072:             *
073:             * @param in The string whose case to ignore.
074:             * @return The string in a case that can be ignored.
075:             */
076:            public String ignoreCaseInOrderBy(String in) {
077:                return in;
078:            }
079:
080:            /**
081:             * @see org.apache.torque.adapter.DB#getIDMethodType()
082:             */
083:            public String getIDMethodType() {
084:                return NO_ID_METHOD;
085:            }
086:
087:            /**
088:             * @see org.apache.torque.adapter.DB#getIDMethodSQL(Object obj)
089:             */
090:            public String getIDMethodSQL(Object obj) {
091:                return null;
092:            }
093:
094:            /**
095:             * Locks the specified table.
096:             *
097:             * @param con The JDBC connection to use.
098:             * @param table The name of the table to lock.
099:             * @exception SQLException No Statement could be created or executed.
100:             */
101:            public void lockTable(Connection con, String table)
102:                    throws SQLException {
103:                Statement statement = con.createStatement();
104:
105:                StringBuffer stmt = new StringBuffer();
106:                stmt.append("SET TRANSACTION ").append(
107:                        "ISOLATION LEVEL READ COMMITTED ").append(
108:                        "NO RECORD_VERSION WAIT ").append("RESERVING ").append(
109:                        table).append(" FOR PROTECTED WRITE");
110:
111:                statement.executeQuery(stmt.toString());
112:            }
113:
114:            /**
115:             * Unlocks the specified table.
116:             *
117:             * @param con The JDBC connection to use.
118:             * @param table The name of the table to unlock.
119:             * @exception SQLException No Statement could be created or executed.
120:             */
121:            public void unlockTable(Connection con, String table)
122:                    throws SQLException {
123:                // Tables in Interbase are unlocked when a commit is issued.
124:                // The user may have issued a commit but do it here to be
125:                // sure.
126:                con.commit();
127:            }
128:
129:            /**
130:             * This method overrides the JDBC escapes used to format dates
131:             * using a <code>DateFormat</code>.  As of version 2.0.11, the MM
132:             * JDBC driver does not implement JDBC 3.0 escapes.
133:             *
134:             * @param date the date to format
135:             * @return The properly formatted date String.
136:             */
137:            public String getDateString(Date date) {
138:                char delim = getStringDelimiter();
139:                return (delim + new SimpleDateFormat(DATE_FORMAT).format(date) + delim);
140:            }
141:
142:            /**
143:             * This method is for the SqlExpression.quoteAndEscape rules.  The rule is,
144:             * any string in a SqlExpression with a BACKSLASH will either be changed to
145:             * "\\" (if the method returns true) or left as "\" (if the method returns
146:             * false).
147:             *
148:             * @return false.
149:             */
150:            public boolean escapeText() {
151:                return false;
152:            }
153:
154:            /**
155:             * Whether an escape clause in like should be used.
156:             * Example : select * from AUTHOR where AUTHOR.NAME like '\_%' ESCAPE '\';
157:             *
158:             * Interbase needs this, so this implementation always returns
159:             * <code>true</code>.
160:             *
161:             * @return whether the escape clause should be appended or not.
162:             */
163:            public boolean useEscapeClauseForLike() {
164:                return true;
165:            }
166:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.