use of java.sql.NClob in project druid by alibaba.
the class StatFilter method buildSlowParameters.
private String buildSlowParameters(StatementProxy statement) {
JSONWriter out = new JSONWriter();
out.writeArrayStart();
for (int i = 0, parametersSize = statement.getParametersSize(); i < parametersSize; ++i) {
JdbcParameter parameter = statement.getParameter(i);
if (i != 0) {
out.writeComma();
}
if (parameter == null) {
continue;
}
Object value = parameter.getValue();
if (value == null) {
out.writeNull();
} else if (value instanceof String) {
String text = (String) value;
if (text.length() > 100) {
out.writeString(text.substring(0, 97) + "...");
} else {
out.writeString(text);
}
} else if (value instanceof Number) {
out.writeObject(value);
} else if (value instanceof java.util.Date) {
out.writeObject(value);
} else if (value instanceof Boolean) {
out.writeObject(value);
} else if (value instanceof InputStream) {
out.writeString("<InputStream>");
} else if (value instanceof NClob) {
out.writeString("<NClob>");
} else if (value instanceof Clob) {
out.writeString("<Clob>");
} else if (value instanceof Blob) {
out.writeString("<Blob>");
} else {
out.writeString('<' + value.getClass().getName() + '>');
}
}
out.writeArrayEnd();
return out.toString();
}
use of java.sql.NClob in project druid by alibaba.
the class ConnectionProxyImpl method createNClob.
@Override
public NClob createNClob() throws SQLException {
FilterChainImpl chain = createChain();
NClob value = chain.connection_createNClob(this);
recycleFilterChain(chain);
return value;
}
use of java.sql.NClob in project druid by alibaba.
the class ResultSetProxyImpl method getNClob.
@Override
public NClob getNClob(int columnIndex) throws SQLException {
FilterChainImpl chain = createChain();
NClob value = chain.resultSet_getNClob(this, columnIndex);
recycleFilterChain(chain);
return value;
}
use of java.sql.NClob in project hibernate-orm by hibernate.
the class ContextualLobCreator method createNClob.
@Override
public NClob createNClob(String string) {
try {
final NClob nclob = createNClob();
nclob.setString(1, string);
return nclob;
} catch (SQLException e) {
throw new JDBCException("Unable to set NCLOB string afterQuery creation", e);
}
}
use of java.sql.NClob in project hibernate-orm by hibernate.
the class LobCreatorTest method testLobCreation.
private void testLobCreation(LobCreator lobCreator) throws SQLException {
Blob blob = lobCreator.createBlob(new byte[] {});
if (lobCreator == NonContextualLobCreator.INSTANCE) {
assertTrue(blob instanceof BlobImplementer);
} else {
assertTrue(blob instanceof JdbcBlob);
}
blob = lobCreator.wrap(blob);
assertTrue(blob instanceof WrappedBlob);
Clob clob = lobCreator.createClob("Hi");
if (lobCreator == NonContextualLobCreator.INSTANCE) {
assertTrue(clob instanceof ClobImplementer);
} else {
assertTrue(clob instanceof JdbcClob);
}
clob = lobCreator.wrap(clob);
assertTrue(clob instanceof WrappedClob);
Clob nclob = lobCreator.createNClob("Hi");
if (lobCreator == NonContextualLobCreator.INSTANCE) {
assertTrue(nclob instanceof NClobImplementer);
} else {
assertTrue(nclob instanceof JdbcNClob);
}
assertTrue(NClob.class.isInstance(nclob));
nclob = lobCreator.wrap(nclob);
assertTrue(nclob instanceof WrappedClob);
blob.free();
clob.free();
nclob.free();
}
Aggregations