org.apache.commons.dbutils.handlers.ArrayHandler Java Examples
The following examples show how to use
org.apache.commons.dbutils.handlers.ArrayHandler.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JDBCRecordReader.java From DataVec with Apache License 2.0 | 6 votes |
/** * @see #loadFromMetaData(RecordMetaData) */ @Override public List<Record> loadFromMetaData(List<RecordMetaData> recordMetaDatas) throws IOException { List<Record> ret = new ArrayList<>(); for (RecordMetaData rmd : recordMetaDatas) { if (!(rmd instanceof RecordMetaDataJdbc)) { throw new IllegalArgumentException( "Invalid metadata; expected RecordMetaDataJdbc instance; got: " + rmd); } QueryRunner runner = new QueryRunner(); String request = ((RecordMetaDataJdbc) rmd).getRequest(); try { Object[] item = runner .query(this.conn, request, new ArrayHandler(), ((RecordMetaDataJdbc) rmd).getParams().toArray()); ret.add(new org.datavec.api.records.impl.Record(toWritable(item), rmd)); } catch (SQLException e) { throw new IllegalArgumentException("Could not execute statement \"" + request + "\"", e); } } return ret; }
Example #2
Source File: JDBCRecordReader.java From deeplearning4j with Apache License 2.0 | 6 votes |
/** * @see #loadFromMetaData(RecordMetaData) */ @Override public List<Record> loadFromMetaData(List<RecordMetaData> recordMetaDatas) throws IOException { List<Record> ret = new ArrayList<>(); for (RecordMetaData rmd : recordMetaDatas) { if (!(rmd instanceof RecordMetaDataJdbc)) { throw new IllegalArgumentException( "Invalid metadata; expected RecordMetaDataJdbc instance; got: " + rmd); } QueryRunner runner = new QueryRunner(); String request = ((RecordMetaDataJdbc) rmd).getRequest(); try { Object[] item = runner .query(this.conn, request, new ArrayHandler(), ((RecordMetaDataJdbc) rmd).getParams().toArray()); ret.add(new org.datavec.api.records.impl.Record(toWritable(item), rmd)); } catch (SQLException e) { throw new IllegalArgumentException("Could not execute statement \"" + request + "\"", e); } } return ret; }
Example #3
Source File: DefaultDataAccessor.java From smart-framework with Apache License 2.0 | 5 votes |
@Override public Object[] queryArray(String sql, Object... params) { Object[] array; try { array = queryRunner.query(sql, new ArrayHandler(), params); } catch (SQLException e) { logger.error("查询出错!", e); throw new RuntimeException(e); } printSQL(sql); return array; }
Example #4
Source File: DefaultDataAccessor.java From smart-framework with Apache License 2.0 | 5 votes |
@Override public Object[] queryArray(String sql, Object... params) { Object[] array; try { array = queryRunner.query(sql, new ArrayHandler(), params); } catch (SQLException e) { logger.error("查询出错!", e); throw new RuntimeException(e); } printSQL(sql); return array; }