public class CsvQuery extends java.lang.Object implements ParametersCallback
Modifier and Type | Field and Description |
---|---|
protected static java.util.logging.Logger |
LOG |
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 java.lang.Object |
getCurrentRowValueAt(int columnIndex,
java.lang.String columnName)
Returns the value of a specified column.
|
java.lang.Object |
getParameter(java.lang.String name)
Returns the value of parameter specified by name.
|
protected ColumnsMap |
parseHeader(CSVReader reader) |
protected void |
processRow(QueryCallback queryCallback,
java.lang.String[] r)
Processes the current row.
|
protected boolean |
rowMatches(java.lang.String[] r)
Checks if current CSV row matches any of the specified patterns.
|
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 java.io.IOException
reader
- CSV content reader.queryCallback
- callback to use for result set iteration.counter
- statements counter.java.io.IOException
- if IO error occurs.protected ColumnsMap parseHeader(CSVReader reader) throws java.io.IOException
java.io.IOException
protected boolean rowMatches(java.lang.String[] r)
r
- row to checkprotected void processRow(QueryCallback queryCallback, java.lang.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 java.lang.Object getParameter(java.lang.String name)
ParametersCallback
The callback internally delegates a call to parent callbacks if the parameter cannot be found.
getParameter
in interface ParametersCallback
name
- parameter name. Providers are allowed (but not required) to ignore a case of the name parameter
to comply with their internal model. For example JDBC drivers are case-insensitive to column names.protected java.lang.Object getCurrentRowValueAt(int columnIndex, java.lang.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 © Copyright 2006-2019 The Scriptella Project Team.