Source Code Cross Referenced for DBSapDB.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:
026:        /**
027:         * This is used to connect to SapDB databases.
028:         *
029:         * <a href="http://www.sapdb.org">http://www.sapdb.org</a>
030:         *
031:         * @author <a href="mailto:dave.polito@planetcad.com">Dave Polito</a>
032:         * @version $Id: DBSapDB.java 473821 2006-11-11 22:37:25Z tv $
033:         */
034:        public class DBSapDB extends AbstractDBAdapter {
035:            /**
036:             * Serial version
037:             */
038:            private static final long serialVersionUID = 8277068258155186370L;
039:
040:            /**
041:             * Empty constructor.
042:             */
043:            protected DBSapDB() {
044:            }
045:
046:            /**
047:             * This method is used to ignore case.
048:             *
049:             * @param in The string to transform to upper case.
050:             * @return The upper case string.
051:             */
052:            public String toUpperCase(String in) {
053:                return new StringBuffer("UPPER(").append(in).append(")")
054:                        .toString();
055:            }
056:
057:            /**
058:             * This method is used to ignore case.
059:             *
060:             * @param in The string whose case to ignore.
061:             * @return The string in a case that can be ignored.
062:             */
063:            public String ignoreCase(String in) {
064:                return new StringBuffer("UPPER(").append(in).append(")")
065:                        .toString();
066:            }
067:
068:            /**
069:             * @see org.apache.torque.adapter.DB#getIDMethodType()
070:             */
071:            public String getIDMethodType() {
072:                return SEQUENCE;
073:            }
074:
075:            /**
076:             * Returns the next key from a sequence.  Uses the following
077:             * implementation:
078:             *
079:             * <blockquote><code><pre>
080:             * select sequenceName.nextval from dual
081:             * </pre></code></blockquote>
082:             *
083:             * @param sequenceName The name of the sequence (should be of type
084:             * <code>String</code>).
085:             * @return SQL to retreive the next database key.
086:             * @see org.apache.torque.adapter.DB#getIDMethodSQL(Object)
087:             */
088:            public String getIDMethodSQL(Object sequenceName) {
089:                return ("select " + sequenceName + ".nextval from dual");
090:            }
091:
092:            /**
093:             * Locks the specified table.
094:             *
095:             * @param con The JDBC connection to use.
096:             * @param table The name of the table to lock.
097:             * @exception SQLException No Statement could be created or executed.
098:             */
099:            public void lockTable(Connection con, String table)
100:                    throws SQLException {
101:                Statement statement = con.createStatement();
102:
103:                StringBuffer stmt = new StringBuffer();
104:                stmt.append("SELECT next_id FROM ").append(table).append(
105:                        " FOR UPDATE");
106:
107:                statement.executeQuery(stmt.toString());
108:            }
109:
110:            /**
111:             * This method is for the SqlExpression.quoteAndEscape rules.  The rule is,
112:             * any string in a SqlExpression with a BACKSLASH will either be changed to
113:             * "\\" or left as "\".  SapDB does not need the escape character.
114:             *
115:             * @return false.
116:             */
117:
118:            public boolean escapeText() {
119:                return false;
120:            }
121:
122:            /**
123:             * Unlocks the specified table.
124:             *
125:             * @param con The JDBC connection to use.
126:             * @param table The name of the table to unlock.
127:             * @exception SQLException No Statement could be created or
128:             * executed.
129:             */
130:            public void unlockTable(Connection con, String table)
131:                    throws SQLException {
132:                // Tables in SapDB are unlocked when a commit is issued.  The
133:                // user may have issued a commit but do it here to be sure.
134:                con.commit();
135:            }
136:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.