FirebirdSQL / python3-driver

Firebird driver for Python that uses new Firebird API
https://www.firebirdsql.org/en/devel-python-driver/
MIT License
27 stars 10 forks source link

Error in _check_integer_range #2

Closed lelikdub closed 3 years ago

lelikdub commented 3 years ago

When i execute query whith params equal null, core.py throw this error in check of types:

File "~\firebird\driver\core.py", line 204, in _check_integer_range if (value < vmin) or (value > vmax): TypeError: '<' not supported between instances of 'NoneType' and 'int'

in _pack_input we have handle NULL but then we check all types anyway

one of solution in core.py after # handle NULL value (https://github.com/FirebirdSQL/python3-driver/blob/91c4483f09d45b58c117eff57240c3f978a5d995/firebird/driver/core.py#L2954) insert:

                # handle NULL value
                in_buffer[in_meta.get_null_offset(i)] = 1 if value is None else 0
                if value is not None:
                    # store parameter value
                    if _is_str_param(value, datatype):
                        # Implicit conversion to string
                        if not isinstance(value, (str, bytes, bytearray)):
                 ...all other code in for