From: mmatthews Date: August 11 2005 7:15pm Subject: Connector/J commit: r4050 - in branches/branch_3_1/connector-j: . src/com/mysql/jdbc src/testsuite/simple List-Archive: http://lists.mysql.com/internals/28176 Message-Id: <200508111915.j7BJFIPB004586@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified: branches/branch_3_1/connector-j/CHANGES branches/branch_3_1/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java branches/branch_3_1/connector-j/src/testsuite/simple/StatementsTest.java Log: Lifted restriction of changing streaming parameters with server-side prepared statements. As long as _all_ streaming parameters were set before execution, .clearParameters() does not have to be called. (due to limitation of client/server protocol, prepared statements can not reset _individual_ stream data on the server side). Modified: branches/branch_3_1/connector-j/CHANGES =================================================================== --- branches/branch_3_1/connector-j/CHANGES 2005-08-11 00:08:08 UTC (rev 4049) +++ branches/branch_3_1/connector-j/CHANGES 2005-08-11 19:15:17 UTC (rev 4050) @@ -60,6 +60,12 @@ - Fixed BUG#11498 - Escape processor didn't honor strings demarcated with double quotes. + + - Lifted restriction of changing streaming parameters with server-side + prepared statements. As long as _all_ streaming parameters were set + before execution, .clearParameters() does not have to be called. + (due to limitation of client/server protocol, prepared statements + can not reset _individual_ stream data on the server side). 06-23-05 - Version 3.1.10-stable Modified: branches/branch_3_1/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java =================================================================== --- branches/branch_3_1/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java 2005-08-11 00:08:08 UTC (rev 4049) +++ branches/branch_3_1/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java 2005-08-11 19:15:17 UTC (rev 4050) @@ -27,6 +27,7 @@ import com.mysql.jdbc.profiler.ProfileEventSink; import com.mysql.jdbc.profiler.ProfilerEvent; +import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.Reader; @@ -76,6 +77,8 @@ static class BindValue { + long boundBeforeExecutionNum = 0; + long bindLength; /* Default length of data */ int bufferType; /* buffer type */ @@ -758,7 +761,8 @@ } this.parameterBindings[parameterIndex].isSet = true; - + this.parameterBindings[parameterIndex].boundBeforeExecutionNum = this.numberOfExecutions; + return this.parameterBindings[parameterIndex]; } @@ -988,10 +992,29 @@ boolean createStreamingResultSet) throws SQLException { synchronized (this.connection.getMutex()) { if (this.detectedLongParameterSwitch) { - throw new SQLException(Messages - .getString("ServerPreparedStatement.11") //$NON-NLS-1$ - + Messages.getString("ServerPreparedStatement.12"), //$NON-NLS-1$ - SQLError.SQL_STATE_DRIVER_NOT_CAPABLE); + // Check when values were bound + boolean firstFound = false; + long boundTimeToCheck = 0; + + for (int i = 0; i < this.parameterCount - 1; i++) { + if (this.parameterBindings[i].isLongData) { + if (firstFound && boundTimeToCheck != + this.parameterBindings[i].boundBeforeExecutionNum) { + throw new SQLException(Messages + .getString("ServerPreparedStatement.11") //$NON-NLS-1$ + + Messages.getString("ServerPreparedStatement.12"), //$NON-NLS-1$ + SQLError.SQL_STATE_DRIVER_NOT_CAPABLE); + } else { + firstFound = true; + boundTimeToCheck = this.parameterBindings[i].boundBeforeExecutionNum; + } + } + } + + // Okay, we've got all "newly"-bound streams, so reset + // server-side state to clear out previous bindings + + serverResetStatement(); } // Check bindings Modified: branches/branch_3_1/connector-j/src/testsuite/simple/StatementsTest.java =================================================================== --- branches/branch_3_1/connector-j/src/testsuite/simple/StatementsTest.java 2005-08-11 00:08:08 UTC (rev 4049) +++ branches/branch_3_1/connector-j/src/testsuite/simple/StatementsTest.java 2005-08-11 19:15:17 UTC (rev 4050) @@ -24,6 +24,9 @@ */ package testsuite.simple; +import java.io.ByteArrayInputStream; +import java.io.CharArrayReader; +import java.io.Reader; import java.sql.CallableStatement; import java.sql.Connection; import java.sql.PreparedStatement; @@ -44,14 +47,23 @@ * @version $Id$ */ public class StatementsTest extends BaseTestCase { + private static final int MAX_COLUMN_LENGTH = 255; + private static final int MAX_COLUMNS_TO_TEST = 40; + private static final int MIN_COLUMN_LENGTH = 10; + private static final int STEP = 8; - private static final int MAX_COLUMN_LENGTH = 255; + /** + * Runs all test cases in this test suite + * + * @param args + */ + public static void main(String[] args) { + junit.textui.TestRunner.run(StatementsTest.class); + } - private static final int MIN_COLUMN_LENGTH = 10; - /** * Creates a new StatementsTest object. * @@ -63,15 +75,6 @@ } /** - * Runs all test cases in this test suite - * - * @param args - */ - public static void main(String[] args) { - junit.textui.TestRunner.run(StatementsTest.class); - } - - /** * DOCUMENT ME! * * @throws Exception @@ -187,7 +190,7 @@ accessorStmt = this.conn.createStatement(); accessorStmt.setMaxRows(1); accessorStmt.setMaxRows(0); // FIXME, test that this actually - // affects rows returned + // affects rows returned accessorStmt.setMaxFieldSize(255); assertTrue("Max field size should match what was set", accessorStmt .getMaxFieldSize() == 255); @@ -320,6 +323,125 @@ } /** + * Tests all variants of numerical types (signed/unsigned) for correct + * operation when used as return values from a prepared statement. + * + * @throws Exception + */ + public void testBinaryResultSetNumericTypes() throws Exception { + /* + * TINYINT 1 -128 127 SMALLINT 2 -32768 32767 MEDIUMINT 3 -8388608 + * 8388607 INT 4 -2147483648 2147483647 BIGINT 8 -9223372036854775808 + * 9223372036854775807 + */ + + String unsignedMinimum = "0"; + + String tiMinimum = "-128"; + String tiMaximum = "127"; + String utiMaximum = "255"; + + String siMinimum = "-32768"; + String siMaximum = "32767"; + String usiMaximum = "65535"; + + String miMinimum = "-8388608"; + String miMaximum = "8388607"; + String umiMaximum = "16777215"; + + String iMinimum = "-2147483648"; + String iMaximum = "2147483647"; + String uiMaximum = "4294967295"; + + String biMinimum = "-9223372036854775808"; + String biMaximum = "9223372036854775807"; + String ubiMaximum = "18446744073709551615"; + + try { + this.stmt + .executeUpdate("DROP TABLE IF EXISTS testBinaryResultSetNumericTypes"); + this.stmt + .executeUpdate("CREATE TABLE testBinaryResultSetNumericTypes(rowOrder TINYINT, ti TINYINT," + + "uti TINYINT UNSIGNED, si SMALLINT," + + "usi SMALLINT UNSIGNED, mi MEDIUMINT," + + "umi MEDIUMINT UNSIGNED, i INT, ui INT UNSIGNED," + + "bi BIGINT, ubi BIGINT UNSIGNED)"); + PreparedStatement inserter = this.conn + .prepareStatement("INSERT INTO testBinaryResultSetNumericTypes VALUES (?,?,?,?,?,?,?,?,?,?,?)"); + inserter.setInt(1, 0); + inserter.setString(2, tiMinimum); + inserter.setString(3, unsignedMinimum); + inserter.setString(4, siMinimum); + inserter.setString(5, unsignedMinimum); + inserter.setString(6, miMinimum); + inserter.setString(7, unsignedMinimum); + inserter.setString(8, iMinimum); + inserter.setString(9, unsignedMinimum); + inserter.setString(10, biMinimum); + inserter.setString(11, unsignedMinimum); + inserter.executeUpdate(); + + inserter.setInt(1, 1); + inserter.setString(2, tiMaximum); + inserter.setString(3, utiMaximum); + inserter.setString(4, siMaximum); + inserter.setString(5, usiMaximum); + inserter.setString(6, miMaximum); + inserter.setString(7, umiMaximum); + inserter.setString(8, iMaximum); + inserter.setString(9, uiMaximum); + inserter.setString(10, biMaximum); + inserter.setString(11, ubiMaximum); + inserter.executeUpdate(); + + PreparedStatement selector = this.conn + .prepareStatement("SELECT * FROM testBinaryResultSetNumericTypes ORDER by rowOrder ASC"); + this.rs = selector.executeQuery(); + + assertTrue(this.rs.next()); + + assertTrue(this.rs.getString(2).equals(tiMinimum)); + assertTrue(this.rs.getString(3).equals(unsignedMinimum)); + assertTrue(this.rs.getString(4).equals(siMinimum)); + assertTrue(this.rs.getString(5).equals(unsignedMinimum)); + assertTrue(this.rs.getString(6).equals(miMinimum)); + assertTrue(this.rs.getString(7).equals(unsignedMinimum)); + assertTrue(this.rs.getString(8).equals(iMinimum)); + assertTrue(this.rs.getString(9).equals(unsignedMinimum)); + assertTrue(this.rs.getString(10).equals(biMinimum)); + assertTrue(this.rs.getString(11).equals(unsignedMinimum)); + + assertTrue(this.rs.next()); + + assertTrue(this.rs.getString(2) + " != " + tiMaximum, this.rs + .getString(2).equals(tiMaximum)); + assertTrue(this.rs.getString(3) + " != " + utiMaximum, this.rs + .getString(3).equals(utiMaximum)); + assertTrue(this.rs.getString(4) + " != " + siMaximum, this.rs + .getString(4).equals(siMaximum)); + assertTrue(this.rs.getString(5) + " != " + usiMaximum, this.rs + .getString(5).equals(usiMaximum)); + assertTrue(this.rs.getString(6) + " != " + miMaximum, this.rs + .getString(6).equals(miMaximum)); + assertTrue(this.rs.getString(7) + " != " + umiMaximum, this.rs + .getString(7).equals(umiMaximum)); + assertTrue(this.rs.getString(8) + " != " + iMaximum, this.rs + .getString(8).equals(iMaximum)); + assertTrue(this.rs.getString(9) + " != " + uiMaximum, this.rs + .getString(9).equals(uiMaximum)); + assertTrue(this.rs.getString(10) + " != " + biMaximum, this.rs + .getString(10).equals(biMaximum)); + assertTrue(this.rs.getString(11) + " != " + ubiMaximum, this.rs + .getString(11).equals(ubiMaximum)); + + assertTrue(!this.rs.next()); + } finally { + this.stmt + .executeUpdate("DROP TABLE IF EXISTS testBinaryResultSetNumericTypes"); + } + } + + /** * Tests stored procedure functionality * * @throws Exception @@ -433,6 +555,93 @@ exceptionAfterClosed); } + public void testEnableStreamingResults() throws Exception { + Statement streamStmt = this.conn.createStatement(); + ((com.mysql.jdbc.Statement) streamStmt).enableStreamingResults(); + assertEquals(streamStmt.getFetchSize(), Integer.MIN_VALUE); + assertEquals(streamStmt.getResultSetType(), ResultSet.TYPE_FORWARD_ONLY); + } + + public void testHoldingResultSetsOverClose() throws Exception { + Properties props = new Properties(); + props.setProperty("holdResultsOpenOverStatementClose", "true"); + + Connection conn2 = getConnectionWithProps(props); + + Statement stmt2 = null; + PreparedStatement pstmt2 = null; + + try { + stmt2 = conn2.createStatement(); + + this.rs = stmt2.executeQuery("SELECT 1"); + this.rs.next(); + this.rs.getInt(1); + stmt2.close(); + this.rs.getInt(1); + + stmt2 = conn2.createStatement(); + stmt2.execute("SELECT 1"); + this.rs = stmt2.getResultSet(); + this.rs.next(); + this.rs.getInt(1); + stmt2.execute("SELECT 2"); + this.rs.getInt(1); + + pstmt2 = conn2.prepareStatement("SELECT 1"); + this.rs = pstmt2.executeQuery(); + this.rs.next(); + this.rs.getInt(1); + pstmt2.close(); + this.rs.getInt(1); + + pstmt2 = conn2.prepareStatement("SELECT 1"); + this.rs = pstmt2.executeQuery(); + this.rs.next(); + this.rs.getInt(1); + pstmt2.executeQuery(); + this.rs.getInt(1); + pstmt2.execute(); + this.rs.getInt(1); + + pstmt2 = ((com.mysql.jdbc.Connection) conn2) + .clientPrepareStatement("SELECT 1"); + this.rs = pstmt2.executeQuery(); + this.rs.next(); + this.rs.getInt(1); + pstmt2.close(); + this.rs.getInt(1); + + pstmt2 = ((com.mysql.jdbc.Connection) conn2) + .clientPrepareStatement("SELECT 1"); + this.rs = pstmt2.executeQuery(); + this.rs.next(); + this.rs.getInt(1); + pstmt2.executeQuery(); + this.rs.getInt(1); + pstmt2.execute(); + this.rs.getInt(1); + + stmt2 = conn2.createStatement(); + this.rs = stmt2.executeQuery("SELECT 1"); + this.rs.next(); + this.rs.getInt(1); + stmt2.executeQuery("SELECT 2"); + this.rs.getInt(1); + this.rs = stmt2.executeQuery("SELECT 1"); + this.rs.next(); + this.rs.getInt(1); + stmt2.executeUpdate("SET @var=1"); + this.rs.getInt(1); + stmt2.execute("SET @var=2"); + this.rs.getInt(1); + } finally { + if (stmt2 != null) { + stmt2.close(); + } + } + } + /** * DOCUMENT ME! * @@ -619,6 +828,33 @@ } } + public void testParsedConversionWarning() throws Exception { + if (versionMeetsMinimum(4, 1)) { + try { + Properties props = new Properties(); + props.setProperty("useUsageAdvisor", "true"); + Connection warnConn = getConnectionWithProps(props); + + this.stmt + .executeUpdate("DROP TABLE IF EXISTS testParsedConversionWarning"); + this.stmt + .executeUpdate("CREATE TABLE testParsedConversionWarning(field1 VARCHAR(255))"); + this.stmt + .executeUpdate("INSERT INTO testParsedConversionWarning VALUES ('1.0')"); + + PreparedStatement badStmt = warnConn + .prepareStatement("SELECT field1 FROM testParsedConversionWarning"); + + this.rs = badStmt.executeQuery(); + assertTrue(this.rs.next()); + this.rs.getFloat(1); + } finally { + this.stmt + .executeUpdate("DROP TABLE IF EXISTS testParsedConversionWarning"); + } + } + } + /** * DOCUMENT ME! * @@ -698,6 +934,58 @@ } } + public void testStreamChange() throws Exception { + createTable("testStreamChange", + "(field1 varchar(32), field2 int, field3 TEXT, field4 BLOB)"); + this.pstmt = this.conn + .prepareStatement("INSERT INTO testStreamChange VALUES (?, ?, ?, ?)"); + + try { + this.pstmt.setString(1, "A"); + this.pstmt.setInt(2, 1); + + char[] cArray = { 'A', 'B', 'C' }; + Reader r = new CharArrayReader(cArray); + this.pstmt.setCharacterStream(3, r, cArray.length); + + byte[] bArray = { 'D', 'E', 'F' }; + ByteArrayInputStream bais = new ByteArrayInputStream(bArray); + this.pstmt.setBinaryStream(4, bais, bArray.length); + + assertEquals(1, this.pstmt.executeUpdate()); + + this.rs = this.stmt + .executeQuery("SELECT field3, field4 from testStreamChange where field1='A'"); + this.rs.next(); + assertEquals("ABC", this.rs.getString(1)); + assertEquals("DEF", this.rs.getString(2)); + + char[] ucArray = { 'C', 'E', 'S', 'U' }; + this.pstmt.setString(1, "CESU"); + this.pstmt.setInt(2, 3); + Reader ucReader = new CharArrayReader(ucArray); + this.pstmt.setCharacterStream(3, ucReader, ucArray.length); + this.pstmt.setBinaryStream(4, null, 0); + assertEquals(1, this.pstmt.executeUpdate()); + + this.rs = this.stmt + .executeQuery("SELECT field3, field4 from testStreamChange where field1='CESU'"); + this.rs.next(); + assertEquals("CESU", this.rs.getString(1)); + assertEquals(null, this.rs.getString(2)); + } finally { + if (this.rs != null) { + this.rs.close(); + this.rs = null; + } + + if (this.pstmt != null) { + this.pstmt.close(); + this.pstmt = null; + } + } + } + /** * DOCUMENT ME! * @@ -712,125 +1000,9 @@ } } - /** - * Tests all variants of numerical types (signed/unsigned) for correct - * operation when used as return values from a prepared statement. - * - * @throws Exception - */ - public void testBinaryResultSetNumericTypes() throws Exception { - /* - * TINYINT 1 -128 127 SMALLINT 2 -32768 32767 MEDIUMINT 3 -8388608 - * 8388607 INT 4 -2147483648 2147483647 BIGINT 8 -9223372036854775808 - * 9223372036854775807 - */ + // Server-side prepared statements can only reset streamed data + // in-toto, not piecemiel. - String unsignedMinimum = "0"; - - String tiMinimum = "-128"; - String tiMaximum = "127"; - String utiMaximum = "255"; - - String siMinimum = "-32768"; - String siMaximum = "32767"; - String usiMaximum = "65535"; - - String miMinimum = "-8388608"; - String miMaximum = "8388607"; - String umiMaximum = "16777215"; - - String iMinimum = "-2147483648"; - String iMaximum = "2147483647"; - String uiMaximum = "4294967295"; - - String biMinimum = "-9223372036854775808"; - String biMaximum = "9223372036854775807"; - String ubiMaximum = "18446744073709551615"; - - try { - this.stmt - .executeUpdate("DROP TABLE IF EXISTS testBinaryResultSetNumericTypes"); - this.stmt - .executeUpdate("CREATE TABLE testBinaryResultSetNumericTypes(rowOrder TINYINT, ti TINYINT," - + "uti TINYINT UNSIGNED, si SMALLINT," - + "usi SMALLINT UNSIGNED, mi MEDIUMINT," - + "umi MEDIUMINT UNSIGNED, i INT, ui INT UNSIGNED," - + "bi BIGINT, ubi BIGINT UNSIGNED)"); - PreparedStatement inserter = this.conn - .prepareStatement("INSERT INTO testBinaryResultSetNumericTypes VALUES (?,?,?,?,?,?,?,?,?,?,?)"); - inserter.setInt(1, 0); - inserter.setString(2, tiMinimum); - inserter.setString(3, unsignedMinimum); - inserter.setString(4, siMinimum); - inserter.setString(5, unsignedMinimum); - inserter.setString(6, miMinimum); - inserter.setString(7, unsignedMinimum); - inserter.setString(8, iMinimum); - inserter.setString(9, unsignedMinimum); - inserter.setString(10, biMinimum); - inserter.setString(11, unsignedMinimum); - inserter.executeUpdate(); - - inserter.setInt(1, 1); - inserter.setString(2, tiMaximum); - inserter.setString(3, utiMaximum); - inserter.setString(4, siMaximum); - inserter.setString(5, usiMaximum); - inserter.setString(6, miMaximum); - inserter.setString(7, umiMaximum); - inserter.setString(8, iMaximum); - inserter.setString(9, uiMaximum); - inserter.setString(10, biMaximum); - inserter.setString(11, ubiMaximum); - inserter.executeUpdate(); - - PreparedStatement selector = this.conn - .prepareStatement("SELECT * FROM testBinaryResultSetNumericTypes ORDER by rowOrder ASC"); - this.rs = selector.executeQuery(); - - assertTrue(this.rs.next()); - - assertTrue(this.rs.getString(2).equals(tiMinimum)); - assertTrue(this.rs.getString(3).equals(unsignedMinimum)); - assertTrue(this.rs.getString(4).equals(siMinimum)); - assertTrue(this.rs.getString(5).equals(unsignedMinimum)); - assertTrue(this.rs.getString(6).equals(miMinimum)); - assertTrue(this.rs.getString(7).equals(unsignedMinimum)); - assertTrue(this.rs.getString(8).equals(iMinimum)); - assertTrue(this.rs.getString(9).equals(unsignedMinimum)); - assertTrue(this.rs.getString(10).equals(biMinimum)); - assertTrue(this.rs.getString(11).equals(unsignedMinimum)); - - assertTrue(this.rs.next()); - - assertTrue(this.rs.getString(2) + " != " + tiMaximum, this.rs - .getString(2).equals(tiMaximum)); - assertTrue(this.rs.getString(3) + " != " + utiMaximum, this.rs - .getString(3).equals(utiMaximum)); - assertTrue(this.rs.getString(4) + " != " + siMaximum, this.rs - .getString(4).equals(siMaximum)); - assertTrue(this.rs.getString(5) + " != " + usiMaximum, this.rs - .getString(5).equals(usiMaximum)); - assertTrue(this.rs.getString(6) + " != " + miMaximum, this.rs - .getString(6).equals(miMaximum)); - assertTrue(this.rs.getString(7) + " != " + umiMaximum, this.rs - .getString(7).equals(umiMaximum)); - assertTrue(this.rs.getString(8) + " != " + iMaximum, this.rs - .getString(8).equals(iMaximum)); - assertTrue(this.rs.getString(9) + " != " + uiMaximum, this.rs - .getString(9).equals(uiMaximum)); - assertTrue(this.rs.getString(10) + " != " + biMaximum, this.rs - .getString(10).equals(biMaximum)); - assertTrue(this.rs.getString(11) + " != " + ubiMaximum, this.rs - .getString(11).equals(ubiMaximum)); - - assertTrue(!this.rs.next()); - } finally { - this.stmt - .executeUpdate("DROP TABLE IF EXISTS testBinaryResultSetNumericTypes"); - } - } - public void testTruncationOnRead() throws Exception { this.rs = this.stmt.executeQuery("SELECT '" + Long.MAX_VALUE + "'"); this.rs.next(); @@ -955,118 +1127,4 @@ } } - - public void testParsedConversionWarning() throws Exception { - if (versionMeetsMinimum(4, 1)) { - try { - Properties props = new Properties(); - props.setProperty("useUsageAdvisor", "true"); - Connection warnConn = getConnectionWithProps(props); - - this.stmt - .executeUpdate("DROP TABLE IF EXISTS testParsedConversionWarning"); - this.stmt - .executeUpdate("CREATE TABLE testParsedConversionWarning(field1 VARCHAR(255))"); - this.stmt - .executeUpdate("INSERT INTO testParsedConversionWarning VALUES ('1.0')"); - - PreparedStatement badStmt = warnConn - .prepareStatement("SELECT field1 FROM testParsedConversionWarning"); - - this.rs = badStmt.executeQuery(); - assertTrue(this.rs.next()); - this.rs.getFloat(1); - } finally { - this.stmt - .executeUpdate("DROP TABLE IF EXISTS testParsedConversionWarning"); - } - } - } - - public void testHoldingResultSetsOverClose() throws Exception { - Properties props = new Properties(); - props.setProperty("holdResultsOpenOverStatementClose", "true"); - - Connection conn2 = getConnectionWithProps(props); - - Statement stmt2 = null; - PreparedStatement pstmt2 = null; - - try { - stmt2 = conn2.createStatement(); - - this.rs = stmt2.executeQuery("SELECT 1"); - this.rs.next(); - this.rs.getInt(1); - stmt2.close(); - this.rs.getInt(1); - - stmt2 = conn2.createStatement(); - stmt2.execute("SELECT 1"); - this.rs = stmt2.getResultSet(); - this.rs.next(); - this.rs.getInt(1); - stmt2.execute("SELECT 2"); - this.rs.getInt(1); - - pstmt2 = conn2.prepareStatement("SELECT 1"); - this.rs = pstmt2.executeQuery(); - this.rs.next(); - this.rs.getInt(1); - pstmt2.close(); - this.rs.getInt(1); - - pstmt2 = conn2.prepareStatement("SELECT 1"); - this.rs = pstmt2.executeQuery(); - this.rs.next(); - this.rs.getInt(1); - pstmt2.executeQuery(); - this.rs.getInt(1); - pstmt2.execute(); - this.rs.getInt(1); - - pstmt2 = ((com.mysql.jdbc.Connection) conn2) - .clientPrepareStatement("SELECT 1"); - this.rs = pstmt2.executeQuery(); - this.rs.next(); - this.rs.getInt(1); - pstmt2.close(); - this.rs.getInt(1); - - pstmt2 = ((com.mysql.jdbc.Connection) conn2) - .clientPrepareStatement("SELECT 1"); - this.rs = pstmt2.executeQuery(); - this.rs.next(); - this.rs.getInt(1); - pstmt2.executeQuery(); - this.rs.getInt(1); - pstmt2.execute(); - this.rs.getInt(1); - - stmt2 = conn2.createStatement(); - this.rs = stmt2.executeQuery("SELECT 1"); - this.rs.next(); - this.rs.getInt(1); - stmt2.executeQuery("SELECT 2"); - this.rs.getInt(1); - this.rs = stmt2.executeQuery("SELECT 1"); - this.rs.next(); - this.rs.getInt(1); - stmt2.executeUpdate("SET @var=1"); - this.rs.getInt(1); - stmt2.execute("SET @var=2"); - this.rs.getInt(1); - } finally { - if (stmt2 != null) { - stmt2.close(); - } - } - } - - public void testEnableStreamingResults() throws Exception { - Statement streamStmt = this.conn.createStatement(); - ((com.mysql.jdbc.Statement) streamStmt).enableStreamingResults(); - assertEquals(streamStmt.getFetchSize(), Integer.MIN_VALUE); - assertEquals(streamStmt.getResultSetType(), ResultSet.TYPE_FORWARD_ONLY); - } }