https://blueprints.launchpad.net/myconnpy/+spec/sp-multi-resultsets

Calling a stored procedure can produce multiple result sets. They should be retrieved and made available to the application.
MySQLdb is using the Cursor nextset()-method to go through multiple result sets. If the stored procedure returns a multiple results, it will require you to get all sets. For example, using MySQLdb, you'll have to do the following when procedure 'multi' returns 2 sets:

# using MySQLdb
 cur.callproc("multi", (5, 6, 0))
 cur.nextset()
 cur.nextset()
 cur.execute("SELECT @_multi_0,@_multi_1,@_multi_2")
 row = cur.fetchone() # == (5L, 6L, 30L)

In Connector/Python we might do it a bit easier, buffering the multiple sets returned and using the fetch-methods to get the results:

# using MySQL Connector/Python
 cur.callproc("multi", (5,6,0))
 row = cur.fetchone() == ('5', '6', 30)

If the application needs the other results, it can get them using next_proc_resultset() this method returns a MySQLCursorBuffered object which holds the result:

# using MySQL Connector/Python
 result = cur.callproc("multi", (5,6,0))
 cursor_set1 = cur.next_proc_resultset()
        rows = cur.fetchall()

Support for multiple result sets的更多相关文章

  1. [转]Entity Framework Sprocs with Multiple Result Sets

    本文转自:https://msdn.microsoft.com/en-us/data/jj691402.aspx Entity Framework Sprocs with Multiple Resul ...

  2. Stored Procedures with Multiple Result Sets

    Stored Procedures with Multiple Result Sets https://msdn.microsoft.com/en-us/data/jj691402.aspx

  3. java.sql.SQLException: Streaming result set com.mysql.jdbc.RowDataDynamic@27ce24aa is still active. No statements may be issued when any streaming result sets are open and in use on a given connection

    在Sqoop往mysql导出数据的时候报了这个错误,一开始还以为是jar包没有打进去或者打错位置了,未解便上网查询. Error reading from database: java.sql.SQL ...

  4. SQL Server ->> WITH RESULT SETS子句

    SQL Server 2012对EXECUTE子句引入了WITH RESULT SETS选项,用于对EXECUTE语句执行的存储过程或者动态语句结果进行一个指定数据类型的转换,这样可以避免一种情况就是 ...

  5. [转]SSIS Execute SQL Task : Mapping Parameters And Result Sets

    本文转自:http://www.programmersedge.com/post/2013/03/05/ssis-execute-sql-task-mapping-parameters-and-res ...

  6. MVC5添加控制器总是报“Multiple object sets per type are not supported”

    http://www.asp.net/mvc/tutorials/mvc-5/introduction/creating-a-connection-string 按照上面的指导做练习,  总报小面的错 ...

  7. Programming Entity Framework 翻译(1)-目录

    1. Introducing the ADO.NET Entity Framework ado.net entity framework 介绍 1 The Entity Relationship Mo ...

  8. 可输出sql的PrepareStatement封装

    import java.io.InputStream; import java.io.Reader; import java.net.URL; import java.sql.Connection; ...

  9. 数据访问的历史 Windows

    节选:Programming Microsoft Visual Basic 6.0 1999 The Data Access Saga All the new database-related cap ...

随机推荐

  1. 我的c程序

    想写一个不同机器通信获取状态的c程序.遇到无数困难.断断续续了3.4周了,得到的结果仍然无法面世. 我想还是把其中遇到的所有困难写下来吧! 下面是结果 #include <stdlib.h> ...

  2. javascript无缝滚动示例

    效果 图片大小均为200*200; 默认向左循环滚动; 鼠标悬浮暂停,鼠标移走继续滚动; 可以在此基础进行扩展. 下面是代码: <!doctype html> <html lang= ...

  3. Fiddler (六) 最常用的快捷键

    使用QuickExec Fiddler2成了网页调试必备的工具,抓包看数据.Fiddler2自带命令行控制,并提供以下用法. Fiddler的快捷命令框让你快速的输入脚本命令. 键盘快捷键 按ALT+ ...

  4. Struts2学习笔记 - HelloWorld总结

    相信网上已经有很多关于struts2的HelloWorld可参考,我这里就不重复了,没个学struts2的人都会做过很多个HelloWorld,而我这里就总结一下一个简单的HelloWorld 我在一 ...

  5. ssh(sturts2_spring_hibernate) 框架搭建之JPA代替hibernate

    一.JPA用来替代hibernate ⒈JPA的全称是JAVA Persistence API.指的是JPA通过注解或者是XML描述对象—关系表的映射关系,并且将运行的实体对象持久化数据库中. ⒉JP ...

  6. 【WP 8.1开发】自定义(RAW)通知的使用

    继续前面的话题,还是推送通知.上一篇文章中遗留了RAW通知的推送没有给各位演示,特特地留到现在,不为别的,只为这个RAW通知有点意思,玩起来会比较有意思.官方文档将RAW通知译为“原始通知”,这里还是 ...

  7. 【WP 8.1开发】推送通知测试服务端程序

    所谓推送通知,用老爷爷都能听懂的话说,就是: 1.我的服务器将通知内容发送到微软的通知服务器,再由通知服务器帮我转发消息. 2.那么,微软的推送服务器是如何知道我的服务器要发消息给哪台手机呢?手机客户 ...

  8. GridView里做页面的链接

    采用Gridview的OnRowDataBound属性 后台 protected void gvTranslateInfo_RowDataBound(object sender, GridViewRo ...

  9. 实现List按与一个字符串的相似度和字母顺序排序(适用于模糊查询后的排序)

    因公司业务需要,自己写了一个,保存起来以后可能还会用到.如果还有更好的方法或者算法,希望大家提出来. 1.简单的相似度算法(自己想到的)      因为List中每个String都会包含一个标准的字符 ...

  10. JAVA_Collection容器

    因为项目的需要,今天抽时间把JAVA中的容器复习了一下,为了以后的不时之需,现在把它记下来. 容器有其名,知其意,用来盛放数据的集合,JAVA中为我们提供了三种容器类:set.list.map,三种容 ...