Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / MyDerby-10.3 / java / tools / org / apache / derby / impl / tools / ij / ijResultImpl.java
diff --git a/JMCR-Stable/real-world application/MyDerby-10.3/java/tools/org/apache/derby/impl/tools/ij/ijResultImpl.java b/JMCR-Stable/real-world application/MyDerby-10.3/java/tools/org/apache/derby/impl/tools/ij/ijResultImpl.java
new file mode 100644 (file)
index 0000000..7d00f43
--- /dev/null
@@ -0,0 +1,83 @@
+/*\r
+\r
+   Derby - Class org.apache.derby.impl.tools.ij.ijResultImpl\r
+\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+      http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+\r
+ */\r
+\r
+package org.apache.derby.impl.tools.ij;\r
+\r
+import org.apache.derby.iapi.tools.i18n.LocalizedResource;\r
+import java.sql.Connection;\r
+import java.sql.ResultSet;\r
+import java.sql.Statement;\r
+import java.sql.SQLException;\r
+import java.sql.SQLWarning;\r
+import java.util.Vector;\r
+import java.util.List;\r
+\r
+/**\r
+ * This is an empty impl for reuse of code.\r
+ *\r
+ */\r
+abstract class ijResultImpl implements ijResult {\r
+       public boolean isConnection() { return false; }\r
+       public boolean isStatement() { return false; }\r
+       public boolean isResultSet() throws SQLException { return false; }\r
+       public boolean isUpdateCount() throws SQLException { return false; }\r
+       public boolean isNextRowOfResultSet() { return false; }\r
+       public boolean isVector() { return false; }\r
+       public boolean isMulti() { return false; }\r
+       public boolean isException() { return false; }\r
+       public boolean isMultipleResultSetResult(){ return false; }\r
+       public boolean hasWarnings() throws SQLException { return getSQLWarnings()!=null; }\r
+\r
+       public Connection getConnection() { return null; }\r
+       public Statement getStatement() { return null; }\r
+       public int getUpdateCount() throws SQLException { return -1; }\r
+       public ResultSet getResultSet() throws SQLException { return null; }\r
+       public List getMultipleResultSets() { return null; }\r
+       public ResultSet getNextRowOfResultSet() { return null; }\r
+       public Vector getVector() { return null; }\r
+       public SQLException getException() { return null; }\r
+\r
+       public int[] getColumnDisplayList() { return null; }\r
+       public int[] getColumnWidthList() { return null; }\r
+\r
+       public void closeStatement() throws SQLException { }\r
+\r
+       public abstract SQLWarning getSQLWarnings() throws SQLException;\r
+       public abstract void clearSQLWarnings() throws SQLException;\r
+\r
+\r
+       public String toString() {\r
+               if (isConnection()) return LocalizedResource.getMessage("IJ_Con0",getConnection().toString());\r
+               if (isStatement()) return LocalizedResource.getMessage("IJ_Stm0",getStatement().toString());\r
+               if (isNextRowOfResultSet()) return LocalizedResource.getMessage("IJ_Row0",getNextRowOfResultSet().toString());\r
+               if (isVector()) return LocalizedResource.getMessage("IJ_Vec0",getVector().toString());\r
+               if (isMulti()) return LocalizedResource.getMessage("IJ_Mul0",getVector().toString());\r
+               if (isException()) return LocalizedResource.getMessage("IJ_Exc0",getException().toString());\r
+               if (isMultipleResultSetResult())\r
+                       return LocalizedResource.getMessage("IJ_MRS0",\r
+                                                                               getMultipleResultSets().toString());\r
+               try {\r
+                       if (isResultSet()) return LocalizedResource.getMessage("IJ_Rse0",getStatement().toString());\r
+               } catch(SQLException se) {\r
+               }\r
+               return LocalizedResource.getMessage("IJ_Unkn0",this.getClass().getName());\r
+       }\r
+}\r