KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > impl > tools > ij > ijResultImpl


1 /*
2
3    Derby - Class org.apache.derby.impl.tools.ij.ijResultImpl
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to You under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. 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
20  */

21
22 package org.apache.derby.impl.tools.ij;
23
24 import org.apache.derby.iapi.tools.i18n.LocalizedResource;
25 import java.sql.Connection JavaDoc;
26 import java.sql.ResultSet JavaDoc;
27 import java.sql.Statement JavaDoc;
28 import java.sql.SQLException JavaDoc;
29 import java.sql.SQLWarning JavaDoc;
30 import java.util.Vector JavaDoc;
31
32 /**
33  * This is an empty impl for reuse of code.
34  *
35  * @author ames
36  */

37 abstract class ijResultImpl implements ijResult {
38     public boolean isConnection() { return false; }
39     public boolean isStatement() { return false; }
40     public boolean isResultSet() throws SQLException JavaDoc { return false; }
41     public boolean isUpdateCount() throws SQLException JavaDoc { return false; }
42     public boolean isNextRowOfResultSet() { return false; }
43     public boolean isVector() { return false; }
44     public boolean isMulti() { return false; }
45     public boolean isException() { return false; }
46     public boolean hasWarnings() throws SQLException JavaDoc { return getSQLWarnings()!=null; }
47
48     public Connection JavaDoc getConnection() { return null; }
49     public Statement JavaDoc getStatement() { return null; }
50     public int getUpdateCount() throws SQLException JavaDoc { return -1; }
51     public ResultSet JavaDoc getResultSet() throws SQLException JavaDoc { return null; }
52     public ResultSet JavaDoc getNextRowOfResultSet() { return null; }
53     public Vector JavaDoc getVector() { return null; }
54     public SQLException JavaDoc getException() { return null; }
55
56     public int[] getColumnDisplayList() { return null; }
57     public int[] getColumnWidthList() { return null; }
58
59     public void closeStatement() throws SQLException JavaDoc { }
60
61     public abstract SQLWarning JavaDoc getSQLWarnings() throws SQLException JavaDoc;
62     public abstract void clearSQLWarnings() throws SQLException JavaDoc;
63
64
65     public String JavaDoc toString() {
66         if (isConnection()) return LocalizedResource.getMessage("IJ_Con0",getConnection().toString());
67         if (isStatement()) return LocalizedResource.getMessage("IJ_Stm0",getStatement().toString());
68         if (isNextRowOfResultSet()) return LocalizedResource.getMessage("IJ_Row0",getNextRowOfResultSet().toString());
69         if (isVector()) return LocalizedResource.getMessage("IJ_Vec0",getVector().toString());
70         if (isMulti()) return LocalizedResource.getMessage("IJ_Mul0",getVector().toString());
71         if (isException()) return LocalizedResource.getMessage("IJ_Exc0",getException().toString());
72         try {
73             if (isResultSet()) return LocalizedResource.getMessage("IJ_Rse0",getStatement().toString());
74         } catch(SQLException JavaDoc se) {
75         }
76         return LocalizedResource.getMessage("IJ_Unkn0",this.getClass().getName());
77     }
78 }
79
Popular Tags