package org.mariadb.jdbc;

import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;

import java.sql.SQLException;
import java.sql.Statement;

import org.junit.Test;

public class StatementTest extends BaseTest {

	public StatementTest() {
	}
	
	@Test
	public void wrapperTest() throws SQLException {
		MySQLStatement mysqlStatement = new MySQLStatement((MySQLConnection) connection);
		assertTrue(mysqlStatement.isWrapperFor(Statement.class));
		assertFalse(mysqlStatement.isWrapperFor(SQLException.class));
		assertThat(mysqlStatement.unwrap(Statement.class), equalTo((Statement)mysqlStatement));
		try {
			mysqlStatement.unwrap(SQLException.class);
			fail("MySQLStatement class unwrapped as SQLException class");
		} catch (SQLException sqle) {
			assertTrue(true);
		} catch (Exception e) {
			assertTrue(false);
		}
		mysqlStatement.close();
	}

}
@@ -98,16 +98,109 @@
 ers.*;%0A%0A
+import java.sql.DriverManager;%0Aimport java.sql.PreparedStatement;%0Aimport java.sql.ResultSet;%0A
 import j
@@ -957,11 +957,428 @@
 se();%0A%09%7D
+%0A%09%0A%09/**%0A%09 * CONJ-90%0A%09 * @throws SQLException%0A%09 */%0A%09@Test%0A%09public void reexecuteStatementTest() throws SQLException %7B%0A%09%09connection = DriverManager.getConnection(%22jdbc:mysql://localhost:3306/test?user=root&allowMultiQueries=true%22);%0A%09%09PreparedStatement stmt = connection.prepareStatement(%22SELECT 1%22);%0A%09%09ResultSet rs = stmt.executeQuery();%0A%09%09rs.next();%0A%09%09rs = stmt.executeQuery();%0A%09%09stmt.close();%0A%09%09connection.close();%0A%09%7D
 %0A%0A%7D

Test case for CONJ-90