查询内部变量会在代码分析中引发错误
Query with variable inside throws an error in Code Analysis
变量$extra_query
破坏了代码分析功能的逻辑并抛出错误:
SELECT *, so.`Location` as so_loc
FROM vw_dispatch
left join sales_orders so on vw_dispatch.customerOrderNo = so.External_Document_No
left join customer_data cd on so.Customer_ID = cd.no
where 1 = 1
and archived = 0
and processed = 0 $extra_query
order by vw_dispatch_id desc
limit 0,200
像这样的错误情况我应该停止检查吗?
我应该使用不同的方式来注入该变量吗?
@Akina 的回答是最接近解决这个问题的。
Try to move 1st logical operator from the variable to the query
pattern, like ... and processed = 0 AND ($extra_query) .... The
variable itself will contain 1=1 @additional_conditions.
akina_solution
变量$extra_query
破坏了代码分析功能的逻辑并抛出错误:
SELECT *, so.`Location` as so_loc
FROM vw_dispatch
left join sales_orders so on vw_dispatch.customerOrderNo = so.External_Document_No
left join customer_data cd on so.Customer_ID = cd.no
where 1 = 1
and archived = 0
and processed = 0 $extra_query
order by vw_dispatch_id desc
limit 0,200
像这样的错误情况我应该停止检查吗? 我应该使用不同的方式来注入该变量吗?
@Akina 的回答是最接近解决这个问题的。
Try to move 1st logical operator from the variable to the query pattern, like ... and processed = 0 AND ($extra_query) .... The variable itself will contain 1=1 @additional_conditions.
akina_solution