A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/oracle/python-cx_Oracle/issues/257 below:

more confusion about binding NATIVE_INT · Issue #257 · oracle/python-cx_Oracle · GitHub

"question" label here, because as usual I can see why this is happening, it is just another surprise (note I differentiate between "surprise" and "expected" :) )

In SQLAlchemy, we have an outputtypehandler that in one particular case, is essentially this:

def handler(cursor, name, default_type, size, precision, scale):

    if precision and scale == 0:
        return cursor.var(
            cx_Oracle.NATIVE_INT,
            255,
            arraysize=cursor.arraysize,
            outconverter=None,
        )

    else:
        return None

it seems well intentioned enough until one of my users decided to stick 9999999999999999999 into it, producing the error:

cx_Oracle.DatabaseError: ORA-01455: converting column overflows integer datatype

Apparently the max int size for NATIVE_INT is 32 bits, so...maybe if you can confirm that, and what kind of datatype is coming back if I dont do that. What's the purpose of NATIVE_INT exactly, and do I have to worry about this on the input side as well (though this user hasn't tried that yet :) )

I can either not return a var at all, or I can do this:

    return cursor.var(
        int, 255, arraysize=cursor.arraysize, outconverter=None
    )

and both of those seem to work great for everything I'm testing plus these new tests. In #208 it seemed like I had decided to use NATIVE_INT but that was on the input side. On the output side can you confirm I should set "int" on the var and/or not return the var?


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4