public final class CsvDataContext extends QueryPostprocessDataContext implements UpdateableDataContext
INFORMATION_SCHEMA_NAME, SYSTEM_PROPERTY_CREATE_DEFAULT_TABLE_ALIAS| Constructor and Description |
|---|
CsvDataContext(File file)
Constructs a CSV DataContext based on a file
|
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,
CsvConfiguration configuration)
Constructs a CSV DataContext based on an
InputStream |
CsvDataContext(Resource resource,
CsvConfiguration configuration) |
CsvDataContext(URL url,
CsvConfiguration configuration)
Constructs a CSV DataContext based on a
URL |
| Modifier and Type | Method and Description |
|---|---|
protected com.opencsv.CSVReader |
createCsvReader(BufferedReader reader) |
protected com.opencsv.CSVReader |
createCsvReader(int skipLines) |
protected Number |
executeCountQuery(Table table,
List<FilterItem> whereItems,
boolean functionApproximationAllowed)
Executes a simple count query, if possible.
|
UpdateSummary |
executeUpdate(UpdateScript update)
Submits an
UpdateScript for execution on the DataContext. |
CsvConfiguration |
getConfiguration()
Gets the CSV configuration used
|
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,
List<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, getSchemaByNameInternal, getSchemaNamesInternal, isMainSchemaTable, isScalarFunctionMaterialized, materializeFromItem, materializeMainSchemaTable, materializeMainSchemaTable, materializeMainSchemaTableSelect, materializeTablecompileQuery, executeQuery, executeQuery, getColumnByQualifiedLabel, getDefaultSchema, getSchemaByName, getSchemaNames, getSchemas, getTableByQualifiedLabel, isQualifiedPathDelim, onSchemaCacheRefreshed, parseQuery, query, refreshSchemasclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcompileQuery, executeQuery, executeQuery, executeQuery, getColumnByQualifiedLabel, getDefaultSchema, getSchemaByName, getSchemaNames, getSchemas, getTableByQualifiedLabel, parseQuery, query, refreshSchemaspublic CsvDataContext(File file, CsvConfiguration configuration)
file - configuration - public CsvDataContext(Resource resource, CsvConfiguration configuration)
public CsvDataContext(URL url, CsvConfiguration configuration)
URLurl - configuration - public CsvDataContext(File file)
file - public CsvDataContext(InputStream inputStream, CsvConfiguration configuration)
InputStreaminputStream - configuration - public CsvConfiguration getConfiguration()
public Resource getResource()
protected Number executeCountQuery(Table table, List<FilterItem> whereItems, boolean functionApproximationAllowed)
QueryPostprocessDataContextexecuteCountQuery in class QueryPostprocessDataContexttable - 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, List<Column> columns, int maxRows)
QueryPostprocessDataContextmaterializeMainSchemaTable in class QueryPostprocessDataContexttable - 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 com.opencsv.CSVReader createCsvReader(int skipLines)
protected com.opencsv.CSVReader createCsvReader(BufferedReader reader)
protected org.apache.metamodel.csv.CsvSchema getMainSchema()
throws MetaModelException
getMainSchema in class QueryPostprocessDataContextMetaModelExceptionprotected String getMainSchemaName()
getMainSchemaName in class QueryPostprocessDataContextprotected boolean isWritable()
public UpdateSummary executeUpdate(UpdateScript update)
UpdateableDataContextUpdateScript 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 UpdateableDataContextupdate - the update script to executeCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.