Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
IStatement |
|
| 1.0;1 |
1 | // Copyright 2004, 2005 The Apache Software Foundation | |
2 | // | |
3 | // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 | // you may not use this file except in compliance with the License. | |
5 | // You may obtain a copy of the License at | |
6 | // | |
7 | // http://www.apache.org/licenses/LICENSE-2.0 | |
8 | // | |
9 | // Unless required by applicable law or agreed to in writing, software | |
10 | // distributed under the License is distributed on an "AS IS" BASIS, | |
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 | // See the License for the specific language governing permissions and | |
13 | // limitations under the License. | |
14 | ||
15 | package org.apache.tapestry.contrib.jdbc; | |
16 | ||
17 | import java.sql.Connection; | |
18 | import java.sql.ResultSet; | |
19 | import java.sql.SQLException; | |
20 | import java.sql.Statement; | |
21 | ||
22 | /** | |
23 | * A wrapper around {@link java.sql.Statement} or | |
24 | * {@link java.sql.PreparedStatement} which hides the differences | |
25 | * between the two. | |
26 | * | |
27 | * @author Howard Lewis Ship | |
28 | * @see org.apache.tapestry.contrib.jdbc.StatementAssembly#createStatement(Connection) | |
29 | * | |
30 | **/ | |
31 | ||
32 | public interface IStatement | |
33 | { | |
34 | /** | |
35 | * Returns the SQL associated with this statement. | |
36 | * | |
37 | **/ | |
38 | ||
39 | String getSQL(); | |
40 | ||
41 | /** | |
42 | * Returns the underlying {@link java.sql.Statement} | |
43 | * (or {@link java.sql.PreparedStatement}). | |
44 | * | |
45 | **/ | |
46 | ||
47 | Statement getStatement(); | |
48 | ||
49 | /** | |
50 | * Closes the underlying statement, and nulls the reference to it. | |
51 | * | |
52 | **/ | |
53 | ||
54 | void close() throws SQLException; | |
55 | ||
56 | /** | |
57 | * Executes the statement as a query, returning a {@link ResultSet}. | |
58 | * | |
59 | **/ | |
60 | ||
61 | ResultSet executeQuery() throws SQLException; | |
62 | ||
63 | /** | |
64 | * Executes the statement as an update, returning the number of rows | |
65 | * affected. | |
66 | * | |
67 | **/ | |
68 | ||
69 | int executeUpdate() throws SQLException; | |
70 | } |