public final class CsvDataContext extends QueryPostprocessDataContext implements UpdateableDataContext
INFORMATION_SCHEMA_NAME
Constructor and Description |
---|
CsvDataContext(File file)
Constructs a CSV DataContext based on a file
|
CsvDataContext(File file,
char separatorChar)
Deprecated.
use
CsvDataContext(File, CsvConfiguration) instead. |
CsvDataContext(File file,
char separatorChar,
char quoteChar)
Deprecated.
use
CsvDataContext(File, CsvConfiguration) instead. |
CsvDataContext(File file,
char separatorChar,
char quoteChar,
String encoding)
Deprecated.
use
CsvDataContext(File, CsvConfiguration) instead. |
CsvDataContext(File file,
CsvConfiguration configuration)
Constructs a CSV DataContext based on a file
The file provided can be either existing or non-existing.
|
CsvDataContext(InputStream inputStream,
char separatorChar,
char quoteChar)
Deprecated.
use
CsvDataContext(InputStream, CsvConfiguration)
instead. |
CsvDataContext(InputStream inputStream,
char separatorChar,
char quoteChar,
String encoding)
Deprecated.
use
CsvDataContext(InputStream, CsvConfiguration)
instead. |
CsvDataContext(InputStream inputStream,
CsvConfiguration configuration)
Constructs a CSV DataContext based on an
InputStream |
CsvDataContext(Resource resource,
CsvConfiguration configuration) |
CsvDataContext(URL url,
char separatorChar,
char quoteChar)
Deprecated.
use
CsvDataContext(URL, CsvConfiguration) instead. |
CsvDataContext(URL url,
char separatorChar,
char quoteChar,
String encoding)
Deprecated.
use
CsvDataContext(URL, CsvConfiguration) instead. |
CsvDataContext(URL url,
CsvConfiguration configuration)
Constructs a CSV DataContext based on a
URL |
Modifier and Type | Method and Description |
---|---|
protected au.com.bytecode.opencsv.CSVReader |
createCsvReader(BufferedReader reader) |
protected au.com.bytecode.opencsv.CSVReader |
createCsvReader(int skipLines) |
protected Number |
executeCountQuery(Table table,
List<FilterItem> whereItems,
boolean functionApproximationAllowed)
Executes a simple count query, if possible.
|
void |
executeUpdate(UpdateScript update)
Submits an
UpdateScript for execution on the DataContext . |
CsvConfiguration |
getConfiguration()
Gets the CSV configuration used
|
File |
getFile()
Deprecated.
use
getResource() instead. |
protected org.apache.metamodel.csv.CsvSchema |
getMainSchema() |
protected String |
getMainSchemaName() |
Resource |
getResource()
Gets the resource that is being read from.
|
protected boolean |
isWritable() |
DataSet |
materializeMainSchemaTable(Table table,
Column[] columns,
int maxRows)
Executes a simple one-table query against a table in the main schema of
the subclasses of this class.
|
addConverter, executePrimaryKeyLookupQuery, executeQuery, getDefaultSchemaName, getMainSchemaInternal, getSchemaByNameInternal, getSchemaNamesInternal, isMainSchemaTable, materializeFromItem, materializeMainSchemaTable, materializeMainSchemaTable, materializeTable
compileQuery, executeQuery, executeQuery, getColumnByQualifiedLabel, getDefaultSchema, getSchemaByName, getSchemaNames, getSchemas, getTableByQualifiedLabel, isQualifiedPathDelim, parseQuery, query, refreshSchemas
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
compileQuery, executeQuery, executeQuery, executeQuery, getColumnByQualifiedLabel, getDefaultSchema, getSchemaByName, getSchemaNames, getSchemas, getTableByQualifiedLabel, parseQuery, query, refreshSchemas
public CsvDataContext(File file, CsvConfiguration configuration)
file
- configuration
- public CsvDataContext(Resource resource, CsvConfiguration configuration)
public CsvDataContext(URL url, CsvConfiguration configuration)
URL
url
- configuration
- public CsvDataContext(File file)
file
- public CsvDataContext(InputStream inputStream, CsvConfiguration configuration)
InputStream
inputStream
- configuration
- @Deprecated public CsvDataContext(File file, char separatorChar)
CsvDataContext(File, CsvConfiguration)
instead.@Deprecated public CsvDataContext(File file, char separatorChar, char quoteChar)
CsvDataContext(File, CsvConfiguration)
instead.@Deprecated public CsvDataContext(File file, char separatorChar, char quoteChar, String encoding)
CsvDataContext(File, CsvConfiguration)
instead.@Deprecated public CsvDataContext(URL url, char separatorChar, char quoteChar)
CsvDataContext(URL, CsvConfiguration)
instead.@Deprecated public CsvDataContext(URL url, char separatorChar, char quoteChar, String encoding)
CsvDataContext(URL, CsvConfiguration)
instead.@Deprecated public CsvDataContext(InputStream inputStream, char separatorChar, char quoteChar)
CsvDataContext(InputStream, CsvConfiguration)
instead.@Deprecated public CsvDataContext(InputStream inputStream, char separatorChar, char quoteChar, String encoding)
CsvDataContext(InputStream, CsvConfiguration)
instead.public CsvConfiguration getConfiguration()
@Deprecated public File getFile()
getResource()
instead.public Resource getResource()
protected Number executeCountQuery(Table table, List<FilterItem> whereItems, boolean functionApproximationAllowed)
QueryPostprocessDataContext
executeCountQuery
in class QueryPostprocessDataContext
table
- the table on which the count is requested.whereItems
- a (sometimes empty) list of WHERE items.functionApproximationAllowed
- whether approximation is allowed or not.public DataSet materializeMainSchemaTable(Table table, Column[] columns, int maxRows)
QueryPostprocessDataContext
materializeMainSchemaTable
in class QueryPostprocessDataContext
table
- the table to querycolumns
- the columns of the table to querymaxRows
- the maximum amount of rows needed or -1 if all rows are
wanted.protected au.com.bytecode.opencsv.CSVReader createCsvReader(int skipLines)
protected au.com.bytecode.opencsv.CSVReader createCsvReader(BufferedReader reader)
protected org.apache.metamodel.csv.CsvSchema getMainSchema() throws MetaModelException
getMainSchema
in class QueryPostprocessDataContext
MetaModelException
protected String getMainSchemaName()
getMainSchemaName
in class QueryPostprocessDataContext
protected boolean isWritable()
public void executeUpdate(UpdateScript update)
UpdateableDataContext
UpdateScript
for execution on the DataContext
.
Since implementations of the DataContext
vary quite a lot, there
is no golden rule as to how an update script will be executed. But the
implementors should strive towards handling an UpdateScript
as a
single transactional change to the data store.executeUpdate
in interface UpdateableDataContext
update
- the update script to executeCopyright © 2007–2014 The Apache Software Foundation. All rights reserved.