db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r417548 [1/2] - in /db/derby/code/trunk/java: client/org/apache/derby/client/am/ client/org/apache/derby/client/net/ engine/org/apache/derby/iapi/jdbc/ engine/org/apache/derby/impl/jdbc/ engine/org/apache/derby/loc/ shared/org/apache/derby/...
Date Tue, 27 Jun 2006 18:26:29 GMT
Author: kahatlen
Date: Tue Jun 27 11:26:28 2006
New Revision: 417548

URL: http://svn.apache.org/viewvc?rev=417548&view=rev
Log:
DERBY-1445: Add new streaming overloads and modify some existing ones.

Adding new (JDBC 4.0) streaming overloads to ResultSet, PreparedStatement
and CallableStatement. The new overloads take a long as the length
parameter.

Patch contributed by V. Narayanan.

Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement40.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement40.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement40.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement40.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedPreparedStatement.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet40.java
    db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties
    db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ResultSetTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/UnsupportedVetter.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement40.java?rev=417548&r1=417547&r2=417548&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement40.java Tue Jun 27 11:26:28 2006
@@ -212,4 +212,53 @@
             throw se.getSQLException();
         }
     }
+
+
+    /**
+     * Sets the designated parameter to the given input stream, which will have
+     * the specified number of bytes.
+     *
+     * @param parameterName the name of the first parameter
+     * @param x the java input stream which contains the ASCII parameter value
+     * @param length the number of bytes in the stream
+     * @exception SQLException thrown on failure.
+     *
+     */
+
+    public final void setAsciiStream(String parameterName, InputStream x, long length)
+    throws SQLException {
+        throw SQLExceptionFactory.notImplemented ("setAsciiStream(String,InputStream,long)");
+    }
+
+    /**
+     * Sets the designated parameter to the given input stream, which will have
+     * the specified number of bytes.
+     *
+     * @param parameterName the name of the first parameter
+     * @param x the java input stream which contains the binary parameter value
+     * @param length the number of bytes in the stream
+     * @exception SQLException thrown on failure.
+     *
+     */
+
+    public final void setBinaryStream(String parameterName, InputStream x, long length)
+    throws SQLException {
+        throw SQLExceptionFactory.notImplemented ("setBinaryStream(String,InputStream,long)");
+    }
+
+    /**
+     * Sets the designated parameter to the given Reader, which will have
+     * the specified number of bytes.
+     *
+     * @param parameterName the name of the first parameter
+     * @param x the java Reader which contains the UNICODE value
+     * @param length the number of bytes in the stream
+     * @exception SQLException thrown on failure.
+     *
+     */
+
+    public final void setCharacterStream(String parameterName, Reader x, long length)
+    throws SQLException {
+       throw SQLExceptionFactory.notImplemented ("setCharacterStream(String,Reader,long)");
+    }
 }

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java?rev=417548&r1=417547&r2=417548&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java Tue Jun 27 11:26:28 2006
@@ -832,16 +832,30 @@
 
     }
 
+    /**
+     * sets the parameter to the  Binary Stream object
+     *
+     * @param parameterIndex the first parameter is 1, the second is 2, ...
+     * @param x the java input stream which contains the binary parameter value
+     * @param length the number of bytes in the stream
+     * @exception SQLException thrown on failure.
+     */
+
     public void setBinaryStream(int parameterIndex,
                                 java.io.InputStream x,
-                                int length) throws SQLException {
+                                long length) throws SQLException {
         try
         {
             synchronized (connection_) {
                 if (agent_.loggingEnabled()) {
-                    agent_.logWriter_.traceEntry(this, "setBinaryStream", parameterIndex, "<input stream>", length);
+                    agent_.logWriter_.traceEntry(this, "setBinaryStream", parameterIndex, "<input stream>", new Long(length));
                 }
-                setBinaryStreamX(parameterIndex, x, length);
+                 if(length > Integer.MAX_VALUE) {
+                    throw new SqlException(agent_.logWriter_,
+                        new ClientMessageId(SQLState.CLIENT_LENGTH_OUTSIDE_RANGE_FOR_DATATYPE),
+                        new Long(length), new Integer(Integer.MAX_VALUE)).getSQLException();
+                }
+                setBinaryStreamX(parameterIndex, x, (int)length);
             }
         }
         catch ( SqlException se )
@@ -850,6 +864,21 @@
         }
     }
 
+    /**
+     * sets the parameter to the  Binary Stream object
+     *
+     * @param parameterIndex the first parameter is 1, the second is 2, ...
+     * @param x the java input stream which contains the binary parameter value
+     * @param length the number of bytes in the stream
+     * @exception SQLException thrown on failure.
+     */
+
+    public void setBinaryStream(int parameterIndex,
+                                java.io.InputStream x,
+                                int length) throws SQLException {
+        setBinaryStream(parameterIndex,x,(long)length);
+    }
+
     protected void setBinaryStreamX(int parameterIndex,
                                  java.io.InputStream x,
                                  int length) throws SqlException {
@@ -862,14 +891,24 @@
         setInput(parameterIndex, new Blob(agent_, x, length));
     }
 
+    /**
+     * We do this inefficiently and read it all in here. The target type
+     * is assumed to be a String.
+     *
+     * @param parameterIndex the first parameter is 1, the second is 2, ...
+     * @param x the java input stream which contains the ASCII parameter value
+     * @param length the number of bytes in the stream
+     * @exception SQLException thrown on failure.
+     */
+
     public void setAsciiStream(int parameterIndex,
                                java.io.InputStream x,
-                               int length) throws SQLException {
+                               long length) throws SQLException {
         try
         {
             synchronized (connection_) {
                 if (agent_.loggingEnabled()) {
-                    agent_.logWriter_.traceEntry(this, "setAsciiStream", parameterIndex, "<input stream>", length);
+                    agent_.logWriter_.traceEntry(this, "setAsciiStream", parameterIndex, "<input stream>", new Long(length));
                 }
                 parameterIndex = checkSetterPreconditions(parameterIndex);
                 parameterMetaData_.clientParamtertype_[parameterIndex - 1] = java.sql.Types.CLOB;
@@ -877,7 +916,12 @@
                     setNull(parameterIndex, java.sql.Types.CLOB);
                     return;
                 }
-                setInput(parameterIndex, new Clob(agent_, x, "US-ASCII", length));
+                if(length > Integer.MAX_VALUE) {
+                    throw new SqlException(agent_.logWriter_,
+                        new ClientMessageId(SQLState.CLIENT_LENGTH_OUTSIDE_RANGE_FOR_DATATYPE),
+                        new Long(length), new Integer(Integer.MAX_VALUE)).getSQLException();
+                }
+                setInput(parameterIndex, new Clob(agent_, x, "US-ASCII", (int)length));
             }
         }
         catch ( SqlException se )
@@ -886,6 +930,21 @@
         }
     }
 
