A key uniquely identifying java.sql.PreparedStatement PreparedStatements. @since 2.0
| 32 | * @since 2.0 |
| 33 | */ |
| 34 | public class PStmtKey { |
| 35 | |
| 36 | /** |
| 37 | * Interface for Prepared or Callable Statement. |
| 38 | */ |
| 39 | @FunctionalInterface |
| 40 | private interface StatementBuilder { |
| 41 | Statement createStatement(Connection connection, PStmtKey key) throws SQLException; |
| 42 | } |
| 43 | |
| 44 | private static final StatementBuilder CallConcurrency = (c, k) -> c.prepareCall(k.sql, k.resultSetType.intValue(), k.resultSetConcurrency.intValue()); |
| 45 | private static final StatementBuilder CallHoldability = (c, k) -> c.prepareCall(k.sql, k.resultSetType.intValue(), k.resultSetConcurrency.intValue(), k.resultSetHoldability.intValue()); |
| 46 | private static final StatementBuilder CallSQL = (c, k) -> c.prepareCall(k.sql); |
| 47 | private static final StatementBuilder StatementAutoGeneratedKeys = (c, k) -> c.prepareStatement(k.sql, k.autoGeneratedKeys.intValue()); |
| 48 | private static final StatementBuilder StatementColumnIndexes = (c, k) -> c.prepareStatement(k.sql, k.columnIndexes); |
| 49 | private static final StatementBuilder StatementColumnNames = (c, k) -> c.prepareStatement(k.sql, k.columnNames); |
| 50 | private static final StatementBuilder StatementConcurrency = (c, k) -> c.prepareStatement(k.sql, k.resultSetType.intValue(), k.resultSetConcurrency.intValue()); |
| 51 | private static final StatementBuilder StatementHoldability = (c, k) -> c.prepareStatement(k.sql, k.resultSetType.intValue(), k.resultSetConcurrency.intValue(), |
| 52 | k.resultSetHoldability.intValue()); |
| 53 | private static final StatementBuilder StatementSQL = (c, k) -> c.prepareStatement(k.sql); |
| 54 | |
| 55 | private static StatementBuilder match(final StatementType statementType, final StatementBuilder prep, final StatementBuilder call) { |
| 56 | switch (Objects.requireNonNull(statementType, "statementType")) { |
| 57 | case PREPARED_STATEMENT: |
| 58 | return prep; |
| 59 | case CALLABLE_STATEMENT: |
| 60 | return call; |
| 61 | default: |
| 62 | throw new IllegalArgumentException(statementType.toString()); |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * SQL defining Prepared or Callable Statement |
| 68 | */ |
| 69 | private final String sql; |
| 70 | |
| 71 | /** |
| 72 | * Result set type; one of {@link ResultSet#TYPE_FORWARD_ONLY}, {@link ResultSet#TYPE_SCROLL_INSENSITIVE}, or |
| 73 | * {@link ResultSet#TYPE_SCROLL_SENSITIVE}. |
| 74 | */ |
| 75 | private final Integer resultSetType; |
| 76 | |
| 77 | /** |
| 78 | * Result set concurrency. A concurrency type; one of {@link ResultSet#CONCUR_READ_ONLY} or |
| 79 | * {@link ResultSet#CONCUR_UPDATABLE}. |
| 80 | */ |
| 81 | private final Integer resultSetConcurrency; |
| 82 | |
| 83 | /** |
| 84 | * Result set holdability. One of the following {@link ResultSet} constants: {@link ResultSet#HOLD_CURSORS_OVER_COMMIT} |
| 85 | * or {@link ResultSet#CLOSE_CURSORS_AT_COMMIT}. |
| 86 | */ |
| 87 | private final Integer resultSetHoldability; |
| 88 | |
| 89 | /** |
| 90 | * Database catalog. |
| 91 | */ |
nothing calls this directly
no test coverage detected