How to print a parametrized SQL query?

非 Y 不嫁゛ 提交于 2019-12-11 06:55:55

问题


How can I get a String with a parametrized SQL query, once parameters inserted ?


回答1:


I think you're assuming that the parameter values will be injected into the SQL and that what ends up being sent to the server is a single string. There's no reason why that needs to be the case - although it could be in some cases.

Generally it would make more sense to send the parameters to the database alongside the SQL but distinct from it. That way there's less work for the SQL engine to do (e.g. parsing numeric values which have been convered into strings), less work for the client to do, less risk of SQL injection attacks due to a failure to escape everything perfectly.



来源:https://stackoverflow.com/questions/31817776/how-to-print-a-parametrized-sql-query

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!