+    /**
+     * We do this inefficiently and read it all in here. The target type
+     * is assumed to be a String.
+     *
+     * @param parameterIndex the first parameter is 1, the second is 2, ...
+     * @param x the java input stream which contains the ASCII parameter value
+     * @param length the number of bytes in the stream
+     * @exception SQLException thrown on failure.
+     */
+    public void setAsciiStream(int parameterIndex,
+                               java.io.InputStream x,
+                               int length) throws SQLException {
+        setAsciiStream(parameterIndex,x,(long)length);
+    }
+
     public void setUnicodeStream(int parameterIndex,
                                  java.io.InputStream x,
                                  int length) throws SQLException {
@@ -910,14 +969,26 @@
         }
     }
 
+     /**
+     * Sets the designated parameter to the given Reader, which will have
+     * the specified number of bytes.
+     *
+     * @param parameterIndex the index of the parameter to which this set
+     *                       method is applied
+     * @param x the java Reader which contains the UNICODE value
+     * @param length the number of bytes in the stream
+     * @exception SQLException thrown on failure.
+     *
+     */
+
     public void setCharacterStream(int parameterIndex,
                                    java.io.Reader x,
-                                   int length) throws SQLException {
+                                   long length) throws SQLException {
         try
         {
             synchronized (connection_) {
                 if (agent_.loggingEnabled()) {
-                    agent_.logWriter_.traceEntry(this, "setCharacterStream", parameterIndex, x, length);
+                    agent_.logWriter_.traceEntry(this, "setCharacterStream", parameterIndex, x, new Long(length));
                 }
                 parameterIndex = checkSetterPreconditions(parameterIndex);
                 parameterMetaData_.clientParamtertype_[parameterIndex - 1] = java.sql.Types.CLOB;
@@ -925,13 +996,36 @@
                     setNull(parameterIndex, java.sql.Types.CLOB);
                     return;
                 }
-                setInput(parameterIndex, new Clob(agent_, x, length));
+                if(length > Integer.MAX_VALUE) {
+                    throw new SqlException(agent_.logWriter_,
+                        new ClientMessageId(SQLState.CLIENT_LENGTH_OUTSIDE_RANGE_FOR_DATATYPE),
+                        new Long(length), new Integer(Integer.MAX_VALUE)).getSQLException();
+                }
+                setInput(parameterIndex, new Clob(agent_, x, (int)length));
             }
         }
         catch ( SqlException se )
         {
             throw se.getSQLException();
         }
+    }
+
+     /**
+     * Sets the designated parameter to the given Reader, which will have
+     * the specified number of bytes.
+     *
+     * @param parameterIndex the index of the parameter to which this
+     *                       set method is applied
+     * @param x the java Reader which contains the UNICODE value
+     * @param length the number of bytes in the stream
+     * @exception SQLException thrown on failure.
+     *
+     */
+
+    public void setCharacterStream(int parameterIndex,
+                                   java.io.Reader x,
+                                   int length) throws SQLException {
+        setCharacterStream(parameterIndex,x,(long)length);
     }
 
     public void setBlob(int parameterIndex, java.sql.Blob x) throws SQLException {

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java?rev=417548&r1=417547&r2=417548&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java Tue Jun 27 11:26:28 2006
@@ -21,7 +21,10 @@
 package org.apache.derby.client.am;
 
 import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
 import java.sql.SQLException;
+import org.apache.derby.client.am.SQLExceptionFactory;
 import org.apache.derby.shared.common.reference.SQLState;
 import org.apache.derby.shared.common.i18n.MessageUtil;
 
@@ -3037,7 +3040,7 @@
         {
             synchronized (connection_) {
                 if (agent_.loggingEnabled()) {
-                    agent_.logWriter_.traceEntry(this, "updateBinaryStream", column, x, length);
+                    agent_.logWriter_.traceEntry(this, "", column, x, length);
                 }
                 checkUpdatePreconditions(column, "updateBinaryStream");
                 updateColumn(column, agent_.crossConverters_.setObjectFromBinaryStream(resultSetMetaData_.types_[column - 1], x, length));
@@ -5411,4 +5414,168 @@
         }
         return isClosed;
     }
+
+
+    /**
+     * Update a column with an ascii stream value.
+     *
+     * The updateXXX() methods are used to update column values in the current
+     * row, or the insert row. The updateXXX() methods do not update the
+     * underlying database, instead the updateRow() or insertRow() methods are
+     * called to update the database.
+     *
+     * @param columnIndex
+     *            the first column is 1, the second is 2, ...
+     * @param x
+     *            the new column value
+     * @param length
+     *            the length of the stream
+     * @exception SQLException
+     *                if a database-access error occurs
+     */
+    public void updateAsciiStream(int columnIndex, InputStream x,
+                    long length) throws SQLException {
+        if(length > Integer.MAX_VALUE)
+                throw new SqlException(agent_.logWriter_,
+                    new ClientMessageId(SQLState.CLIENT_LENGTH_OUTSIDE_RANGE_FOR_DATATYPE),
+                    new Long(length), new Integer(Integer.MAX_VALUE)).getSQLException();
+        else
+            updateAsciiStream(columnIndex,x,(int)length);
+    }
+
+    /**
+     * Update a column with a binary stream value.
+     *
+     * The updateXXX() methods are used to update column values in the current
+     * row, or the insert row. The updateXXX() methods do not update the
+     * underlying database, instead the updateRow() or insertRow() methods are
+     * called to update the database.
+     *
+     * @param columnIndex
+     *            the first column is 1, the second is 2, ...
+     * @param x
+     *            the new column value
+     * @param length
+     *            the length of the stream
+     * @exception SQLException
+     *                if a database-access error occurs
+     */
+    public void updateBinaryStream(int columnIndex, InputStream x,
+        long length) throws SQLException {
+         if(length > Integer.MAX_VALUE)
+                throw new SqlException(agent_.logWriter_,
+                    new ClientMessageId(SQLState.CLIENT_LENGTH_OUTSIDE_RANGE_FOR_DATATYPE),
+                    new Long(length), new Integer(Integer.MAX_VALUE)).getSQLException();
+        else
+            updateBinaryStream(columnIndex,x,(int)length);
+
+     }
+
+    /**
+     * Update a column with a character stream value.
+     *
+     * The updateXXX() methods are used to update column values in the current
+     * row, or the insert row. The updateXXX() methods do not update the
+     * underlying database, instead the updateRow() or insertRow() methods are
+     * called to update the database.
+     *
+     * @param columnIndex
+     *            the first column is 1, the second is 2, ...
+     * @param x
+     *            the new column value
+     * @param length
+     *            the length of the stream
+     * @exception SQLException
+     *                if a database-access error occurs
+     */
+    public void updateCharacterStream(int columnIndex, Reader x,
+                    long length) throws SQLException {
+        if(length > Integer.MAX_VALUE)
+                throw new SqlException(agent_.logWriter_,
+                    new ClientMessageId(SQLState.CLIENT_LENGTH_OUTSIDE_RANGE_FOR_DATATYPE),
+                    new Long(length), new Integer(Integer.MAX_VALUE)).getSQLException();
+        else
+            updateCharacterStream(columnIndex,x,(int)length);
+    }
+
+    /**
+     * Update a column with an ascii stream value.
+     *
+     * The updateXXX() methods are used to update column values in the current
+     * row, or the insert row. The updateXXX() methods do not update the
+     * underlying database, instead the updateRow() or insertRow() methods are
+     * called to update the database.
+     *
+     * @param columnName
+     *            the name of the column
+     * @param x
+     *            the new column value
+     * @param length
+     *            of the stream
+     * @exception SQLException
+     *                if a database-access error occurs
+     */
+    public void updateAsciiStream(String columnName, InputStream x,
+                    long length) throws SQLException {
+        try {
+            updateAsciiStream(findColumnX(columnName), x, length);
+        }
+        catch(SqlException sqle) {
+            throw sqle.getSQLException();
+        }
+    }
+
+    /**
+     * Update a column with a binary stream value.
+     *
+     * The updateXXX() methods are used to update column values in the current
+     * row, or the insert row. The updateXXX() methods do not update the
+     * underlying database, instead the updateRow() or insertRow() methods are
+     * called to update the database.
+     *
+     * @param columnName
+     *            the name of the column
+     * @param x
+     *            the new column value
+     * @param length
+     *            of the stream
+     * @exception SQLException
+     *                if a database-access error occurs
+     */
+    public void updateBinaryStream(String columnName, InputStream x,
+                    long length) throws SQLException {
+        try {
+            updateBinaryStream(findColumnX(columnName), x, length);
+        }
+        catch(SqlException sqle) {
+            throw sqle.getSQLException();
+        }
+    }
+
+    /**
+     * Update a column with a character stream value.
+     *
+     * The updateXXX() methods are used to update column values in the current
+     * row, or the insert row. The updateXXX() methods do not update the
+     * underlying database, instead the updateRow() or insertRow() methods are
+     * called to update the database.
+     *
+     * @param columnName
+     *            the name of the column
+     * @param reader
+     *            the new column value
+     * @param length
+     *            length of the stream
+     * @exception SQLException
+     *                if a database-access error occurs
+     */
+    public void updateCharacterStream(String columnName, Reader reader,
+        long length) throws SQLException {
+         try {
+             updateCharacterStream(findColumnX(columnName), reader, length);
+         }
+         catch(SqlException sqle) {
+             throw sqle.getSQLException();
+         }
+     }
 }

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java?rev=417548&r1=417547&r2=417548&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java Tue Jun 27 11:26:28 2006
@@ -102,16 +102,16 @@
         throw SQLExceptionFactory.notImplemented ("updateNString (String, String)");
     }
     
