public class H2DatabaseDriver extends Object implements DatabaseDriver
Modifier and Type | Class and Description |
---|---|
static class |
H2DatabaseDriver.Type |
Constructor and Description |
---|
H2DatabaseDriver(H2DatabaseDriver.Type dbType,
String path,
boolean clearDB)
Constructor for the H2 database driver.
|
Modifier and Type | Method and Description |
---|---|
void |
bulkCopy(String path,
String delimiter,
boolean hasTruth,
PredicateInfo predicateInfo,
Partition partition)
Perform a bulk copy operation to load the file directly into the database.
|
void |
close()
Close out any outstanding connections and cleanup.
|
String |
finalizeCreateTable(com.healthmarketscience.sqlbuilder.CreateTableQuery createTable)
Gives the driver a chance to perform any final
manipulations to the CREATE TABLE statement.
|
Connection |
getConnection()
Returns a connection to the database.
|
String |
getDoubleTypeName()
Get the type name for a double type.
|
String |
getStringAggregate(String columnName,
String delimiter,
boolean distinct)
Get a string aggregating expression (one that
would appear in the SELECT clause of a grouping query.
|
String |
getSurrogateKeyColumnDefinition(String columnName)
Get the SQL definition for a primary, surrogate (auto-increment) key
for use in a CREATE TABLE statement.
|
String |
getTypeName(ConstantType type)
Get the type name for each argument type.
|
String |
getUpsert(String tableName,
String[] columns,
String[] keyColumns)
Get the SQL for an upsert (merge) on the specified table and columns.
|
boolean |
supportsBulkCopy()
Returns whether the underline database supports bulk copying operations.
|
public H2DatabaseDriver(H2DatabaseDriver.Type dbType, String path, boolean clearDB)
dbType
- Type of database, either Disk or Memory.path
- Path to database on disk, or name if type is Memory.clearDB
- Whether to perform a DROP ALL on the database after connecting.public void close()
DatabaseDriver
close
in interface DatabaseDriver
public Connection getConnection()
DatabaseDriver
getConnection
in interface DatabaseDriver
public boolean supportsBulkCopy()
DatabaseDriver
supportsBulkCopy
in interface DatabaseDriver
public void bulkCopy(String path, String delimiter, boolean hasTruth, PredicateInfo predicateInfo, Partition partition)
DatabaseDriver
bulkCopy
in interface DatabaseDriver
public String getTypeName(ConstantType type)
DatabaseDriver
getTypeName
in interface DatabaseDriver
public String getSurrogateKeyColumnDefinition(String columnName)
DatabaseDriver
getSurrogateKeyColumnDefinition
in interface DatabaseDriver
public String getDoubleTypeName()
DatabaseDriver
getDoubleTypeName
in interface DatabaseDriver
public String getUpsert(String tableName, String[] columns, String[] keyColumns)
DatabaseDriver
getUpsert
in interface DatabaseDriver
public String finalizeCreateTable(com.healthmarketscience.sqlbuilder.CreateTableQuery createTable)
DatabaseDriver
finalizeCreateTable
in interface DatabaseDriver
public String getStringAggregate(String columnName, String delimiter, boolean distinct)
DatabaseDriver
getStringAggregate
in interface DatabaseDriver
Copyright © 2018 University of California, Santa Cruz. All rights reserved.