You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafodion.apache.org by "mashengchen (JIRA)" <ji...@apache.org> on 2017/12/05 01:24:00 UTC

[jira] [Assigned] (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:all-tabpanel ]

mashengchen reassigned TRAFODION-2685:
--------------------------------------

    Assignee: mashengchen

> 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
>            Assignee: mashengchen
>
> 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)