1 package com.daffodilwoods.daffodildb.server.sql99.expression.booleanvalueexpression; 2 3 import com.daffodilwoods.daffodildb.server.serversystem.*; 4 import com.daffodilwoods.daffodildb.server.sql99.*; 5 import com.daffodilwoods.daffodildb.server.sql99.common.*; 6 import com.daffodilwoods.daffodildb.server.sql99.ddl.descriptors.*; 7 import com.daffodilwoods.daffodildb.server.sql99.expression.expressionprimary.*; 8 import com.daffodilwoods.daffodildb.server.sql99.utils.*; 9 import com.daffodilwoods.daffodildb.utils.*; 10 import com.daffodilwoods.daffodildb.utils.field.*; 11 import com.daffodilwoods.database.resource.*; 12 13 public class RecursiveRoutineExecuter implements _Executer { 14 private SQLargumentlist _SQLargumentlist; 15 private RoutineDescriptor routineDescriptor; 16 private ParametersDescriptor[] parameters; 17 private _ServerSession currentSession; 18 private _Executer parentExecuter = null; 19 private int routineCount; 20 21 public RecursiveRoutineExecuter(_ServerSession currentSession0, SQLargumentlist _SQLargumentlist0, RoutineDescriptor routineDescriptor0, ParametersDescriptor[] parameters0, _Executer parentExecuter0) { 22 _SQLargumentlist = _SQLargumentlist0; 23 routineDescriptor = routineDescriptor0; 24 parameters = parameters0; 25 currentSession = currentSession0; 26 parentExecuter = parentExecuter0; 27 } 28 29 public Object execute(_VariableValues variableValues) throws DException { 30 int numberOfParametersInParameterList = _SQLargumentlist.getNumberOfParametersInArgumentList(); 31 Object [] values = null; 32 Object obj = null; 33 if (numberOfParametersInParameterList != 0) { 34 if (_SQLargumentlist.getParameterReferences() == null) { 35 values = (Object []) _SQLargumentlist.run(variableValues == null ? new VariableValues(currentSession) : variableValues); 36 } else { 37 values = (Object []) _SQLargumentlist.run(variableValues == null ? new VariableValues(_SQLargumentlist.getParameterReferences(), currentSession) : variableValues); 38 } 39 try { 40 routineCount++; 41 if (routineCount > 32) 42 throw new DException("DSE8160", null); 43 Object [] result = (Object []) ( (routineinvocation) parentExecuter).executeRoutine(values); 44 obj = ( (routineinvocation) parentExecuter).makeResultObject(values, result); 45 } finally { 46 routineCount--; 47 } 48 } else { 49 try { 50 routineCount++; 51 if (routineCount > 32) 52 throw new DException("DSE8160", null); 53 obj = parentExecuter.execute(values); 54 } finally { 55 routineCount--; 56 } 57 } 58 60 66 return obj; 67 } 68 69 public Object execute(Object [] values) throws DException { 70 throw new java.lang.UnsupportedOperationException ("Method execute() not yet implemented."); 71 } 72 73 public Object executeForFresh(Object [] values) throws DException { 74 throw new java.lang.UnsupportedOperationException ("Method executeForFresh() not yet implemented."); 75 } 76 77 private DataTypeDescriptor getDataTypeDescriptor(_ServerSession currentSession) throws DException { 78 DataTypeDescriptor dt = new DataTypeDescriptor(); 79 dt.object_catalog = routineDescriptor.SPECIFIC_CATALOG; 80 dt.object_schema = routineDescriptor.SPECIFIC_SCHEMA; 81 dt.object_name = routineDescriptor.SPECIFIC_NAME; 82 dt.object_type = SqlKeywords.ROUTINE; 83 dt.dtd_identifier = "dummy"; 84 dt.load(currentSession); 85 return dt; 86 } 87 } 88 | Popular Tags |