Subject [fdb] Fail on insert BIGINT limits values
Author Maximiliano Robaina
Hi,

In fdb, the BIGINT fail on insert with lower limit value.


>>> import fdb
>>>
>>> maxval = 9223372036854775807
>>> minval = -maxval - 1
>>>
>>> conn = fdb.connect(dsn='django-test', user='sysdba', password='masterkey')
>>> cur.execute('INSERT INTO MODEL_FIELDS_BIGINT("VALUE") VALUES (?)', [minval])
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/fdb/fbcore.py", line 2697, in execute
    self._ps._execute(parameters)
  File "/usr/local/lib/python2.7/dist-packages/fdb/fbcore.py", line 2375, in _execute
    self.__Tuple2XSQLDA(self.in_sqlda, parameters)
  File "/usr/local/lib/python2.7/dist-packages/fdb/fbcore.py", line 2217, in __Tuple2XSQLDA
    int_to_bytes(value, sqlvar.sqllen))), buf_pointer)
  File "/usr/local/lib/python2.7/dist-packages/fdb/fbcore.py", line 443, in int_to_bytes
    return struct.pack(fmt, val)
error: integer out of range for 'Q' format code
>>>



The table structure is:

CREATE TABLE MODEL_FIELDS_BIGINT
(
  ID Integer NOT NULL,
  "VALUE" Bigint NOT NULL,
  NULL_VALUE Bigint,
  PRIMARY KEY (ID)
);



 
--
Maxi


b: http://maxirobaina.tumblr.com
t: http://twitter.com/maxirobaina