mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
add testcase & bug fixed
This commit is contained in:
@@ -100,4 +100,34 @@ public class DruidPooledResultSetTest extends TestCase {
|
||||
|
||||
conn.close();
|
||||
}
|
||||
|
||||
public void test_rowCount() throws Exception {
|
||||
String sql = "select ?";
|
||||
Connection conn = dataSource.getConnection();
|
||||
|
||||
PreparedStatement stmt = conn.prepareStatement(sql);
|
||||
stmt.setString(1, "xxx");
|
||||
DruidPooledResultSet rs = (DruidPooledResultSet) stmt.executeQuery();
|
||||
|
||||
Assert.assertEquals(true, rs.next());
|
||||
Assert.assertEquals(false, rs.next());
|
||||
|
||||
Assert.assertEquals(1, rs.getFetchRowCount());
|
||||
|
||||
Assert.assertEquals(true, rs.previous());
|
||||
Assert.assertEquals(false, rs.previous());
|
||||
|
||||
Assert.assertEquals(1, rs.getFetchRowCount());
|
||||
|
||||
Assert.assertEquals(true, rs.next());
|
||||
Assert.assertEquals(false, rs.next());
|
||||
|
||||
Assert.assertEquals(1, rs.getFetchRowCount());
|
||||
|
||||
Assert.assertFalse(rs.rowUpdated());
|
||||
|
||||
rs.close();
|
||||
|
||||
conn.close();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user