add testcase & bug fixed

This commit is contained in:
wenshao
2012-08-25 06:48:07 +08:00
parent f2b4c56a8c
commit 78550243b2
15 changed files with 558 additions and 1 deletions
@@ -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();
}
}