Skip to content

Commit 052356e

Browse files
committed
Change where debug output
1 parent d1bdad7 commit 052356e

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

firebirdsql/aio/fbcore.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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):

firebirdsql/fbcore.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,7 @@ class Statement(object):
6060
def __init__(self, trans):
6161
DEBUG_OUTPUT("Statement::__init__()")
6262
self.trans = trans
63-
self._allocate_stmt()
64-
self._is_open = False
65-
self.stmt_type = None
6663

67-
def _allocate_stmt(self):
6864
self.trans.connection._op_allocate_statement()
6965
if (self.trans.connection.accept_type & ptype_MASK) == ptype_lazy_send:
7066
self.trans.connection.lazy_response_count += 1
@@ -73,6 +69,9 @@ def _allocate_stmt(self):
7369
(h, oid, buf) = self.trans.connection._op_response()
7470
self.handle = h
7571

72+
self._is_open = False
73+
self.stmt_type = None
74+
7675
def fetch_generator(self):
7776
DEBUG_OUTPUT("Statement::_fetch_generator()", self.handle, self.trans._trans_handle)
7877
connection = self.trans.connection
@@ -195,6 +194,7 @@ def __getattr__(self, attrname):
195194
raise AttributeError
196195

197196
def close(self):
197+
DEBUG_OUTPUT("PreparedStatement::close()")
198198
self.stmt.close()
199199

200200

@@ -255,7 +255,6 @@ def prep(self, query, explain_plan=False):
255255
def _execute(self, query, params):
256256
if params is None:
257257
params = []
258-
DEBUG_OUTPUT("Cursor::execute()", query, params)
259258
self.transaction.check_trans_handle()
260259
stmt = self._get_stmt(query)
261260
cooked_params = self._convert_params(params)
@@ -268,9 +267,6 @@ def _execute(self, query, params):
268267
self.transaction.connection._op_response()
269268
self._fetch_records = None
270269
else:
271-
DEBUG_OUTPUT(
272-
"Cursor::execute() _op_execute()",
273-
stmt.handle, self.transaction.trans_handle)
274270
self.transaction.connection._op_execute(
275271
stmt.handle, self.transaction.trans_handle, cooked_params)
276272
(h, oid, buf) = self.transaction.connection._op_response()
@@ -284,6 +280,7 @@ def _execute(self, query, params):
284280
return self
285281

286282
def execute(self, query, params=None):
283+
DEBUG_OUTPUT("Cursor::execute()", query, params)
287284
try:
288285
return self._execute(query, params)
289286
finally:
@@ -471,6 +468,7 @@ def begin(self):
471468
self._begin()
472469

473470
def savepoint(self, name):
471+
DEBUG_OUTPUT("Transaction::savepoint()", name)
474472
if self._trans_handle is None:
475473
return
476474
self.connection._op_exec_immediate(self._trans_handle, query='SAVEPOINT '+name)
@@ -911,6 +909,7 @@ def commit(self, retaining=False):
911909
self._transaction.commit(retaining=retaining)
912910

913911
def savepoint(self, name):
912+
DEBUG_OUTPUT("Connection::savepoint()", name)
914913
return self._transaction.savepoint(name)
915914

916915
def rollback(self, retaining=False, savepoint=None):

0 commit comments

Comments
 (0)