public class CsvConnection extends AbstractTextConnection
For configuration details and examples see overview page.
AbstractConnection.StatementCounter| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ESCAPE
Name of the
escape connection property. |
static java.lang.String |
HEADERS
Name of the
headers connection property. |
protected static java.util.logging.Logger |
LOG |
static java.lang.String |
QUOTE
Name of the
quote connection property. |
static java.lang.String |
QUOTEALL
Name of the
quoteall connection property. |
static java.lang.String |
SEPARATOR
Name of the
separator connection property. |
ENCODING, EOL, FLUSH, FORMAT_PREFIX, NULL_STRING, SKIP_LINES, TRIMcounter| Constructor and Description |
|---|
CsvConnection(ConnectionParameters parameters) |
| Modifier and Type | Method and Description |
|---|---|
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 CsvConnectionParameters |
getConnectionParameters() |
protected CSVWriter |
getOut() |
protected CsvQuery |
newCsvQuery(CSVReader csvReader,
PropertiesSubstitutor ps)
Template factory method to instantiate query handlers.
|
newInputReader, newOutputWritercommit, getDialectIdentifier, getExecutedStatementsCount, isReadonly, rollback, setDialectIdentifier, toStringprotected static final java.util.logging.Logger LOG
public static final java.lang.String SEPARATOR
separator connection property.
The delimiter to use for separating entries when reading from or writing to files.public static final java.lang.String QUOTE
quote connection property.
The character to use for quoted elements when reading from or writing to files. Use empty string to suppress
quoting.public static final java.lang.String ESCAPE
escape connection property.
The character to use for escaped elements when writing to files. Use empty string to suppress
escaping.public static final java.lang.String HEADERS
headers connection property.
true means the first line contains headers. Default value is true.
Only valid for <query> elements.
public static final java.lang.String QUOTEALL
quoteall connection property.
false means only elements with the quote or escape character are quoted.
Default value is true.public CsvConnection(ConnectionParameters parameters)
public void executeScript(Resource scriptContent, ParametersCallback parametersCallback) throws ProviderException
ConnectionscriptContent 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.
scriptContent - script content. Cannot be null.parametersCallback - callback to get parameter values. Cannot be null.ProviderException - if script execution failed.public void executeQuery(Resource queryContent, ParametersCallback parametersCallback, QueryCallback queryCallback) throws ProviderException
ConnectionqueryContent - 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.ProviderException - if query execution failed.Connection.executeScript(scriptella.spi.Resource,scriptella.spi.ParametersCallback)protected CSVWriter getOut()
protected CsvQuery newCsvQuery(CSVReader csvReader, PropertiesSubstitutor ps)
csvReader - CSV reader to use for parsing.ps - properties substitutor.public void close()
throws ProviderException
ConnectionProviderException - if a critical failure occured.protected CsvConnectionParameters getConnectionParameters()
getConnectionParameters in class AbstractTextConnectionCopyright © Copyright 2006-2019 The Scriptella Project Team.