[cx-oracle-users] subscribe in cx_oracle
Brought to you by:
atuining
From: Mark B. <mar...@bl...> - 2010-11-11 00:50:24
|
I'm testing the subscribe() for change notification, but I'm having some problems. If I copy the example really closely I get notifications ok, but if I try to put the call to conn.subscribe(...) into a function then it doesn't work, I don't get any errors but changes are not reported. e.g. if I have: --------------- conn = cx_Oracle.connect(user, pass, db, events = True) sql = "select * from <some_table>" def OnChanges(message): print "Message received" sub = conn.subscribe(callback = OnChanges ,operations = cx_Oracle.OPCODE_UPDATE ,rowids = False) sub.registerquery(sql) sleep(60) --------------- it works fine. But if I do this: --------------- conn = cx_Oracle.connect(user, pass, db, events = True) sql = "select * from <some_table>" def OnChanges(message): print "Message received" def subscribe(): sub = conn.subscribe(callback = OnChanges ,operations = cx_Oracle.OPCODE_UPDATE ,rowids = False) sub.registerquery(sql) subscribe() sleep(60) --------------- it doesn't give any errors, but doesn't report any changes. Am I doing something wrong? mark. |