Source Code Cross Referenced for MckoiSqlDriver.java in  » Testing » PolePosition-0.20 » com » versant » core » jdbc » sql » 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 » Testing » PolePosition 0.20 » com.versant.core.jdbc.sql 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 1998 - 2005 Versant Corporation
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         *
008:         * Contributors:
009:         * Versant Corporation - initial API and implementation
010:         */
011:        package com.versant.core.jdbc.sql;
012:
013:        import com.versant.core.jdbc.metadata.*;
014:        import com.versant.core.jdbc.sql.exp.SqlExp;
015:        import com.versant.core.util.CharBuf;
016:
017:        import java.io.PrintWriter;
018:        import java.util.HashMap;
019:        import java.sql.Types;
020:
021:        import com.versant.core.util.CharBuf;
022:
023:        /**
024:         * A driver for McKoi.
025:         */
026:        public class MckoiSqlDriver extends SqlDriver {
027:
028:            /**
029:             * Get the name of this driver.
030:             */
031:            public String getName() {
032:                return "mckoi";
033:            }
034:
035:            /**
036:             * Get the default type mapping for the supplied JDBC type code from
037:             * java.sql.Types or null if the type is not supported. There is no
038:             * need to set the database or jdbcType on the mapping as this is done
039:             * after this call returns. Subclasses should override this and to
040:             * customize type mappings.
041:             */
042:            protected JdbcTypeMapping getTypeMapping(int jdbcType) {
043:                switch (jdbcType) {
044:                case Types.LONGVARCHAR:
045:                case Types.CLOB:
046:                    return new JdbcTypeMapping("LONGVARCHAR", 0, 0,
047:                            JdbcTypeMapping.TRUE, JdbcTypeMapping.FALSE, null);
048:                case Types.LONGVARBINARY:
049:                case Types.BLOB:
050:                    return new JdbcTypeMapping("LONGVARBINARY", 0, 0,
051:                            JdbcTypeMapping.TRUE, JdbcTypeMapping.FALSE,
052:                            bytesConverterFactory);
053:                }
054:                return super .getTypeMapping(jdbcType);
055:            }
056:
057:            /**
058:             * Get the default field mappings for this driver. These map java classes
059:             * to column properties. Subclasses should override this, call super() and
060:             * replace mappings as needed.
061:             */
062:            public HashMap getJavaTypeMappings() {
063:                HashMap ans = super .getJavaTypeMappings();
064:                return ans;
065:            }
066:
067:            /**
068:             * Does the JDBC driver support statement batching?
069:             */
070:            public boolean isInsertBatchingSupported() {
071:                return false;
072:            }
073:
074:            /**
075:             * Does the JDBC driver support statement batching for updates?
076:             */
077:            public boolean isUpdateBatchingSupported() {
078:                return false;
079:            }
080:
081:            /**
082:             * Does this driver use the ANSI join syntax (i.e. the join clauses appear
083:             * in the from list e.g. postgres)?
084:             */
085:            public boolean isAnsiJoinSyntax() {
086:                return true;
087:            }
088:
089:            /**
090:             * Is null a valid value for a column with a foreign key constraint?
091:             */
092:            public boolean isNullForeignKeyOk() {
093:                return true;
094:            }
095:
096:            /**
097:             * Must 'exists (select ...)' clauses be converted into a join and
098:             * distinct be added to the select (e.g. MySQL) ?
099:             */
100:            public boolean isConvertExistsToDistinctJoin() {
101:                return true;
102:            }
103:
104:            /**
105:             * Create a default name generator instance for JdbcStore's using this
106:             * driver.
107:             */
108:            public JdbcNameGenerator createJdbcNameGenerator() {
109:                DefaultJdbcNameGenerator n = createDefaultJdbcNameGenerator();
110:                n.setMaxColumnNameLength(31);
111:                n.setMaxTableNameLength(31);
112:                n.setMaxConstraintNameLength(31);
113:                n.setMaxTableNameLength(31);
114:                return n;
115:            }
116:
117:            /**
118:             * Append the allow nulls part of the definition for a column in a
119:             * create table statement.
120:             */
121:            protected void appendCreateColumnNulls(JdbcTable t, JdbcColumn c,
122:                    CharBuf s) {
123:                if (!c.nulls)
124:                    s.append(" not null");
125:            }
126:
127:            /**
128:             * Add the primary key constraint part of a create table statement to s.
129:             */
130:            protected void appendPrimaryKeyConstraint(JdbcTable t, CharBuf s) {
131:                s.append("constraint ");
132:                s.append(t.pkConstraintName);
133:                s.append(" primary key (");
134:                appendColumnNameList(t.pk, s);
135:                s.append(')');
136:            }
137:
138:            /**
139:             * Append an 'add constraint' statement for c.
140:             */
141:            protected void appendRefConstraint(CharBuf s, JdbcConstraint c) {
142:                s.append("alter table ");
143:                s.append(c.src.name);
144:                s.append(" add constraint ");
145:                s.append(c.name);
146:                s.append(" foreign key (");
147:                appendColumnNameList(c.srcCols, s);
148:                s.append(") references ");
149:                s.append(c.dest.name);
150:                s.append('(');
151:                appendColumnNameList(c.dest.pk, s);
152:                s.append(')');
153:            }
154:
155:            /**
156:             * Write an SQL statement to a script with appropriate separator.
157:             */
158:            protected void print(PrintWriter out, String sql) {
159:                out.print(sql);
160:                out.println(";");
161:                out.println();
162:            }
163:
164:            /**
165:             * Append the from list entry for a table.
166:             */
167:            public void appendSqlFrom(JdbcTable table, String alias, CharBuf s) {
168:                s.append(table.name);
169:                if (alias != null) {
170:                    s.append(" AS ");
171:                    s.append(alias);
172:                }
173:            }
174:
175:            /**
176:             * Append the from list entry for a table that is the right hand table
177:             * in a join i.e. it is being joined to.
178:             * @param exp This is the expression that joins the tables
179:             * @param outer If true then this is an outer join
180:             */
181:            public void appendSqlFromJoin(JdbcTable table, String alias,
182:                    SqlExp exp, boolean outer, CharBuf s) {
183:                if (outer)
184:                    s.append(" LEFT JOIN ");
185:                else
186:                    s.append(" JOIN ");
187:                s.append(table.name);
188:                if (alias != null) {
189:                    s.append(" AS ");
190:                    s.append(alias);
191:                }
192:                if (exp != null) {
193:                    s.append(" ON (");
194:                    exp.appendSQL(this , s, null);
195:                    s.append(')');
196:                }
197:            }
198:
199:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.