-    public void updateNCharacterStream(int columnIndex, Reader x, int length)
+    public void updateNCharacterStream(int columnIndex, Reader x, long length)
         throws SQLException {
         throw SQLExceptionFactory.notImplemented(
-                "updateNCharacterStream(int,Reader,int)");
+                "updateNCharacterStream(int,Reader,long)");
     }
     
-    public void updateNCharacterStream(String columnName, Reader x, int length)
+    public void updateNCharacterStream(String columnName, Reader x, long length)
         throws SQLException {
         throw SQLExceptionFactory.notImplemented(
-                "updateNCharacterStream(String,Reader,int)");
+                "updateNCharacterStream(String,Reader,long)");
     }
     
     public void updateNClob(int columnIndex, NClob nClob) throws SQLException {
@@ -188,4 +188,156 @@
         }
     }
     
+    /**
+     * Updates the designated column with a java.sql.Blob value. The updater
+     * methods are used to update column values in the current row or the insert
+     * row. The updater methods do not update the underlying database; instead
+     * the updateRow or insertRow methods are called to update the database.
+     *
+     * @param columnIndex -
+     *            the first column is 1, the second is 2
+     * @param x -
+     *            the new column value
+     * @param length -
+     *            the length of the Blob datatype
+     * @exception SQLException
+     *
+     */
+    public void updateBlob(int columnIndex, InputStream x, long length)
+                            throws SQLException {
+        throw SQLExceptionFactory.notImplemented("updateBlob(int,InputStream,long)");
+    }
+
+    /**
+     * Updates the designated column with a java.sql.Blob value. The updater
+     * methods are used to update column values in the current row or the insert
+     * row. The updater methods do not update the underlying database; instead
+     * the updateRow or insertRow methods are called to update the database.
+     *
+     * @param columnName -
+     *            the name of the column to be updated
+     * @param x -
+     *            the new column value
+     * @param length -
+     *            the length of the Blob datatype
+     * @exception SQLException
+     *
+     */
+
+    public void updateBlob(String columnName, InputStream x, long length)
+                           throws SQLException {
+        throw SQLExceptionFactory.notImplemented("updateBlob(String,inputStream,long)");
+    }
+
+    /**
+     * Updates the designated column with a java.sql.Clob value. The updater
+     * methods are used to update column values in the current row or the insert
+     * row. The updater methods do not update the underlying database; instead
+     * the updateRow or insertRow methods are called to update the database.
+     *
+     * @param columnIndex -
+     *            the first column is 1, the second is 2
+     * @param x -
+     *            the new column value
+     * @exception SQLException
+     *                Feature not implemented for now.
+     */
+    public void updateClob(int columnIndex, Reader x, long length)
+                throws SQLException {
+        throw SQLExceptionFactory.notImplemented("updateClob(int,Reader,long)");
+    }
+
+    /**
+     * Updates the designated column with a java.sql.Clob value. The updater
+     * methods are used to update column values in the current row or the insert
+     * row. The updater methods do not update the underlying database; instead
+     * the updateRow or insertRow methods are called to update the database.
+     *
+     * @param columnName -
+     *            the name of the Clob column
+     * @param x -
+     *            the new column value
+     * @exception SQLException
+     *                Feature not implemented for now.
+     */
+
+     public void updateClob(String columnName, InputStream x, long length)
+                           throws SQLException {
+         throw SQLExceptionFactory.notImplemented("updateClob(String,InputStream,long)");
+     }
+
+     /**
+     * Updates the designated column with a java.sql.Clob value. The updater
+     * methods are used to update column values in the current row or the insert
+     * row. The updater methods do not update the underlying database; instead
+     * the updateRow or insertRow methods are called to update the database.
+     *
+     * @param columnName -
+     *            the name of the Clob column
+     * @param x -
+     *            the new column value
+     * @exception SQLException
+     *                Feature not implemented for now.
+     */
+
+     public void updateClob(String columnName, Reader x, long length)
+                           throws SQLException {
+         throw SQLExceptionFactory.notImplemented("updateClob(String,Reader,long)");
+     }
+
+     /**
+     * Updates the designated column with a java.sql.NClob value. The updater
+     * methods are used to update column values in the current row or the insert
+     * row. The updater methods do not update the underlying database; instead
+     * the updateRow or insertRow methods are called to update the database.
+     *
+     * @param columnIndex -
+     *            the first column is 1, the second is 2
+     * @param x -
+     *            the new column value
+     * @exception SQLException
+     *                Feature not implemented for now.
+     */
+    public void updateNClob(int columnIndex, Reader x, long length)
+                throws SQLException {
+        throw SQLExceptionFactory.notImplemented("updateNClob(int,Reader,long)");
+    }
+
+    /**
+     * Updates the designated column with a java.sql.NClob value. The updater
+     * methods are used to update column values in the current row or the insert
+     * row. The updater methods do not update the underlying database; instead
+     * the updateRow or insertRow methods are called to update the database.
+     *
+     * @param columnName -
+     *            the name of the Clob column
+     * @param x -
+     *            the new column value
+     * @exception SQLException
+     *                Feature not implemented for now.
+     */
+
+     public void updateNClob(String columnName, InputStream x, long length)
+                           throws SQLException {
+         throw SQLExceptionFactory.notImplemented("updateNClob(String,InputStream,long)");
+     }
+
+     /**
+     * Updates the designated column with a java.sql.NClob value. The updater
+     * methods are used to update column values in the current row or the insert
+     * row. The updater methods do not update the underlying database; instead
+     * the updateRow or insertRow methods are called to update the database.
+     *
+     * @param columnName -
+     *            the name of the Clob column
+     * @param x -
+     *            the new column value
+     * @exception SQLException
+     *                Feature not implemented for now.
+     */
+
+     public void updateNClob(String columnName, Reader x, long length)
+                           throws SQLException {
+         throw SQLExceptionFactory.notImplemented("updateNClob(String,Reader,long)");
+     }
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement40.java?rev=417548&r1=417547&r2=417548&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement40.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredCallableStatement40.java Tue Jun 27 11:26:28 2006
@@ -223,5 +223,101 @@
      */
     public void setPoolable(boolean poolable) throws SQLException {
         getStatement().setPoolable(poolable);
-    }    
+    }
+
+    /**
+     * Sets the designated parameter to the given input stream, which will have
+     * the specified number of bytes.
+     *
+     * @param parameterIndex the first parameter is 1, the second is 2, ...
+     * @param x the java input stream which contains the ASCII parameter value
+     * @param length the number of bytes in the stream
+     * @exception SQLException thrown on failure.
+     *
+     */
+
+    public final void setAsciiStream(int parameterIndex, InputStream x, long length)
+    throws SQLException {
+        getCallableStatement().setAsciiStream(parameterIndex,x,length);
+    }
+
+    /**
+     * Sets the designated parameter to the given input stream, which will have
+     * the specified number of bytes.
+     *
+     * @param parameterIndex the first parameter is 1, the second is 2, ...
+     * @param x the java input stream which contains the binary parameter value
+     * @param length the number of bytes in the stream
+     * @exception SQLException thrown on failure.
+     *
+     */
+
+    public final void setBinaryStream(int parameterIndex, InputStream x, long length)
+    throws SQLException {
+        getCallableStatement().setBinaryStream(parameterIndex,x,length);
+    }
+
+    /**
+     * Sets the designated parameter to the given Reader, which will have
+     * the specified number of bytes.
+     *
+     * @param parameterIndex the first parameter is 1, the second is 2, ...
+     * @param x the java Reader which contains the UNICODE value
+     * @param length the number of bytes in the stream
+     * @exception SQLException thrown on failure.
+     *
+     */
+
+    public final void setCharacterStream(int parameterIndex, Reader x, long length)
+    throws SQLException {
+        getCallableStatement().setCharacterStream(parameterIndex,x,length);
+    }
+
+    /**
+     * Sets the designated parameter to the given input stream, which will have
+     * the specified number of bytes.
+     *
+     * @param parameterIndex the first parameter is 1, the second is 2, ...
+     * @param x the java input stream which contains the ASCII parameter value
+     * @param length the number of bytes in the stream
+     * @exception SQLException thrown on failure.
+     *
+     */
+
+    public final void setAsciiStream(String parameterName, InputStream x, long length)
+    throws SQLException {
+        getCallableStatement().setAsciiStream(parameterName,x,length);
+    }
+
+    /**
+     * Sets the designated parameter to the given input stream, which will have
+     * the specified number of bytes.
+     *
+     * @param parameterIndex the first parameter is 1, the second is 2, ...
+     * @param x the java input stream which contains the binary parameter value
+     * @param length the number of bytes in the stream
+     * @exception SQLException thrown on failure.
+     *
+     */
+
+    public final void setBinaryStream(String parameterName, InputStream x, long length)
+    throws SQLException {
+        getCallableStatement().setBinaryStream(parameterName,x,length);
+    }
+
+    /**
+     * Sets the designated parameter to the given Reader, which will have
+     * the specified number of bytes.
+     *
+     * @param parameterIndex the first parameter is 1, the second is 2, ...
+     * @param x the java Reader which contains the UNICODE value
+     * @param length the number of bytes in the stream
+     * @exception SQLException thrown on failure.
+     *
+     */
+
+    public final void setCharacterStream(String parameterName, Reader x, long length)
+    throws SQLException {
+        getCallableStatement().setCharacterStream(parameterName,x,length);
+    }
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement40.java?rev=417548&r1=417547&r2=417548&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement40.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/BrokeredPreparedStatement40.java Tue Jun 27 11:26:28 2006
@@ -119,4 +119,53 @@
     public void setPoolable(boolean poolable) throws SQLException {
         getStatement().setPoolable(poolable);
     }    
