1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *     http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18package javax.sql;
19
20import java.sql.Connection;
21import java.sql.ResultSet;
22import java.sql.SQLException;
23
24/**
25 * An interface provided by a {@code RowSet} object to let either a {@code
26 * RowSetReader} or a {@code RowSetWriter} access its internal state, thereby
27 * providing facilities to read and update the state of the {@code RowSet}.
28 */
29public interface RowSetInternal {
30
31    /**
32     * Gets the connection associated with this {@code RowSet} object.
33     *
34     * @return the connection or {@code null}.
35     * @throws SQLException
36     *             if there is a problem accessing the database.
37     */
38    public Connection getConnection() throws SQLException;
39
40    /**
41     * Gets the {@code ResultSet} that was the original (unmodified) content of
42     * the {@code RowSet}.
43     * <p>
44     * The {@code ResultSet}'s cursor is positioned before the first row of
45     * data.
46     *
47     * @return the {@code ResultSet} that contained the original data value of
48     *         the {@code RowSet}.
49     * @throws SQLException
50     *             if there is a problem accessing the database.
51     */
52    public ResultSet getOriginal() throws SQLException;
53
54    /**
55     * Gets the original value of the current row only. If the current row did
56     * not have an original value, then an empty value is returned.
57     *
58     * @return a {@code ResultSet} containing the value of the current row only.
59     * @throws SQLException
60     *             if there is a problem accessing the database, or if the
61     *             cursor is not on a valid row (before the first row, after the
62     *             last one or pointing to the insert row).
63     */
64    public ResultSet getOriginalRow() throws SQLException;
65
66    /**
67     * Gets the parameter values that have been set for this {@code RowSet}'s
68     * command.
69     *
70     * @return the values of parameters that have been set.
71     * @throws SQLException
72     *             if there is a problem accessing the database.
73     */
74    public Object[] getParams() throws SQLException;
75
76    /**
77     * Sets {@code RowSetMetaData} for this {@code RowSet}. The {@code
78     * RowSetMetaData} is used by a {@code RowSetReader} to set values giving
79     * information about the {@code RowSet}'s columns.
80     *
81     * @param theMetaData
82     *            holds the metadata about the {@code RowSet}'s columns.
83     * @throws SQLException
84     *             if there is a problem accessing the database.
85     */
86    public void setMetaData(RowSetMetaData theMetaData) throws SQLException;
87}
88