public class CsvQuery extends Object implements ParametersCallback
| Constructor and Description |
|---|
CsvQuery(CSVReader queryReader,
PropertiesSubstitutor substitutor,
CsvConnectionParameters csvParams)
Creates a query for CSVReader.
|
| Modifier and Type | Method and Description |
|---|---|
void |
execute(CSVReader reader,
QueryCallback queryCallback,
AbstractConnection.StatementCounter counter)
Executes a query over a specified text content.
|
protected ColumnsMap |
getColumnsMap() |
protected Object |
getCurrentRowValueAt(int columnIndex,
String columnName)
Returns the value of a specified column.
|
Object |
getParameter(String name) |
protected ColumnsMap |
parseHeader(CSVReader reader) |
protected void |
processRow(QueryCallback queryCallback,
String[] r)
Processes the current row.
|
protected boolean |
rowMatches(String[] r)
Checks if current CSV row matches any of the specified patterns.
|
protected static final Logger LOG
public CsvQuery(CSVReader queryReader, PropertiesSubstitutor substitutor, CsvConnectionParameters csvParams)
queryReader - query CSVReader.substitutor - properties substitutor to use. The parameters for the substitutor must be set by a caller.csvParams - parsed parameters of the CSV connectionpublic void execute(CSVReader reader, QueryCallback queryCallback, AbstractConnection.StatementCounter counter) throws IOException
reader - CSV content reader.queryCallback - callback to use for result set iteration.counter - statements counter.IOException - if IO error occurs.protected ColumnsMap parseHeader(CSVReader reader) throws IOException
IOExceptionprotected boolean rowMatches(String[] r)
r - row to checkprotected void processRow(QueryCallback queryCallback, String[] r)
This template method may be used for customizations by sublasses.
queryCallback - query callback to use.r - row to pass as current parameters callback.public Object getParameter(String name)
getParameter in interface ParametersCallbackprotected Object getCurrentRowValueAt(int columnIndex, String columnName)
This method may be overriden to perform conversion etc
2 parameters are passed for performance reasons, so that subclasses may decide wich one to use.
columnIndex - column indexcolumnName - column name.protected ColumnsMap getColumnsMap()
Copyright © 2006–2019. All rights reserved.