使用mysqlclient执行存储过程报错2014 Commands out of sync; you can't run this command now

Posted 守望人间

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用mysqlclient执行存储过程报错2014 Commands out of sync; you can't run this command now相关的知识,希望对你有一定的参考价值。

在连续执行存储过程,并且存储过程有返回查询结果时,报错2014 Commands out of sync; you can‘t run this command now;

参考https://blog.csdn.net/ice4026/article/details/37592715

需要使用cursor.nextset(),或者断开connect;

mysqlclient中的cursor.callproc方法中有一段注释:

Compatibility warning: The act of calling a stored procedure
itself creates an empty result set. This appears after any
result sets generated by the procedure. This is non-standard
behavior with respect to the DB-API. Be sure to use nextset()
to advance through all result sets; otherwise you may get
disconnected.

 

以上是关于使用mysqlclient执行存储过程报错2014 Commands out of sync; you can't run this command now的主要内容,如果未能解决你的问题,请参考以下文章

Windows下安装模块mysqlclient报错处理

Django启动报错Did you install mysqlclient or MySQL-python

Linux 上安装 mysqlclient,报错解决方案

pip 安装mysqlclient报错OSError: mysql_config not found

pip install mysqlclient报错(OSError: mysql_config not found)

ORACLE的存储过程执行报错