PageRenderTime 20ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/etlunit-database/src/main/java/org/bitbucket/bradleysmithllc/etlunit/feature/database/JDBCClient.java

https://bitbucket.org/bradleysmithllc/etl-unit
Java | 82 lines | 47 code | 16 blank | 19 comment | 0 complexity | af305f89142d3129b921ac007b521774 MD5 | raw file
  1. package org.bitbucket.bradleysmithllc.etlunit.feature.database;
  2. /*
  3. * #%L
  4. * etlunit-database
  5. * %%
  6. * Copyright (C) 2010 - 2014 bradleysmithllc
  7. * %%
  8. * Licensed under the Apache License, Version 2.0 (the "License");
  9. * you may not use this file except in compliance with the License.
  10. * You may obtain a copy of the License at
  11. *
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. *
  14. * Unless required by applicable law or agreed to in writing, software
  15. * distributed under the License is distributed on an "AS IS" BASIS,
  16. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. * See the License for the specific language governing permissions and
  18. * limitations under the License.
  19. * #L%
  20. */
  21. import org.bitbucket.bradleysmithllc.etlunit.TestExecutionError;
  22. import javax.inject.Inject;
  23. import java.io.IOException;
  24. import java.sql.*;
  25. public interface JDBCClient
  26. {
  27. void worksFor(DatabaseImplementation dbi);
  28. interface ConnectionClient
  29. {
  30. void connection(Connection conn, DatabaseConnection connection, String mode, DatabaseImplementation.database_role id) throws Exception;
  31. }
  32. void useConnection(DatabaseConnection connection, String mode, ConnectionClient client) throws TestExecutionError;
  33. void useConnection(DatabaseConnection connection, String mode, ConnectionClient client, DatabaseImplementation.database_role id) throws TestExecutionError;
  34. interface StatementClient
  35. {
  36. void connection(Connection conn, Statement st, DatabaseConnection connection, String mode, DatabaseImplementation.database_role id) throws Exception;
  37. }
  38. void useStatement(DatabaseConnection connection, String mode, StatementClient client) throws TestExecutionError;
  39. void useStatement(DatabaseConnection connection, String mode, StatementClient client, DatabaseImplementation.database_role id) throws TestExecutionError;
  40. interface PreparedStatementClient
  41. {
  42. String prepareText();
  43. void connection(Connection conn, PreparedStatement st, DatabaseConnection connection, String mode, DatabaseImplementation.database_role id) throws Exception;
  44. }
  45. void usePreparedStatement(DatabaseConnection connection, String mode, PreparedStatementClient client) throws TestExecutionError;
  46. void usePreparedStatement(DatabaseConnection connection, String mode, PreparedStatementClient client, DatabaseImplementation.database_role id) throws TestExecutionError;
  47. interface CallableStatementClient
  48. {
  49. String callText();
  50. void connection(Connection conn, CallableStatement st, DatabaseConnection connection, String mode, DatabaseImplementation.database_role id) throws Exception;
  51. }
  52. void useCallableStatement(DatabaseConnection connection, String mode, CallableStatementClient client) throws TestExecutionError;
  53. void useCallableStatement(DatabaseConnection connection, String mode, CallableStatementClient client, DatabaseImplementation.database_role id) throws TestExecutionError;
  54. interface ResultSetClient
  55. {
  56. void beginSet(Connection conn, ResultSet st, DatabaseConnection connection, String mode, DatabaseImplementation.database_role id) throws Exception;
  57. void next(Connection conn, ResultSet st, DatabaseConnection connection, String mode, DatabaseImplementation.database_role id) throws Exception;
  58. void endSet(Connection conn, DatabaseConnection connection, String mode, DatabaseImplementation.database_role id) throws Exception;
  59. }
  60. void useResultSet(DatabaseConnection connection, String mode, ResultSetClient client, String query) throws TestExecutionError;
  61. void useResultSet(DatabaseConnection connection, String mode, ResultSetClient client, String query, DatabaseImplementation.database_role id) throws TestExecutionError;
  62. void useResultSetScript(DatabaseConnection connection, String mode, ResultSetClient client, String script) throws TestExecutionError, IOException;
  63. void useResultSetScript(DatabaseConnection connection, String mode, ResultSetClient client, String script, DatabaseImplementation.database_role id) throws TestExecutionError, IOException;
  64. void useResultSetScriptResource(DatabaseConnection connection, String mode, ResultSetClient client, String script) throws TestExecutionError, IOException;
  65. void useResultSetScriptResource(DatabaseConnection connection, String mode, ResultSetClient client, String script, DatabaseImplementation.database_role id) throws TestExecutionError, IOException;
  66. }