package testsuite.simple; import java.util.Properties; import java.math.BigDecimal; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.Statement; import testsuite.BaseTestCase; public class TestBug27174 extends BaseTestCase { public TestBug27174(String name) { super(name); // TODO Auto-generated constructor stub } public void testBug27174() throws Exception { createTable("bug27174", "("+ "USER DECIMAL(24) ZEROFILL NOT NULL,"+ "APP_SET BIGINT UNSIGNED NOT NULL DEFAULT 0,"+ "MODULE CHAR(16) BINARY NOT NULL,"+ "INSTANCE SMALLINT UNSIGNED NOT NULL DEFAULT 0,"+ "ID BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,"+ "T TIMESTAMP NOT NULL,"+ "VAL TEXT NOT NULL,"+ "CONSTRAINT PRIMARY KEY (USER, APP_SET,MODULE, INSTANCE),"+ "CONSTRAINT UNIQUE INDEX ID_IDX (ID)"+ ")ENGINE=InnoDB DELAY_KEY_WRITE = 1 MIN_ROWS=100000 DEFAULT CHARACTER SET latin1 DEFAULT COLLATE latin1_bin;" ); try { System.out.println("java.vm.version : " + System.getProperty("java.vm.version")); System.out.println("java.vm.vendor : " + System.getProperty("java.vm.vendor")); System.out.println("java.runtime.version : " + System.getProperty("java.runtime.version")); System.out.println("os.name : " + System.getProperty("os.name")); System.out.println("os.version : " + System.getProperty("os.version ")); System.out.println("sun.management.compiler : " + System.getProperty("sun.management.compiler")); Properties props = new Properties(); props.put("useUnicode", "false"); props.put("useServerPrepStmts", "false"); props.put("CachePreparedStatements", "true"); props.put("DontTrackOpenResources", "false"); Connection conn2 = getConnectionWithProps(props); Statement stmt2 = conn2.createStatement(); String UPDATE_XXXX = "UPDATE bug27174 SET VAL=? " + "\nWHERE USER=?" + "\n AND 0 != APP_SET & 1 << ?" + "\n AND MODULE=? AND INSTANCE=?"; String INSERT_XXXX = "INSERT INTO bug27174 " + "\n(USER, APP_SET, MODULE, INSTANCE, VAL)" + "\nVALUES " + "\n(823006865215726505000002, 1 << 13, 'email_0', 2, 'inital value')"; stmt2.executeUpdate("DELETE FROM bug27174 "); stmt2.executeUpdate(INSERT_XXXX); PreparedStatement pstm = conn2.prepareStatement(UPDATE_XXXX, Statement.NO_GENERATED_KEYS); pstm.setString (1, "some new Value"); pstm.setBigDecimal(2, new BigDecimal("823006865215726505000002")); pstm.setInt (3, 13); pstm.setString (4, "email_0"); pstm.setShort (5, (short) 2); assertEquals(pstm.executeUpdate(),1); pstm.close(); conn2.close(); props.put("useServerPrepStmts", "false"); conn2 = getConnectionWithProps(props); PreparedStatement pstm1 = conn2.prepareStatement(UPDATE_XXXX, Statement.NO_GENERATED_KEYS); pstm1.setString (1, "some other Value"); pstm1.setBigDecimal(2, new BigDecimal("823006865215726505000002")); pstm1.setInt (3, 13); pstm1.setString (4, "email_0"); pstm1.setShort (5, (short) 2); assertEquals(pstm1.executeUpdate(),1); pstm1.close(); conn2.close(); } finally { closeMemberJDBCResources(); } } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub junit.textui.TestRunner.run(TestBug27174.class); } }