use of com.alibaba.druid.mock.MockRef in project druid by alibaba.
the class LogFilterTest method executeSQL.
@SuppressWarnings("deprecation")
private void executeSQL(DataSourceProxyImpl dataSource) throws SQLException {
String sql = "SELECT 1";
Connection conn = dataSource.connect(new Properties());
conn.commit();
conn.rollback();
Statement stmt = conn.createStatement();
stmt.execute(sql);
stmt.addBatch(sql);
stmt.executeBatch();
stmt.executeQuery(sql);
stmt.executeUpdate(sql);
stmt.cancel();
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setArray(1, null);
pstmt.setAsciiStream(2, null);
pstmt.setBigDecimal(3, null);
pstmt.setBinaryStream(4, null);
pstmt.setBlob(5, conn.createBlob());
pstmt.setByte(6, (byte) 1);
pstmt.setBytes(7, new byte[1]);
pstmt.setCharacterStream(8, null);
pstmt.setClob(9, conn.createClob());
pstmt.setDate(10, null);
pstmt.setFloat(11, 1F);
pstmt.setInt(12, 1);
pstmt.setLong(13, 1L);
pstmt.setNCharacterStream(14, null);
pstmt.setNClob(15, conn.createNClob());
pstmt.setNString(16, null);
pstmt.setNull(17, Types.VARCHAR);
pstmt.setObject(18, null);
pstmt.setRef(19, new MockRef());
pstmt.setRowId(20, new MockRowId());
pstmt.setShort(21, (short) 1);
pstmt.setSQLXML(22, conn.createSQLXML());
pstmt.setString(23, "");
pstmt.setTime(24, null);
pstmt.setTimestamp(25, null);
pstmt.setUnicodeStream(26, null, 0);
pstmt.setURL(27, null);
pstmt.execute();
pstmt.addBatch();
pstmt.executeBatch();
pstmt.executeQuery();
pstmt.executeUpdate();
conn.prepareCall(sql);
ResultSet rs = stmt.executeQuery(sql);
rs.next();
rs.close();
{
Exception error = null;
try {
stmt.execute(MockStatement.ERROR_SQL);
} catch (SQLException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
stmt.close();
pstmt.close();
conn.close();
}
Aggregations