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()

时间: 2024-08-06 15:59:01

Support for multiple result sets的相关文章

[转]SSIS Execute SQL Task : Mapping Parameters And Result Sets

本文转自:http://www.programmersedge.com/post/2013/03/05/ssis-execute-sql-task-mapping-parameters-and-result-sets.aspx#.U18_6PmSxBk A very common scenario in an ETL process is one in which you need to call out to some configuration tables to figure out so

SQL Server ->> WITH RESULT SETS子句

SQL Server 2012对EXECUTE子句引入了WITH RESULT SETS选项,用于对EXECUTE语句执行的存储过程或者动态语句结果进行一个指定数据类型的转换,这样可以避免一种情况就是需要用临时表存储后再转换成目标表的数据字段类型,或者需要用OPENQUERY去转换. 用法: EXEC spGet_Employees WITH RESULT SETS ( ( NI_Number varchar(15), FirstName varchar(30), Surname varchar

dapper-dot-net/Dapper NET40/SqlMapper.cs

/* License: http://www.apache.org/licenses/LICENSE-2.0 Home page: http://code.google.com/p/dapper-dot-net/ Note: to build on C# 3.0 + .NET 3.5, include the CSHARP30 compiler symbol (and yes, I know the difference between language and runtime versions

.Net轻量级ORM-NPoco的使用方法-摘自NPoco国外官方Wiki

文章引用自NPoco官方Wiki,地址:https://github.com/schotime/NPoco/wiki,因公司网络不稳定,有时无法访问,特将其摘抄. Home Welcome to the NPoco wiki! NPoco is a fork of PetaPoco with a handful of extra features. Getting Started: Your first query 1 public class User 2 { 3 public int Use

FluentData -Micro ORM with a fluent API that makes it simple to query a database 【MYSQL】

官方地址:http://fluentdata.codeplex.com/documentation MYSQL: MySQL through the MySQL Connector .NET driver. 连接字符串:Server=127.0.0.1;Database=testDB;Uid=root;Pwd=jnex;<system.data> <DbProviderFactories> <add name="MySQL Data Provider" i

数据访问的历史 Windows

节选:Programming Microsoft Visual Basic 6.0 1999 The Data Access Saga All the new database-related capacities in Visual Basic 6 are based on Microsoft ActiveX Data Objects (ADO), a technology that lets you access any database or data source, as long as

Dapper完美兼容Oracle,执行存储过程,并返回结果集。

这个问题,困扰了我整整两天. 刚刚用到Dapper的时候,感觉非常牛掰.特别是配合.net 4.0新特性dynamic,让我生成泛型集合,再转json一气呵成. 不过,各种ORM总有让人吐槽的地方... 比如,我之前在SqlServer上写测试,搞封装,没有任何问题.CURD.批量操作.存储过程.事物等. 可是以转到Oracle上,就出问题了[喂~不是说好的支持Oracle的么] 在写Dapper+Oracle单元测试的前期,是没有问题的,也就是说普通的Sql操作是没有任何问题的. 然后,我写到

关于mysql_connect CLIENT_MULTI_RESULTS

自己写了一个mysql存储过程,以为php有用于调用存储过程的内建函数,查了一下发现只能用mysql_query(call pro())这样的方式,我认为从本质上也就相当于在mysql命令行里执行语句了,由于我的存储过程含有输入输出参数,直接调用会报一个mysql_error错误:XXXXcan't return a result set in the given context google了一下这个错误发现有人用以下的代码解决了这个问题: 原文地址:http://www.phpweblog.

[Linux内核]ctrl-z/fg/bg/nohup/setsid/()与&amp;/disown/screen

转自:https://my.oschina.net/alphajay/blog/65058 My Tips: Ctrl -z    ->   suspend fg           ->   foreground bg           ->  background 1. ctrl-z.fg.bg 如果前台执行一个程序很久没执行完,那么可以用 ctrl+z挂起它,系统会做类似如下提示: 1 [1]+ Stopped sleep 100 然后可以用bg把程序调到后台执行: 1 [[em