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 ...
随机推荐
- IOS Animation-CAShapeLayer、UIBezierPath与Animation的结合
在阅读本文之前,对CAShapeLayer.UIBezierPath不熟悉的话,可以先阅读文章 贝塞尔曲线与Layer 如果对动画不熟悉的话,先阅读文章 动画基础.深入 Layer是绘图的画板,Bez ...
- 阿里云主机(aliyun-Linux) x64安装Redis详解
转载于:http://www.itxuexiwang.com/a/shujukujishu/redis/2016/0216/97.html?1455870336 如何在Linux上安装Redis呢, ...
- 我心中的核心组件(可插拔的AOP)~第十二回 IoC组件Unity
回到目录 说在前 Ioc组件有很多,之前也介绍过autofac,castle等,今天再来说一下在微软Nlayer DDD架构里使用的unity组件,今天主要说一下依靠注入,如果希望看拦截的用法,可以阅 ...
- NodeJS系列~第三个小例子,NodeJs与Redis实现高并发的队列存储
返回目录 众所周知 redis量个强大的缓存组件,可以部署在win32和linux环境之上,它有五大存储结构,其中有一种为列表list,它可以实现quene和stack的功能,即队列和堆栈的功能. r ...
- 爱上MVC3~MVC+ZTree实现对树的CURD及拖拽操作
回到目录 上一讲中,我们学习了如何使用zTree对一棵大树(大数据量的树型结构的数据表,呵呵,名称有点绕,但说的是事实)进行异步加载,今天这讲,我们来说说,如何去操作这棵大树,无非就是添加子节点,删除 ...
- 正则表达式匹配/data/misc/wifi/wpa_supplicant.conf的WiFi名称与密码
正则表达式匹配/data/misc/wifi/wpa_supplicant.conf的WiFi名称与密码: String regex_name="ssid=\"(.*?)\&quo ...
- Android开发学习之路-Service和Activity的通信
在很多时候,Service都不仅仅需要在后台运行,还需要和Activity进行通信,或者接受Activity的指挥,如何来实现,来看代码. 定义一个服务 // 创建一个服务,然后在onBind()中返 ...
- Android 代码混淆之部分类不混淆的技巧
在编写Android程序之后,我们通常要代码进行混淆编码,这样才能保证市场上我们的应用不会被别人进行反编译,然后破解,所以此时需要在发布正式版本的时候,有一些类事不能混淆的,比如实现了 Seriali ...
- java中IO流相关知识点
(一) 下边使用outputStream字节输出流进行写操作 package zdbIO;import java.io.File;import java.io.FileNotFoundExceptio ...
- 使用SQL Server Audit记录数据库变更
最近工作中有一个需求,就是某一个比较重要的业务表经常被莫名其妙的变更.在SQL Server中这类工作如果不事前捕获记录的话,无法做到.对于捕获变更来说,可以考虑的选择包括Trace,CDC. ...