db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mamta A. Satoor (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-3842) Convert "org.apache.derbyTesting.functionTests.tests.store.holdCursorExternalSortJDBC30.sql" to junit.
Date Tue, 26 Aug 2008 17:46:44 GMT

    [ https://issues.apache.org/jira/browse/DERBY-3842?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12625803#action_12625803
] 

Mamta A. Satoor commented on DERBY-3842:
----------------------------------------

The .sql test uses function PADSTRING to insert data as shown below
insert into foo values 
    (10,PADSTRING('10',2000)), (9,PADSTRING('9',2000)), (8,PADSTRING('8',2000)), (7,PADSTRING('7',2000)),
(6,PADSTRING('6',2000)), (5,PADSTRING('5',2000)), (4,PADSTRING('4',2000)), (3,PADSTRING('3',2000)),
(2,PADSTRING('2',2000)), (1,PADSTRING('1',2000));

The junit test does following to replace the usage of PADSTRING in .sql test
+        String[] rows = new String[10];
+        for(int i = rows.length; i >= 1; i--){
+            rows[i - 1] = Formatters.padString("" + i, 2000);                
+        }
+        
+        Statement stUtil = createStatement();        
+        stUtil.executeUpdate("create table foo (a int, data varchar(2000))");
+        stUtil.close();
+        
+        PreparedStatement ps = prepareStatement(
+                "insert into foo values(?,?), (?,?), (?,?), (?,?), (?,?), " +
+                "(?,?), (?,?), (?,?), (?,?), (?,?)");
+        for(int i = 0; i < rows.length; i++){
+            ps.setInt(i * 2 + 1, rows.length - i);
+            ps.setString(i * 2 + 2, rows[rows.length - i - 1]);
+        }
+        ps.executeUpdate();
+        ps.close();

I think to imitate the original test, the junit test should create a PADSTRING function and
use that to load data into the table. The example of that can be found in StressMultiTest


> Convert "org.apache.derbyTesting.functionTests.tests.store.holdCursorExternalSortJDBC30.sql"
to junit.
> ------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3842
>                 URL: https://issues.apache.org/jira/browse/DERBY-3842
>             Project: Derby
>          Issue Type: Test
>          Components: Test
>            Reporter: Junjie Peng
>            Assignee: Junjie Peng
>         Attachments: derby-3842-1.patch, derby-3842-1.stat
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message