You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ba...@apache.org on 2006/04/25 03:08:03 UTC

svn commit: r396753 - in /db/derby/code/branches/10.1/java: engine/org/apache/derby/iapi/types/ testing/org/apache/derbyTesting/functionTests/master/ testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ tools/org/apache/derby/loc/

Author: bandaram
Date: Mon Apr 24 18:08:01 2006
New Revision: 396753

URL: http://svn.apache.org/viewcvs?rev=396753&view=rev
Log:
Ported two changes from trunk to 10.1 branch, 375877 and 376142.

Both originally submitted by Satheesh Bandaram (satheesh@sourcery.org)

Modified:
    db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java
    db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/parameterMapping.out
    db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/prepStmtNull.out
    db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/prepStmtNull.java
    db/derby/code/branches/10.1/java/tools/org/apache/derby/loc/toolsmessages.properties

Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java
URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java?rev=396753&r1=396752&r2=396753&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java (original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java Mon Apr 24 18:08:01 2006
@@ -992,6 +992,10 @@
 			return false;
 		}
 		
+		// To CLOB
+		if (existingType == Types.CLOB && DataTypeDescriptor.isCharacterType(jdbcTypeId))
+			return true;
+
 		return false;
 	}
 

Modified: db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/parameterMapping.out
URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/parameterMapping.out?rev=396753&r1=396752&r2=396753&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/parameterMapping.out (original)
+++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/parameterMapping.out Mon Apr 24 18:08:01 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/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/prepStmtNull.out
URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/prepStmtNull.out?rev=396753&r1=396752&r2=396753&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/prepStmtNull.out (original)
+++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/prepStmtNull.out Mon Apr 24 18:08:01 2006
@@ -4,3 +4,5 @@
 Test prepStmtNull starting
 ResultSet is: blob
 ResultSet is: null
+Test3 prepStmtNull starting
+ResultSet is: null

Modified: db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/prepStmtNull.java
URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/prepStmtNull.java?rev=396753&r1=396752&r2=396753&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/prepStmtNull.java (original)
+++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/prepStmtNull.java Mon Apr 24 18:08:01 2006
@@ -11,6 +11,7 @@
     public static void main(String[] args) {
         test1(args);
         test2(args);
+        test3(args);
     }
     
         public static void test1(String []args) {   
@@ -109,6 +110,46 @@
  		}
      }
      
+     /* 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));
+               }
+          } 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) {
@@ -116,4 +157,4 @@
                         se = se.getNextException();
                 }
         }
-}     
+}

Modified: db/derby/code/branches/10.1/java/tools/org/apache/derby/loc/toolsmessages.properties
URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/tools/org/apache/derby/loc/toolsmessages.properties?rev=396753&r1=396752&r2=396753&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/tools/org/apache/derby/loc/toolsmessages.properties (original)
+++ db/derby/code/branches/10.1/java/tools/org/apache/derby/loc/toolsmessages.properties Mon Apr 24 18:08:01 2006
@@ -176,7 +176,7 @@
 \ USAGE:\n\ java org.apache.derby.tools.dblook -d <sourceDBUrl> [OPTIONS]\n\n\
 \ \twhere the source URL is the full URL, including the connection protocol\n\
 \ \tand any connection attributes that might apply.  For example, use\n\
-\ \t'jdbc:derby:myDB', or 'jdbc:derby:net://localhost:1527/myDB:user=usr;'. \n\n\
+\ \t'jdbc:derby:myDB', or 'jdbc:derby://localhost:1527/myDB;user=usr;'. \n\n\
 \ \toptions include: \n\n\
 \ \t-z <schemaName> to specify a schema to which the DDL generation\n\
 \ \t should be limited.  Only database objects with that schema will have\n\