+
+
+    /**
+     * Sets the designated parameter to the given input stream, which will have
+     * the specified number of bytes.
+     *
+     * @param parameterIndex the first parameter is 1, the second is 2, ...
+     * @param x the java input stream which contains the ASCII parameter value
+     * @param length the number of bytes in the stream
+     * @exception SQLException thrown on failure.
+     *
+     */
+
+    public final void setAsciiStream(int parameterIndex, InputStream x, long length)
+    throws SQLException {
+        getPreparedStatement().setAsciiStream(parameterIndex,x,length);
+    }
+
+    /**
+     * Sets the designated parameter to the given input stream, which will have
+     * the specified number of bytes.
+     *
+     * @param parameterIndex the first parameter is 1, the second is 2, ...
+     * @param x the java input stream which contains the binary parameter value
+     * @param length the number of bytes in the stream
+     * @exception SQLException thrown on failure.
+     *
+     */
+
+    public final void setBinaryStream(int parameterIndex, InputStream x, long length)
+    throws SQLException {
+        getPreparedStatement().setBinaryStream(parameterIndex,x,length);
+    }
+
+    /**
+     * Sets the designated parameter to the given Reader, which will have
+     * the specified number of bytes.
+     *
+     * @param parameterIndex the first parameter is 1, the second is 2, ...
+     * @param x the java Reader which contains the UNICODE value
+     * @param length the number of bytes in the stream
+     * @exception SQLException thrown on failure.
+     *
+     */
+
+    public final void setCharacterStream(int parameterIndex, Reader x, long length)
+    throws SQLException {
+        getPreparedStatement().setCharacterStream(parameterIndex,x,length);
+    }
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement40.java?rev=417548&r1=417547&r2=417548&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement40.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement40.java Tue Jun 27 11:26:28 2006
@@ -230,4 +230,51 @@
         }
     }
     
