Class AbstractStoredProcedure
java.lang.Object
com.denodo.vdb.catalog.storage.MetadataObject
com.denodo.vdb.catalog.storage.MetaObjectStored
com.denodo.vdb.engine.storedprocedure.AbstractStoredProcedure
- All Implemented Interfaces:
StoredProcedure,StoredProcedureExecutor,Serializable
public abstract class AbstractStoredProcedure
extends com.denodo.vdb.catalog.storage.MetaObjectStored
implements StoredProcedure
This class should be extended by all the stored procedures. The specific
procedures must implement the method
doCall, and should use
the method getProcedureResultSet to add the generated results.- See Also:
-
Field Summary
Fields inherited from class com.denodo.vdb.catalog.storage.MetaObjectStored
_createDate, _description, _lastDirectUserModifier, _lastUserModifier, _userCreator, idFields inherited from class com.denodo.vdb.catalog.storage.MetadataObject
latestDirectModificationDate, latestModificationDate, latestModificationEpoch, latestModificationInstant -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal StoredProcedureResultSetMethod which executes the stored procedure.booleanReturnstrueif the field names defined by the stored procedure are case sensitive.voidclose()Deprecated.As of Denodo 5.5, this method is deprecated because it is never invoked.voidcommit()The Execution Engine invokes this method to confirm the current transaction.static final ArraycreateArray(Collection<? extends Object> values, int type) Creates a SQL array object.static final StructcreateStruct(List<String> fieldNames, List<? extends Object> values) Creates a SQL struct object.protected abstract voidThe Execution Engine invokes this method when this procedure is called.
If the procedure has to return results, invokegetProcedureResultSetfrom this method, to obtain an object of the classStoredProcedureResultSet, which will contain the results that this procedure will return.final StoredProcedureParameter[]Returns the parameters created by this procedure when it was created.com.denodo.vdb.interpreter.parser.ElementTypeintDeprecated.As of Denodo 5.5, this method is deprecated because its result is not used.final StoredProcedureResultSetObtains the execution result of the stored procedure.voidinitialize(DatabaseEnvironment newEnvironment) Initializes the stored procedure.final voidLog a message.voidprepare()The Execution Engine invokes this method when it is about to begin a transaction involving this procedure.voidrollback()The Execution Engine invokes this method to undo the current transaction.final voidsetEnvironment(DatabaseEnvironment environment) voidsetUse60TypeMappings(Boolean use60TypeMappings) booleanstop()The Execution Engine invokes this method when a query involving the stored procedure is cancelled.Methods inherited from class com.denodo.vdb.catalog.storage.MetaObjectStored
copyPropertiesToObject, exists, existsObjectByNameIgnoringCase, findByPublicName, findByPublicName, findByPublicName, findByPublicName, findIdByName, findIdsByName, getCreateDate, getCreateDateAsMillis, getElementDescription, getId, getIdByPublicName, getIdByPublicName, getJars, getLastDirectUserModifier, getLastUserModifier, getName, getPublicNameById, getPublicNameByIds, getSessionWorkspace, getUserCreator, initialize, renameMetaObjectStored, setCreateDate, setElementDescription, setId, setLastDirectUserModifier, setLastUserModifier, setName, setUserCreator, storeRenamedMetaObjectMethods inherited from class com.denodo.vdb.catalog.storage.MetadataObject
getLatestDirectModificationDate, getLatestDirectModificationDateAsMillis, getLatestModificationDate, getLatestModificationDateAsMillis, getLatestModificationEpoch, getLatestModificationInstant, setLatestDirectModificationDate, setLatestModificationDate, setLatestModificationEpochMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.denodo.vdb.engine.storedprocedure.StoredProcedure
getDescription, getNameMethods inherited from interface com.denodo.vdb.engine.storedprocedure.StoredProcedureExecutor
getParameters
-
Constructor Details
-
AbstractStoredProcedure
public AbstractStoredProcedure()
-
-
Method Details
-
initialize
Description copied from interface:StoredProcedureInitializes the stored procedure.- Specified by:
initializein interfaceStoredProcedure- Parameters:
newEnvironment- An object which allows to the procedure to communicate with the VDP server.- See Also:
-
call
public final StoredProcedureResultSet call(String accessName, Object[] inputValues, com.denodo.vdb.misc.IContext context) Description copied from interface:StoredProcedureExecutorMethod which executes the stored procedure.- Specified by:
callin interfaceStoredProcedureExecutor- Parameters:
accessName- the name of the procedure access.inputValues- the input parameters of the procedure.context- the execution context.- Returns:
- the result of the stored procedure execution.
- See Also:
-
doCall
The Execution Engine invokes this method when this procedure is called.
If the procedure has to return results, invokegetProcedureResultSetfrom this method, to obtain an object of the classStoredProcedureResultSet, which will contain the results that this procedure will return. Then, invoke its methodStoredProcedureResultSet.addRowfor each row you want to return.- Parameters:
inputValues- The list of parameters of the procedure.- Throws:
StoredProcedureException- if there is any error executing the procedure.
-
getProcedureResultSet
Description copied from interface:StoredProcedureExecutorObtains the execution result of the stored procedure. This method is used to add results to the stored procedure.- Specified by:
getProcedureResultSetin interfaceStoredProcedureExecutor- Returns:
- the execution result of the stored procedure.
- See Also:
-
prepare
public void prepare()Description copied from interface:StoredProcedureThe Execution Engine invokes this method when it is about to begin a transaction involving this procedure.- Specified by:
preparein interfaceStoredProcedure- See Also:
-
commit
public void commit()Description copied from interface:StoredProcedureThe Execution Engine invokes this method to confirm the current transaction.- Specified by:
commitin interfaceStoredProcedure- See Also:
-
rollback
public void rollback()Description copied from interface:StoredProcedureThe Execution Engine invokes this method to undo the current transaction.- Specified by:
rollbackin interfaceStoredProcedure- See Also:
-
close
Deprecated.As of Denodo 5.5, this method is deprecated because it is never invoked.
It will be removed in future versions of the Denodo Platform.Description copied from interface:StoredProcedureExecutorReleases the stored procedure resources.- Specified by:
closein interfaceStoredProcedureExecutor- See Also:
-
getNumOfAffectedRows
Deprecated.As of Denodo 5.5, this method is deprecated because its result is not used.
It will be removed in future versions of the Denodo Platform.Description copied from interface:StoredProcedureExecutorObtains the number of rows in the database which have been written, deleted or modified.- Specified by:
getNumOfAffectedRowsin interfaceStoredProcedureExecutor- Returns:
- the number of rows in the database which have been written, deleted or modified.
- See Also:
-
stop
public boolean stop()Description copied from interface:StoredProcedureThe Execution Engine invokes this method when a query involving the stored procedure is cancelled. The classAbstractStoredProcedureprovides a default implementation of this method that does not do anything and only returnsfalse.
If the tasks executed by this procedure can be cancelled, override this method and cancel them. If this procedure opens any connection to other systems, opens files, etc., close these resources from this method.
If this method returnstrue, the procedure must guarantee that it will finish after this method is invoked. If the procedure will not finish after invoking this procedure, returnfalse.
If this procedure does not overwrite this method, the Execution Engine will try to interrupt the execution of this procedure and the queries started by it. Therefore, overwriting this method is not mandatory, although recommended.- Specified by:
stopin interfaceStoredProcedure- Returns:
trueif the execution of the procedure has finished.falseotherwise.- See Also:
-
caseSensitiveParameters
public boolean caseSensitiveParameters()Description copied from interface:StoredProcedureReturnstrueif the field names defined by the stored procedure are case sensitive. If not, they are converted to lower case.- Specified by:
caseSensitiveParametersin interfaceStoredProcedure- Returns:
trueif the field names defined by the stored procedure are case sensitive.falseotherwise- See Also:
-
setEnvironment
- Specified by:
setEnvironmentin interfaceStoredProcedure- Parameters:
environment- An object which allows to the procedure to communicate with the Virtual DataPort server.- See Also:
-
createArray
Creates a SQL array object.- Parameters:
values- the values used to create the array.type- the SQL type of the values.- Returns:
- a java.sql.Array instance.
-
createStruct
public static final Struct createStruct(List<String> fieldNames, List<? extends Object> values) throws SQLException Creates a SQL struct object.- Parameters:
fieldNames- a list with the names of the struct fields.values- a list with the struct values.- Returns:
- a java.sql.Struct instance.
- Throws:
SQLException- if there is any error creating the struct.
-
getCachedParameters
Returns the parameters created by this procedure when it was created.- Returns:
- the cachedParameters
-
getEnvironment
- Returns:
- the environment, object which allows to the procedure to communicate with the VDP server
-
log
Log a message.
If the Level is currently enabled for the given level, the message is forwarded to the logging system.
This is equivalent to invoking the methodDatabaseEnvironment.log(int,String)- Parameters:
level- One of the following message level identifiers:logMessage- The string message
-
setUse60TypeMappings
-
getUse60TypeMappings
-
getElementType
public com.denodo.vdb.interpreter.parser.ElementType getElementType()- Specified by:
getElementTypein classcom.denodo.vdb.catalog.storage.MetaObjectStored
-