在数据库查询字符串中转义引号的好方法? [英] A good way to escape quotes in a database query string?

查看:144
本文介绍了在数据库查询字符串中转义引号的好方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试过各种各样的Python模块,他们或者逃避太多或错误的方式。
你在Python中找到什么最好的方法来解决引号(,)?

I've tried all manner of Python modules and they either escape too much or in the wrong way. What's the best way you've found to escape quotes (", ') in Python?

推荐答案

数据库查询的一部分,您应该可以使用参数化SQL声明

If it's part of a Database query you should be able to use a Parameterized SQL Statement.

除了转义您的引号,这将处理所有特殊字符,并将保护您免受 SQL注入攻击

As well as escaping your quotes, this will deal with all special characters and will protect you from SQL injection attacks.

这篇关于在数据库查询字符串中转义引号的好方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