+    /**
+     * Sets the designated parameter to the given input stream, which will have
+     * the specified number of bytes.
+     *
+     * @param parameterName the name of the first parameter
+     * @param x the java input stream which contains the ASCII parameter value
+     * @param length the number of bytes in the stream
+     * @exception SQLException thrown on failure.
+     *
+     */
+
+    public final void setAsciiStream(String parameterName, InputStream x, long length)
+    throws SQLException {
+        throw Util.notImplemented();
+    }
+
+    /**
+     * Sets the designated parameter to the given input stream, which will have
+     * the specified number of bytes.
+     *
+     * @param parameterName the name of the first parameter
+     * @param x the java input stream which contains the binary parameter value
+     * @param length the number of bytes in the stream
+     * @exception SQLException thrown on failure.
+     *
+     */
+
+    public final void setBinaryStream(String parameterName, InputStream x, long length)
+    throws SQLException {
+        throw Util.notImplemented();
+    }
+
+    /**
+     * Sets the designated parameter to the given Reader, which will have
+     * the specified number of bytes.
+     *
+     * @param parameterName the name of the first parameter
+     * @param x the java Reader which contains the UNICODE value
+     * @param length the number of bytes in the stream
+     * @exception SQLException thrown on failure.
+     *
+     */
+
+    public final void setCharacterStream(String parameterName, Reader x, long length)
+    throws SQLException {
+        throw Util.notImplemented();
+    }
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedPreparedStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedPreparedStatement.java?rev=417548&r1=417547&r2=417548&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedPreparedStatement.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedPreparedStatement.java Tue Jun 27 11:26:28 2006
@@ -561,7 +561,7 @@
      * @param length the number of bytes in the stream 
 	 * @exception SQLException thrown on failure.
      */
-    public final void setAsciiStream(int parameterIndex, InputStream x, int length)
+    public final void setAsciiStream(int parameterIndex, InputStream x, long length)
 	    throws SQLException {
 		checkStatus();
 
@@ -594,6 +594,22 @@
 	}
 
     /**
+     * We do this inefficiently and read it all in here. The target type
+     * is assumed to be a String.
+     *
+     * @param parameterIndex the first parameter is 1, the second is 2, ...
+     * @param x the java input stream which contains the ASCII parameter value
+     * @param length the number of bytes in the stream
+     * @exception SQLException thrown on failure.
+     */
+
+    public final void setAsciiStream(int parameterIndex, InputStream x, int length)
+    throws SQLException {
+        setAsciiStream(parameterIndex,x,(long)length);
+    }
+
+
+    /**
 		Deprecated in JDBC 3.0
      *
      * @param parameterIndex the first parameter is 1, the second is 2, ...
@@ -628,8 +644,7 @@
      */
     public final void setCharacterStream(int parameterIndex,
        			  java.io.Reader reader,
-			  int length) throws SQLException
-	{
+			  long length) throws SQLException {
 		checkStatus();
 		int jdbcTypeId = getParameterJDBCType(parameterIndex);
 		switch (jdbcTypeId) {
@@ -646,6 +661,29 @@
 		setCharacterStreamInternal(parameterIndex, reader, length);
 	}
 
+    /**
+     * When a very large UNICODE value is input to a LONGVARCHAR
+     * parameter, it may be more practical to send it via a
+     * java.io.Reader. JDBC will read the data from the stream
+     * as needed, until it reaches end-of-file.  The JDBC driver will
+     * do any necessary conversion from UNICODE to the database char format.
+     *
+     * <P><B>Note:</B> This stream object can either be a standard
+     * Java stream object or your own subclass that implements the
+     * standard interface.
+     *
+     * @param parameterIndex the first parameter is 1, the second is 2, ...
+     * @param reader the java reader which contains the UNICODE data
+     * @param length the number of characters in the stream
+     * @exception SQLException if a database-access error occurs.
+     */
+    public final void setCharacterStream(int parameterIndex,
+        java.io.Reader reader,
+        int length) throws SQLException {
+        setCharacterStream(parameterIndex,reader,(long)length);
+    }
+
+
     private void setCharacterStreamInternal(int parameterIndex,
 						Reader reader, long length)
 	    throws SQLException
@@ -727,15 +765,15 @@
 	}
 
     /**
+     * sets the parameter to the Binary stream
      * 
      * @param parameterIndex the first parameter is 1, the second is 2, ...
      * @param x the java input stream which contains the binary parameter value
      * @param length the number of bytes in the stream 
 	 * @exception SQLException thrown on failure.
      */
