Skip to content

Commit

Permalink
0006145: Purge fails with incorrect syntax near 'd' on SQL Server
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Dec 5, 2023
1 parent 929e43e commit d18f80c
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@ public PurgeServiceSqlMap(IDatabasePlatform platform, Map<String, String> replac
" and ? and batch_id not in (select batch_id from $(data_event) where batch_id between ? " +
" and ?) " );

putSql("deleteOutgoingBatchExistsSql", "delete from $(outgoing_batch) b where status = ? and batch_id between ? and ? " +
"and not exists (select 1 from $(data_event) e where e.batch_id = b.batch_id)");
putSql("deleteOutgoingBatchExistsSql", "delete from $(outgoing_batch) where status = ? and batch_id between ? and ? " +
"and not exists (select 1 from $(data_event) e where e.batch_id = $(outgoing_batch).batch_id)");

putSql("deleteDataEventSql" ,
"delete from $(data_event) where batch_id not in (select batch_id from " +
" $(outgoing_batch) where batch_id between ? and ? and status != ?) " +
" and batch_id between ? and ? " );

putSql("deleteDataEventExistsSql", "delete from $(data_event) e where batch_id between ? and ? " +
"and not exists (select 1 from $(outgoing_batch) b where b.batch_id = e.batch_id and b.status != ?)");
putSql("deleteDataEventExistsSql", "delete from $(data_event) where batch_id between ? and ? " +
"and not exists (select 1 from $(outgoing_batch) b where b.batch_id = $(data_event).batch_id and b.status != ?)");

putSql("minDataId", "select min(data_id) from $(data)");

Expand Down Expand Up @@ -94,10 +94,10 @@ public PurgeServiceSqlMap(IDatabasePlatform platform, Map<String, String> replac
" (select batch_id from $(outgoing_batch) where " +
" status != ?)) " );

putSql("deleteDataExistsSql", "delete from $(data) d where data_id between ? and ? " +
"and exists (select 1 from $(data_event) e where e.data_id = d.data_id) " +
putSql("deleteDataExistsSql", "delete from $(data) where data_id between ? and ? " +
"and exists (select 1 from $(data_event) e where e.data_id = $(data).data_id) " +
"and not exists (select 1 from $(outgoing_batch) b inner join $(data_event) e on e.batch_id = b.batch_id " +
"where e.data_id = d.data_id and b.status != ?)");
"where e.data_id = $(data).data_id and b.status != ?)");

putSql("selectIncomingBatchRangeSql" ,
"select node_id, min(batch_id) as min_id, max(batch_id) as max_id from $(incoming_batch) where " +
Expand Down

0 comments on commit d18f80c

Please sign in to comment.