Support for postgresql

I think it was the last request using 'end' missing the postgresql support.
This commit is contained in:
Crystark 2014-04-07 17:37:03 +02:00
parent 4d6174ebf2
commit 40a6804192
1 changed files with 8 additions and 3 deletions

View File

@ -39,13 +39,15 @@ public class DbUpdaterJob implements Jobby
private final HadoopDruidIndexerConfig config;
private final IDBI dbi;
private final DbConnector dbConnector;
public DbUpdaterJob(
HadoopDruidIndexerConfig config
)
{
this.config = config;
this.dbi = new DbConnector(config.getUpdaterJobSpec(), null).getDBI();
this.dbConnector = new DbConnector(config.getUpdaterJobSpec(), null);
this.dbi = this.dbConnector.getDBI();
}
@Override
@ -61,8 +63,11 @@ public class DbUpdaterJob implements Jobby
{
final PreparedBatch batch = handle.prepareBatch(
String.format(
"INSERT INTO %s (id, dataSource, created_date, start, end, partitioned, version, used, payload) "
+ "VALUES (:id, :dataSource, :created_date, :start, :end, :partitioned, :version, :used, :payload)",
dbConnector.isPostgreSQL() ?
"INSERT INTO %s (id, dataSource, created_date, start, \"end\", partitioned, version, used, payload) "
+ "VALUES (:id, :dataSource, :created_date, :start, :end, :partitioned, :version, :used, :payload)" :
"INSERT INTO %s (id, dataSource, created_date, start, end, partitioned, version, used, payload) "
+ "VALUES (:id, :dataSource, :created_date, :start, :end, :partitioned, :version, :used, :payload)",
config.getUpdaterJobSpec().getSegmentTable()
)
);