scriptella.driver.csv
Class CsvQuery

java.lang.Object
  extended by scriptella.driver.csv.CsvQuery
All Implemented Interfaces:
ParametersCallback

public class CsvQuery
extends java.lang.Object
implements ParametersCallback

Query for CSV file.

Version:
1.0
Author:
Fyodor Kupolov

Constructor Summary
CsvQuery(CSVReader queryReader, PropertiesSubstitutor substitutor, java.lang.String nullString, boolean headers, boolean trim)
          Creates a query for CSVReader.
 
Method Summary
 void execute(CSVReader reader, QueryCallback queryCallback, AbstractConnection.StatementCounter counter)
          Executes a query over a specified text content.
 java.lang.Object getParameter(java.lang.String name)
          Returns the value of parameter specified by name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CsvQuery

public CsvQuery(CSVReader queryReader,
                PropertiesSubstitutor substitutor,
                java.lang.String nullString,
                boolean headers,
                boolean trim)
Creates a query for CSVReader.

Parameters:
queryReader - query CSVReader.
substitutor - properties substitutor to use. The parameters for the substitutor must be set by a caller.
headers - true if first line of input CSV file contains headers.
trim - true if if extra whitespaces should be trimmed.
nullString - string to treat as NULL.
Method Detail

execute

public void execute(CSVReader reader,
                    QueryCallback queryCallback,
                    AbstractConnection.StatementCounter counter)
             throws java.io.IOException
Executes a query over a specified text content.

Parameters:
reader - CSV content reader.
queryCallback - callback to use for result set iteration.
counter - statements counter.
Throws:
java.io.IOException - if IO error occurs.

getParameter

public java.lang.Object getParameter(java.lang.String name)
Description copied from interface: ParametersCallback
Returns the value of parameter specified by name.

The callback internally delegates a call to parent callbacks if the parameter cannot be found.

Specified by:
getParameter in interface ParametersCallback
Parameters:
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.
Returns:
parameter value or null if parameter doesn't exist.


Copyright © Copyright 2006-2007 The Scriptella Project Team.