Variable column names using prepared statements

后端 未结 7 727

I was wondering if there was anyway to specify returned column names using prepared statements.

I am using MySQL and Java.

When I try it:

St         


        
7条回答
  •  孤独总比滥情好
    2020-11-22 08:53

    I think this case can't work because the whole point of the prepared statement is to prevent the user from putting in unescaped query bits - so you're always going to have the text quoted or escaped.

    You'll need to sanitize this input in Java if you want to affect the query structure safely.

提交回复
热议问题