Package org.apache.openjpa.jdbc.sql
Class StoredProcedure
java.lang.Object
org.apache.openjpa.jdbc.sql.StoredProcedure
Holds metadata about a Database Stored Procedure.
This is different than
An instance of this class can be constructed either by reading from database meta data or by programatic assignment. If an instance if created programmatically, then its SQL body or parameters can be added.
This class can generate the SQL statement to create, drop or delete this procedure.
MultiQueryMetaData
which holds the metadata
about what the user has specified.
An instance of this class can be constructed either by reading from database meta data or by programatic assignment. If an instance if created programmatically, then its SQL body or parameters can be added.
This class can generate the SQL statement to create, drop or delete this procedure.
- Author:
- Pinaki Poddar
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
An enumeration on type of parameter for a Stored Procedure.static enum
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddParameter
(String var, String typeName) Adds anIN
parameter of the given name and type.addParameter
(StoredProcedure.PARAM param, String var, String typeName) Adds the given parameter declaration.Gets the SQL for calling this procedure.Column[]
Gets the SQL for creating this procedure.Gets the SQL for dropping this procedure.Column[]
Column[]
getName()
Gets the name of this procedure.Column[]
Column[]
Column[]
void
setCatalog
(DBIdentifier catalog) setExternalName
(Class<?> cls, String method, Class<?>... paramTypes) setLanguage
(String language) void
setParameterStyle
(String lang) Sets the language whose parameter passing convention will be used to pass paramater values.setResult
(int i) setResult
(int i, boolean dynamic) void
setSchema
(DBIdentifier schema) Adds a read SQL statement via an external method.toString()
-
Constructor Details
-
StoredProcedure
Create a procedure of the given name. -
StoredProcedure
1. PROCEDURE_CAT - String - the procedure catalog name 2. PROCEDURE_SCHEM - String - the procedure schema name (possibly null) 3. PROCEDURE_NAME - String - the procedure name 4. COLUMN_NAME - String - the name of the column 5. COLUMN_TYPE - short - the kind of column or parameter, as follows: DatabaseMetaData.procedureColumnUnknown - type unknown DatabaseMetaData.procedureColumnIn - an IN parameter DatabaseMetaData.procedureColumnInOut - an INOUT parameter DatabaseMetaData.procedureColumnOut - an OUT parameter DatabaseMetaData.procedureColumnReturn - a return value DatabaseMetaData.procedureReturnsResult - a result column in a result set 6. DATA_TYPE - int - the SQL type of the data, as in java.sql.Types 7. TYPE_NAME - String - the SQL type name, for a UDT it is fully qualified 8. PRECISION - int - the precision 9. LENGTH - int - the length of the data in bytes 10.SCALE - short - the scale for numeric types 11.RADIX - short - the Radix for numeric data (typically 2 or 10) 12.NULLABLE - short - can the data contain null: DatabaseMetaData.procedureNoNulls - NULLs not permitted DatabaseMetaData.procedureNullable - NULLs are permitted DatabaseMetaData.procedureNullableUnknown - NULL status unknown 13.REMARKS - String - an explanatory comment about the data item
- Throws:
SQLException
-
-
Method Details
-
setCatalog
-
setSchema
-
setName
-
getInColumns
-
getInOutColumns
-
getOutColumns
-
getReturnColumns
-
getResultColumns
-
getColumns
-
getName
Gets the name of this procedure. -
addParameter
Adds anIN
parameter of the given name and type.- Parameters:
var
- name of the variabletypeName
- name of the SQL type e.g.VARCAR(32)
- Returns:
- this procedure instance
-
addParameter
Adds the given parameter declaration.- Parameters:
param
- type of parameter.var
- name of the variabletypeName
- name of the SQL type e.g.VARCAR(32)
- Returns:
- this procedure instance
-
setLanguage
-
getCreateSQL
Gets the SQL for creating this procedure. -
getDropSQL
Gets the SQL for dropping this procedure. -
getCallSQL
Gets the SQL for calling this procedure. -
setSQL
Adds a read SQL statement via an external method. -
setParameterStyle
Sets the language whose parameter passing convention will be used to pass paramater values.- Parameters:
lang
-- Returns:
-
setExternalName
-
setResult
-
setResult
-
toString
-