mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
添加返回值为NULL的测试
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@63 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -736,20 +736,17 @@ public class MockResultSet implements ResultSet {
|
||||
|
||||
@Override
|
||||
public Ref getRef(int columnIndex) throws SQLException {
|
||||
|
||||
return null;
|
||||
return (Ref) getObject(columnIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Blob getBlob(int columnIndex) throws SQLException {
|
||||
|
||||
return null;
|
||||
return (Blob) getObject(columnIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Clob getClob(int columnIndex) throws SQLException {
|
||||
|
||||
return null;
|
||||
return (Clob) getObject(columnIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.alibaba.druid.bvt.proxy.filter;
|
||||
|
||||
import java.sql.Blob;
|
||||
import java.sql.Clob;
|
||||
import java.sql.Connection;
|
||||
import java.sql.NClob;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.RowId;
|
||||
import java.sql.SQLXML;
|
||||
import java.sql.Statement;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
|
||||
public class ClobTest extends TestCase {
|
||||
|
||||
public void test_clob() throws Exception {
|
||||
DruidDataSource dataSource = new DruidDataSource();
|
||||
dataSource.setFilters("stat");
|
||||
dataSource.setUrl("jdbc:mock:");
|
||||
|
||||
Connection conn = dataSource.getConnection();
|
||||
Statement stmt = conn.createStatement();
|
||||
ResultSet rs = stmt.executeQuery("SELECT NULL");
|
||||
|
||||
Assert.assertTrue(rs.next());
|
||||
|
||||
{
|
||||
Clob x = rs.getClob(1);
|
||||
Assert.assertNull(x);
|
||||
}
|
||||
|
||||
{
|
||||
NClob x = rs.getNClob(1);
|
||||
Assert.assertNull(x);
|
||||
}
|
||||
|
||||
{
|
||||
Blob x = rs.getBlob(1);
|
||||
Assert.assertNull(x);
|
||||
}
|
||||
|
||||
{
|
||||
SQLXML x = rs.getSQLXML(1);
|
||||
Assert.assertNull(x);
|
||||
}
|
||||
|
||||
{
|
||||
String x = rs.getString(1);
|
||||
Assert.assertNull(x);
|
||||
}
|
||||
|
||||
Assert.assertNull(rs.getRowId(1));
|
||||
Assert.assertNull(rs.getBigDecimal(1));
|
||||
Assert.assertNull(rs.getObject(1));
|
||||
|
||||
rs.close();
|
||||
stmt.close();
|
||||
conn.close();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user