Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / derby-10.3.2.1 / java / engine / org / apache / derby / impl / jdbc / EmbedResultSet20.java
diff --git a/JMCR-Stable/real-world application/derby-10.3.2.1/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet20.java b/JMCR-Stable/real-world application/derby-10.3.2.1/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet20.java
new file mode 100644 (file)
index 0000000..1f69720
--- /dev/null
@@ -0,0 +1,617 @@
+/*\r
+\r
+   Derby - Class org.apache.derby.impl.jdbc.EmbedResultSet20\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.jdbc;\r
+\r
+import org.apache.derby.iapi.reference.JDBC20Translation;\r
+import org.apache.derby.iapi.reference.SQLState;\r
+import org.apache.derby.iapi.sql.ResultSet;\r
+import org.apache.derby.iapi.sql.execute.ExecCursorTableReference;\r
+import org.apache.derby.iapi.error.StandardException;\r
+import org.apache.derby.impl.jdbc.Util;\r
+import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;\r
+import org.apache.derby.iapi.sql.conn.StatementContext;\r
+                                         \r
+import org.apache.derby.iapi.types.DataValueDescriptor;\r
+\r
+import java.sql.Statement;\r
+import java.sql.SQLException;\r
+import java.sql.Types;\r
+\r
+/* ---- New jdbc 2.0 types ----- */\r
+import java.sql.Array;\r
+import java.sql.Blob;\r
+import java.sql.Clob;\r
+import java.sql.NClob;\r
+import java.sql.Ref;\r
+import java.sql.RowId;\r
+import java.sql.SQLXML;\r
+import java.util.Map;\r
+import java.io.Reader;\r
+import java.math.BigDecimal;\r
+import java.net.URL;\r
+\r
+/**\r
+ * This class extends the EmbedResultSet class in order to support new\r
+ * methods and classes that come with JDBC 2.0.\r
+     <P><B>Supports</B>\r
+   <UL>\r
+   <LI> JDBC 2.0/2.1\r
+   <LI> JDBC 3.0\r
+   </UL>\r
+ *      @see org.apache.derby.impl.jdbc.EmbedResultSet\r
+ *\r
+ */\r
+\r
+public class EmbedResultSet20\r
+        extends org.apache.derby.impl.jdbc.EmbedResultSet {\r
+\r
+        //////////////////////////////////////////////////////////////\r
+        //\r
+        // CONSTRUCTORS\r
+        //\r
+        //////////////////////////////////////////////////////////////\r
+\r
+        /**\r
+         * This class provides the glue between the Derby\r
+         * resultset and the JDBC resultset, mapping calls-to-calls.\r
+         */\r
+        public EmbedResultSet20(org.apache.derby.impl.jdbc.EmbedConnection conn, \r
+                                                         ResultSet resultsToWrap,  \r
+                                                         boolean forMetaData,\r
+                                                         org.apache.derby.impl.jdbc.EmbedStatement stmt,\r
+                                                         boolean isAtomic)  \r
+        throws SQLException {\r
+                super(conn, resultsToWrap, forMetaData, stmt, isAtomic);\r
+        }\r
+\r
+\r
+               /*\r
+               ** Methods using java.math.BigDecimal, not supported in JSR169\r
+               */\r
+               /**\r
+                * Get the value of a column in the current row as a java.lang.BigDecimal object.\r
+                *\r
+                * @param columnIndex the first column is 1, the second is 2, ...\r
+                * @param scale the number of digits to the right of the decimal\r
+                * @return the column value; if the value is SQL NULL, the result is null\r
+                * @exception SQLException thrown on failure.\r
+                */\r
+               public final BigDecimal getBigDecimal(int columnIndex, int scale)\r
+                       throws SQLException {\r
+\r
+                       BigDecimal ret = getBigDecimal(columnIndex);\r
+                       if (ret != null) {\r
+                               return ret.setScale(scale, BigDecimal.ROUND_HALF_DOWN);\r
+                       }\r
+                       return null;\r
+               }\r
+\r
+               public final BigDecimal getBigDecimal(int columnIndex)\r
+                       throws SQLException {\r
+                       checkIfClosed("getBigDecimal");\r
+                       try {\r
+\r
+                               DataValueDescriptor dvd = getColumn(columnIndex);\r
+\r
+                               if (wasNull = dvd.isNull())\r
+                                       return null;\r
+                               \r
+                               return org.apache.derby.iapi.types.SQLDecimal.getBigDecimal(dvd);\r
+\r
+                       } catch (StandardException t) {\r
+                               throw noStateChangeException(t);\r
+                       }\r
+               }\r
+\r
+               /**\r
+                * Get the value of a column in the current row as a java.lang.BigDecimal object.\r
+                *\r
+                * @param columnName is the SQL name of the column\r
+                * @param scale the number of digits to the right of the decimal\r
+                * @return the column value; if the value is SQL NULL, the result is null\r
+                * @exception SQLException thrown on failure.\r
+                */\r
+               public final BigDecimal getBigDecimal(String columnName, int scale)\r
+                       throws SQLException {\r
+                       checkIfClosed("getBigDecimal");\r
+                       return (getBigDecimal(findColumnName(columnName), scale));\r
+               }\r
+\r
+\r
+    /**\r
+     * JDBC 2.0\r
+     *\r
+               Deprecated in JDBC 2.0, not supported by JCC.\r
+        * @exception SQLException thrown on failure.\r
+     */\r
+    public final java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException {\r
+               throw Util.notImplemented("getUnicodeStream");\r
+       }\r
+    /**\r
+               Deprecated in JDBC 2.0, not supported by JCC.\r
+        * @exception SQLException thrown on failure.\r
+     */\r
+    public final java.io.InputStream getUnicodeStream(String columnName) throws SQLException {\r
+               throw Util.notImplemented("getUnicodeStream");\r
+       }       \r
+       \r
+    /**\r
+     * JDBC 2.0\r
+     *\r
+     * Get the value of a column in the current row as a java.math.BigDecimal \r
+     * object.\r
+     *\r
+         * @exception SQLException Feature not implemented for now.\r
+     */\r
+    public final BigDecimal getBigDecimal(String columnName) throws SQLException {\r
+        checkIfClosed("getBigDecimal");\r
+        return getBigDecimal(findColumnName(columnName));\r
+    }\r
+\r
+    public void updateBigDecimal(int columnIndex, BigDecimal x)\r
+    throws SQLException {\r
+        try {\r
+            getDVDforColumnToBeUpdated(columnIndex, "updateBigDecimal").setBigDecimal(x);\r
+        } catch (StandardException t) {\r
+            throw noStateChangeException(t);\r
+        }\r
+    }\r
+\r
+       /**\r
+        * JDBC 2.0\r
+        * \r
+        * Update a column with an Object value.\r
+        * \r
+        * The updateXXX() methods are used to update column values in the current\r
+        * row, or the insert row. The updateXXX() methods do not update the\r
+        * underlying database, instead the updateRow() or insertRow() methods are\r
+        * called to update the database.\r
+        * \r
+        * @param columnIndex\r
+        *            the first column is 1, the second is 2, ...\r
+        * @param x\r
+        *            the new column value\r
+        * @exception SQLException\r
+        *                if a database-access error occurs\r
+        */\r
+       public void updateObject(int columnIndex, Object x) throws SQLException {\r
+               //If the Object x is the right datatype, this method will eventually call getDVDforColumnToBeUpdated which will check for\r
+               //the read only resultset. But for other datatypes of x, we want to catch if this updateObject is being\r
+               //issued against a read only resultset. And that is the reason for call to checksBeforeUpdateOrDelete here.\r
+               checksBeforeUpdateOrDelete("updateObject", columnIndex);\r
+               int colType = getColumnType(columnIndex);\r
+\r
+               if (x instanceof BigDecimal) {\r
+                       updateBigDecimal(columnIndex, (BigDecimal) x);\r
+                       return;\r
+               }\r
+               super.updateObject(columnIndex, x);\r
+       }\r
+\r
+    /**\r
+     * JDBC 2.0\r
+     *\r
+     * Update a column with a BigDecimal value.\r
+     *\r
+     * The updateXXX() methods are used to update column values in the\r
+     * current row, or the insert row.  The updateXXX() methods do not \r
+     * update the underlying database, instead the updateRow() or insertRow()\r
+     * methods are called to update the database.\r
+     *\r
+     * @param columnName the name of the column\r
+     * @param x the new column value\r
+     * @exception SQLException if a database-access error occurs\r
+     */\r
+    public void updateBigDecimal(String columnName, BigDecimal x)\r
+    throws SQLException {\r
+            checkIfClosed("updateBigDecimal");\r
+            updateBigDecimal(findColumnName(columnName), x);\r
+        }\r
+\r
+    /**\r
+     * JDBC 2.0\r
+     *\r
+     * Returns the value of column @i as a Java object.  Use the\r
+     * param map to determine the class from which to construct data of \r
+     * SQL structured and distinct types.\r
+     *\r
+     * @param columnIndex the first column is 1, the second is 2, ...\r
+     * @param map the mapping from SQL type names to Java classes\r
+     * @return an object representing the SQL value\r
+         * @exception SQLException Feature not implemented for now.\r
+     */\r
+    public Object getObject(int columnIndex, java.util.Map map) throws SQLException {\r
+        checkIfClosed("getObject");\r
+        if( map == null)\r
+            throw Util.generateCsSQLException(SQLState.INVALID_API_PARAMETER,map,"map",\r
+                                              "java.sql.ResultSet.getObject");\r
+        if(!(map.isEmpty()))\r
+            throw Util.notImplemented();\r
+        // Map is empty call the normal getObject method.\r
+        return getObject(columnIndex);\r
+        }\r
+\r
+    /**\r
+     * JDBC 2.0\r
+     *\r
+     * Get a REF(&lt;structured-type&gt;) column.\r
+     *\r
+     * @param i the first column is 1, the second is 2, ...\r
+     * @return an object representing data of an SQL REF type\r
+         * @exception SQLException Feature not implemented for now.\r
+     */\r
+    public Ref getRef(int i) throws SQLException {\r
+                throw Util.notImplemented();\r
+        }\r
+\r
+    /**\r
+     * JDBC 2.0\r
+     *\r
+     * Get an array column.\r
+     *\r
+     * @param i the first column is 1, the second is 2, ...\r
+     * @return an object representing an SQL array\r
+         * @exception SQLException Feature not implemented for now.\r
+     */\r
+    public Array getArray(int i) throws SQLException {\r
+                throw Util.notImplemented();\r
+        }\r
+\r
+    /**\r
+     * JDBC 2.0\r
+     *\r
+     * Returns the value of column @i as a Java object.  Use the \r
+     * param map to determine the class from which to construct data of \r
+     * SQL structured and distinct types.\r
+     *\r
+     * @param colName the column name\r
+     * @param map the mapping from SQL type names to Java classes\r
+     * @return an object representing the SQL value\r
+         * @exception SQLException Feature not implemented for now.\r
+     */\r
+    public Object getObject(String colName, java.util.Map map)\r
+    throws SQLException {\r
+        checkIfClosed("getObject");\r
+        return getObject(findColumn(colName),map);\r
+        }\r
+\r
+    /**\r
+     * JDBC 2.0\r
+     *\r
+     * Get a REF(&lt;structured-type&gt;) column.\r
+     *\r
+     * @param colName the column name\r
+     * @return an object representing data of an SQL REF type\r
+         * @exception SQLException Feature not implemented for now.\r
+     */\r
+    public Ref getRef(String colName) throws SQLException {\r
+                throw Util.notImplemented();\r
+        }\r
+\r
+\r
+\r
+\r
+    /**\r
+     * JDBC 2.0\r
+     *\r
+     * Get an array column.\r
+     *\r
+     * @param colName the column name\r
+     * @return an object representing an SQL array\r
+         * @exception SQLException Feature not implemented for now.\r
+     */\r
+    public Array getArray(String colName) throws SQLException {\r
+                throw Util.notImplemented();\r
+        }\r
+\r
+\r
+        /**\r
+    Following methods are for the new JDBC 3.0 methods in java.sql.ResultSet\r
+    (see the JDBC 3.0 spec). We have the JDBC 3.0 methods in Local20\r
+    package, so we don't have to have a new class in Local30.\r
+    The new JDBC 3.0 methods don't make use of any new JDBC3.0 classes and\r
+    so this will work fine in jdbc2.0 configuration.\r
+        */\r
+\r
+        /////////////////////////////////////////////////////////////////////////\r
+        //\r
+        //      JDBC 3.0        -       New public methods\r
+        //\r
+        /////////////////////////////////////////////////////////////////////////\r
+\r
+\r
+\r
+        /**\r
+    * JDBC 3.0\r
+    *\r
+    * Updates the designated column with a java.sql.Ref value. The updater methods are\r
+    * used to update column values in the current row or the insert row. The\r
+    * updater methods do not update the underlying database; instead the updateRow\r
+    * or insertRow methods are called to update the database.\r
+    *\r
+    * @param columnIndex - the first column is 1, the second is 2\r
+    * @param x - the new column value\r
+    * @exception SQLException Feature not implemented for now.\r
+        */\r
+        public void updateRef(int columnIndex, Ref x)\r
+    throws SQLException\r
+        {\r
+                throw Util.notImplemented();\r
+        }\r
+\r
+        /**\r
+    * JDBC 3.0\r
+    *\r
+    * Updates the designated column with a java.sql.Ref value. The updater methods are\r
+    * used to update column values in the current row or the insert row. The\r
+    * updater methods do not update the underlying database; instead the updateRow\r
+    * or insertRow methods are called to update the database.\r
+    *\r
+    * @param columnName - the SQL name of the column\r
+    * @param x - the new column value\r
+    * @exception SQLException Feature not implemented for now.\r
+        */\r
+        public void updateRef(String columnName, Ref x)\r
+    throws SQLException\r
+        {\r
+                throw Util.notImplemented();\r
+        }\r
+\r
+        /**\r
+    * JDBC 3.0\r
+    *\r
+    * Updates the designated column with a java.sql.Array value. The updater methods are\r
+    * used to update column values in the current row or the insert row. The\r
+    * updater methods do not update the underlying database; instead the updateRow\r
+    * or insertRow methods are called to update the database.\r
+    *\r
+    * @param columnIndex - the first column is 1, the second is 2\r
+    * @param x - the new column value\r
+    * @exception SQLException Feature not implemented for now.\r
+        */\r
+        public void updateArray(int columnIndex, Array x)\r
+    throws SQLException\r
+        {\r
+                throw Util.notImplemented();\r
+        }\r
+\r
+        /**\r
+    * JDBC 3.0\r
+    *\r
+    * Updates the designated column with a java.sql.Array value. The updater methods are\r
+    * used to update column values in the current row or the insert row. The\r
+    * updater methods do not update the underlying database; instead the updateRow\r
+    * or insertRow methods are called to update the database.\r
+    *\r
+    * @param columnName - the SQL name of the column\r
+    * @param x - the new column value\r
+    * @exception SQLException Feature not implemented for now.\r
+        */\r
+        public void updateArray(String columnName, Array x)\r
+    throws SQLException\r
+        {\r
+                throw Util.notImplemented();\r
+        }\r
+\r
+\r
+               public Reader getNCharacterStream(int columnIndex) throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       return null;\r
+               }\r
+\r
+\r
+               public Reader getNCharacterStream(String columnLabel)\r
+                               throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       return null;\r
+               }\r
+\r
+\r
+               public NClob getNClob(int columnIndex) throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       return null;\r
+               }\r
+\r
+\r
+               public NClob getNClob(String columnLabel) throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       return null;\r
+               }\r
+\r
+\r
+               public String getNString(int columnIndex) throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       return null;\r
+               }\r
+\r
+\r
+               public String getNString(String columnLabel) throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       return null;\r
+               }\r
+\r
+\r
+\r
+               public RowId getRowId(int columnIndex) throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       return null;\r
+               }\r
+\r
+\r
+               public RowId getRowId(String columnLabel) throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       return null;\r
+               }\r
+\r
+\r
+               public SQLXML getSQLXML(int columnIndex) throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       return null;\r
+               }\r
+\r
+\r
+               public SQLXML getSQLXML(String columnLabel) throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       return null;\r
+               }\r
+\r
+\r
+               public void updateNCharacterStream(int columnIndex, Reader x)\r
+                               throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       \r
+               }\r
+\r
+\r
+               public void updateNCharacterStream(String columnLabel, Reader reader)\r
+                               throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       \r
+               }\r
+\r
+\r
+               public void updateNCharacterStream(int columnIndex, Reader x,\r
+                               long length) throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       \r
+               }\r
+\r
+\r
+               public void updateNCharacterStream(String columnLabel, Reader reader,\r
+                               long length) throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       \r
+               }\r
+\r
+\r
+               public void updateNClob(int columnIndex, NClob clob)\r
+                               throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       \r
+               }\r
+\r
+\r
+               public void updateNClob(String columnLabel, NClob clob)\r
+                               throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       \r
+               }\r
+\r
+\r
+               public void updateNClob(int columnIndex, Reader reader)\r
+                               throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       \r
+               }\r
+\r
+\r
+               public void updateNClob(String columnLabel, Reader reader)\r
+                               throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       \r
+               }\r
+\r
+\r
+               public void updateNClob(int columnIndex, Reader reader, long length)\r
+                               throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       \r
+               }\r
+\r
+\r
+               public void updateNClob(String columnLabel, Reader reader, long length)\r
+                               throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       \r
+               }\r
+\r
+\r
+               public void updateNString(int columnIndex, String string)\r
+                               throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       \r
+               }\r
+\r
+\r
+               public void updateNString(String columnLabel, String string)\r
+                               throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       \r
+               }\r
+\r
+\r
+               public void updateRowId(int columnIndex, RowId x) throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       \r
+               }\r
+\r
+\r
+               public void updateRowId(String columnLabel, RowId x)\r
+                               throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       \r
+               }\r
+\r
+\r
+               public void updateSQLXML(int columnIndex, SQLXML xmlObject)\r
+                               throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       \r
+               }\r
+\r
+\r
+               public void updateSQLXML(String columnLabel, SQLXML xmlObject)\r
+                               throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       \r
+               }\r
+\r
+\r
+               public boolean isWrapperFor(Class<?> iface) throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       return false;\r
+               }\r
+\r
+\r
+               public <T> T unwrap(Class<T> iface) throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       return null;\r
+               }\r
+\r
+\r
+               public <T> T getObject(int columnIndex, Class<T> type)\r
+                               throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       return null;\r
+               }\r
+\r
+\r
+               public <T> T getObject(String columnLabel, Class<T> type)\r
+                               throws SQLException {\r
+                       // TODO Auto-generated method stub\r
+                       return null;\r
+               }\r
+\r
+\r
\r
+\r
+}\r