Package com.nordstrom.common.jdbc
Interface DatabaseUtils.SProcAPI
-
- Enclosing class:
- DatabaseUtils
public static interface DatabaseUtils.SProcAPI
This interface defines the API supported by database stored procedure collections.Each entry in the collection declares a signature, which consists of the name of the stored procedure and a parenthesized, comma-delimited list of zero or more argument place holders. Each argument place holder in the signature indicates the mode of the corresponding parameter:
- '>' indicates an IN parameter
- '<' indicates an OUT parameter
- '=' indicates an INOUT parameter
varargs
). This indicates that an array of zero or more values will complete the place holder.EXAMPLE SIGNATURE:
NORMALIZE_PRICES(>, <, =:)
Stored procedures whose signatures declare one or more arguments must also define the associated types for those arguments. Type specifiers are defined by the JDBC API in the- The first argument is an IN parameter
- The second argument is an OUT parameter
- The third argument is an array of zero or more INOUT parameters
Types
class. A type specifier must be provided for each place holder in the signature.To support execution of stored procedures on multiple endpoints, implement
getConnection()
with sub-configurations or other dynamic data sources (e.g. - web service).EXAMPLE STORED PROCEDURE COLLECTION
public enum SProcValues implements SProcAPI { /** args: [ ] */ SHOW_SUPPLIERS("SHOW_SUPPLIERS()"), /** args: [ coffee_name, supplier_name ] */ GET_SUPPLIER_OF_COFFEE("GET_SUPPLIER_OF_COFFEE(>, <)", Types.VARCHAR, Types.VARCHAR), /** args: [ coffee_name, max_percent, new_price ] */ RAISE_PRICE("RAISE_PRICE(>, >, =)", Types.VARCHAR, Types.REAL, Types.NUMERIC), /** args: [ str, val... ] */ IN_VARARGS("IN_VARARGS(<, >:)", Types.VARCHAR, Types.INTEGER), /** args: [ val, str... ] */ OUT_VARARGS("OUT_VARARGS(>, <:)", Types.INTEGER, Types.VARCHAR); private int[] argTypes; private String signature; SProcValues(String signature, int... argTypes) { this.signature = signature; this.argTypes = argTypes; }
@Override
public String getSignature() { return signature; }@Override
public int[] getArgTypes () { return argTypes; }@Override
public String getConnection() { return OpctValues.getRmsConnect(); }@Override
publicEnum<SProcValues>
getEnum() { return this; } }
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int[]
getArgTypes()
Get the argument types for this stored procedure object.String
getConnection()
Get the database connection string for this stored procedure object.Enum<? extends DatabaseUtils.SProcAPI>
getEnum()
Get the implementing enumerated constant for this stored procedure object.String
getSignature()
Get the signature for this stored procedure object.
-
-
-
Method Detail
-
getSignature
String getSignature()
Get the signature for this stored procedure object.- Returns:
- stored procedure signature
-
getArgTypes
int[] getArgTypes()
Get the argument types for this stored procedure object.- Returns:
- stored procedure argument types
-
getConnection
String getConnection()
Get the database connection string for this stored procedure object.- Returns:
- stored procedure connection string
-
getEnum
Enum<? extends DatabaseUtils.SProcAPI> getEnum()
Get the implementing enumerated constant for this stored procedure object.- Returns:
- stored procedure enumerated constant
-
-