scriptella.driver.csv
Class CsvConnection

java.lang.Object
  extended by scriptella.spi.AbstractConnection
      extended by scriptella.driver.text.AbstractTextConnection
          extended by scriptella.driver.csv.CsvConnection
All Implemented Interfaces:
scriptella.spi.Connection

public class CsvConnection
extends AbstractTextConnection

Represents a connection to CSV file.

For configuration details and examples see overview page.

Version:
1.0
Author:
Fyodor Kupolov

Nested Class Summary
 
Nested classes/interfaces inherited from class scriptella.spi.AbstractConnection
scriptella.spi.AbstractConnection.StatementCounter
 
Field Summary
protected  boolean headers
           
static java.lang.String HEADERS
          Name of the headers connection property.
protected static java.util.logging.Logger LOG
           
protected  char quote
           
static java.lang.String QUOTE
          Name of the quote connection property.
protected  char separator
           
static java.lang.String SEPARATOR
          Name of the separator connection property.
 
Fields inherited from class scriptella.driver.text.AbstractTextConnection
encoding, ENCODING, eol, EOL, flush, FLUSH, NULL_STRING, nullString, SKIP_LINES, skipLines, trim, TRIM, url
 
Fields inherited from class scriptella.spi.AbstractConnection
counter
 
Constructor Summary
CsvConnection(scriptella.spi.ConnectionParameters parameters)
           
 
Method Summary
 void close()
           
 void executeQuery(scriptella.spi.Resource queryContent, scriptella.spi.ParametersCallback parametersCallback, scriptella.spi.QueryCallback queryCallback)
           
 void executeScript(scriptella.spi.Resource scriptContent, scriptella.spi.ParametersCallback parametersCallback)
           
protected  CSVWriter getOut()
           
protected  CsvQuery newCsvQuery(CSVReader csvReader, scriptella.expression.PropertiesSubstitutor ps)
          Template factory method to instantiate query handlers.
 
Methods inherited from class scriptella.driver.text.AbstractTextConnection
getEncoding, getEol, getUrl, isTrim, newInputReader, newOutputWriter
 
Methods inherited from class scriptella.spi.AbstractConnection
commit, getDialectIdentifier, getExecutedStatementsCount, isReadonly, rollback, setDialectIdentifier, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG

protected static final java.util.logging.Logger LOG

SEPARATOR

public static final java.lang.String SEPARATOR
Name of the separator connection property. The delimiter to use for separating entries when reading from or writing to files.

See Also:
Constant Field Values

QUOTE

public static final java.lang.String QUOTE
Name of the quote connection property. The character to use for quoted elements when reading from or writing to files. Use empty string to suppress quoting.

See Also:
Constant Field Values

HEADERS

public static final java.lang.String HEADERS
Name of the headers connection property. true means the first line contains headers. Default value is true.

Only valid for <query> elements.

See Also:
Constant Field Values

separator

protected final char separator

quote

protected final char quote

headers

protected final boolean headers
Constructor Detail

CsvConnection

public CsvConnection(scriptella.spi.ConnectionParameters parameters)
Method Detail

executeScript

public void executeScript(scriptella.spi.Resource scriptContent,
                          scriptella.spi.ParametersCallback parametersCallback)
                   throws scriptella.spi.ProviderException
Throws:
scriptella.spi.ProviderException

executeQuery

public void executeQuery(scriptella.spi.Resource queryContent,
                         scriptella.spi.ParametersCallback parametersCallback,
                         scriptella.spi.QueryCallback queryCallback)
                  throws scriptella.spi.ProviderException
Throws:
scriptella.spi.ProviderException

getOut

protected CSVWriter getOut()
Returns:
lazily intialized writer.

newCsvQuery

protected CsvQuery newCsvQuery(CSVReader csvReader,
                               scriptella.expression.PropertiesSubstitutor ps)
Template factory method to instantiate query handlers.

Parameters:
csvReader - CSV reader to use for parsing.
ps - properties substitutor.
Returns:
constructed query for a specified input and parameters.

close

public void close()
           throws scriptella.spi.ProviderException
Throws:
scriptella.spi.ProviderException


Copyright © Copyright 2006-2009 The Scriptella Project Team.