Re: New features?

"Walter Dörwald" <[email protected]> Wed, 24 Feb 2016 15:07:47 +0100
Newsgroups gmane.comp.python.db.cx-oracle
Message-ID <[email protected]>
On 24 Feb 2016, at 0:30, Anthony Tuininga wrote:

> On Thu, Jan 28, 2016 at 2:52 AM, Walter Dörwald 
> <[email protected]>
> wrote:
>
>> On 27 Jan 2016, at 17:21, Anthony Tuininga wrote:
>>
>>> All,
>>>
>>> I have recently been able to spend a bit more time on cx_Oracle and
>>> would
>>> like your feedback on what features would be of the greatest benefit
>>> to
>>> you. Besides the ones that are in 5.2.1, the following features have
>>> been
>>> committed:
>>>
>>> Added support for pickling/unpickling error objects
>>> Added support for getting implicit results (Oracle Database 12.1)
>>> Added support for Transaction Guard (Oracle Database 12.1)
>>> Added support for setting max lifetime session of pool (Oracle
>>> Database
>>> 12.1)
>>>
>>> Any and all feedback appreciated.
>>>
>>> Anthony
>>
>> We have many procedures which have a parameter with type INTEGERS, 
>> which
>> is defined as:
>>
>>  create or replace type integers as table of integer;
>>
>> I'd like to by able to such a procedure through cx_Oracle.
>>
>
> This can now be done with the code in the source repository today.
>
> typeObj = connection.gettype("integers")
> obj = typeObj.newobject()
> obj.extend([1, 2, 3, 4])
> cursor = connection.cursor()
> cursor.callproc("someprocedure", (obj,))

It doesn't seem to work for me. I get the following:

$ python
Python 3.5.1 (default, Jan 22 2016, 11:57:23)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.1.76)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>> import cx_Oracle
>> db = cx_Oracle.connect("user/pwd@db")
>> integers = db.gettype("INTEGERS")
>> i = integers.newobject()
>> i.extend([1,2,3,4])
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
cx_Oracle.NotSupportedError: Object_ConvertFromPython(): unhandled data 
type 3
>> ^D

integers is defined as:

    create or replace type INTEGERS as table of integer;

I installed cx_Oracle via

$ hg clone https://bitbucket.org/anthony_tuininga/cx_oracle
$ cd cx_oracle
$ pip install .

BTW, it would be great if the type object could be called (just like a 
Python class) to create an instance, i.e. use:

	i = integers([1, 2, 3, 4])

instead of

     i = integers.newobject()
     i.extend([1,2,3,4])

Servus,
    Walter

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
cx-oracle-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cx-oracle-users