/** * {@inheritDoc} */ @Override public void set(final PreparedStatement st, final int index, final Array value, final int dbSqlType) throws SQLException { st.setArray(index, value); }
@Override public void setArray(int parameterIndex, Array x) throws SQLException { rawStatement.setArray(parameterIndex, x); }
@Override public void setArray(int parameterIndex, Array x) throws SQLException { rawStatement.setArray(parameterIndex, x); }
@Override public void setArray(int parameterIndex, Array x) throws SQLException { statement.setArray(parameterIndex, x); }
/** {@inheritDoc} */ @Override public void setArray(int parameterIndex, Array x) throws SQLException { delegate.setArray(parameterIndex, x); }
public void setArray(int i, Array x) throws SQLException { pstmt.setArray(i, x); }
PreparedStatement pstmt = conn.prepareStatement("select * from employee where id in (?)"); Array array = conn.createArrayOf("VARCHAR", new Object[]{"1", "2","3"}); pstmt.setArray(1, array); ResultSet rs = pstmt.executeQuery();
final PreparedStatement statement = connection.prepareStatement( "SELECT my_column FROM my_table where search_column = ANY (?)" ); final String[] values = getValues(); statement.setArray(1, connection.createArrayOf("text", values)); final ResultSet rs = statement.executeQuery(); try { while(rs.next()) { // do some... } } finally { rs.close(); }
final PreparedStatement statement = connection.prepareStatement( "SELECT my_column FROM my_table " + "where search_column IN (SELECT * FROM unnest(?))" ); final String[] values = getValues(); statement.setArray(1, connection.createArrayOf("text", values)); final ResultSet rs = statement.executeQuery(); try { while(rs.next()) { // do some... } } finally { rs.close(); }
@Override public void setArray(int parameterIndex, Array x) throws SQLException { setParamByIndex(parameterIndex, x); targetStatement.setArray(parameterIndex, x); }
@Override public void run() throws Exception { stmt.setArray(1, null); } });
@Override public void setArray(int parameterIndex, Array x) throws SQLException { SQLException e = null; try { delegate.setArray(parameterIndex, x); } catch (SQLException sqle) { e = sqle; throw e; } finally { eventListener.onAfterPreparedStatementSet(statementInformation, parameterIndex, x, e); } }
@Override public void setArray(int parameterIndex, Array x) throws SQLException { checkOpen(); try { stmt.setArray(parameterIndex, x); } catch (Throwable t) { throw checkException(t); } }
@Override public void preparedStatement_setArray(PreparedStatementProxy statement, int parameterIndex, Array x) throws SQLException { if (this.pos < filterSize) { nextFilter().preparedStatement_setArray(this, statement, parameterIndex, x); return; } statement.getRawObject().setArray(parameterIndex, x); }
public Map<FileHistoryId, PartialFileHistory> getFileHistories(List<FileHistoryId> fileHistoryIds) { String[] fileHistoryIdsStr = createFileHistoryIdsArray(fileHistoryIds); try (PreparedStatement preparedStatement = getStatement("filehistory.select.master.getFileHistoriesByIds.sql")) { preparedStatement.setArray(1, connection.createArrayOf("varchar", fileHistoryIdsStr)); try (ResultSet resultSet = preparedStatement.executeQuery()) { return createFileHistoriesFromResult(resultSet); } } catch (SQLException e) { throw new RuntimeException(e); } }
@Override public void apply(int position, PreparedStatement statement, StatementContext ctx) throws SQLException { SqlArrayArgumentStrategy argumentStyle = ctx.getSqlArrayArgumentStrategy(); switch (argumentStyle) { case SQL_ARRAY: java.sql.Array sqlArray = statement.getConnection().createArrayOf(typeName, array); ctx.addCleanable(sqlArray::free); statement.setArray(position, sqlArray); break; case OBJECT_ARRAY: statement.setObject(position, array); break; default: throw new UnsupportedOperationException("Unknown array argument style " + argumentStyle); } }
public Q setArray(final int index, final Array value) { initPrepared(); try { preparedStatement.setArray(index, value); } catch (SQLException sex) { throwSetParamError(index, sex); } return _this(); }
public Q setArray(final String param, final Array value) { initPrepared(); final int[] positions = query.getNamedParameterIndices(param); try { for (final int position : positions) { preparedStatement.setArray(position, value); } } catch (SQLException sex) { throwSetParamError(param, sex); } return _this(); }
@Override protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException { StringArrayTypeDescriptor arrayTypeDescriptor = (StringArrayTypeDescriptor) javaTypeDescriptor; st.setArray(index, st.getConnection().createArrayOf( arrayTypeDescriptor.getSqlArrayType(), arrayTypeDescriptor.unwrap((String[]) value, Object[].class, options) )); }
@Test public void byteArrayIsTypedAsVarbinary() throws SQLException { Argument nullByteArrayArg = db.getJdbi().withHandle(h -> h.getConfig(Arguments.class).findFor(byte[].class, new byte[] {1})).get(); nullByteArrayArg.apply(0, stmt, null); verify(stmt, never()).setArray(anyInt(), any(Array.class)); verify(stmt).setBytes(anyInt(), any(byte[].class)); }