Package com.alibaba.druid.stat

Examples of com.alibaba.druid.stat.JdbcSqlStat


    private void clobOpenAfter(JdbcDataSourceStat dataSourceStat, StatementProxy stmt, ClobProxy clob) {
        dataSourceStat.incrementClobOpenCount();

        if (stmt != null) {
            JdbcSqlStat sqlStat = stmt.getSqlStat();
            if (sqlStat != null) {
                sqlStat.incrementClobOpenCount();
            }
        }

        StatFilterContext.getInstance().clob_open();
    }
View Full Code Here


        Connection conn = dataSource.getConnection();

        String sql = "select 'x'";
        PreparedStatement stmt = conn.prepareStatement("select 'x'");

        JdbcSqlStat sqlStat = dataSource.getDataSourceStat().getSqlStat(sql);

        Assert.assertEquals(0, sqlStat.getClobOpenCount());

        ResultSet rs = stmt.executeQuery();
        rs.next();
        rs.getObject(1);
        rs.getObject(2);
        rs.close();
        stmt.close();

        conn.close();

        Assert.assertEquals(2, sqlStat.getClobOpenCount());

        sqlStat.reset();
        Assert.assertEquals(0, sqlStat.getClobOpenCount());
    }
View Full Code Here

        Connection conn = dataSource.getConnection();

        String sql = "select 'x'";
        PreparedStatement stmt = conn.prepareStatement("select 'x'");

        JdbcSqlStat sqlStat = dataSource.getDataSourceStat().getSqlStat(sql);

        Assert.assertEquals(0, sqlStat.getClobOpenCount());

        ResultSet rs = stmt.executeQuery();
        rs.next();
        rs.getObject("1");
        rs.getObject("2");
        rs.getObject("3");
        rs.close();
        stmt.close();

        conn.close();

        Assert.assertEquals(3, sqlStat.getClobOpenCount());

        sqlStat.reset();
        Assert.assertEquals(0, sqlStat.getClobOpenCount());
    }
View Full Code Here

        Connection conn = dataSource.getConnection();

        String sql = "select 'x'";
        PreparedStatement stmt = conn.prepareStatement("select 'x'");

        JdbcSqlStat sqlStat = dataSource.getDataSourceStat().getSqlStat(sql);

        Assert.assertEquals(0, sqlStat.getClobOpenCount());

        ResultSet rs = stmt.executeQuery();
        rs.next();
        rs.getObject(1, Collections.<String,Class<?>>emptyMap());
        rs.getObject(2, Collections.<String,Class<?>>emptyMap());
        rs.getObject(3, Collections.<String,Class<?>>emptyMap());
        rs.getObject(4, Collections.<String,Class<?>>emptyMap());
        rs.close();
        stmt.close();

        conn.close();

        Assert.assertEquals(4, sqlStat.getClobOpenCount());

        sqlStat.reset();
        Assert.assertEquals(0, sqlStat.getClobOpenCount());
    }
View Full Code Here

        Connection conn = dataSource.getConnection();

        String sql = "select 'x'";
        PreparedStatement stmt = conn.prepareStatement("select 'x'");

        JdbcSqlStat sqlStat = dataSource.getDataSourceStat().getSqlStat(sql);

        Assert.assertEquals(0, sqlStat.getClobOpenCount());

        ResultSet rs = stmt.executeQuery();
        rs.next();
        rs.getObject("1", Collections.<String,Class<?>>emptyMap());
        rs.getObject("2", Collections.<String,Class<?>>emptyMap());
        rs.getObject("3", Collections.<String,Class<?>>emptyMap());
        rs.getObject("4", Collections.<String,Class<?>>emptyMap());
        rs.getObject("5", Collections.<String,Class<?>>emptyMap());
        rs.close();
        stmt.close();

        conn.close();

        Assert.assertEquals(5, sqlStat.getClobOpenCount());

        sqlStat.reset();
        Assert.assertEquals(0, sqlStat.getClobOpenCount());
    }
