db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r422689 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/jdbc/ testing/org/apache/derbyTesting/functionTests/master/ testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/
Date Mon, 17 Jul 2006 11:30:38 GMT
Author: kahatlen
Date: Mon Jul 17 04:30:37 2006
New Revision: 422689

URL: http://svn.apache.org/viewvc?rev=422689&view=rev
Log:
DERBY-1493: Implement PreparedStatement.setNull(int, int, String) in
the embedded driver.

Patch submitted by V. Narayanan.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedPreparedStatement.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/prepStmtNull.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/prepStmtNull.java

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=422689&r1=422688&r2=422689&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
Mon Jul 17 04:30:37 2006
@@ -850,19 +850,36 @@
 	/////////////////////////////////////////////////////////////////////////
 
     /**
+     *
      * JDBC 2.0
      *
-     * Set null for user-named types and REF type parameters
-     * 
-     * @exception SQLException if a database-access error occurs.
+     * Sets the designated parameter to SQL <code>NULL</code>.
+     * This version of the method <code>setNull</code> should
+     * be used for user-defined types and REF type parameters.  Examples
+     * of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and
+     * named array types.
+     *
+     * @param paramIndex the first parameter is 1, the second is 2, ...
+     * @param sqlType a value from <code>java.sql.Types</code>
+     * @param typeName the fully-qualified name of an SQL user-defined type;
+     *  ignored if the parameter is not a user-defined type or REF
+     * @exception SQLException if a database access error occurs or
+     * this method is called on a closed <code>PreparedStatement</code>
+     * @exception SQLFeatureNotSupportedException if <code>sqlType</code> is
+     * a <code>ARRAY</code>, <code>BLOB</code>, <code>CLOB</code>,
+     * <code>DATALINK</code>, <code>JAVA_OBJECT</code>, <code>NCHAR</code>,
+     * <code>NCLOB</code>, <code>NVARCHAR</code>, <code>LONGNVARCHAR</code>,
+     *  <code>REF</code>, <code>ROWID</code>, <code>SQLXML</code>
+     * or  <code>STRUCT</code> data type and the JDBC driver does not support
+     * this data type or if the JDBC driver does not support this method
+     *
      */
-	public void setNull(int paramIndex,
-						int sqlType,
-						String typeName)
-		 throws SQLException
-	{
-		throw Util.notImplemented("setNull");
-	}
+    public void setNull(int paramIndex,
+        int sqlType,
+        String typeName)
+        throws SQLException {
+        setNull(paramIndex,sqlType);
+    }
 
     /**
      * JDBC 2.0

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/prepStmtNull.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/prepStmtNull.out?rev=422689&r1=422688&r2=422689&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/prepStmtNull.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/prepStmtNull.out
Mon Jul 17 04:30:37 2006
@@ -1,8 +1,13 @@
 Test prepStmtNull starting
 ResultSet is: work
 ResultSet is: null
+ResultSet is: work1
+ResultSet is: null
 Test prepStmtNull starting
 ResultSet is: blob
 ResultSet is: null
+ResultSet is: blob1
+ResultSet is: null
 Test3 prepStmtNull starting
+ResultSet is: null
 ResultSet is: null

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/prepStmtNull.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/prepStmtNull.java?rev=422689&r1=422688&r2=422689&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/prepStmtNull.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/prepStmtNull.java
Mon Jul 17 04:30:37 2006
@@ -43,6 +43,9 @@
    			pStmt.setString(1,"work");
 			pStmt.setNull(2,java.sql.Types.TIMESTAMP);
 			pStmt.addBatch();
+			pStmt.setString(1,"work1");
+			pStmt.setNull(2,java.sql.Types.TIMESTAMP,"");
+			pStmt.addBatch();
 
 		
 			pStmt.executeBatch();
@@ -94,6 +97,9 @@
    			pStmt.setString(1,"blob");
 			pStmt.setNull(2,java.sql.Types.BLOB);
 			pStmt.addBatch();
+			pStmt.setString(1,"blob1");
+			pStmt.setNull(2,java.sql.Types.BLOB,"");
+			pStmt.addBatch();
 
 		
 			pStmt.executeBatch();
@@ -143,6 +149,9 @@
                pStmt = con.prepareStatement("insert into ClobBlob values (?,?)");
    			   			
                pStmt.setNull(1, Types.VARCHAR);
+               pStmt.setBytes(2, b2);
+               pStmt.execute();
+               pStmt.setNull(1, Types.VARCHAR,"");
                pStmt.setBytes(2, b2);
                pStmt.execute();
 



Mime
View raw message