@@ -66,11 +66,7 @@ class AsyncStatement(Statement):
6666 def __init__ (self , trans ):
6767 DEBUG_OUTPUT ("AsyncStatement::__init__()" )
6868 self .trans = trans
69- self ._allocate_stmt ()
70- self ._is_open = False
71- self .stmt_type = None
7269
73- def _allocate_stmt (self ):
7470 self .trans .connection ._op_allocate_statement ()
7571 if (self .trans .connection .accept_type & ptype_MASK ) == ptype_lazy_send :
7672 self .trans .connection .lazy_response_count += 1
@@ -79,6 +75,9 @@ def _allocate_stmt(self):
7975 (h , oid , buf ) = self .trans .connection ._op_response ()
8076 self .handle = h
8177
78+ self ._is_open = False
79+ self .stmt_type = None
80+
8281 def fetch_generator (self ):
8382 # TODO: async method ?
8483 return super ().fetch_generator ()
@@ -141,6 +140,7 @@ async def __init__(self, cur, sql, explain_plan=False):
141140 self .sql = sql
142141
143142 async def close (self ):
143+ DEBUG_OUTPUT ("PreparedStatement::close()" )
144144 await self .stmt .close ()
145145
146146
@@ -186,14 +186,13 @@ async def _get_stmt(self, query):
186186 return stmt
187187
188188 async def prep (self , query , explain_plan = False ):
189- DEBUG_OUTPUT ("Cursor ::prep()" )
189+ DEBUG_OUTPUT ("AcyncCursor ::prep()" )
190190 prepared_statement = await AsyncPreparedStatement (self , query , explain_plan = explain_plan )
191191 return prepared_statement
192192
193193 async def _execute (self , query , params ):
194194 if params is None :
195195 params = []
196- DEBUG_OUTPUT ("Cursor::execute()" , query , params )
197196 await self .transaction .check_trans_handle ()
198197 stmt = await self ._get_stmt (query )
199198 cooked_params = self ._convert_params (params )
@@ -222,6 +221,7 @@ async def _execute(self, query, params):
222221 return self
223222
224223 async def execute (self , query , params = None ):
224+ DEBUG_OUTPUT ("AsyncCursor::execute()" , query , params )
225225 try :
226226 return await self ._execute (query , params )
227227 finally :
@@ -230,7 +230,7 @@ async def execute(self, query, params=None):
230230 async def callproc (self , procname , params = None ):
231231 if params is None :
232232 params = []
233- DEBUG_OUTPUT ("Cursor ::callproc()" )
233+ DEBUG_OUTPUT ("AsyncCursor ::callproc()" )
234234 query = 'EXECUTE PROCEDURE ' + procname + ' ' + ',' .join ('?' * len (params ))
235235 await self .execute (query , params )
236236 return self ._callproc_result
@@ -338,7 +338,7 @@ def description(self):
338338
339339 @property
340340 async def rowcount (self ):
341- DEBUG_OUTPUT ("Cursor ::rowcount()" )
341+ DEBUG_OUTPUT ("AsyncCursor ::rowcount()" )
342342 if self .stmt .handle == - 1 :
343343 return - 1
344344
@@ -352,7 +352,7 @@ async def rowcount(self):
352352 else :
353353 # insert count + update count + delete count
354354 count = bytes_to_int (buf [27 :31 ]) + bytes_to_int (buf [6 :10 ]) + bytes_to_int (buf [13 :17 ])
355- DEBUG_OUTPUT ("Cursor ::rowcount()" , self .stmt .stmt_type , count )
355+ DEBUG_OUTPUT ("AsyncCursor ::rowcount()" , self .stmt .stmt_type , count )
356356 return count
357357
358358
@@ -380,6 +380,7 @@ async def begin(self):
380380 await self ._begin ()
381381
382382 async def savepoint (self , name ):
383+ DEBUG_OUTPUT ("AsyncTransaction::savepoint()" , name )
383384 if self ._trans_handle is None :
384385 return
385386 self .connection ._op_exec_immediate (self ._trans_handle , query = 'SAVEPOINT ' + name )
@@ -811,6 +812,7 @@ async def commit(self, retaining=False):
811812 await self ._transaction .commit (retaining = retaining )
812813
813814 async def savepoint (self , name ):
815+ DEBUG_OUTPUT ("AsyncConnection::savepoint()" , name )
814816 return await self ._transaction .savepoint (name )
815817
816818 async def rollback (self , retaining = False , savepoint = None ):
0 commit comments