Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 81764 invoked from network); 8 Feb 2006 07:11:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 8 Feb 2006 07:11:11 -0000 Received: (qmail 42392 invoked by uid 500); 8 Feb 2006 07:11:11 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 42366 invoked by uid 500); 8 Feb 2006 07:11:10 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 42350 invoked by uid 99); 8 Feb 2006 07:11:10 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Feb 2006 23:11:10 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 07 Feb 2006 23:11:09 -0800 Received: (qmail 81603 invoked by uid 65534); 8 Feb 2006 07:10:49 -0000 Message-ID: <20060208071049.81601.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r375877 - in /db/derby/code/trunk/java: engine/org/apache/derby/iapi/types/ testing/org/apache/derbyTesting/functionTests/master/ testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ Date: Wed, 08 Feb 2006 07:10:48 -0000 To: derby-commits@db.apache.org From: bandaram@apache.org X-Mailer: svnmailer-1.0.6 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: bandaram Date: Tue Feb 7 23:10:47 2006 New Revision: 375877 URL: http://svn.apache.org/viewcvs?rev=375877&view=rev Log: DERBY-628: Allow setting a CLOB to NULL using any character types for setNull. Submitted by Satheesh Bandaram(satheesh@sourcery.org) Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/parameterMapping.out 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/iapi/types/DataTypeDescriptor.java URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java?rev=375877&r1=375876&r2=375877&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java Tue Feb 7 23:10:47 2006 @@ -990,6 +990,10 @@ return false; } + // To CLOB + if (existingType == Types.CLOB && DataTypeDescriptor.isCharacterType(jdbcTypeId)) + return true; + return false; } Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/parameterMapping.out URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/parameterMapping.out?rev=375877&r1=375876&r2=375877&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/parameterMapping.out (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/parameterMapping.out Tue Feb 7 23:10:47 2006 @@ -3290,12 +3290,12 @@ setNull with batching support(Types.NUMERIC) IC setNull(Types.BIT) IC setNull with batching support(Types.BIT) IC - setNull(CHAR) IC - setNull with batching support(CHAR) IC - setNull(VARCHAR) IC - setNull with batching support(VARCHAR) IC - setNull(LONG VARCHAR) IC - setNull with batching support(LONG VARCHAR) IC + setNull(CHAR) getClob=null was null true + setNull with batching support(CHAR) getClob=null was null true + setNull(VARCHAR) getClob=null was null true + setNull with batching support(VARCHAR) getClob=null was null true + setNull(LONG VARCHAR) getClob=null was null true + setNull with batching support(LONG VARCHAR) getClob=null was null true setNull(VARCHAR () FOR BIT DATA) IC setNull with batching support(VARCHAR () FOR BIT DATA) IC setNull(DATE) IC Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/prepStmtNull.out URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/prepStmtNull.out?rev=375877&r1=375876&r2=375877&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 Tue Feb 7 23:10:47 2006 @@ -4,3 +4,5 @@ Test prepStmtNull starting ResultSet is: blob ResultSet is: null +Test3 prepStmtNull starting +ResultSet is: null Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/prepStmtNull.java URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/prepStmtNull.java?rev=375877&r1=375876&r2=375877&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 Tue Feb 7 23:10:47 2006 @@ -13,6 +13,7 @@ public static void main(String[] args) { test1(args); test2(args); + test3(args); } public static void test1(String []args) { @@ -117,6 +118,48 @@ } } + /* Test setNull() on Clob/Blob using Varchar/binary types */ + public static void test3(String []args) { + Connection con; + ResultSet rs; + PreparedStatement stmt = null; + PreparedStatement pStmt = null; + Statement stmt1 = null; + byte[] b2 = new byte[1]; + b2[0] = (byte)64; + + System.out.println("Test3 prepStmtNull starting"); + + try + { + // use the ij utility to read the property file and + // make the initial connection. + ij.getPropertyArg(args); + con = ij.startJBMS(); + + stmt = con.prepareStatement("create table ClobBlob(cval clob, bval blob(16K))"); + stmt.executeUpdate(); + + pStmt = con.prepareStatement("insert into ClobBlob values (?,?)"); + + pStmt.setNull(1, Types.VARCHAR); + pStmt.setBytes(2, b2); + pStmt.execute(); + + stmt1 = con.createStatement(); + rs = stmt1.executeQuery("select * from ClobBlob"); + while(rs.next()) { + System.out.println("ResultSet is: "+rs.getObject(1)); + } + String[] testObjects = {"table ClobBlob"}; + TestUtil.cleanUpTest(stmt1, testObjects); + } catch(SQLException sqle) { + dumpSQLExceptions(sqle); + } catch(Throwable e) { + System.out.println("FAIL -- unexpected exception: "); + } + } + static private void dumpSQLExceptions (SQLException se) { System.out.println("FAIL -- unexpected exception"); while (se != null) { @@ -124,4 +167,4 @@ se = se.getNextException(); } } -} +}