You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by li...@apache.org on 2016/12/05 06:55:49 UTC

[3/4] incubator-trafodion git commit: add copyright & one more test case

add copyright & one more test case


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/c751a589
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/c751a589
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/c751a589

Branch: refs/heads/master
Commit: c751a589f8e9b2361da590baf708653d93b2f050
Parents: 1daecf1
Author: mashengchen <ma...@gmail.com>
Authored: Wed Nov 30 03:00:48 2016 +0000
Committer: mashengchen <ma...@gmail.com>
Committed: Wed Nov 30 03:00:48 2016 +0000

----------------------------------------------------------------------
 .../org/trafodion/jdbc_test/TestNumeric.java    | 61 ++++++++++++++++++++
 1 file changed, 61 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c751a589/dcs/src/test/jdbc_test/src/test/java/org/trafodion/jdbc_test/TestNumeric.java
----------------------------------------------------------------------
diff --git a/dcs/src/test/jdbc_test/src/test/java/org/trafodion/jdbc_test/TestNumeric.java b/dcs/src/test/jdbc_test/src/test/java/org/trafodion/jdbc_test/TestNumeric.java
index ea55328..3ed5826 100644
--- a/dcs/src/test/jdbc_test/src/test/java/org/trafodion/jdbc_test/TestNumeric.java
+++ b/dcs/src/test/jdbc_test/src/test/java/org/trafodion/jdbc_test/TestNumeric.java
@@ -1,3 +1,26 @@
+/**
+ * @@@ START COPYRIGHT @@@
+ *
+ * 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.
+ *
+ * @@@ END COPYRIGHT @@
+ */
+
 import static org.junit.Assert.assertEquals;
 
 import java.math.BigDecimal;
@@ -49,5 +72,43 @@ public class TestNumeric {
         }
 
     }
+    @Test
+    public void JDBCNumeric2() throws SQLException {
+        Connection conn = null;
+        Statement stmt = null;
+        PreparedStatement prepStmt = null;
+        ResultSet rs = null;
+        String sql = "upsert using load into numeric_tbl2 values (?,?);";
+        try {
+            conn = Utils.getUserConnection();
+            stmt = conn.createStatement();
+            stmt.executeUpdate("set schema " + Utils.catalog + "." + Utils.schema);
+            stmt.executeUpdate("create table if not exists numeric_tbl2 (c0 int not null, c1 numeric(10,2))");
+            stmt.executeUpdate("delete from numeric_tbl2");
+
+            prepStmt = conn.prepareStatement(sql);
+            for (int i = 0; i < 1000; i++) {
+                prepStmt.setInt(1, i);
+                prepStmt.setBigDecimal(2, new BigDecimal(-1));
+                prepStmt.addBatch();
+            }
+            prepStmt.executeBatch();
+
+            rs = stmt.executeQuery("select count(*) from numeric_tbl2 where c1=-1;");
+            int result = 0;
+            while (rs.next()) {
+                result = rs.getInt(1);
+            }
+            rs.close();
+            assertEquals("Rows returned count should be 1000", 1000, result);
+        } catch (SQLException e) {
+            e.printStackTrace();
+        } finally {
+            stmt.close();
+            prepStmt.close();
+            conn.close();
+        }
+
+    }
 }