1 21 22 package org.apache.derby.impl.sql.compile; 23 24 import org.apache.derby.iapi.services.context.ContextManager; 25 26 import org.apache.derby.iapi.sql.compile.CompilerContext; 27 28 import org.apache.derby.iapi.services.compiler.MethodBuilder; 29 30 import org.apache.derby.iapi.services.sanity.SanityManager; 31 32 import org.apache.derby.iapi.jdbc.ConnectionContext; 33 34 import org.apache.derby.iapi.error.StandardException; 35 36 import org.apache.derby.iapi.sql.dictionary.DataDictionary; 37 38 import org.apache.derby.iapi.types.TypeId; 39 40 import org.apache.derby.iapi.types.DataValueFactory; 41 import org.apache.derby.iapi.services.classfile.VMOpcode; 42 43 44 import org.apache.derby.iapi.store.access.Qualifier; 45 46 import org.apache.derby.impl.sql.compile.ExpressionClassBuilder; 47 import org.apache.derby.impl.sql.execute.BaseActivation; 48 49 import org.apache.derby.iapi.util.JBitSet; 50 51 import org.apache.derby.catalog.TypeDescriptor; 52 import org.apache.derby.iapi.reference.ClassName; 53 54 import java.sql.SQLException ; 55 import java.sql.Types ; 56 57 import java.util.Vector ; 58 59 67 68 public final class GetCurrentConnectionNode extends JavaValueNode 69 { 70 74 75 public GetCurrentConnectionNode() 76 { 77 81 82 setJavaTypeName("java.sql.Connection"); 83 } 84 85 94 95 public JavaValueNode bindExpression( 96 FromList fromList, SubqueryList subqueryList, 97 Vector aggregateVector) 98 throws StandardException 99 { 100 return this; 101 } 102 103 116 public void preprocess(int numTables, 117 FromList outerFromList, 118 SubqueryList outerSubqueryList, 119 PredicateList outerPredicateList) 120 throws StandardException 121 { 122 } 123 124 148 public boolean categorize(JBitSet referencedTabs, boolean simplePredsOnly) 149 { 150 return false; 151 } 152 153 160 public JavaValueNode remapColumnReferencesToExpressions() 161 { 162 return this; 163 } 164 165 168 169 void bindParameter() 170 { 171 } 172 173 185 protected int getOrderableVariantType() 186 { 187 return Qualifier.QUERY_INVARIANT; 188 } 189 198 public void generateExpression(ExpressionClassBuilder acb, 199 MethodBuilder mb) 200 throws StandardException 201 { 202 mb.pushThis(); 203 mb.callMethod(VMOpcode.INVOKEVIRTUAL, ClassName.BaseActivation, "getCurrentConnection", getJavaTypeName(), 0); 204 } 205 206 213 public void checkReliability(ValueNode sqlNode) 214 throws StandardException { 215 sqlNode.checkReliability("getCurrentConnection()", 216 CompilerContext.CURRENT_CONNECTION_ILLEGAL); 217 } 218 219 } 220 | Popular Tags |