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 ...
随机推荐
- EF架构~有时使用SQL更方便
回到目录 在进行统计时,尤其是按月进行统计,由于我们采用的时间是一个2015-12-12日这种,所以在linq你无法进行拆分,你拆分了在发到SQL时也会报错,因为SQL那边更新不需要你.net的方法, ...
- Atitit 理解Monad attilax总结
Atitit 理解Monad attilax总结 但函数式编程最大的一个问题是,函数是一个数学抽象,在现实世界中不存在,1 那既然这样就够用了,还要 Monad 干嘛?Monad 的作用在这里就体现出 ...
- Atitit 跨平台异常处理(2)--------异常转换 -----java c# js异常对象结构比较and转换
Atitit 跨平台异常处理(2)--------异常转换 -----java c# js异常对象结构比较and转换 { "@type":"java.lang.Runti ...
- iOS---NSAutoreleasePool自动释放原理及详解
前言:当您向一个对象发送一个autorelease消息时,Cocoa就会将该对象的一个引用放入到最新的自动释放池.它仍然是个正当的对象,因此自动释放池 定义的作用域内的其它对象可以向它发送消息.当程序 ...
- Java连接MongoDB进行增删改查
1.导入必须的包: 详情看项目:http://pan.baidu.com/s/1cvDAOY 2.通过Myeclipse创建WEB项目 3. 3.bean:创建实体类 package com.bean ...
- JS魔法堂:剖析源码理解Promises/A规范
一.前言 Promises/A是由CommonJS组织制定的异步模式编程规范,有不少库已根据该规范及后来经改进的Promises/A+规范提供了实现 如Q, Bluebird, when, rsvp. ...
- LSA,pLSA原理及其代码实现
一. LSA 1. LSA原理 LSA(latent semantic analysis)潜在语义分析,也被称为 LSI(latent semantic index),是 Scott Deerwest ...
- 如何调试PHP程序
一.PHP自带的调试功能 1.修改php.ini )开发环境 需要打开报错输出显示,方便开发者调试. display_errors = On )生产环境 不能直接将错误输出,而是记入日志,以免透露路径 ...
- 使用php来访问操作sql server
使用php来访问操作sql server 在此分成三步走: 第一部:查看配置,下载文件 首先查看自己的php和sql server版本 Php文件输入echo PHP_VERSION 运行脚本就可以 ...
- URL格式
URL由三部分组成:资源类型.存放资源的主机域名.资源文件名. URL的一般语法格式为: (带方括号[]的为可选项): protocol :// hostname[:port] / path / [; ...