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 ka...@apache.org on 2011/05/17 18:03:08 UTC

svn commit: r1104365 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/Derby5236Test.java

Author: kahatlen
Date: Tue May 17 16:03:08 2011
New Revision: 1104365

URL: http://svn.apache.org/viewvc?rev=1104365&view=rev
Log:
DERBY-5236: Client driver silently truncates strings that exceed 32KB

Test case for the bug. Currently disabled.

Added:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/Derby5236Test.java   (with props)

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/Derby5236Test.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/Derby5236Test.java?rev=1104365&view=auto
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/Derby5236Test.java (added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/Derby5236Test.java Tue May 17 16:03:08 2011
@@ -0,0 +1,59 @@
+/*
+
+   Derby - Class org.apache.derbyTesting.functionTests.tests.jdbcapi.Derby5236Test
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+ */
+
+package org.apache.derbyTesting.functionTests.tests.jdbcapi;
+
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.Arrays;
+import junit.framework.Test;
+import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.JDBC;
+import org.apache.derbyTesting.junit.TestConfiguration;
+
+/**
+ * Test case for DERBY-5236.
+ */
+public class Derby5236Test extends BaseJDBCTestCase {
+    public Derby5236Test(String name) {
+        super(name);
+    }
+
+    public static Test suite() {
+        return TestConfiguration.defaultSuite(Derby5236Test.class);
+    }
+
+    /**
+     * Verify that string values aren't truncated when their UTF-8 encoded
+     * representation exceeds 32KB.
+     */
+    public void testLongColumn() throws SQLException {
+        PreparedStatement ps = prepareStatement(
+                "values cast(? as varchar(20000))");
+
+        char[] chars = new char[20000];
+        Arrays.fill(chars, '\u4e10');
+        String str = new String(chars);
+
+        ps.setString(1, str);
+        JDBC.assertSingleValueResultSet(ps.executeQuery(), str);
+    }
+}

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/Derby5236Test.java
------------------------------------------------------------------------------
    svn:eol-style = native