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. GAMIT 10.50在Ubuntu 12.04系统下的安装

    转载于:http://www.itxuexiwang.com/a/liunxjishu/2016/0225/162.html?1456480908 摘要:GAMIT/GLOBK是一套安装于Unix/L ...

  2. lua的私有性(privacy)

    很多人认为私有性是面向对象语言的应有的一部分.每个对象的状态应该是这个对象自己的事情.在一些面向对象的语言中,比如C++和Java你可以控制对象成员变量或者成员方法是否私有.其他一些语言比如Small ...

  3. 初入职场的建议--摘自GameRes

    又开始一年一度的校招了,最近跑了几个学校演讲,发现很多话用短短的一堂职业规划课讲还远远不够,因为那堂课仅仅可能帮大家多思考怎样找到一份合适的工作,并没有提醒大家怎样在工作中发展自己的职业. 见过这么多 ...

  4. Java六大问题你都懂了吗?

    这些问题对于认真学习java的人都要必知的,当然如果你只是初学者就没必要那么严格了,那如果你认为自己已经超越初学者了,却不很懂这些问题,请将你自己重归初学者行列. 一.到底要怎么样初始化! 本问题讨论 ...

  5. 【管理心得之三十八】如果“Q”不是高富帅,也吸引不了白富美“A”

    场景再现=========================={美剧片段}一位老人在电话亭中,一次又一次地向公用电话投硬币,但是每一次仅是接通后就自动掉线了.老人无奈之下寻求他人拨打报修电话,但苦等了许 ...

  6. 创建Cookie,简单模拟登录,记录登录名,购物车记录先前添加内容,session控制登录

     工作任务:模拟淘宝登录和购物车功能:使用cookie记录登录名,下次登录时能够记得上次的登录名,使用cookie模拟购物车功能,使用session记住登录信息并验证是否登录,防止利用url打开网站, ...

  7. jquery 插件开发

    一.$.extend()  这种方式用来定义一些辅助方法是比较方便的 $.extend({ sayHello:function(name){ console.log('Hello:'+name); } ...

  8. Searching for a valid kernel header path... The path "" is not a valid path to the ***** kernel headers. Would you like to change it? [yes]

    在centos 6.5安装vmtools时候,解压包,mount挂载后,安装pl过程中报 这个问题,半天没有解决,google 后发现这样就行了 I installed the kernel-deve ...

  9. Android ListView 进阶学习

    1.使用ListView展示数据结构为二维数组的数据 当我们遇到数据结构是二维数组的需求的时候,我们会首先想到ListView,但是要想实现二维数组,会想到ListView里面嵌套ListView,但 ...

  10. javascript原型对象prototype

    “我们创建的每一个函数都有一个prototype(原型)属性,这个属性是一个指针,指向一个对象,而这个对象的用途是包含可以由特定类型的所有实例共享的属性和方法.” 引用类型才具有prototype属性 ...