001: /*
002:
003: Derby - Class org.apache.derby.impl.tools.ij.ijResultImpl
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to You under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021:
022: package org.apache.derby.impl.tools.ij;
023:
024: import org.apache.derby.iapi.tools.i18n.LocalizedResource;
025: import java.sql.Connection;
026: import java.sql.ResultSet;
027: import java.sql.Statement;
028: import java.sql.SQLException;
029: import java.sql.SQLWarning;
030: import java.util.Vector;
031:
032: /**
033: * This is an empty impl for reuse of code.
034: *
035: * @author ames
036: */
037: abstract class ijResultImpl implements ijResult {
038: public boolean isConnection() {
039: return false;
040: }
041:
042: public boolean isStatement() {
043: return false;
044: }
045:
046: public boolean isResultSet() throws SQLException {
047: return false;
048: }
049:
050: public boolean isUpdateCount() throws SQLException {
051: return false;
052: }
053:
054: public boolean isNextRowOfResultSet() {
055: return false;
056: }
057:
058: public boolean isVector() {
059: return false;
060: }
061:
062: public boolean isMulti() {
063: return false;
064: }
065:
066: public boolean isException() {
067: return false;
068: }
069:
070: public boolean hasWarnings() throws SQLException {
071: return getSQLWarnings() != null;
072: }
073:
074: public Connection getConnection() {
075: return null;
076: }
077:
078: public Statement getStatement() {
079: return null;
080: }
081:
082: public int getUpdateCount() throws SQLException {
083: return -1;
084: }
085:
086: public ResultSet getResultSet() throws SQLException {
087: return null;
088: }
089:
090: public ResultSet getNextRowOfResultSet() {
091: return null;
092: }
093:
094: public Vector getVector() {
095: return null;
096: }
097:
098: public SQLException getException() {
099: return null;
100: }
101:
102: public int[] getColumnDisplayList() {
103: return null;
104: }
105:
106: public int[] getColumnWidthList() {
107: return null;
108: }
109:
110: public void closeStatement() throws SQLException {
111: }
112:
113: public abstract SQLWarning getSQLWarnings() throws SQLException;
114:
115: public abstract void clearSQLWarnings() throws SQLException;
116:
117: public String toString() {
118: if (isConnection())
119: return LocalizedResource.getMessage("IJ_Con0",
120: getConnection().toString());
121: if (isStatement())
122: return LocalizedResource.getMessage("IJ_Stm0",
123: getStatement().toString());
124: if (isNextRowOfResultSet())
125: return LocalizedResource.getMessage("IJ_Row0",
126: getNextRowOfResultSet().toString());
127: if (isVector())
128: return LocalizedResource.getMessage("IJ_Vec0", getVector()
129: .toString());
130: if (isMulti())
131: return LocalizedResource.getMessage("IJ_Mul0", getVector()
132: .toString());
133: if (isException())
134: return LocalizedResource.getMessage("IJ_Exc0",
135: getException().toString());
136: try {
137: if (isResultSet())
138: return LocalizedResource.getMessage("IJ_Rse0",
139: getStatement().toString());
140: } catch (SQLException se) {
141: }
142: return LocalizedResource.getMessage("IJ_Unkn0", this.getClass()
143: .getName());
144: }
145: }
|