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. 《鸟哥的linux私房菜》 - linux命令温故而知新

    在公司的某角落里,看到了<鸟哥的linux私房菜>,顿时想看看是什么鬼. 其他时候还要自己去买才有,现在正好,比图书馆方便.看完了,写点啥! 编辑器很重要,一个vim就主要是我的使用方向: ...

  2. Java-set集合

    package exception; import java.util.Map; import java.util.TreeMap; import java.util.HashMap; public ...

  3. hibernate(九) 二级缓存和事务级别详讲

    序言 这算是hibernate的最后一篇文章了,下一系列会讲解Struts2的东西,然后说完Struts2,在到Spring,然后在写一个SSH如何整合的案例.之后就会在去讲SSM,在之后我自己的个人 ...

  4. TSql HierarchyID 数据类型用法

    HierarchyID 数据类型是一种长度可变的系统数据类型.可使用 HierarchyID 表示层次结构中的位置.类型为 HierarchyID 的列不会自动表示树,由应用程序来生成和分配 Hier ...

  5. MFC 字符串类CString 源代码

    原文:http://blog.csdn.net/benny5609/article/details/1926088 CString使用的是引用技术,可以共享数据(这个大家都知道),另外空的CStirn ...

  6. 机器学习&数据挖掘笔记_24(PGM练习八:结构学习)

    前言: 本次实验包含了2部分:贝叶斯模型参数的学习以及贝叶斯模型结构的学习,在前面的博文PGM练习七:CRF中参数的学习 中我们已经知道怎样学习马尔科夫模型(CRF)的参数,那个实验采用的是优化方法, ...

  7. 轻松自动化---selenium-webdriver(python) (三)

     本节重点: 简单对象的定位 -----自动化测试的核心 对象的定位应该是自动化测试的核心,要想操作一个对象,首先应该识别这个对象.一个对象就是一个人一样,他会有各种的特征(属性),如比我们可以通过一 ...

  8. 应用 CSS3 动画实现12种风格的通知提示

    今天我们想分享几个简单的款式的网站通知效果.有很多的方式来呈现消息给用户:从经典的咆哮般的通知到窗口顶部的通知栏.各个网站的通知样式和效果千篇一律,难得出现创意的通知效果.这里是实现一个应用 CSS3 ...

  9. 配置springmvc在其他类中(spring容器外)获取注入bean

    学习https://github.com/thinkgem/jeesite 今天在写JedisUtils的时候要注入JedisPool,而这个属性被设置为static,@Resource和@Autow ...

  10. SQL--视图