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, _lastUserModifier, _userCreator, id
Fields inherited from class com.denodo.vdb.catalog.storage.MetadataObject
latestModificationDate, latestModificationEpoch, latestModificationInstant
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal StoredProcedureResultSet
Method which executes the stored procedure.boolean
Returnstrue
if the field names defined by the stored procedure are case sensitive.void
close()
Deprecated.As of Denodo 5.5, this method is deprecated because it is never invoked.void
commit()
The Execution Engine invokes this method to confirm the current transaction.static final Array
createArray
(Collection<? extends Object> values, int type) Creates a SQL array object.static final Struct
createStruct
(List<String> fieldNames, List<? extends Object> values) Creates a SQL struct object.protected abstract void
The Execution Engine invokes this method when this procedure is called.
If the procedure has to return results, invokegetProcedureResultSet
from 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.ElementType
int
Deprecated.As of Denodo 5.5, this method is deprecated because its result is not used.final StoredProcedureResultSet
Obtains the execution result of the stored procedure.void
initialize
(DatabaseEnvironment newEnvironment) Initializes the stored procedure.final void
Log a message.void
prepare()
The Execution Engine invokes this method when it is about to begin a transaction involving this procedure.void
rollback()
The Execution Engine invokes this method to undo the current transaction.final void
setEnvironment
(DatabaseEnvironment environment) void
setUse60TypeMappings
(Boolean use60TypeMappings) boolean
stop()
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, getLastUserModifier, getName, getPublicNameById, getPublicNameByIds, getSessionWorkspace, getUserCreator, initialize, renameMetaObjectStored, setCreateDate, setElementDescription, setId, setLastUserModifier, setName, setUserCreator, storeRenamedMetaObject
Methods inherited from class com.denodo.vdb.catalog.storage.MetadataObject
getLatestModificationDate, getLatestModificationDateAsMillis, getLatestModificationEpoch, getLatestModificationInstant, setLatestModificationDate, setLatestModificationEpoch
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.denodo.vdb.engine.storedprocedure.StoredProcedure
getDescription, getName
Methods inherited from interface com.denodo.vdb.engine.storedprocedure.StoredProcedureExecutor
getParameters
-
Constructor Details
-
AbstractStoredProcedure
public AbstractStoredProcedure()Constructor.
-
-
Method Details
-
initialize
Description copied from interface:StoredProcedure
Initializes the stored procedure.- Specified by:
initialize
in 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:StoredProcedureExecutor
Method which executes the stored procedure.- Specified by:
call
in 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, invokegetProcedureResultSet
from this method, to obtain an object of the classStoredProcedureResultSet
, which will contain the results that this procedure will return. Then, invoke its methodStoredProcedureResultSet.addRow
for 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:StoredProcedureExecutor
Obtains the execution result of the stored procedure. This method is used to add results to the stored procedure.- Specified by:
getProcedureResultSet
in interfaceStoredProcedureExecutor
- Returns:
- the execution result of the stored procedure.
- See Also:
-
prepare
public void prepare()Description copied from interface:StoredProcedure
The Execution Engine invokes this method when it is about to begin a transaction involving this procedure.- Specified by:
prepare
in interfaceStoredProcedure
- See Also:
-
commit
public void commit()Description copied from interface:StoredProcedure
The Execution Engine invokes this method to confirm the current transaction.- Specified by:
commit
in interfaceStoredProcedure
- See Also:
-
rollback
public void rollback()Description copied from interface:StoredProcedure
The Execution Engine invokes this method to undo the current transaction.- Specified by:
rollback
in 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:StoredProcedureExecutor
Releases the stored procedure resources.- Specified by:
close
in 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:StoredProcedureExecutor
Obtains the number of rows in the database which have been written, deleted or modified.- Specified by:
getNumOfAffectedRows
in 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:StoredProcedure
The Execution Engine invokes this method when a query involving the stored procedure is cancelled. The classAbstractStoredProcedure
provides 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:
stop
in interfaceStoredProcedure
- Returns:
true
if the execution of the procedure has finished.false
otherwise.- See Also:
-
caseSensitiveParameters
public boolean caseSensitiveParameters()Description copied from interface:StoredProcedure
Returnstrue
if the field names defined by the stored procedure are case sensitive. If not, they are converted to lower case.- Specified by:
caseSensitiveParameters
in interfaceStoredProcedure
- Returns:
true
if the field names defined by the stored procedure are case sensitive.false
otherwise- See Also:
-
setEnvironment
- Specified by:
setEnvironment
in 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:
getElementType
in classcom.denodo.vdb.catalog.storage.MetaObjectStored
-