Support for multiple result sets
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的更多相关文章
- [转]Entity Framework Sprocs with Multiple Result Sets
本文转自:https://msdn.microsoft.com/en-us/data/jj691402.aspx Entity Framework Sprocs with Multiple Resul ...
- Stored Procedures with Multiple Result Sets
Stored Procedures with Multiple Result Sets https://msdn.microsoft.com/en-us/data/jj691402.aspx
- 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 ...
- SQL Server ->> WITH RESULT SETS子句
SQL Server 2012对EXECUTE子句引入了WITH RESULT SETS选项,用于对EXECUTE语句执行的存储过程或者动态语句结果进行一个指定数据类型的转换,这样可以避免一种情况就是 ...
- [转]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 ...
- MVC5添加控制器总是报“Multiple object sets per type are not supported”
http://www.asp.net/mvc/tutorials/mvc-5/introduction/creating-a-connection-string 按照上面的指导做练习, 总报小面的错 ...
- Programming Entity Framework 翻译(1)-目录
1. Introducing the ADO.NET Entity Framework ado.net entity framework 介绍 1 The Entity Relationship Mo ...
- 可输出sql的PrepareStatement封装
import java.io.InputStream; import java.io.Reader; import java.net.URL; import java.sql.Connection; ...
- 数据访问的历史 Windows
节选:Programming Microsoft Visual Basic 6.0 1999 The Data Access Saga All the new database-related cap ...
随机推荐
- linux service
有些东西真是难得搞懂,一旦懂了就容易记住了. 说到service 就不能不说 daemon, 他们两者看起来不相关.其实是紧密相连的两个概念. —— 就像两个同心的正五边形和正六边形放在一起时候的样子 ...
- Jsp+ Servlet+Ajax实现点赞功能
1.jsp页面,使用ajax实现局部刷新 2.servlet接受处理去更新数据库 随后上传
- 我心中的核心组件(可插拔的AOP)~第十三回 实现AOP的拦截组件Unity.Interception
回到目录 说在前 本节主要说一下Unity家族里的拦截组件,对于方法拦截有很多组件提供,基本上每个Ioc组件都有对它的实现,如autofac,它主要用在orchard项目里,而castle也有以拦截的 ...
- mysql如果数据不存在,则插入新数据,否则更新的实现方法
mysql如果数据不存在,则插入新数据,否则更新的实现方法 //如果不存在,则插入新数据 $sql = "INSERT INTO {$ecs->table('cat_lang')} ( ...
- 深入理解PHP内核(五)变量及数据类型-变量的结构和类型
原文链接:http://www.orlion.ga/238/ 编程语言的类型可以分为强类型和弱类型两种,PHP是弱类型语言,但是C语言是强类型语言.在官网PHP实现内部,所有变量使用同一种数据结构(z ...
- s2sh框架搭建(基于spring aop)
对于spring aop 是如何管理事务的,请看一下:http://bbs.csdn.net/topics/290021423 1.applicationContext.xml <?xml ve ...
- 《BI那点儿事》Microsoft 神经网络算法
Microsoft神经网络是迄今为止最强大.最复杂的算法.要想知道它有多复杂,请看SQL Server联机丛书对该算法的说明:“这个算法通过建立多层感知神经元网络,建立分类和回归挖掘模型.与Micro ...
- PHP内核的学习--PHP生命周期
一切的开始: SAPI接口 SAPI(Server Application Programming Interface)指的是PHP具体应用的编程接口, 就像PC一样,无论安装哪些操作系统,只要满足了 ...
- Moon River
读书笔记系列链接地址http://www.cnblogs.com/shoufengwei/p/5714661.html. 昨晚无意中听到了一首英文歌曲,虽不知其意,但是瞬间就被优美的旋律 ...
- [转载]PhotoShop性能优化
现在随着Photoshop版本越来越高功能也越来越强大,而往往强大的功能需要电脑有好的配置运行,比如HDR.图像合成或者3D和视频等类似的功能,还有处理比较大尺寸的图像时,如果电脑配置不够强往往非常卡 ...