MySQLdb模块是否支持预备语句? [英] Does the MySQLdb module support prepared statements?

查看:70
本文介绍了MySQLdb模块是否支持预备语句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MySQLdb是否支持服务器端已准备好声明?我无法从其手册中找出答案.

Does MySQLdb support server-side prepared statements? I can't figure this out from its manual.

推荐答案

检查MySQLdb 软件包注释:

Check the MySQLdb Package Comments:

在MySQLdb中,通过转义字符串然后将其盲目插入到查询中来完成参数化",而不是使用MYSQL_STMT API.因此,unicode字符串必须先经过两个中间表示形式(编码字符串,转义编码字符串),然后才能被数据库接收.

"Parameterization" is done in MySQLdb by escaping strings and then blindly interpolating them into the query, instead of using the MYSQL_STMT API. As a result unicode strings have to go through two intermediate representations (encoded string, escaped encoded string) before they're received by the database.

所以答案是:不,不是.

So the answer is: No, it doesn't.

这篇关于MySQLdb模块是否支持预备语句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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