@Override public void setValues(PreparedStatement ps) throws SQLException { ps.setString(1, shortContext); if (longContext != null) { lobHandler.getLobCreator().setClobAsString(ps, 2, longContext); } else { ps.setNull(2, getClobTypeToUse()); } ps.setLong(3, executionId); } });
this.lobCreator.setClobAsString(ps, paramIndex, (String) this.content);
@Override public void setValues(PreparedStatement ps, int i) throws SQLException { Long executionId = executionIdIterator.next(); String serializedContext = serializedContexts.get(executionId); String shortContext; String longContext; if (serializedContext.length() > shortContextLength) { // Overestimate length of ellipsis to be on the safe side with // 2-byte chars shortContext = serializedContext.substring(0, shortContextLength - 8) + " ..."; longContext = serializedContext; } else { shortContext = serializedContext; longContext = null; } ps.setString(1, shortContext); if (longContext != null) { lobHandler.getLobCreator().setClobAsString(ps, 2, longContext); } else { ps.setNull(2, getClobTypeToUse()); } ps.setLong(3, executionId); }
@Test public void testSetClobAsString() throws SQLException, IOException { String content = "testContent"; lobCreator.setClobAsString(ps, 1, content); verify(ps).setString(1, content); }
@Test public void test4() throws SQLException { String testContent = "Bla"; SqlLobValue lob = new SqlLobValue(testContent, handler); lob.setTypeValue(preparedStatement, 1, Types.CLOB, "test"); verify(creator).setClobAsString(preparedStatement, 1, testContent); }
switch (sqlType) { case Types.CLOB: lobCreator.setClobAsString(ps, paramIndex, (String) param); break; case Types.BLOB:
@Test public void testCorrectCleanup() throws SQLException { SqlLobValue lob = new SqlLobValue("Bla", handler); lob.setTypeValue(preparedStatement, 1, Types.CLOB, "test"); lob.cleanup(); verify(creator).setClobAsString(preparedStatement, 1, "Bla"); verify(creator).close(); }
@Override protected void nullSafeSetInternal( PreparedStatement ps, int index, Object value, LobCreator lobCreator) throws SQLException { lobCreator.setClobAsString(ps, index, (String) value); }
protected void setParameterInternal( PreparedStatement ps, int index, Object value, String jdbcType, LobCreator lobCreator) throws SQLException { lobCreator.setClobAsString(ps, index, (String) value); }
@Override public void setValues(PreparedStatement ps) throws SQLException { ps.setString(1, shortContext); if (longContext != null) { lobHandler.getLobCreator().setClobAsString(ps, 2, longContext); } else { ps.setNull(2, getClobTypeToUse()); } ps.setLong(3, executionId); } });
public void setValues(PreparedStatement ps) throws SQLException { ps.setString(1, shortContext); if (longContext != null) { lobHandler.getLobCreator().setClobAsString(ps, 2, longContext); } else { ps.setNull(2, getClobTypeToUse()); } ps.setLong(3, executionId); } });
@Override public void setValues(PreparedStatement ps) throws SQLException { ps.setString(1, shortContext); if (longContext != null) { lobHandler.getLobCreator().setClobAsString(ps, 2, longContext); } else { ps.setNull(2, getClobTypeToUse()); } ps.setLong(3, executionId); } });
@Override public void setValues(PreparedStatement ps) throws SQLException { ps.setString(1, shortContext); if (longContext != null) { lobHandler.getLobCreator().setClobAsString(ps, 2, longContext); } else { ps.setNull(2, getClobTypeToUse()); } ps.setLong(3, executionId); } });
@Override public void setValues(PreparedStatement ps) throws SQLException { ps.setString(1, shortContext); if (longContext != null) { lobHandler.getLobCreator().setClobAsString(ps, 2, longContext); } else { ps.setNull(2, getClobTypeToUse()); } ps.setLong(3, executionId); } });
@Override public void setValues(PreparedStatement ps, int i) throws SQLException { Long executionId = executionIdIterator.next(); String serializedContext = serializedContexts.get(executionId); String shortContext; String longContext; if (serializedContext.length() > shortContextLength) { // Overestimate length of ellipsis to be on the safe side with // 2-byte chars shortContext = serializedContext.substring(0, shortContextLength - 8) + " ..."; longContext = serializedContext; } else { shortContext = serializedContext; longContext = null; } ps.setString(1, shortContext); if (longContext != null) { lobHandler.getLobCreator().setClobAsString(ps, 2, longContext); } else { ps.setNull(2, getClobTypeToUse()); } ps.setLong(3, executionId); }
@Override public void setValues(PreparedStatement ps, int i) throws SQLException { Long executionId = executionIdIterator.next(); String serializedContext = serializedContexts.get(executionId); String shortContext; String longContext; if (serializedContext.length() > shortContextLength) { // Overestimate length of ellipsis to be on the safe side with // 2-byte chars shortContext = serializedContext.substring(0, shortContextLength - 8) + " ..."; longContext = serializedContext; } else { shortContext = serializedContext; longContext = null; } ps.setString(1, shortContext); if (longContext != null) { lobHandler.getLobCreator().setClobAsString(ps, 2, longContext); } else { ps.setNull(2, getClobTypeToUse()); } ps.setLong(3, executionId); }
@Override public void setValues(PreparedStatement ps, int i) throws SQLException { Long executionId = executionIdIterator.next(); String serializedContext = serializedContexts.get(executionId); String shortContext; String longContext; if (serializedContext.length() > shortContextLength) { // Overestimate length of ellipsis to be on the safe side with // 2-byte chars shortContext = serializedContext.substring(0, shortContextLength - 8) + " ..."; longContext = serializedContext; } else { shortContext = serializedContext; longContext = null; } ps.setString(1, shortContext); if (longContext != null) { lobHandler.getLobCreator().setClobAsString(ps, 2, longContext); } else { ps.setNull(2, getClobTypeToUse()); } ps.setLong(3, executionId); }
@Override public void setValues(PreparedStatement ps, int i) throws SQLException { Long executionId = executionIdIterator.next(); String serializedContext = serializedContexts.get(executionId); String shortContext; String longContext; if (serializedContext.length() > shortContextLength) { // Overestimate length of ellipsis to be on the safe side with // 2-byte chars shortContext = serializedContext.substring(0, shortContextLength - 8) + " ..."; longContext = serializedContext; } else { shortContext = serializedContext; longContext = null; } ps.setString(1, shortContext); if (longContext != null) { lobHandler.getLobCreator().setClobAsString(ps, 2, longContext); } else { ps.setNull(2, getClobTypeToUse()); } ps.setLong(3, executionId); }
public void setValues(PreparedStatement ps, Object[] args, int[] argTypes, LobHandler lobHandler) throws SQLException { for (int i = 1; i <= args.length; i++) { Object arg = args[i - 1]; int argType = argTypes != null && argTypes.length >= i ? argTypes[i - 1] : SqlTypeValue.TYPE_UNKNOWN; if (argType == Types.BLOB && lobHandler != null && arg instanceof byte[]) { lobHandler.getLobCreator().setBlobAsBytes(ps, i, (byte[]) arg); } else if (argType == Types.BLOB && lobHandler != null && arg instanceof String) { lobHandler.getLobCreator().setBlobAsBytes(ps, i, arg.toString().getBytes()); } else if (argType == Types.CLOB && lobHandler != null) { lobHandler.getLobCreator().setClobAsString(ps, i, (String) arg); } else if ((argType == Types.DECIMAL || argType == Types.NUMERIC) && arg != null) { setDecimalValue(ps, i, arg, argType); } else { StatementCreatorUtils.setParameterValue(ps, i, verifyArgType(arg, argType), arg); } } }
lobHandler.getLobCreator().setBlobAsBytes(ps, i, arg.toString().getBytes()); } else if (argType == Types.CLOB && lobHandler != null) { lobHandler.getLobCreator().setClobAsString(ps, i, (String) arg); } else if (arg!=null && argType == Types.DATE && arg instanceof Date) { Date clone = (Date) (((Date) arg).clone());