--- /dev/null
+/*\r
+\r
+ Derby - Class org.apache.derby.impl.jdbc.EmbedCallableStatement20\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 java.math.BigDecimal;\r
+import java.sql.CallableStatement;\r
+import java.sql.SQLException;\r
+import java.sql.Date;\r
+import java.sql.Time;\r
+import java.sql.Timestamp;\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.Ref;\r
+\r
+import java.net.URL;\r
+import java.util.Map;\r
+\r
+import java.io.ByteArrayInputStream;\r
+import java.io.InputStream;\r
+import java.io.InputStreamReader;\r
+import java.io.Reader;\r
+import java.io.StringReader;\r
+import java.io.UnsupportedEncodingException;\r
+\r
+import java.util.Calendar;\r
+\r
+import org.apache.derby.iapi.error.StandardException;\r
+\r
+import org.apache.derby.iapi.services.io.StreamStorable;\r
+import org.apache.derby.iapi.sql.conn.StatementContext;\r
+import org.apache.derby.iapi.reference.JDBC30Translation;\r
+import org.apache.derby.iapi.reference.SQLState;\r
+import org.apache.derby.iapi.types.DataValueDescriptor;\r
+\r
+import org.apache.derby.impl.jdbc.Util;\r
+import org.apache.derby.impl.jdbc.EmbedConnection;\r
+import org.apache.derby.impl.jdbc.EmbedResultSet;\r
+\r
+\r
+/**\r
+ * This class extends the EmbedCallableStatement class in order to support new\r
+ * methods and classes that come with JDBC 2.0.\r
+ *\r
+ * @see org.apache.derby.impl.jdbc.EmbedCallableStatement\r
+ *\r
+ */\r
+public abstract class EmbedCallableStatement20\r
+ extends org.apache.derby.impl.jdbc.EmbedCallableStatement \r
+{\r
+\r
+ //////////////////////////////////////////////////////////////\r
+ //\r
+ // CONSTRUCTORS\r
+ //\r
+ //////////////////////////////////////////////////////////////\r
+ public EmbedCallableStatement20 (EmbedConnection conn, String sql,\r
+ int resultSetType,\r
+ int resultSetConcurrency,\r
+ int resultSetHoldability)\r
+ throws SQLException\r
+ {\r
+ super(conn, sql, resultSetType, resultSetConcurrency, resultSetHoldability);\r
+ }\r
+\r
+ /////////////////////////////////////////////////////////////////////////\r
+ //\r
+ // JDBC 2.0 - New public methods\r
+ //\r
+ /////////////////////////////////////////////////////////////////////////\r
+\r
+ /**\r
+ * JDBC 2.0\r
+ *\r
+ * Get the value of a NUMERIC parameter as a java.math.BigDecimal object.\r
+ *\r
+ * @param parameterIndex the first parameter is 1, the second is 2, ...\r
+ * @return the parameter value (full precision); if the value is SQL NULL, \r
+ * the result is null \r
+ * @exception SQLException if a database-access error occurs.\r
+ */\r
+ public BigDecimal getBigDecimal(int parameterIndex) throws SQLException \r
+ {\r
+ checkStatus();\r
+ try {\r
+ DataValueDescriptor dvd = getParms().getParameterForGet(parameterIndex-1);\r
+ if (wasNull = dvd.isNull())\r
+ return null;\r
+ \r
+ return org.apache.derby.iapi.types.SQLDecimal.getBigDecimal(dvd);\r
+ \r
+ } catch (StandardException e)\r
+ {\r
+ throw EmbedResultSet.noStateChangeException(e);\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * JDBC 2.0\r
+ *\r
+ * Returns an object representing the value of OUT parameter @i.\r
+ * Use the @map to determine the class from which to construct \r
+ * data of SQL structured and distinct types.\r
+ *\r
+ * @param i the first parameter is 1, the second is 2, ...\r
+ * @param map the mapping from SQL type names to Java classes\r
+ * @return a java.lang.Object holding the OUT parameter value.\r
+ * @exception SQLException if a database-access error occurs.\r
+ */\r
+ public Object getObject (int i, java.util.Map map) throws SQLException \r
+ {\r
+ checkStatus();\r
+ if( map == null)\r
+ throw Util.generateCsSQLException(SQLState.INVALID_API_PARAMETER,map,"map",\r
+ "java.sql.CallableStatement.getObject");\r
+ if(!(map.isEmpty()))\r
+ throw Util.notImplemented();\r
+ // Map is empty call the normal getObject method.\r
+ return getObject(i);\r
+ }\r
+\r
+ /**\r
+ * JDBC 2.0\r
+ *\r
+ * Get a REF(<structured-type>) OUT parameter.\r
+ *\r
+ * @param i the first parameter is 1, the second is 2, ...\r
+ * @return an object representing data of an SQL REF Type\r
+ * @exception SQLException if a database-access error occurs.\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 OUT parameter.\r
+ *\r
+ * @param i the first parameter is 1, the second is 2, ...\r
+ * @return an object representing an SQL array\r
+ * @exception SQLException if a database-access error occurs.\r
+ */\r
+ public Array getArray (int i) throws SQLException {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+\r
+ \r
+ /*\r
+ * Note: all the JDBC 2.0 Prepared statement methods are duplicated in here\r
+ * because this class inherits from Local/EmbedCallableStatement, which\r
+ * inherits from local/PreparedStatement. This class should inherit from a\r
+ * local20/PreparedStatement. Since java does not allow multiple inheritance,\r
+ * duplicate the code here.\r
+ */\r
+ \r
+ /**\r
+ * JDBC 2.0\r
+ *\r
+ * Set a REF(<structured-type>) parameter.\r
+ *\r
+ * @param i the first parameter is 1, the second is 2, ...\r
+ * @param x an object representing data of an SQL REF Type\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void setRef (int i, Ref x) throws SQLException {\r
+ throw Util.notImplemented();\r
+ }\r
+ \r
+ /**\r
+ * JDBC 2.0\r
+ *\r
+ * Set an Array parameter.\r
+ *\r
+ * @param i the first parameter is 1, the second is 2, ...\r
+ * @param x an object representing an SQL array\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void setArray (int i, Array x) throws SQLException {\r
+ throw Util.notImplemented();\r
+ }\r
+ \r
+\r
+ /////////////////////////////////////////////////////////////////////////\r
+ //\r
+ // JDBC 3.0 - New public methods\r
+ //\r
+ /////////////////////////////////////////////////////////////////////////\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Registers the OUT parameter named parameterName to the JDBC type sqlType.\r
+ * All OUT parameters must be registered before a stored procedure is executed.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param sqlType - the JDBC type code defined by java.sql.Types. If the\r
+ * parameter is of JDBC type NUMERIC or DECIMAL, the version of registerOutParameter\r
+ * that accepts a scale value should be used.\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void registerOutParameter(String parameterName,\r
+ int sqlType)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Registers the designated output parameter. This version of the method\r
+ * registerOutParameter should be used for a user-named or REF output parameter.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param sqlType - the SQL type code defined by java.sql.Types.\r
+ * @param typeName - the fully-qualified name of an SQL structure type\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void registerOutParameter(String parameterName,\r
+ int sqlType, String typeName)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Registers the parameter named parameterName to the JDBC type sqlType.\r
+ * This method must be called before a stored procedure is executed.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param sqlType - the SQL type code defined by java.sql.Types.\r
+ * @param scale - the desired number of digits to the right of the decimal point.\r
+ * It must be greater than or equal to zero.\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void registerOutParameter(String parameterName,\r
+ int sqlType, int scale)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Retrieves the value of a JDBC REF (<structured-type) parameter as a Ref object\r
+ * in the Java programming language.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @return the parameter value as a Ref object in the Java Programming language.\r
+ * If the value is SQL NULL, the result is null.\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public Ref getRef(String parameterName)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Retrieves the value of a JDBC BLOB parameter as a Blob object\r
+ * in the Java programming language.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @return the parameter value as a Blob object in the Java Programming language.\r
+ * If the value is SQL NULL, the result is null.\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public Blob getBlob(String parameterName)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Retrieves the value of a JDBC CLOB parameter as a Clob object\r
+ * in the Java programming language.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @return the parameter value as a Clob object in the Java Programming language.\r
+ * If the value is SQL NULL, the result is null.\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public Clob getClob(String parameterName)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Retrieves the value of a JDBC ARRAY parameter as an Array object\r
+ * in the Java programming language.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @return the parameter value as a Array object in the Java Programming language.\r
+ * If the value is SQL NULL, the result is null.\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public Array getArray(String parameterName)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Sets the designated parameter to SQL NULL.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param sqlType - the SQL type code defined in java.sql.Types\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void setNull(String parameterName, int sqlType)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Sets the designated parameter to SQL NULL.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param sqlType - the SQL type code defined in java.sql.Types\r
+ * @param typeName - the fully-qualified name of an SQL user-defined type\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void setNull(String parameterName, int sqlType, String typeName)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Sets the designated parameter to the given Java boolean value. The driver\r
+ * converts this to an SQL BIT value when it sends it to the database.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param x - the parameter value\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void setBoolean(String parameterName, boolean x)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Retrieves the value of a JDBC BIT parameter as a boolean in the Java\r
+ * programming language.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @return the parameter value. If the value is SQL NULL, the result is false.\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public boolean getBoolean(String parameterName)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Sets the designated parameter to the given Java byte value. The driver\r
+ * converts this to an SQL TINYINT value when it sends it to the database.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param x - the parameter value\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void setByte(String parameterName, byte x)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Retrieves the value of a JDBC TINYINT parameter as a byte in the Java\r
+ * programming language.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @return the parameter value. If the value is SQL NULL, the result is 0.\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public byte getByte(String parameterName)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Sets the designated parameter to the given Java short value. The driver\r
+ * converts this to an SQL SMALLINT value when it sends it to the database.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param x - the parameter value\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void setShort(String parameterName, short x)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Retrieves the value of a JDBC SMALLINT parameter as a short in the Java\r
+ * programming language.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @return the parameter value. If the value is SQL NULL, the result is 0.\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public short getShort(String parameterName)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Sets the designated parameter to the given Java int value. The driver\r
+ * converts this to an SQL INTEGER value when it sends it to the database.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param x - the parameter value\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void setInt(String parameterName, int x)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Retrieves the value of a JDBC INTEGER parameter as a int in the Java\r
+ * programming language.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @return the parameter value. If the value is SQL NULL, the result is 0.\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public int getInt(String parameterName)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Sets the designated parameter to the given Java long value. The driver\r
+ * converts this to an SQL BIGINT value when it sends it to the database.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param x - the parameter value\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void setLong(String parameterName, long x)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Retrieves the value of a JDBC BIGINT parameter as a long in the Java\r
+ * programming language.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @return the parameter value. If the value is SQL NULL, the result is 0.\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public long getLong(String parameterName)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Sets the designated parameter to the given Java float value. The driver\r
+ * converts this to an SQL FLOAT value when it sends it to the database.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param x - the parameter value\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void setFloat(String parameterName, float x)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Retrieves the value of a JDBC FLOAT parameter as a float in the Java\r
+ * programming language.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @return the parameter value. If the value is SQL NULL, the result is 0.\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public float getFloat(String parameterName)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Sets the designated parameter to the given Java double value. The driver\r
+ * converts this to an SQL DOUBLE value when it sends it to the database.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param x - the parameter value\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void setDouble(String parameterName, double x)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Retrieves the value of a JDBC DOUBLE parameter as a double in the Java\r
+ * programming language.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @return the parameter value. If the value is SQL NULL, the result is 0.\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public double getDouble(String parameterName)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Sets the designated parameter to the given java.math.BigDecimal value. The driver\r
+ * converts this to an SQL NUMERIC value when it sends it to the database.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param x - the parameter value\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void setBigDecimal(String parameterName, BigDecimal x)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Retrieves the value of a JDBC NUMERIC parameter as a java.math.BigDecimal\r
+ * object with as many digits to the right of the decimal point as the value contains\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @return the parameter value. If the value is SQL NULL, the result is 0.\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public BigDecimal getBigDecimal(String parameterName)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Sets the designated parameter to the given Java String value. The driver\r
+ * converts this to an SQL VARCHAR OR LONGVARCHAR value (depending on the\r
+ * argument's size relative the driver's limits on VARCHAR values) when it\r
+ * sends it to the database.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param x - the parameter value\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void setString(String parameterName, String x)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Retrieves the value of a JDBC CHAR, VARCHAR, or LONGVARCHAR parameter as\r
+ * a String in the Java programming language.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @return the parameter value. If the value is SQL NULL, the result is null.\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public String getString(String parameterName)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Sets the designated parameter to the given Java array of bytes. The driver\r
+ * converts this to an SQL VARBINARY OR LONGVARBINARY (depending on the argument's\r
+ * size relative to the driver's limits on VARBINARY values)when it sends it to\r
+ * the database.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param x - the parameter value\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void setBytes(String parameterName, byte[] x)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Retrieves the value of a JDBC BINARY or VARBINARY parameter as an array\r
+ * of byte values in the Java programming language.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @return the parameter value. If the value is SQL NULL, the result is null.\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public byte[] getBytes(String parameterName)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Sets the designated parameter to the given java.sql.Date value. The driver\r
+ * converts this to an SQL DATE value when it sends it to the database.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param x - the parameter value\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void setDate(String parameterName, Date x)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Sets the designated parameter to the given java.sql.Date value, using the given\r
+ * Calendar object.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param x - the parameter value\r
+ * @param cal - the Calendar object the driver will use to construct the date\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void setDate(String parameterName, Date x, Calendar cal)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Retrieves the value of a JDBC DATE parameter as ajava.sql.Date object\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @return the parameter value. If the value is SQL NULL, the result is null.\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public Date getDate(String parameterName)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Retrieves the value of a JDBC DATE parameter as a java.sql.Date object,\r
+ * using the given Calendar object to construct the date object.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param cal - the Calendar object the driver will use to construct the date\r
+ * @return the parameter value. If the value is SQL NULL, the result is null.\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public Date getDate(String parameterName, Calendar cal)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Sets the designated parameter to the given java.sql.Time value. The driver\r
+ * converts this to an SQL TIME value when it sends it to the database.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param x - the parameter value\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void setTime(String parameterName, Time x)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Retrieves the value of a JDBC TIME parameter as ajava.sql.Time object\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @return the parameter value. If the value is SQL NULL, the result is null.\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public Time getTime(String parameterName)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Retrieves the value of a JDBC TIME parameter as a java.sql.Time object,\r
+ * using the given Calendar object to construct the time object.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param cal - the Calendar object the driver will use to construct the time\r
+ * @return the parameter value. If the value is SQL NULL, the result is null.\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public Time getTime(String parameterName, Calendar cal)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Sets the designated parameter to the given java.sql.Time value using the\r
+ * Calendar object\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param x - the parameter value\r
+ * @param cal - the Calendar object the driver will use to construct the time\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void setTime(String parameterName, Time x, Calendar cal)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Sets the designated parameter to the given java.sql.Timestamp value. The driver\r
+ * converts this to an SQL TIMESTAMP value when it sends it to the database.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param x - the parameter value\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void setTimestamp(String parameterName, Timestamp x)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Sets the designated parameter to the given java.sql.Timestamp value, using the\r
+ * given Calendar object\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param x - the parameter value\r
+ * @param cal - the Calendar object the driver will use to construct the timestamp.\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void setTimestamp(String parameterName, Timestamp x, Calendar cal)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Retrieves the value of a JDBC TIMESTAMP parameter as a java.sql.Timestamp object\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @return the parameter value. If the value is SQL NULL, the result is null.\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public Timestamp getTimestamp(String parameterName)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Retrieves the value of a JDBC TIMESTAMP parameter as a java.sql.Timestamp object,\r
+ * using the given Calendar object to construct the Timestamp object.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param cal - the Calendar object the driver will use to construct the Timestamp\r
+ * @return the parameter value. If the value is SQL NULL, the result is null.\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public Timestamp getTimestamp(String parameterName, Calendar cal)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Sets the designated parameter to the given input stream, which will have the\r
+ * specified number of bytes.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param x - the Java input stream that contains the ASCII parameter value\r
+ * @param length - the number of bytes in the stream\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void setAsciiStream(String parameterName, InputStream x, int length)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Sets the designated parameter to the given input stream, which will have the\r
+ * specified number of bytes.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param x - the Java input stream that contains the binary parameter value\r
+ * @param length - the number of bytes in the stream\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void setBinaryStream(String parameterName, InputStream x, int length)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Sets the designated parameter to the given Reader object, which is the given\r
+ * number of characters long.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param reader - the java.io.Reader object that contains the UNICODE data\r
+ * @param length - the number of characters in the stream\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void setCharacterStream(String parameterName, Reader reader, int length)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Sets the value of the designated parameter with the given object. The second\r
+ * argument must be an object type; for integral values, the java.lang equivalent\r
+ * objects should be used.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param x - the object containing the input parameter value\r
+ * @param targetSqlType - the SQL type (as defined in java.sql.Types) to be sent to\r
+ * the database. The scale argument may further qualify this type.\r
+ * @param scale - for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types, this\r
+ * is the number of digits after the decimal point. For all other types, this value\r
+ * will be ignored.\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void setObject(String parameterName, Object x, int targetSqlType, int scale)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Retrieves the value of a parameter as an Object in the java programming language.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @return a java.lang.Object holding the OUT parameter value\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public Object getObject(String parameterName)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Returns an object representing the value of OUT parameter i and uses map for\r
+ * the custom mapping of the parameter value.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param map - the mapping from SQL type names to Java classes\r
+ * @return a java.lang.Object holding the OUT parameter value\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public Object getObject(String parameterName, Map map)\r
+ throws SQLException\r
+ {\r
+ checkStatus();\r
+ if( map == null)\r
+ throw Util.generateCsSQLException(SQLState.INVALID_API_PARAMETER,map,"map",\r
+ "java.sql.CallableStatement.getObject");\r
+ if(!(map.isEmpty()))\r
+ throw Util.notImplemented();\r
+\r
+ // Map is empty so call the normal getObject method.\r
+ return getObject(parameterName);\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Sets the value of the designated parameter with the given object. This method\r
+ * is like the method setObject above, except that it assumes a scale of zero.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param x - the object containing the input parameter value\r
+ * @param targetSqlType - the SQL type (as defined in java.sql.Types) to be sent to\r
+ * the database. \r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void setObject(String parameterName, Object x, int targetSqlType)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /**\r
+ * JDBC 3.0\r
+ *\r
+ * Sets the value of the designated parameter with the given object. The second\r
+ * parameter must be of type Object; therefore, the java.lang equivalent objects\r
+ * should be used for built-in types.\r
+ *\r
+ * @param parameterName - the name of the parameter\r
+ * @param x - the object containing the input parameter value\r
+ * @exception SQLException Feature not implemented for now.\r
+ */\r
+ public void setObject(String parameterName, Object x)\r
+ throws SQLException\r
+ {\r
+ throw Util.notImplemented();\r
+ }\r
+\r
+ /*\r
+ ** Methods using BigDecimal, moved out of EmbedPreparedStatement\r
+ ** to allow that class to support JSR169.\r
+ */\r
+ /**\r
+ * Set a parameter to a java.lang.BigDecimal value. \r
+ * The driver converts this to a SQL NUMERIC value when\r
+ * it sends it to the database.\r
+ *\r
+ * @param parameterIndex the first parameter is 1, the second is 2, ...\r
+ * @param x the parameter value\r
+ * @exception SQLException thrown on failure.\r
+ */\r
+ public final void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException {\r
+ checkStatus();\r
+ try {\r
+ /* JDBC is one-based, DBMS is zero-based */\r
+ getParms().getParameterForSet(parameterIndex - 1).setBigDecimal(x);\r
+\r
+ } catch (Throwable t) {\r
+ throw EmbedResultSet.noStateChangeException(t);\r
+ }\r
+ }\r
+ /**\r
+ * @see CallableStatement#getBigDecimal\r
+ * @exception SQLException NoOutputParameters thrown.\r
+ */\r
+ public final BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException\r
+ {\r
+ BigDecimal v = getBigDecimal(parameterIndex);\r
+ if (v != null)\r
+ v = v.setScale(scale, BigDecimal.ROUND_HALF_DOWN);\r
+ return v;\r
+ }\r
+ /**\r
+ Allow explict setObject conversions by sub-classes for classes\r
+ not supported by this variant. In this case handle BigDecimal.\r
+ @return true if the object was set successfully, false if no valid\r
+ conversion exists.\r
+\r
+ @exception SQLException value could not be set.\r
+ */\r
+ boolean setObjectConvert(int parameterIndex, Object x) throws SQLException\r
+ {\r
+ if (x instanceof BigDecimal) {\r
+ setBigDecimal(parameterIndex, (BigDecimal) x);\r
+ return true;\r
+ }\r
+ return false;\r
+ }\r
+\r
+ /////////////////////////////////////////////////////////////////////////\r
+ //\r
+ // JDBC 4.0 - New public methods\r
+ //\r
+ /////////////////////////////////////////////////////////////////////////\r
+ \r
+ /**\r
+ * Retrieves the value of the designated parameter as a \r
+ * <code>java.io.Reader</code> object in the Java programming language.\r
+ * Introduced in JDBC 4.0.\r
+ *\r
+ * @param parameterIndex the first parameter is 1, the second is 2, ...\r
+ * @return a <code>java.io.Reader</code> object that contains the parameter\r
+ * value; if the value is SQL <code>NULL</code>, the value returned\r
+ * is <code>null</code> in the Java programming language.\r
+ * @throws SQLException if a database access error occurs or this method is\r
+ * called on a closed <code>CallableStatement</code>\r
+ */\r
+ public Reader getCharacterStream(int parameterIndex)\r
+ throws SQLException {\r
+ checkStatus();\r
+ // Make sure the specified parameter has mode OUT or IN/OUT.\r
+ switch (getParms().getParameterMode(parameterIndex)) {\r
+ case JDBC30Translation.PARAMETER_MODE_IN:\r
+ case JDBC30Translation.PARAMETER_MODE_UNKNOWN:\r
+ throw newSQLException(SQLState.LANG_NOT_OUTPUT_PARAMETER,\r
+ Integer.toString(parameterIndex));\r
+ }\r
+ Reader reader = null;\r
+ int paramType = getParameterJDBCType(parameterIndex);\r
+ switch (paramType) {\r
+ // Handle character/string types.\r
+ case Types.CHAR:\r
+ case Types.VARCHAR:\r
+ case Types.LONGVARCHAR:\r
+ case Types.CLOB:\r
+ boolean pushStack = false;\r
+ Object syncObject = getConnectionSynchronization();\r
+ synchronized (syncObject) {\r
+ try {\r
+ DataValueDescriptor param = \r
+ getParms().getParameterForGet(parameterIndex -1);\r
+ if (param.isNull()) {\r
+ break;\r
+ }\r
+ pushStack = true;\r
+ setupContextStack();\r
+\r
+ StreamStorable ss = (StreamStorable)param;\r
+ InputStream stream = ss.returnStream();\r
+ if (stream == null) {\r
+ reader = new StringReader(param.getString());\r
+ } else {\r
+ reader = new UTF8Reader(stream, 0, this, syncObject);\r
+ }\r
+ } catch (Throwable t) {\r
+ throw EmbedResultSet.noStateChangeException(t);\r
+ } finally {\r
+ if (pushStack) {\r
+ restoreContextStack();\r
+ }\r
+ }\r
+ } // End synchronized block\r
+ break;\r
+\r
+ // Handle binary types.\r
+ // JDBC says to support these, but no defintion exists for the output.\r
+ // Match JCC which treats the bytes as a UTF-16BE stream.\r
+ case Types.BINARY:\r
+ case Types.VARBINARY:\r
+ case Types.LONGVARBINARY:\r
+ case Types.BLOB:\r
+ try {\r
+ InputStream is = getBinaryStream(parameterIndex);\r
+ if (is != null) {\r
+ reader = new InputStreamReader(is, "UTF-16BE");\r
+ }\r
+ break;\r
+ } catch (UnsupportedEncodingException uee) {\r
+ throw newSQLException(uee.getMessage());\r
+ }\r
+\r
+ default:\r
+ throw newSQLException(SQLState.LANG_DATA_TYPE_GET_MISMATCH, \r
+ "java.io.Reader", Util.typeName(paramType));\r
+ } \r
+ // Update wasNull. \r
+ wasNull = (reader == null);\r
+ return reader;\r
+ }\r
+ \r
+ // Private utility classes\r
+\r
+ /**\r
+ * Get binary stream for a parameter.\r
+ *\r
+ * @param parameterIndex first parameter is 1, second is 2 etc.\r
+ * @return a stream for the binary parameter, or <code>null</code>.\r
+ *\r
+ * @throws SQLException if a database access error occurs.\r
+ */\r
+ private InputStream getBinaryStream(int parameterIndex)\r
+ throws SQLException {\r
+ int paramType = getParameterJDBCType(parameterIndex); \r
+ switch (paramType) {\r
+ case Types.BINARY:\r
+ case Types.VARBINARY:\r
+ case Types.LONGVARBINARY:\r
+ case Types.BLOB:\r
+ break;\r
+ default:\r
+ throw newSQLException(SQLState.LANG_DATA_TYPE_GET_MISMATCH, \r
+ "java.io.InputStream", Util.typeName(paramType));\r
+ }\r
+\r
+ boolean pushStack = false;\r
+ synchronized (getConnectionSynchronization()) {\r
+ try {\r
+ DataValueDescriptor param = \r
+ getParms().getParameterForGet(parameterIndex -1);\r
+ wasNull = param.isNull();\r
+ if (wasNull) {\r
+ return null;\r
+ }\r
+ pushStack = true;\r
+ setupContextStack();\r
+\r
+ StreamStorable ss = (StreamStorable)param;\r
+ InputStream stream = ss.returnStream();\r
+ if (stream == null) {\r
+ stream = new ByteArrayInputStream(param.getBytes());\r
+ } else {\r
+ stream = new BinaryToRawStream(stream, param);\r
+ }\r
+ return stream;\r
+ } catch (Throwable t) {\r
+ throw EmbedResultSet.noStateChangeException(t);\r
+ } finally {\r
+ if (pushStack) {\r
+ restoreContextStack();\r
+ }\r
+ }\r
+ } // End synchronized block\r
+ }\r
+}\r