Re: Implicit Results interface in cx_Oracle

Shai Berger <shai-9mtU2oJkgntWk0Htik3J/[email protected]> Tue, 3 Feb 2015 21:49:27 +0200
Newsgroups gmane.comp.python.db.cx-oracle
Organization Platonix Joint Ventures
Message-ID <[email protected]>
Hi Krishna,

This looks very interesting. Just one comment on the suggested API:

On Tuesday 03 February 2015 13:36:10 Krishna Mohan IV wrote:
> 
> Cursor.getnextimplicitresult()
>
> Fetch cursor for a unique resultset returned by a pl/sql function or
> procedure using dbms_sql.return_result. This function should be used
> when the Cursor. implicitresultcount is greater than 0. This routine
> should be called iteratively to get all the cursors returned by the
> PLSQL procedure.  Fetching of rows for each of these cursor objects can
> be done using fetchall/ fetchmany/ fetchone .
> A Python  none object is returned when no implicit results exist.
> 

I would consider adding, from the get-go, an iterator for such cursors, as the 
primary interface. Something like:

	for imprset in topcur.implicitresults():
		results = imprset.fetchall()
		print results

Note that, according to the docs, the result-sets can be fetched in parallel, 
so something like this should also work:

	result_sets = list(topcur.implicitresults())
	results = zip(*result_sets)

Have fun,
	Shai.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/