File tree 4 files changed +21
-5
lines changed
4 files changed +21
-5
lines changed Original file line number Diff line number Diff line change 5
5
### 0.2.3
6
6
7
7
- Fix ` escape_sequence ` . (#20 )
8
+ - Fix ` connection.autocommit ` . (#21 )
9
+ - Fix ` _clear_result ` . (#22 )
8
10
9
11
### 0.2.2
10
12
Original file line number Diff line number Diff line change @@ -636,7 +636,7 @@ class Connection:
636
636
await result.read()
637
637
self ._result = result
638
638
self ._affected_rows = result.affected_rows
639
- if result.server_status is not None :
639
+ if result.server_status ! = 0 :
640
640
self .server_status = result.server_status
641
641
642
642
def insert_id (self ):
@@ -704,7 +704,7 @@ class Connection:
704
704
705
705
if self ._ssl_context:
706
706
# capablities, max packet, charset
707
- data = IIB.pack( self ._client_flag, 16777216 , 33 )
707
+ data = IIB.pack(self ._client_flag, 16777216 , 33 )
708
708
data += b' \x00 ' * (32 - len (data))
709
709
710
710
self .write_packet(data)
@@ -1141,7 +1141,7 @@ cdef class MySQLResult:
1141
1141
self .affected_rows = len (rows)
1142
1142
self .rows = tuple (rows)
1143
1143
1144
- def _read_row_from_packet (self , packet ):
1144
+ cpdef _read_row_from_packet(self , packet: MysqlPacket ):
1145
1145
row = []
1146
1146
for encoding, converter in self .converters:
1147
1147
try :
Original file line number Diff line number Diff line change @@ -306,7 +306,7 @@ cdef class Cursor:
306
306
self ._executed = q
307
307
return args
308
308
309
- cpdef fetchone(self ):
309
+ cpdef fetchone(self ):
310
310
""" Fetch the next row."""
311
311
self ._check_executed()
312
312
fut = self ._loop.create_future()
@@ -366,7 +366,7 @@ cdef class Cursor:
366
366
await self ._do_get_result()
367
367
return self .rowcount
368
368
369
- cdef _clear_result(self ):
369
+ cpdef _clear_result(self ):
370
370
self .rownumber = 0
371
371
self ._result = None
372
372
self .rowcount = 0
Original file line number Diff line number Diff line change
1
+ import pytest
2
+
3
+
4
+ @pytest .mark .asyncio
5
+ async def test_autocommit (connection ):
6
+ await connection .autocommit (True )
7
+ cursor = connection .cursor ()
8
+ await cursor .execute ("SELECT @@autocommit;" )
9
+ assert await cursor .fetchone () == (1 ,)
10
+ await cursor .close ()
11
+ await connection .autocommit (False )
12
+ cursor = connection .cursor ()
13
+ await cursor .execute ("SELECT @@autocommit;" )
14
+ assert await cursor .fetchone () == (0 ,)
You can’t perform that action at this time.
0 commit comments