-    public final void setBinaryStream(int parameterIndex, InputStream x, int length)
-	    throws SQLException
-		{
+    public final void setBinaryStream(int parameterIndex, InputStream x, long length)
+	    throws SQLException {
 
 		checkStatus();
 
@@ -752,6 +790,19 @@
 
     	setBinaryStreamInternal(parameterIndex, x, length);
 	}
+
+    /**
+     * sets the parameter to the binary stream
+     *
+     * @param parameterIndex the first parameter is 1, the second is 2, ...
+     * @param x the java input stream which contains the binary parameter value
+     * @param length the number of bytes in the stream
+     * @exception SQLException thrown on failure.
+     */
+    public final void setBinaryStream(int parameterIndex, InputStream x, int length)
+    throws SQLException {
+        setBinaryStream(parameterIndex,x,(long)length);
+    }
 
     private void setBinaryStreamInternal(int parameterIndex, InputStream x,
 				long length)

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java?rev=417548&r1=417547&r2=417548&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java Tue Jun 27 11:26:28 2006
@@ -69,6 +69,7 @@
 import java.sql.Timestamp;
 import java.sql.Types;
 
+import java.io.Reader;
 import java.io.InputStream;
 import java.io.IOException;
 import java.net.URL;
@@ -2626,7 +2627,6 @@
 	}
 
 	/**
-	 * JDBC 2.0
 	 *
 	 * Update a column with an ascii stream value.
 	 *
@@ -2645,7 +2645,7 @@
 	 *                if a database-access error occurs
 	 */
 	public void updateAsciiStream(int columnIndex, java.io.InputStream x,
-			int length) throws SQLException {
+			long length) throws SQLException {
 		checksBeforeUpdateXXX("updateAsciiStream", columnIndex);
 
 		int colType = getColumnType(columnIndex);
@@ -2672,7 +2672,6 @@
 	}
 
 	/**
-	 * JDBC 2.0
 	 *
 	 * Update a column with a binary stream value.
 	 *
@@ -2691,7 +2690,7 @@
 	 *                if a database-access error occurs
 	 */
 	public void updateBinaryStream(int columnIndex, java.io.InputStream x,
-			int length) throws SQLException {
+			long length) throws SQLException {
 		checksBeforeUpdateXXX("updateBinaryStream", columnIndex);
 		int colType = getColumnType(columnIndex);
 		switch (colType) {
@@ -2737,7 +2736,7 @@
 	}
 
 	/**
-	 * JDBC 2.0
+	 * JDBC 4.0
 	 * 
 	 * Update a column with a character stream value.
 	 * 
@@ -2756,7 +2755,7 @@
 	 *                if a database-access error occurs
 	 */
 	public void updateCharacterStream(int columnIndex, java.io.Reader x,
-			int length) throws SQLException {
+			long length) throws SQLException {
 		//If the column type is the right datatype, this method will eventually call getDVDforColumnToBeUpdated which will check for
 		//the read only resultset. But for other datatypes, we want to catch if this updateCharacterStream is being issued
 		//against a read only resultset. And that is the reason for call to checksBeforeUpdateXXX here.
@@ -4400,6 +4399,273 @@
          } else {
              topWarning.setNextWarning(w);
          }
+     }
+
+     /**
+      *
+      * JDBC 2.0
+      *
+      * Update a column with an ascii stream value.
+      *
+      * The updateXXX() methods are used to update column values in the current
+      * row, or the insert row. The updateXXX() methods do not update the
+      * underlying database, instead the updateRow() or insertRow() methods are
+      * called to update the database.
+      *
+      * @param columnIndex
+      *            the first column is 1, the second is 2, ...
+      * @param x
+      *            the new column value
+      * @param length
+      *            the length of the stream
+      * @exception SQLException
+      *                if a database-access error occurs
+      */
+     public void updateAsciiStream(int columnIndex, java.io.InputStream x,
+         int length) throws SQLException {
+         checkIfClosed("updateAsciiStream");
+         updateAsciiStream(columnIndex,x,(long)length);
+     }
+
+     /**
+      *
+      * JDBC 2.0
+      *
+      * Update a column with a binary stream value.
+      *
+      * The updateXXX() methods are used to update column values in the current
+      * row, or the insert row. The updateXXX() methods do not update the
+      * underlying database, instead the updateRow() or insertRow() methods are
+      * called to update the database.
+      *
+      * @param columnIndex
+      *            the first column is 1, the second is 2, ...
+      * @param x
+      *            the new column value
+      * @param length
+      *            the length of the stream
+      * @exception SQLException
+      *                if a database-access error occurs
+      */
+     public void updateBinaryStream(int columnIndex, java.io.InputStream x,
+         int length) throws SQLException {
+         checkIfClosed("updateBinaryStream");
+         updateBinaryStream(columnIndex,x,(long)length);
+     }
+
+     /**
+      *
+      * JDBC 2.0
+      *
+      * Update a column with a character stream value.
+      *
+      * The updateXXX() methods are used to update column values in the current
+      * row, or the insert row. The updateXXX() methods do not update the
+      * underlying database, instead the updateRow() or insertRow() methods are
+      * called to update the database.
+      *
+      * @param columnIndex
+      *            the first column is 1, the second is 2, ...
+      * @param x
+      *            the new column value
+      * @param length
+      *            the length of the stream
+      * @exception SQLException
+      *                if a database-access error occurs
+      */
+     public void updateCharacterStream(int columnIndex, java.io.Reader x,
+         int length) throws SQLException {
+         checkIfClosed("updateCharacterStream");
+         updateCharacterStream(columnIndex,x,(long)length);
+     }
+
+     /**
+      *
+      * JDBC 4.0
+      *
+      * Update a column with an ascii stream value.
+      *
+      * The updateXXX() methods are used to update column values in the current
+      * row, or the insert row. The updateXXX() methods do not update the
+      * underlying database, instead the updateRow() or insertRow() methods are
+      * called to update the database.
+      *
+      * @param columnName
+      *            the name of the column
+      * @param x
+      *            the new column value
+      * @param length
+      *            of the stream
+      * @exception SQLException
+      *                if a database-access error occurs
+      */
+     public void updateAsciiStream(String columnName, java.io.InputStream x,
+         long length) throws SQLException {
+         checkIfClosed("updateAsciiStream");
+         updateAsciiStream(findColumnName(columnName),x,length);
+     }
+
+     /**
+      *
+      * JDBC 4.0
+      *
+      * Update a column with a binary stream value.
+      *
+      * The updateXXX() methods are used to update column values in the current
+      * row, or the insert row. The updateXXX() methods do not update the
+      * underlying database, instead the updateRow() or insertRow() methods are
+      * called to update the database.
+      *
+      * @param columnName
+      *            the name of the column
+      * @param x
+      *            the new column value
+      * @param length
+      *            of the stream
+      * @exception SQLException
+      *                if a database-access error occurs
+      */
+
+     public void updateBinaryStream(String columnName, java.io.InputStream x,
+         long length) throws SQLException {
+         checkIfClosed("updateBinaryStream");
+         updateBinaryStream(findColumnName(columnName),x,length);
+     }
+
+     /**
+      * JDBC 4.0
+      *
+      * Update a column with a character stream value.
+      *
+      * The updateXXX() methods are used to update column values in the current
+      * row, or the insert row. The updateXXX() methods do not update the
+      * underlying database, instead the updateRow() or insertRow() methods are
+      * called to update the database.
+      *
+      * @param columnName
+      *            the name of the column
+      * @param reader
+      *            the new column value
+      * @param length
+      *            length of the stream
+      * @exception SQLException
+      *                if a database-access error occurs
+      */
+     public void updateCharacterStream(String columnName, java.io.Reader reader,
+         long length) throws SQLException {
+         checkIfClosed("updateCharacterStream");
+         updateCharacterStream(findColumnName(columnName),reader,length);
+     }
+
+     /**
+      *
+      * JDBC 4.0
+      *
+      * Updates the designated column with a java.sql.Blob value. The updater
+      * methods are used to update column values in the current row or the insert
+      * row. The updater methods do not update the underlying database; instead
+      * the updateRow or insertRow methods are called to update the database.
+      *
+      * @param columnIndex -
+      *            the first column is 1, the second is 2
+      * @param x -
+      *            the new column value
+      * @param length -
+      *            the length of the Blob datatype
+      * @exception SQLException
+      *
+      */
+     public void updateBlob(int columnIndex, InputStream x, long length)
+     throws SQLException {
+         checksBeforeUpdateXXX("updateBlob", columnIndex);
+         int colType = getColumnType(columnIndex);
+         if (colType != Types.BLOB)
+             throw dataTypeConversion(columnIndex, "java.sql.Blob");
+
+         if (x == null)
+             updateNull(columnIndex);
+         else {
+             updateBinaryStreamInternal(columnIndex, x, length, "updateBlob");
+         }
+     }
+
+     /**
+      *
+      * JDBC 4.0
+      *
+      * Updates the designated column with a java.sql.Blob value. The updater
+      * methods are used to update column values in the current row or the insert
+      * row. The updater methods do not update the underlying database; instead
+      * the updateRow or insertRow methods are called to update the database.
+      *
+      * @param columnName -
+      *            the name of the column to be updated
+      * @param x -
+      *            the new column value
+      * @param length -
+      *            the length of the Blob datatype
+      * @exception SQLException
+      *
+      */
+
+     public void updateBlob(String columnName, InputStream x, long length)
+     throws SQLException {
+         checkIfClosed("updateBlob");
+         updateBlob(findColumnName(columnName),x,length);
+     }
+
+     /**
+      *
+      * JDBC 4.0
+      *
+      * Updates the designated column with a java.sql.Clob value. The updater
+      * methods are used to update column values in the current row or the insert
+      * row. The updater methods do not update the underlying database; instead
+      * the updateRow or insertRow methods are called to update the database.
+      *
+      * @param columnIndex -
+      *            the first column is 1, the second is 2
+      * @param x -
+      *            the new column value
+      * @exception SQLException
+      *                Feature not implemented for now.
+      */
+     public void updateClob(int columnIndex, Reader x, long length)
+     throws SQLException {
+         checksBeforeUpdateXXX("updateClob", columnIndex);
+         int colType = getColumnType(columnIndex);
+         if (colType != Types.CLOB)
+             throw dataTypeConversion(columnIndex, "java.sql.Clob");
+
+         if (x == null) {
+             updateNull(columnIndex);
+         } else {
+             updateCharacterStreamInternal(
+                 columnIndex, x,length, "updateClob");
+         }
+     }
+
+     /**
+      *
+      * JDBC 4.0
+      *
+      * Updates the designated column with a java.sql.Clob value. The updater
+      * methods are used to update column values in the current row or the insert
+      * row. The updater methods do not update the underlying database; instead
+      * the updateRow or insertRow methods are called to update the database.
+      *
+      * @param columnName -
+      *            the name of the Clob column
+      * @param x -
+      *            the new column value
+      * @exception SQLException
+      *                Feature not implemented for now.
+      */
+
+     public void updateClob(String columnName, Reader x, long length)
+     throws SQLException {
+         checkIfClosed("updateClob");
+         updateClob(findColumnName(columnName),x,length);
      }
 }
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet40.java?rev=417548&r1=417547&r2=417548&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet40.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet40.java Tue Jun 27 11:26:28 2006
@@ -64,12 +64,12 @@
         throw Util.notImplemented();
     }
     
