2

Firebird 2.5、Python 2.7、および FDB 1.4 で監査およびトレース サービスを使用しようとしています。

これは私がアイドルでやっていることです:

>>> import fdb
>>> svc = fdb.services.connect(password='masterkey', host='localhost')
>>> trace_config = """<database>
enabled true
log_connections true
log_transactions true
log_statement_finish true
time_threshold 0

</database>"""
>>> trace_id = svc.trace_start(trace_config, 'test_trace_2')
>>> svc.readline()

この後、データベースに接続して選択などを行っていますが、readlineは返されません。

私はどこかでステップを逃していますか?

4

1 に答える 1

3

出力用に 64kb のバッファがあることが判明しました。FDB の作者 Pavel Cisar から直接出力を取得する方法があります。

while 1:
    try:
       line = svc._QS(fdb.ibase.isc_info_svc_line)
    except fdb.OperationalError:
       # It is routine for actions such as RESTORE to raise an
       # exception at the end of their output.  We ignore any such
       # exception and assume that it was expected, which is somewhat
       # risky.  For example, suppose the network connection is broken
       # while the client is receiving the action&#39;s output...
       break
    if not line: # we reached the end of output
       break
    print line
于 2013-10-27T14:02:18.483 に答える