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:
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
AbstractConnection.StatementCounter
 
Field Summary
static java.lang.String HEADERS
          Name of the headers connection property.
static java.lang.String NULL_STRING
          Name of the null_string connection property.
static java.lang.String QUOTE
          Name of the quote connection property.
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, SKIP_LINES, skipLines, trim, TRIM, url
 
Fields inherited from class scriptella.spi.AbstractConnection
counter
 
Constructor Summary
CsvConnection(ConnectionParameters parameters)
           
 
Method Summary
 void close()
          Closes the connection and releases all related resources.
 void executeQuery(Resource queryContent, ParametersCallback parametersCallback, QueryCallback queryCallback)
          Executes a query specified by its content.
 void executeScript(Resource scriptContent, ParametersCallback parametersCallback)
          Executes a script specified by its content.
protected  CSVWriter getOut()
           
 
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

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

NULL_STRING

public static final java.lang.String NULL_STRING
Name of the null_string connection property. If set, specifies value of a string token to be parsed as Java null literal.

See Also:
Constant Field Values
Constructor Detail

CsvConnection

public CsvConnection(ConnectionParameters parameters)
Method Detail

executeScript

public void executeScript(Resource scriptContent,
                          ParametersCallback parametersCallback)
                   throws ProviderException
Description copied from interface: Connection
Executes a script specified by its content.

scriptContent may be used as a key for caching purposes, i.e. provider may precompile scripts and use compiled versions for subsequent executions. Please note that only inline text resources can be safely cached.

Parameters:
scriptContent - script content. Cannot be null.
parametersCallback - callback to get parameter values. Cannot be null.
Throws:
ProviderException - if script execution failed.

executeQuery

public void executeQuery(Resource queryContent,
                         ParametersCallback parametersCallback,
                         QueryCallback queryCallback)
                  throws ProviderException
Description copied from interface: Connection
Executes a query specified by its content.

Parameters:
queryContent - query content. Cannot be null.
parametersCallback - callback to get parameter values. Cannot be null.
queryCallback - callback to call for each result set element produced by this query. Cannot be null.
Throws:
ProviderException - if query execution failed.
See Also:
Connection.executeScript(scriptella.spi.Resource,scriptella.spi.ParametersCallback)

getOut

protected CSVWriter getOut()
Returns:
lazily intialized writer.

close

public void close()
           throws ProviderException
Description copied from interface: Connection
Closes the connection and releases all related resources.

Throws:
ProviderException - if a critical failure occured.


Copyright © Copyright 2006-2007 The Scriptella Project Team.