-    public void updateNCharacterStream(int columnIndex, Reader x, int length) 
+    public void updateNCharacterStream(int columnIndex, Reader x, long length)
         throws SQLException {
         throw Util.notImplemented();
     }
     
-    public void updateNCharacterStream(String columnName, Reader x, int length)
+    public void updateNCharacterStream(String columnName, Reader x, long length)
         throws SQLException {
         throw Util.notImplemented();
     }
@@ -168,4 +168,43 @@
         }
     }
     
+    /**
+     *
+     * Updates the designated column using the given Reader  object,
+     * which is the given number of characters long.
+     *
+     * @param columnIndex -
+     *        the first column is 1, the second is 2
+     * @param x -
+     *        the new column value
+     * @param length -
+     *        the length of the stream
+     *
+     * @exception SQLException
+     *                Feature not implemented for now.
+     */
+    public void updateNClob(int columnIndex, Reader x, long length)
+    throws SQLException {
+        throw Util.notImplemented();
+    }
+
+    /**
+     * Updates the designated column using the given Reader  object,
+     * which is the given number of characters long.
+     *
+     * @param columnName -
+     *            the Name of the column to be updated
+     * @param x -
+     *            the new column value
+     * @param length -
+     *        the length of the stream
+     *
+     * @exception SQLException
+     *                Feature not implemented for now.
+     *
+     */
+    public void updateNClob(String columnName, Reader x, long length)
+    throws SQLException{
+        throw Util.notImplemented();
+    }
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties?rev=417548&r1=417547&r2=417548&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/loc/messages_en.properties Tue Jun 27 11:26:28 2006
@@ -414,6 +414,7 @@
 22003.S.1=Year ({0}) exceeds the maximum ''{1}''.
 22003.S.2=Decimal may only be up to 31 digits.
 22003.S.3=Overflow occurred during numeric data type conversion of ''{0}'' to {1}.
+22004.S.4=The length ({0}) exceeds the maximum length for the data type ({1}).
 22005=An attempt was made to get a data value of type ''{0}'' from a data value of type ''{1}''.
 22005.S.1=Unable to convert a value of type ''{0}'' to type ''{1}'' : the encoding is not supported.
 22005.S.2=The required character converter is not available.

Modified: db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java?rev=417548&r1=417547&r2=417548&view=diff
==============================================================================
--- db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java (original)
+++ db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java Tue Jun 27 11:26:28 2006
@@ -653,6 +653,7 @@
     String YEAR_EXCEEDS_MAXIMUM                                        = "22003.S.1";
     String DECIMAL_TOO_MANY_DIGITS                                     = "22003.S.2";
     String NUMERIC_OVERFLOW                                            = "22003.S.3";
+    String CLIENT_LENGTH_OUTSIDE_RANGE_FOR_DATATYPE                    = "22003.S.4";
 
 	String LANG_DATA_TYPE_GET_MISMATCH                                 = "22005"; // same 22005 error
     String UNSUPPORTED_ENCODING                                        = "22005.S.1";

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java?rev=417548&r1=417547&r2=417548&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java Tue Jun 27 11:26:28 2006
@@ -531,6 +531,67 @@
         }
     }
 
+
+    /**
+     *
+     * Tests the setCharacterStream method that accepts length as a long
+     * parameter in the Callable Statement interface
+     *
+     * @throws SQLException Upon any error that occurs while calling this
+     *         method
+     *
+     */
+
+    public void testSetCharacterStream() throws SQLException {
+        try {
+            cStmt.setCharacterStream("Some String",null,0L);
+        }
+        catch(SQLFeatureNotSupportedException sqlfne) {
+            //Do nothing as this is the expected behaviour
+
+        }
+    }
+
+    /**
+     *
+     * Tests the setAsciiStream method that accepts length as a long
+     * parameter in the Callable Statement interface
+     *
+     * @throws SQLException Upon any error that occurs while calling this
+     *         method
+     *
+     */
+
+    public void testSetAsciiStream() throws SQLException {
+        try {
+            cStmt.setAsciiStream("Some String",null,0L);
+        }
+        catch(SQLFeatureNotSupportedException sqlfne) {
+            //Do nothing as this is the expected behaviour
+
+        }
+    }
+
+    /**
+     *
+     * Tests the setBinaryStream method that accepts length as a long
+     * parameter in the Callable Statement interface
+     *
+     * @throws SQLException Upon any error that occurs while calling this
+     *         method
+     *
+     */
+
+    public void testSetBinaryStream() throws SQLException {
+        try {
+            cStmt.setBinaryStream("Some String",null,0L);
+        }
+        catch(SQLFeatureNotSupportedException sqlfne) {
+            //Do nothing as this is the expected behaviour
+
+        }
+    }
+
     /**
      * Return suite with all tests of the class.
      */

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest.java?rev=417548&r1=417547&r2=417548&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest.java Tue Jun 27 11:26:28 2006
@@ -41,6 +41,9 @@
     Connection conn      = null;
     //PreparedStatement object
     PreparedStatement ps = null;
