1 21 22 package org.apache.derby.impl.tools.ij; 23 24 import org.apache.derby.iapi.tools.i18n.LocalizedResource; 25 import java.sql.Connection ; 26 import java.sql.ResultSet ; 27 import java.sql.Statement ; 28 import java.sql.SQLException ; 29 import java.sql.SQLWarning ; 30 import java.util.Vector ; 31 32 37 abstract class ijResultImpl implements ijResult { 38 public boolean isConnection() { return false; } 39 public boolean isStatement() { return false; } 40 public boolean isResultSet() throws SQLException { return false; } 41 public boolean isUpdateCount() throws SQLException { 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 { return getSQLWarnings()!=null; } 47 48 public Connection getConnection() { return null; } 49 public Statement getStatement() { return null; } 50 public int getUpdateCount() throws SQLException { return -1; } 51 public ResultSet getResultSet() throws SQLException { return null; } 52 public ResultSet getNextRowOfResultSet() { return null; } 53 public Vector getVector() { return null; } 54 public SQLException getException() { return null; } 55 56 public int[] getColumnDisplayList() { return null; } 57 public int[] getColumnWidthList() { return null; } 58 59 public void closeStatement() throws SQLException { } 60 61 public abstract SQLWarning getSQLWarnings() throws SQLException ; 62 public abstract void clearSQLWarnings() throws SQLException ; 63 64 65 public String 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 se) { 75 } 76 return LocalizedResource.getMessage("IJ_Unkn0",this.getClass().getName()); 77 } 78 } 79 | Popular Tags |