We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 6b6cf99 + 2be39f1 commit ce730e9Copy full SHA for ce730e9
CHANGELOG.md
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
4
The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
and this project adheres to [Semantic Versioning](http://semver.org/).
6
7
+## [1.10.2] - Unreleased
8
+
9
+### Fixed
10
11
+- #34 - Pre-1970 dates causes OverflowError
12
13
## [1.10.1] - 2023-12-21
14
15
### Fixed
src/firebird/driver/core.py
@@ -3328,7 +3328,7 @@ def _pack_input(self, meta: iMessageMetadata, buffer: bytes,
3328
in_meta.get_subtype(i), scale)
3329
memmove(buf_addr + offset, value.to_bytes(length, 'little', signed=True), length)
3330
elif datatype == SQLDataType.DATE:
3331
- memmove(buf_addr + offset, _util.encode_date(value).to_bytes(length, 'little'), length)
+ memmove(buf_addr + offset, _util.encode_date(value).to_bytes(length, 'little', signed=True), length)
3332
elif datatype == SQLDataType.TIME:
3333
memmove(buf_addr + offset, _util.encode_time(value).to_bytes(length, 'little'), length)
3334
elif datatype == SQLDataType.TIME_TZ:
tests/test_driver.py
@@ -1475,6 +1475,16 @@ def test_insert_datetime(self):
1475
self.assertListEqual(rows,
1476
[(4, datetime.date(2011, 11, 13), datetime.time(15, 0, 1, 200000),
1477
datetime.datetime(2011, 11, 13, 15, 0, 1, 200000))])
1478
1479
+ # encode date before 1859-11-17 produce a negative number
1480
+ now = datetime.datetime(1859, 11, 16, 15, 0, 1, 200000)
1481
+ cur.execute('insert into T2 (C1,C6,C7,C8) values (?,?,?,?)', [5, now.date(), now.time(), now])
1482
+ self.con.commit()
1483
+ cur.execute('select C1,C6,C7,C8 from T2 where C1 = 5')
1484
+ rows = cur.fetchall()
1485
+ self.assertListEqual(rows,
1486
+ [(5, datetime.date(1859, 11, 16), datetime.time(15, 0, 1, 200000),
1487
+ datetime.datetime(1859, 11, 16, 15, 0, 1, 200000))])
1488
def test_insert_blob(self):
1489
with self.con.cursor() as cur, self.con2.cursor() as cur2:
1490
cur.execute('insert into T2 (C1,C9) values (?,?)', [4, 'This is a BLOB!'])
0 commit comments