Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

trace api response without loop

  • Loading branch information...
commit d06cd68962c49eecbd33dd1b6a752d1daa0654cb 1 parent 6271722
Hajime Nakagami authored
Showing with 20 additions and 28 deletions.
  1. +20 −28 firebirdsql/fbcore.py
48 firebirdsql/fbcore.py
View
@@ -1292,13 +1292,11 @@ def trace_start(self, name=None, cfg=None, f=None):
self._op_service_start(spb)
(h, oid, buf) = self._op_response()
self.svc_handle = h
- while True:
- self._op_service_info(bs([0x02]), bs([0x3e]))
- (h, oid, buf) = self._op_response()
- if buf[:4] == bs([0x3e,0x00,0x00,0x01]):
- break
- ln = bytes_to_int(buf[1:2])
- (f if f else sys.stdout).write(self.bytes_to_str(buf[3:3+ln]))
+
+ self._op_service_info(bs([0x02]), bs([0x3e]))
+ (h, oid, buf) = self._op_response()
+ ln = bytes_to_int(buf[1:2])
+ (f if f else sys.stdout).write(self.bytes_to_str(buf[3:3+ln]))
def trace_stop(self, id, f=None):
spb = bs([isc_action_svc_trace_stop])
@@ -1306,13 +1304,11 @@ def trace_stop(self, id, f=None):
self._op_service_start(spb)
(h, oid, buf) = self._op_response()
self.svc_handle = h
- while True:
- self._op_service_info(bs([0x02]), bs([0x3e]))
- (h, oid, buf) = self._op_response()
- if buf[:4] == bs([0x3e,0x00,0x00,0x01]):
- break
- ln = bytes_to_int(buf[1:2])
- (f if f else sys.stdout).write(self.bytes_to_str(buf[3:3+ln]))
+
+ self._op_service_info(bs([0x02]), bs([0x3e]))
+ (h, oid, buf) = self._op_response()
+ ln = bytes_to_int(buf[1:2])
+ (f if f else sys.stdout).write(self.bytes_to_str(buf[3:3+ln]))
def trace_suspend(self, id, f=None):
spb = bs([isc_action_svc_trace_suspned])
@@ -1320,13 +1316,11 @@ def trace_suspend(self, id, f=None):
self._op_service_start(spb)
(h, oid, buf) = self._op_response()
self.svc_handle = h
- while True:
- self._op_service_info(bs([0x02]), bs([0x3e]))
- (h, oid, buf) = self._op_response()
- if buf[:4] == bs([0x3e,0x00,0x00,0x01]):
- break
- ln = bytes_to_int(buf[1:2])
- (f if f else sys.stdout).write(self.bytes_to_str(buf[3:3+ln]))
+
+ self._op_service_info(bs([0x02]), bs([0x3e]))
+ (h, oid, buf) = self._op_response()
+ ln = bytes_to_int(buf[1:2])
+ (f if f else sys.stdout).write(self.bytes_to_str(buf[3:3+ln]))
def trace_resume(self, id, f=None):
spb = bs([isc_action_svc_trace_resume])
@@ -1334,13 +1328,11 @@ def trace_resume(self, id, f=None):
self._op_service_start(spb)
(h, oid, buf) = self._op_response()
self.svc_handle = h
- while True:
- self._op_service_info(bs([0x02]), bs([0x3e]))
- (h, oid, buf) = self._op_response()
- if buf[:4] == bs([0x3e,0x00,0x00,0x01]):
- break
- ln = bytes_to_int(buf[1:2])
- (f if f else sys.stdout).write(self.bytes_to_str(buf[3:3+ln]))
+
+ self._op_service_info(bs([0x02]), bs([0x3e]))
+ (h, oid, buf) = self._op_response()
+ ln = bytes_to_int(buf[1:2])
+ (f if f else sys.stdout).write(self.bytes_to_str(buf[3:3+ln]))
def trace_list(self, f=None):
spb = bs([isc_action_svc_trace_list])
Please sign in to comment.
Something went wrong with that request. Please try again.