Source Code Cross Referenced for GetCurrentConnectionNode.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » impl » sql » compile » 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 DBMS » db derby 10.2 » org.apache.derby.impl.sql.compile 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:           Derby - Class org.apache.derby.impl.sql.compile.GetCurrentConnectionNode
004:
005:           Licensed to the Apache Software Foundation (ASF) under one or more
006:           contributor license agreements.  See the NOTICE file distributed with
007:           this work for additional information regarding copyright ownership.
008:           The ASF licenses this file to you under the Apache License, Version 2.0
009:           (the "License"); you may not use this file except in compliance with
010:           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, software
015:           distributed under the License is distributed on an "AS IS" BASIS,
016:           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017:           See the License for the specific language governing permissions and
018:           limitations under the License.
019:
020:         */
021:
022:        package org.apache.derby.impl.sql.compile;
023:
024:        import org.apache.derby.iapi.services.context.ContextManager;
025:
026:        import org.apache.derby.iapi.sql.compile.CompilerContext;
027:
028:        import org.apache.derby.iapi.services.compiler.MethodBuilder;
029:
030:        import org.apache.derby.iapi.services.sanity.SanityManager;
031:
032:        import org.apache.derby.iapi.jdbc.ConnectionContext;
033:
034:        import org.apache.derby.iapi.error.StandardException;
035:
036:        import org.apache.derby.iapi.sql.dictionary.DataDictionary;
037:
038:        import org.apache.derby.iapi.types.TypeId;
039:
040:        import org.apache.derby.iapi.types.DataValueFactory;
041:        import org.apache.derby.iapi.services.classfile.VMOpcode;
042:
043:        import org.apache.derby.iapi.store.access.Qualifier;
044:
045:        import org.apache.derby.impl.sql.compile.ExpressionClassBuilder;
046:        import org.apache.derby.impl.sql.execute.BaseActivation;
047:
048:        import org.apache.derby.iapi.util.JBitSet;
049:
050:        import org.apache.derby.catalog.TypeDescriptor;
051:        import org.apache.derby.iapi.reference.ClassName;
052:
053:        import java.sql.SQLException;
054:        import java.sql.Types;
055:
056:        import java.util.Vector;
057:
058:        /**
059:         * This node represents a unary getCurrentConnection operator
060:         * RESOLVE - parameter will always be null for now.  Someday
061:         * we may want to allow user to specify which of their connections
062:         * they want.  Assume that we will use a String.
063:         *
064:         * @author Jerry Brenner
065:         */
066:
067:        public final class GetCurrentConnectionNode extends JavaValueNode {
068:            /**
069:             * Constructor for a GetCurrentConnectionNode
070:             *
071:             */
072:
073:            public GetCurrentConnectionNode() {
074:                /*
075:                 ** The result type of getCurrentConnection is
076:                 ** java.sql.Connection
077:                 */
078:
079:                setJavaTypeName("java.sql.Connection");
080:            }
081:
082:            /**
083:             * Bind this operator
084:             *
085:             * @param fromList			The query's FROM list
086:             * @param subqueryList		The subquery list being built as we find SubqueryNodes
087:             * @param aggregateVector	The aggregate vector being built as we find AggregateNodes
088:             *
089:             * @exception StandardException		Thrown on error
090:             */
091:
092:            public JavaValueNode bindExpression(FromList fromList,
093:                    SubqueryList subqueryList, Vector aggregateVector)
094:                    throws StandardException {
095:                return this ;
096:            }
097:
098:            /**
099:             * Preprocess an expression tree.  We do a number of transformations
100:             * here (including subqueries, IN lists, LIKE and BETWEEN) plus
101:             * subquery flattening.
102:             * NOTE: This is done before the outer ResultSetNode is preprocessed.
103:             *
104:             * @param	numTables			Number of tables in the DML Statement
105:             * @param	outerFromList		FromList from outer query block
106:             * @param	outerSubqueryList	SubqueryList from outer query block
107:             * @param	outerPredicateList	PredicateList from outer query block
108:             *
109:             * @exception StandardException		Thrown on error
110:             */
111:            public void preprocess(int numTables, FromList outerFromList,
112:                    SubqueryList outerSubqueryList,
113:                    PredicateList outerPredicateList) throws StandardException {
114:            }
115:
116:            /**
117:             * Categorize this predicate.  Initially, this means
118:             * building a bit map of the referenced tables for each predicate.
119:             * If the source of this ColumnReference (at the next underlying level)
120:             * is not a ColumnReference or a VirtualColumnNode then this predicate
121:             * will not be pushed down.
122:             *
123:             * For example, in:
124:             *		select * from (select 1 from s) a (x) where x = 1
125:             * we will not push down x = 1.
126:             * NOTE: It would be easy to handle the case of a constant, but if the
127:             * inner SELECT returns an arbitrary expression, then we would have to copy
128:             * that tree into the pushed predicate, and that tree could contain
129:             * subqueries and method calls.
130:             * RESOLVE - revisit this issue once we have views.
131:             *
132:             * @param referencedTabs	JBitSet with bit map of referenced FromTables
133:             * @param simplePredsOnly	Whether or not to consider method
134:             *							calls, field references and conditional nodes
135:             *							when building bit map
136:             *
137:             * @return boolean		Whether or not source.expression is a ColumnReference
138:             *						or a VirtualColumnNode.
139:             */
140:            public boolean categorize(JBitSet referencedTabs,
141:                    boolean simplePredsOnly) {
142:                return false;
143:            }
144:
145:            /**
146:             * Remap all ColumnReferences in this tree to be clones of the
147:             * underlying expression.
148:             *
149:             * @return JavaValueNode			The remapped expression tree.
150:             *
151:             */
152:            public JavaValueNode remapColumnReferencesToExpressions() {
153:                return this ;
154:            }
155:
156:            /**
157:             * Bind a ? parameter operand of the char_length function.
158:             */
159:
160:            void bindParameter() {
161:            }
162:
163:            /**
164:             * Return the variant type for the underlying expression.
165:             * The variant type can be:
166:             *		VARIANT				- variant within a scan
167:             *							  (method calls and non-static field access)
168:             *		SCAN_INVARIANT		- invariant within a scan
169:             *							  (column references from outer tables)
170:             *		QUERY_INVARIANT		- invariant within the life of a query
171:             *							  (constant expressions)
172:             *
173:             * @return	The variant type for the underlying expression.
174:             */
175:            protected int getOrderableVariantType() {
176:                return Qualifier.QUERY_INVARIANT;
177:            }
178:
179:            /**
180:             *
181:             * @see ConstantNode#generateExpression
182:             *
183:             * @param acb	The ExpressionClassBuilder for the class being built
184:             * @param mb	The method the code to place the code
185:             *
186:             * @exception StandardException		Thrown on error
187:             */
188:            public void generateExpression(ExpressionClassBuilder acb,
189:                    MethodBuilder mb) throws StandardException {
190:                mb.pushThis();
191:                mb.callMethod(VMOpcode.INVOKEVIRTUAL, ClassName.BaseActivation,
192:                        "getCurrentConnection", getJavaTypeName(), 0);
193:            }
194:
195:            /**
196:            	Check the reliability type of this java value.
197:
198:                @exception StandardException		Thrown on error
199:
200:            	@see org.apache.derby.iapi.sql.compile.CompilerContext
201:             */
202:            public void checkReliability(ValueNode sqlNode)
203:                    throws StandardException {
204:                sqlNode.checkReliability("getCurrentConnection()",
205:                        CompilerContext.CURRENT_CONNECTION_ILLEGAL);
206:            }
207:
208:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.