+    //Statement object
+    Statement s = null;
+
     
     /**
      * Create a test with the given name.
@@ -61,11 +64,22 @@
     public void setUp() 
         throws SQLException {
         conn = getConnection();
+        //create the statement object
+        s = conn.createStatement();
         //Create the PreparedStatement that will then be used as the basis 
         //throughout this test henceforth
         //This prepared statement will however NOT be used for testing
         //setClob and setBlob
         ps = conn.prepareStatement("select count(*) from sys.systables");
+        
+         // STEP1: create the tables
+         // Structure of table
+         // --------------------------
+         // SNO            Clob Column
+         // --------------------------
+
+         s.execute("create table ClobTestTable (sno int, clobCol CLOB(1M))");
+         s.execute("create table BlobTestTable (sno int, blobCol BLOB(1M))");
     }
 
     /**
@@ -77,6 +91,11 @@
      */
     public void tearDown() 
         throws SQLException {
+        
+        s.execute("drop table ClobTestTable");
+        s.execute("drop table BlobTestTable");
+        s.close();
+        
         if (conn != null && !conn.isClosed()) {
             conn.rollback();
             conn.close();
@@ -287,17 +306,6 @@
      *
      */
     public void testSetClob() throws SQLException {
-        
-        // Keeping the above in mind 
-        // STEP1: create the tables
-        // Structure of table
-        // --------------------------
-        // SNO            Clob Column
-        // --------------------------
-        
-        Statement s = conn.createStatement();
-        s.execute("create table ClobTestTable (sno int, clobCol CLOB(1M))");
-        
         //insert default values into the table
         
         String str = "Test data for the Clob object";
@@ -336,8 +344,6 @@
         
         if(!equalClob(clobToBeInerted,clobRetrieved)) 
             fail("Clob not inserted properly using setClob");
-        
-        s.execute("drop table ClobTestTable");
     }
     
     /*
@@ -384,17 +390,6 @@
      *
      */
     public void testSetBlob() throws SQLException {
-        
-        // Keeping the above in mind 
-        // STEP1: create the tables
-        // Structure of table
-        // --------------------------
-        // SNO            Blob Column
-        // --------------------------
-        
-        Statement s = conn.createStatement();
-        s.execute("create table BlobTestTable (sno int, blobCol BLOB(1M))");
-        
         //insert default values into the table
         
         byte[] bytes = new byte[] {
@@ -436,8 +431,6 @@
         
         if(!equalBlob(blobToBeInerted,blobRetrieved)) 
             fail("Blob not inserted properly using setBlob");
-        
-        s.execute("drop table BlobTestTable");
     }
     
     /*
@@ -536,5 +529,145 @@
         } catch(Exception e) {
             fail("Unexpected exception thrown in method " + e);
         }
+    }
+    
+    
+    /**
+     *
+     * Tests the PreparedStatement interface method setCharacterStream
+     *
+     * @throws SQLException
+     *
+     */
+    public void testSetCharacterStream() throws SQLException {
+        String str = "Test data for the Clob object";
+        StringReader is = new StringReader("Test data for the Clob object");
+        
+        try {
+            is.reset();
+        } catch (IOException ioe) {
+            fail("Failed to reset Clob input stream: " + ioe.getMessage());
+        }
+        
+        PreparedStatement ps_sc = conn.prepareStatement("insert into ClobTestTable values(?,?)");
+        
+        //initially insert the data
+        ps_sc.setInt(1,1);
+        ps_sc.setCharacterStream(2,is,str.length());
+        ps_sc.executeUpdate();
+        
+        //Now query to retrieve the Clob
+        ResultSet rs = s.executeQuery("select * from ClobTestTable where sno = 1");
+        rs.next();
+        Clob clobRetrieved = rs.getClob(2);
+        rs.close();
+        
+        String str_out = clobRetrieved.getSubString(1L,(int)clobRetrieved.length());
+        
+        assertEquals("Error in inserting data into the Clob object",str,str_out);
+        ps_sc.close();
+    }
+    
+     /**
+      *
+      * Tests the PreparedStatement interface method setAsciiStream
+      *
+      * @throws SQLException
+      *
+      */
+    
+    public void testSetAsciiStream() throws SQLException {
+        //insert default values into the table
+        
+        byte[] bytes = new byte[] {
+            0x65, 0x66, 0x67, 0x68, 0x69,
+            0x69, 0x68, 0x67, 0x66, 0x65
+        };
+        
+        byte [] bytes1 = new byte[10];
+        
+        InputStream is = new java.io.ByteArrayInputStream(bytes);
+        
+        try {
+            is.reset();
+        } catch (IOException ioe) {
+            fail("Failed to reset Clob input stream: " + ioe.getMessage());
+        }
+        
+        PreparedStatement ps_sb = conn.prepareStatement("insert into ClobTestTable values(?,?)");
+        
+        //initially insert the data
+        ps_sb.setInt(1,1);
+        ps_sb.setAsciiStream(2,is,bytes.length);
+        ps_sb.executeUpdate();
+        
+        //Now query to retrieve the Clob
+        ResultSet rs = s.executeQuery("select * from ClobTestTable where sno = 1");
+        rs.next();
+        Clob ClobRetrieved = rs.getClob(2);
+        rs.close();
+        
+        try {
+            InputStream is_ret = ClobRetrieved.getAsciiStream();
+            is_ret.read(bytes1);
+        } catch(IOException ioe) {
+            fail("IOException while reading the Clob from the database");
+        }
+        for(int i=0;i<bytes.length;i++) {
+            assertEquals("Error in inserting data into the Clob",bytes[i],bytes1[i]);
+        }
+        ps_sb.close();
+    }
+    
+    /**
+     *
+     * Tests the PreparedStatement interface method setBinaryStream
+     *
+     * @throws SQLException
+     *
+     */
+    
+    public void testSetBinaryStream() throws SQLException {
+        //insert default values into the table
+        
+        byte[] bytes = new byte[] {
+            0x65, 0x66, 0x67, 0x68, 0x69,
+            0x69, 0x68, 0x67, 0x66, 0x65
+        };
+        
+        byte [] bytes1 = new byte[10];
+        
+        InputStream is = new java.io.ByteArrayInputStream(bytes);
+        
+        try {
+            is.reset();
+        } catch (IOException ioe) {
+            fail("Failed to reset blob input stream: " + ioe.getMessage());
+        }
+        
+        PreparedStatement ps_sb = conn.prepareStatement("insert into BlobTestTable values(?,?)");
+        
+        //initially insert the data
+        ps_sb.setInt(1,1);
+        ps_sb.setBinaryStream(2,is,bytes.length);
+        ps_sb.executeUpdate();
+        
+        //Now query to retrieve the Clob
+        ResultSet rs = s.executeQuery("select * from BlobTestTable where sno = 1");
+        rs.next();
+        Blob blobRetrieved = rs.getBlob(2);
+        rs.close();
+        
+        try {
+            InputStream is_ret = blobRetrieved.getBinaryStream();
+            is_ret.read(bytes1);
+        } catch(IOException ioe) {
+            fail("IOException while reading the Clob from the database");
+        }
+        
+        for(int i=0;i<bytes.length;i++) {
+            assertEquals("Error in inserting data into the Blob",bytes[i],bytes1[i]);
+        }
+        ps_sb.close();
     }
 }



Mime
View raw message