View Full Code Here

        Connection conn = dataSource.getConnection();

        String sql = "select 'x'";
        PreparedStatement stmt = conn.prepareStatement("select 'x'");

        JdbcSqlStat sqlStat = dataSource.getDataSourceStat().getSqlStat(sql);

        Assert.assertEquals(0, sqlStat.getReadStringLength());
        Assert.assertEquals(0, sqlStat.getReadBytesLength());

        ResultSet rs = stmt.executeQuery();
        rs.next();
        rs.getBytes(1);
        rs.close();
        stmt.close();

        conn.close();

        Assert.assertEquals(0, sqlStat.getReadStringLength());
        Assert.assertEquals(6, sqlStat.getReadBytesLength());

        sqlStat.reset();
        Assert.assertEquals(0, sqlStat.getReadStringLength());
        Assert.assertEquals(0, sqlStat.getReadBytesLength());
    }
View Full Code Here

        Connection conn = dataSource.getConnection();

        String sql = "select 'x'";
        PreparedStatement stmt = conn.prepareStatement("select 'x'");

        JdbcSqlStat sqlStat = dataSource.getDataSourceStat().getSqlStat(sql);

        Assert.assertEquals(0, sqlStat.getReadStringLength());
        Assert.assertEquals(0, sqlStat.getReadBytesLength());

        ResultSet rs = stmt.executeQuery();
        rs.next();
        rs.getBytes("1");
        rs.close();
        stmt.close();

        conn.close();

        Assert.assertEquals(0, sqlStat.getReadStringLength());
        Assert.assertEquals(7, sqlStat.getReadBytesLength());

        sqlStat.reset();
        Assert.assertEquals(0, sqlStat.getReadStringLength());
        Assert.assertEquals(0, sqlStat.getReadBytesLength());
    }
View Full Code Here

        Connection conn = dataSource.getConnection();

        String sql = "select 'x'";
        PreparedStatement stmt = conn.prepareStatement("select 'x'");

        JdbcSqlStat sqlStat = dataSource.getDataSourceStat().getSqlStat(sql);

        Assert.assertEquals(0, sqlStat.getBlobOpenCount());

        ResultSet rs = stmt.executeQuery();
        rs.next();
        rs.getObject(1);
        rs.getObject(2);
        rs.close();
        stmt.close();

        conn.close();

        Assert.assertEquals(2, sqlStat.getBlobOpenCount());

        sqlStat.reset();
        Assert.assertEquals(0, sqlStat.getBlobOpenCount());
    }
View Full Code Here

        Connection conn = dataSource.getConnection();

        String sql = "select 'x'";
        PreparedStatement stmt = conn.prepareStatement("select 'x'");

        JdbcSqlStat sqlStat = dataSource.getDataSourceStat().getSqlStat(sql);

        Assert.assertEquals(0, sqlStat.getBlobOpenCount());

        ResultSet rs = stmt.executeQuery();
        rs.next();
        rs.getObject("1");
        rs.getObject("2");
        rs.getObject("3");
        rs.close();
        stmt.close();

        conn.close();

        Assert.assertEquals(3, sqlStat.getBlobOpenCount());

        sqlStat.reset();
        Assert.assertEquals(0, sqlStat.getBlobOpenCount());
    }
View Full Code Here

        Connection conn = dataSource.getConnection();

        String sql = "select 'x'";
        PreparedStatement stmt = conn.prepareStatement("select 'x'");

        JdbcSqlStat sqlStat = dataSource.getDataSourceStat().getSqlStat(sql);

        Assert.assertEquals(0, sqlStat.getBlobOpenCount());

        ResultSet rs = stmt.executeQuery();
        rs.next();
        rs.getObject(1, Collections.<String, Class<?>> emptyMap());
        rs.getObject(2, Collections.<String, Class<?>> emptyMap());
        rs.getObject(3, Collections.<String, Class<?>> emptyMap());
        rs.getObject(4, Collections.<String, Class<?>> emptyMap());
        rs.close();
        stmt.close();

        conn.close();

        Assert.assertEquals(4, sqlStat.getBlobOpenCount());

        sqlStat.reset();
        Assert.assertEquals(0, sqlStat.getBlobOpenCount());
    }
View Full Code Here

TOP

Related Classes of com.alibaba.druid.stat.JdbcSqlStat

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.