public class JdbcTableWriter extends Object implements TableWriter
| Constructor and Description |
|---|
JdbcTableWriter(Table table,
DataSource datasource,
String namespace) |
JdbcTableWriter(Table specTable,
DataSource dataSource,
String tablePrefix,
Connection optionalConnection) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Ensure that database connection closes.
|
void |
commit() |
String |
create(String json,
boolean autoCommit)
Create a new entity in the database from the provided JSON string.
|
int |
delete(Integer id,
boolean autoCommit)
Deletes an entity for the specified ID.
|
int |
deleteWhere(String fieldName,
String value,
boolean autoCommit)
For a given condition (fieldName = 'value'), delete all entities that match the condition.
|
int |
normalizeStopTimesForPattern(int id,
int beginWithSequence)
For a given pattern id and starting stop sequence (inclusive), normalize all stop times to match the pattern
stops' travel times.
|
String |
update(Integer id,
String json,
boolean autoCommit)
Update entity for a given ID with the provided JSON string.
|
public JdbcTableWriter(Table table, DataSource datasource, String namespace) throws InvalidNamespaceException
InvalidNamespaceExceptionpublic JdbcTableWriter(Table specTable, DataSource dataSource, String tablePrefix, Connection optionalConnection) throws InvalidNamespaceException
InvalidNamespaceExceptionpublic String create(String json, boolean autoCommit) throws SQLException, IOException
create in interface TableWriterSQLExceptionIOExceptionpublic String update(Integer id, String json, boolean autoCommit) throws SQLException, IOException
update in interface TableWriterSQLExceptionIOExceptionpublic int normalizeStopTimesForPattern(int id,
int beginWithSequence)
throws SQLException
SQLExceptionpublic int deleteWhere(String fieldName, String value, boolean autoCommit) throws SQLException
delete(Integer, boolean) method, it also will delete any "child" entities that reference any entities
matching the original query.deleteWhere in interface TableWriterSQLExceptionpublic int delete(Integer id, boolean autoCommit) throws SQLException
delete in interface TableWriterSQLExceptionpublic void commit()
throws SQLException
commit in interface TableWriterSQLExceptionpublic void close()
close in interface TableWriterCopyright © 2019. All rights reserved.