Skip to content

Commit

Permalink
Fix sql maps to avoid using hard coded prefixes to tables.
Browse files Browse the repository at this point in the history
  • Loading branch information
klementinastojanovska committed Nov 28, 2017
1 parent 63f91f5 commit 5f3dab1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public OutgoingBatchServiceSqlMap(IDatabasePlatform platform,
"update $(outgoing_batch) set ignore_count=1, status='OK', error_flag=0, last_update_time=current_timestamp where load_id=?");

putSql("cancelChannelBatchesSelectSql",
"select node_id, batch_id from sym_outgoing_batch where channel_id = ? and status <> ?");
"select node_id, batch_id from $(outgoing_batch) where channel_id = ? and status <> ?");

putSql("cancelChannelBatchesSelectTableSql", " and summary=?");

Expand Down Expand Up @@ -108,7 +108,7 @@ public OutgoingBatchServiceSqlMap(IDatabasePlatform platform,
"select count(*) from $(outgoing_batch) where error_flag=1 and channel_id=?");

putSql("countOutgoingBatchesByChannelSql",
"select count(*) as batch_count, channel_id from sym_outgoing_batch where node_id = ? and channel_id <> 'heartbeat' and status in ('ER','RQ','NE','QY','RT') group by channel_id order by batch_count desc, channel_id");
"select count(*) as batch_count, channel_id from $(outgoing_batch) where node_id = ? and channel_id <> 'heartbeat' and status in ('ER','RQ','NE','QY','RT') group by channel_id order by batch_count desc, channel_id");

putSql("countOutgoingBatchesErrorsSql",
"select count(*) from $(outgoing_batch) where error_flag=1");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ public PurgeServiceSqlMap(IDatabasePlatform platform, Map<String, String> replac

putSql("purgeNodeHostJobStatsSql", "delete from $(node_host_job_stats) where start_time < ?");

putSql("selectIncomingErrorsBatchIdsSql", "select distinct e.batch_id as batch_id from sym_incoming_error e LEFT OUTER JOIN sym_incoming_batch i ON e.batch_id = i.batch_id where i.batch_id IS NULL");
putSql("selectIncomingErrorsBatchIdsSql", "select distinct e.batch_id as batch_id from $(incoming_error) e LEFT OUTER JOIN $(incoming_batch) i ON e.batch_id = i.batch_id where i.batch_id IS NULL");

putSql("deleteIncomingErrorsBatchIdsSql", "delete from sym_incoming_error where batch_id IN (?)");
putSql("deleteIncomingErrorsBatchIdsSql", "delete from $(incoming_error) where batch_id IN (?)");

putSql("deleteOutgoingBatchByCreateTimeSql", "delete from sym_outgoing_batch where create_time < ?");
putSql("deleteDataEventByCreateTimeSql", "delete from sym_data_event where create_time < ?");
putSql("deleteDataByCreateTimeSql", "delete from sym_data where create_time < ?");
putSql("deleteExtractRequestByCreateTimeSql", "delete from sym_extract_request where create_time < ?");
putSql("deleteOutgoingBatchByCreateTimeSql", "delete from $(outgoing_batch) where create_time < ?");
putSql("deleteDataEventByCreateTimeSql", "delete from $(data_event) where create_time < ?");
putSql("deleteDataByCreateTimeSql", "delete from $(data) where create_time < ?");
putSql("deleteExtractRequestByCreateTimeSql", "delete from $(extract_request) where create_time < ?");

putSql("selectStrandedDataEventRangeSql" ,
"select min(data_id) as min_id, max(data_id) as max_id from $(data_event) " +
Expand Down

0 comments on commit 5f3dab1

Please sign in to comment.