import java.sql.SQLException;
import java.util.*;

public class Bug12229 extends testsuite.BaseTestCase
{
    public Bug12229(String name)
    {
	super(name);
    }
    
    public void setUp() throws Exception
    {
	super.setUp();
        Properties props = new Properties();
 	props.put("profileSQL", "true");
//	props.put("logger", MySqlTraceLogger.class.getName());
 	props.put("slowQueryThresholdMillis", "0");
 	props.put("logSlowQueries", "true");
	// 	Everything works  great. Then when I add the following line:
	props.put("explainSlowQueries", "true");
        conn = getConnectionWithProps(props);

	dropTable("test_table"); 
	createTable("test_table","(`int_field` integer )");  
	stmt.executeUpdate("insert into test_table values (123456),(1)");  
    }
    public void testHanging() throws SQLException
    {
	pstmt = conn.prepareStatement("SELECT `int_field` FROM `test_table` WHERE `int_field` = ?");
	pstmt.setInt(1,1);

	rs = pstmt.executeQuery();
	assertTrue("retieved 0 records (must retrieve 1 record)",rs.next());
	String i1 = rs.getObject(1).toString();

	rs = pstmt.executeQuery();
	assertTrue("retieved 0 records (must retrieve 1 record)",rs.next());

	rs = pstmt.executeQuery();
	assertTrue("retieved 0 records (must retrieve 1 record)",rs.next());

    }
    
    public static void  main(String args[]) throws Exception
    {
	junit.textui.TestRunner.run(Bug12229.class);      
    }
    
}