You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafodion.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/07/14 09:38:00 UTC

[jira] [Commented] (TRAFODION-2685) using setString method to insert negative to integer column signed successfully

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

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

GitHub user mashengchen opened a pull request:

    https://github.com/apache/incubator-trafodion/pull/1180

    [TRAFODION-2685] int type doesnot check boundary

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/mashengchen/incubator-trafodion jdbc_int_boundary

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-trafodion/pull/1180.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1180
    
----
commit 5370426f82acba0ebd748a5e41797bf2c57dc53f
Author: mashengchen <ma...@gmail.com>
Date:   2017-07-14T09:10:14Z

    fix int type doesnot check boundary

----


> 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)