Permalink
Browse files

trace api response without loop

  • Loading branch information...
1 parent 6271722 commit d06cd68962c49eecbd33dd1b6a752d1daa0654cb @nakagami committed Apr 9, 2011
Showing with 20 additions and 28 deletions.
  1. +20 −28 firebirdsql/fbcore.py
View
@@ -1292,55 +1292,47 @@ 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])
spb += bs([isc_spb_trc_id]) + int_to_bytes(id, 4)
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])
spb += bs([isc_spb_trc_id]) + int_to_bytes(id, 4)
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])
spb += bs([isc_spb_trc_id]) + int_to_bytes(id, 4)
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])

0 comments on commit d06cd68

Please sign in to comment.