Search in sources :

Example 11 with NClob

use of java.sql.NClob in project druid by alibaba.

the class ClobTest method test_clob.

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();
    dataSource.close();
}
Also used : NClob(java.sql.NClob) Blob(java.sql.Blob) SQLXML(java.sql.SQLXML) Statement(java.sql.Statement) Connection(java.sql.Connection) ResultSet(java.sql.ResultSet) NClob(java.sql.NClob) Clob(java.sql.Clob) DruidDataSource(com.alibaba.druid.pool.DruidDataSource)

Aggregations

NClob (java.sql.NClob)11 FilterChainImpl (com.alibaba.druid.filter.FilterChainImpl)5 Clob (java.sql.Clob)5 Blob (java.sql.Blob)4 Connection (java.sql.Connection)3 ResultSet (java.sql.ResultSet)3 MockNClob (com.alibaba.druid.mock.MockNClob)2 SQLException (java.sql.SQLException)2 Statement (java.sql.Statement)2 DruidDataSource (com.alibaba.druid.pool.DruidDataSource)1 JdbcParameter (com.alibaba.druid.proxy.jdbc.JdbcParameter)1 JSONWriter (com.alibaba.druid.support.json.JSONWriter)1 InputStream (java.io.InputStream)1 StringReader (java.io.StringReader)1 Writer (java.io.Writer)1 PreparedStatement (java.sql.PreparedStatement)1 SQLXML (java.sql.SQLXML)1 Savepoint (java.sql.Savepoint)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1