Package com.mckoi.database
Class ProcedureManager
java.lang.Object
com.mckoi.database.ProcedureManager
A DatabaseConnection procedure manager. This controls adding, updating,
deleting and querying/calling stored procedures.
- Author:
- Tobias Downer
-
Method Summary
Modifier and TypeMethodDescriptionvoid
defineJavaProcedure
(ProcedureName procedure_name, String java_specification, TType return_type, TType[] param_types, String username) Defines a Java stored procedure.void
deleteProcedure
(ProcedureName procedure_name) Deletes the procedure with the given name, or generates an error if the procedure doesn't exist.invokeProcedure
(ProcedureName procedure_name, TObject[] params) Invokes the procedure with the given name and the given parameters and returns the procedure return value.static Method
javaProcedureMethod
(String location_str, TType[] param_types) Given a Java location_str and a list of parameter types, returns an immutable 'Method' object that can be used to invoke a Java stored procedure.static String[]
Given a location string as defined for a Java stored procedure, this parses the string into the various parts.boolean
procedureExists
(ProcedureName procedure_name) Returns true if the procedure with the given name exists.boolean
procedureExists
(TableName procedure_name) Returns true if the procedure with the given table name exists.
-
Method Details
-
parseJavaLocationString
Given a location string as defined for a Java stored procedure, this parses the string into the various parts. For example, given the string 'com.mycompany.storedprocedures.MyFunctions.minFunction()' this will parse the string out to the class called 'com.mycompany.storedprocedures.MyFunctions' and the method 'minFunction' with no arguments. This function will work event if the method name is not given, or the method name does not have an arguments specification. -
procedureExists
Returns true if the procedure with the given name exists. -
procedureExists
Returns true if the procedure with the given table name exists. -
defineJavaProcedure
public void defineJavaProcedure(ProcedureName procedure_name, String java_specification, TType return_type, TType[] param_types, String username) throws DatabaseException Defines a Java stored procedure. If the procedure with the name has not been defined it is defined. If the procedure has been defined then it is overwritten with this information.If 'return_type' is null then the procedure does not return a value.
- Throws:
DatabaseException
-
deleteProcedure
Deletes the procedure with the given name, or generates an error if the procedure doesn't exist.- Throws:
DatabaseException
-
invokeProcedure
Invokes the procedure with the given name and the given parameters and returns the procedure return value. -
javaProcedureMethod
Given a Java location_str and a list of parameter types, returns an immutable 'Method' object that can be used to invoke a Java stored procedure. The returned object can be cached if necessary. Note that this method will generate an error for the following situations: a) The invokation class or method was not found, b) there is not an invokation method with the required number of arguments or that matches the method specification.Returns null if the invokation method could not be found.
-