@@ -141,9 +141,8 @@ async def execute(self, query: str, *args, timeout: float=None) -> str:
141
141
return await self ._protocol .query (query , timeout )
142
142
143
143
stmt = await self ._get_statement (query , timeout )
144
- protocol = self ._protocol
145
- _ , status , _ = await protocol .bind_execute (stmt , args , '' , 0 ,
146
- True , timeout )
144
+ _ , status , _ = await self ._protocol .bind_execute (stmt , args , '' , 0 ,
145
+ True , timeout )
147
146
return status .decode ()
148
147
149
148
async def _get_statement (self , query , timeout ):
@@ -218,8 +217,8 @@ async def fetch(self, query, *args, timeout=None) -> list:
218
217
:return list: A list of :class:`Record` instances.
219
218
"""
220
219
stmt = await self ._get_statement (query , timeout )
221
- protocol = self ._protocol
222
- data = await protocol . bind_execute ( stmt , args , '' , 0 , False , timeout )
220
+ data = await self ._protocol . bind_execute ( stmt , args , '' , 0 ,
221
+ False , timeout )
223
222
return data
224
223
225
224
async def fetchval (self , query , * args , column = 0 , timeout = None ):
@@ -237,8 +236,8 @@ async def fetchval(self, query, *args, column=0, timeout=None):
237
236
:return: The value of the specified column of the first record.
238
237
"""
239
238
stmt = await self ._get_statement (query , timeout )
240
- protocol = self ._protocol
241
- data = await protocol . bind_execute ( stmt , args , '' , 1 , False , timeout )
239
+ data = await self ._protocol . bind_execute ( stmt , args , '' , 1 ,
240
+ False , timeout )
242
241
if not data :
243
242
return None
244
243
return data [0 ][column ]
@@ -253,8 +252,8 @@ async def fetchrow(self, query, *args, timeout=None):
253
252
:return: The first row as a :class:`Record` instance.
254
253
"""
255
254
stmt = await self ._get_statement (query , timeout )
256
- protocol = self ._protocol
257
- data = await protocol . bind_execute ( stmt , args , '' , 1 , False , timeout )
255
+ data = await self ._protocol . bind_execute ( stmt , args , '' , 1 ,
256
+ False , timeout )
258
257
if not data :
259
258
return None
260
259
return data [0 ]
@@ -335,8 +334,7 @@ async def close(self):
335
334
self ._close_stmts ()
336
335
self ._listeners = {}
337
336
self ._aborted = True
338
- protocol = self ._protocol
339
- await protocol .close ()
337
+ await self ._protocol .close ()
340
338
341
339
def terminate (self ):
342
340
"""Terminate the connection without waiting for pending data."""
@@ -377,9 +375,8 @@ def _maybe_gc_stmt(self, stmt):
377
375
async def _cleanup_stmts (self ):
378
376
to_close = self ._stmts_to_close
379
377
self ._stmts_to_close = set ()
380
- protocol = self ._protocol
381
378
for stmt in to_close :
382
- await protocol .close_statement (stmt , False )
379
+ await self . _protocol .close_statement (stmt , False )
383
380
384
381
def _request_portal_name (self ):
385
382
return self ._get_unique_id ()
0 commit comments