Skip to content

Commit 79e219f

Browse files
committed
Fix negative pk. (#2)
1 parent 41fb3cd commit 79e219f

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## 0.1
44

5+
### 0.1.7
6+
7+
- Fix negative pk. (#2)
8+
59
### 0.1.6
610

711
- Bug fix.

asyncmy/protocol.pyx

+5-3
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ cdef class MysqlPacket:
105105
self._position += 4
106106
return result
107107

108-
cpdef int read_uint64(self):
109-
cdef int result = struct.unpack_from("<Q", self._data, self._position)[0]
108+
cpdef unsigned long read_uint64(self):
109+
cdef unsigned long result = struct.unpack_from("<Q", self._data, self._position)[0]
110110
self._position += 8
111111
return result
112112

@@ -265,8 +265,9 @@ cdef class OKPacketWrapper:
265265
"""
266266
cdef:
267267
MysqlPacket packet
268-
public int affected_rows, insert_id, server_status, warning_count, has_next
268+
public int affected_rows, server_status, warning_count, has_next
269269
public bytes message
270+
public unsigned long insert_id
270271

271272
def __init__(self, MysqlPacket from_packet):
272273
if not from_packet.is_ok_packet():
@@ -281,6 +282,7 @@ cdef class OKPacketWrapper:
281282

282283
self.affected_rows = self.packet.read_length_encoded_integer()
283284
self.insert_id = self.packet.read_length_encoded_integer()
285+
284286
self.server_status, self.warning_count = self.read_struct("<HH")
285287
self.message = self.packet.read_all()
286288
self.has_next = self.server_status & SERVER_MORE_RESULTS_EXISTS

asyncmy/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__VERSION__ = "0.1.6"
1+
__VERSION__ = "0.1.7"

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "asyncmy"
3-
version = "0.1.6"
3+
version = "0.1.7"
44
description = "A fast asyncio MySQL driver"
55
authors = ["long2ice <[email protected]>"]
66
license = "Apache-2.0"

tests/test_cursor.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ async def test_dict_cursor(connection):
3131
async def test_insert(connection):
3232
async with connection.cursor(cursor=DictCursor) as cursor:
3333
rows = await cursor.execute(
34-
"""INSERT INTO test.asyncmy(`decimal`, date, datetime, `float`, string, `tinyint`) VALUES (%s,%s,%s,%s,%s,%s)""",
34+
"""INSERT INTO test.asyncmy(id,`decimal`, date, datetime, `float`, string, `tinyint`) VALUES (%s,%s,%s,%s,%s,%s,%s)""",
3535
(
36+
-1,
3637
1,
3738
"2020-08-08",
3839
"2020-08-08 00:00:00",

0 commit comments

Comments
 (0)