有一个需求,直接在java层面分析sql,防止查询语句的where条件恒真,导致查了整张表的数据。想了一天不知道怎么搞
select * from table where 1=1;
select * from table where 1=1 and "a" ="a";
select * from table where 1=1 and column_1 = ? or 2=2;
这上面这三种都要直接拦截住不能执行。

select * from table where 1=1;
select * from table where 1=1 and "a" ="a";
select * from table where 1=1 and column_1 = ? or 2=2;
这上面这三种都要直接拦截住不能执行。