> From: "Anthony Tuininga" <ant...@gm...>
> Subject: [cx-oracle-users] Feedback desired on types and binding
>
> The methods cursor.setinputsizes(), cursor.var() and cursor.callfunc()
> accept types to indicate what sort of bind variable is desired. These
> types are generally the types defined by the DB API but I have added a
> number of additional ones to support data types supported by Oracle
> but not covered by the DB API. There are a number of cases where the
> type indicated by Oracle covers multiple Python types. This is seen
> primarily in two places (that I am aware of at the moment). The first
> is the desire to return integers from callfunc() and the second is the
> desire to return unicode strings directly from cx_Oracle (rather than
> have to decode them yourself). A couple of patches have been sent to
> me to do both of these things by adding another set of high-level
> types. The problem with this is that it further confuses the already
> confused type hierarchy. So far all of the types are types from the
> Oracle perspective only and I'd like to keep it that way. So, I have
> an alternative suggestion which I'd like some feedback on: allow
> setinputsizes(), var() and calfunc() to accept Python types and use
> these to tweak the type of Python object that will be returned. In
> other words
>
> cursor.callfunc("SomeFunction", int, (parm1, parm2))
>
> or
>
> cursor.setinputsizes(someparm = int)
>
> or
>
> cursor.var(int)
>
> In all of the above cases a NUMBER bind variable would be created but
> whenever the value of the variable is acquired the type of object
> returned would be an integer. The same thing would occur with unicode.
>
> Does this seem reasonable to you? Any comments appreciated. Thank you.
>
> Anthony Tuininga
+1
|