01: /**
02: * Sequoia: Database clustering technology.
03: * Copyright (C) 2006 Continuent, Inc.
04: * Contact: sequoia@continuent.org
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: *
18: * Initial developer(s): Gilles Rayrat.
19: * Contributor(s): ______________________.
20: */package org.continuent.sequoia.controller.backend.result;
21:
22: import java.io.Serializable;
23: import java.sql.SQLWarning;
24:
25: /**
26: * Super-class for all results of [Prepared|Callable]Statement.XXXExecuteXXX()
27: * commands that holds the sql warning chain generated by the execution of this
28: * command.<br>
29: * In order to introduce the sql warnings support, every command issued on a
30: * backend must call getWarnings() right after its execution. This is the only
31: * way to keep the context and to make sure that no other command is issued
32: * between the execute and the getWarnings.<br>
33: * Warnings are *not* retrieved by default, so there will be no performance
34: * issue for those who don't need warnings. To enable them, use
35: * "?retrieveSQLWarnings=true" URL option at connection time (this is a
36: * by-connection property)
37: *
38: * @author <a href="mailto:gilles.rayrat@continuent.com">Gilles Rayrat</a>
39: * @version 1.0
40: */
41: public abstract class AbstractResult implements Serializable {
42: private SQLWarning statementWarnings = null;
43:
44: /**
45: * Get the warning chain associated to the current result
46: *
47: * @return the warning chain or null if there were no warning, or if warnings
48: * retrieval was not enabled for this connection
49: */
50: public SQLWarning getStatementWarnings() {
51: return statementWarnings;
52: }
53:
54: /**
55: * Associate a warning chain for the current result
56: *
57: * @param warnings the SQL warnings that comes with the result
58: */
59: public void setStatementWarnings(SQLWarning warnings) {
60: this.statementWarnings = warnings;
61: }
62: }
|