1 /* 2 3 Derby - Class org.apache.derby.iapi.sql.execute.ExecPreparedStatement 4 5 Licensed to the Apache Software Foundation (ASF) under one or more 6 contributor license agreements. See the NOTICE file distributed with 7 this work for additional information regarding copyright ownership. 8 The ASF licenses this file to you under the Apache License, Version 2.0 9 (the "License"); you may not use this file except in compliance with 10 the License. You may obtain a copy of the License at 11 12 http://www.apache.org/licenses/LICENSE-2.0 13 14 Unless required by applicable law or agreed to in writing, software 15 distributed under the License is distributed on an "AS IS" BASIS, 16 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 See the License for the specific language governing permissions and 18 limitations under the License. 19 20 */ 21 22 package org.apache.derby.iapi.sql.execute; 23 24 import org.apache.derby.iapi.services.loader.GeneratedClass; 25 26 import org.apache.derby.iapi.error.StandardException; 27 28 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext; 29 30 import org.apache.derby.iapi.sql.PreparedStatement; 31 import org.apache.derby.iapi.sql.ResultColumnDescriptor; 32 33 import java.util.List; 34 35 /** 36 * Execution extends prepared statement to add methods it needs 37 * for execution purposes (that should not be on the Database API). 38 * 39 * @author ames 40 */ 41 public interface ExecPreparedStatement 42 extends PreparedStatement { 43 44 /** 45 * set the statement text 46 * 47 * @param txt the source text 48 */ 49 void setSource(String txt); 50 51 /** 52 * Get the Execution constants. This routine is called at Execution time. 53 * 54 * @return ConstantAction The big structure enclosing the Execution constants. 55 */ 56 ConstantAction getConstantAction( ); 57 58 /** 59 * Get a saved object by number. This is called during execution to 60 * access objects created at compile time. These are meant to be 61 * read-only at run time. 62 * 63 * @return Object A saved object. The caller has to know what 64 * it is requesting and cast it back to the expected type. 65 */ 66 Object getSavedObject(int objectNum); 67 68 /** 69 * Get all the saved objects. Used for stored prepared 70 * statements. 71 * 72 * @return Object[] the saved objects 73 */ 74 Object[] getSavedObjects(); 75 76 /** 77 * Get the saved cursor info. Used for stored prepared 78 * statements. 79 * 80 * @return Object the cursor info 81 */ 82 Object getCursorInfo(); 83 84 /** 85 * Get the class generated for this prepared statement. 86 * Used to confirm compatability with auxilary structures. 87 * 88 * @exception StandardException on error obtaining class 89 * (probably when a stored prepared statement is loading) 90 */ 91 GeneratedClass getActivationClass() throws StandardException; 92 93 /** 94 * Mark the statement as unusable, i.e. the system is 95 * finished with it and no one should be able to use it. 96 */ 97 void finish(LanguageConnectionContext lcc); 98 99 /** 100 * Does this statement need a savpoint 101 * 102 * @return true if needs a savepoint 103 */ 104 boolean needsSavepoint(); 105 106 /** 107 * Get a new prepared statement that is a shallow copy 108 * of the current one. 109 * 110 * @return a new prepared statement 111 * 112 * @exception StandardException on error 113 */ 114 public ExecPreparedStatement getClone() throws StandardException; 115 116 /* Methods from old CursorPreparedStatement */ 117 118 /** 119 * the update mode of the cursor 120 * 121 * @return The update mode of the cursor 122 */ 123 int getUpdateMode(); 124 125 /** 126 * the target table of the cursor 127 * 128 * @return target table of the cursor 129 */ 130 ExecCursorTableReference getTargetTable(); 131 132 /** 133 * the target columns of the cursor; this is a superset of 134 * the updatable columns, describing the row available 135 * 136 * @return target columns of the cursor as an array of column descriptors 137 */ 138 ResultColumnDescriptor[] getTargetColumns(); 139 140 /** 141 * the update columns of the cursor 142 * 143 * @return update columns of the cursor as a string of column names 144 */ 145 String[] getUpdateColumns(); 146 147 /** 148 * set this parepared statement to be valid 149 */ 150 void setValid(); 151 152 /** 153 * Indicate that the statement represents an SPS action 154 */ 155 void setSPSAction(); 156 157 /** 158 * @return the list of permissions required to execute this statement. May be null if 159 * the database does not use SQL standard authorization 160 */ 161 List getRequiredPermissionsList(); 162 } 163 164