[ 
https://issues.apache.org/jira/browse/TRAFODION-2685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16089920#comment-16089920
 ] 

ASF GitHub Bot commented on TRAFODION-2685:
-------------------------------------------

Github user selvaganesang commented on a diff in the pull request:

    
https://github.com/apache/incubator-trafodion/pull/1180#discussion_r127725164
  
    --- Diff: 
core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4ResultSet.java ---
    @@ -1372,7 +1372,7 @@ public long getLong(int columnIndex) throws 
SQLException {
                                                }
                                        } else {
                                                throw 
TrafT4Messages.createSQLException(connection_.props_, connection_.getLocale(),
    -                                                           
"numeric_out_of_range", null);
    +                                                           
"numeric_out_of_range", bd.longValue());
    --- End diff --
    
    Will the longValue convert the bd into  a proper long value? Should we 
display the original bd value instead?


> using setString method to insert negative to integer column signed 
> successfully
> -------------------------------------------------------------------------------
>
>                 Key: TRAFODION-2685
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-2685
>             Project: Apache Trafodion
>          Issue Type: Bug
>          Components: client-jdbc-t4
>         Environment: cenot:6.7
>            Reporter: luoyunpeng
>
> using setString method to insert negative to integer column signed, result as 
> following:
> expect: {color:red}-2147483649{color}, but was: {color:red}2147483647{color}.
> expect: {color:red}2147483648{color},  but was: {color:red}-2147483648{color}.
> test code as following:
> ####
> public void testSetString() throws SQLException {
>               String tableName = "testsetString";
>               try {
>                       Statement stmt = conn.createStatement();
>                       stmt.executeUpdate("create table " + tableName + " (id 
> int not null,age int,primary key(id))");
>                       stmt.executeUpdate("delete from " + tableName);
>                       pstmt = conn.prepareStatement("insert into " + 
> tableName + " values(?,?)");
>                       pstmt.setInt(1, 1);
>                       pstmt.setString(2, "-2147483649");
>                       pstmt.executeUpdate();
>                       
>                       pstmt.setInt(1, 2);
>                       pstmt.setString(2, "2147483648");
>                       pstmt.executeUpdate();
>                       ResultSet rs = stmt.executeQuery("select * from " + 
> tableName);
>                       rs.next();
>                       System.out.println(rs.getString(2));
>                       rs.next();
>                       System.out.println(rs.getString(2));
>               } finally {
>                       dropTable(tableName);
>               }
>       }
> ####



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to