Server Message filter for _servermsg_cb
Alexander Stepochkin <[email protected]> Thu, 7 Feb 2008 19:07:42 +0300
| Newsgroups | gmane.comp.python.sybase |
|---|---|
| Message-ID | <OFFDC1D3DC.3EADA6C5-ONC32573E8.004EF34F-C32573E8.0058AC4E@troika.ru> |
Hello,
I have recently encountered a problem while trying to backup
database.
_servermsg_cb raises error on messages that are not error for
backup.
Maybe I missed something.
I failed to work around this problem without changing
_servermsg_cb :
#====================================================================
def _servermsg_cb(ctx, conn, msg):
skiperr = False
hook = _output_hooks.get(conn)
if hook:
skiperr = hook(conn, msg)
if skiperr: return
mn = msg.msgnumber
if mn == 2601: ## Attempt to insert duplicate key row in
object with unique index
raise IntegrityError(msg)
if mn == 2812: ## Procedure not found
raise StoredProcedureError(msg)
if not (mn in (0, 5701, 5703, 5704) or ((mn >= 6200) and (mn
< 6300))):
# Non-errors:
# 0 PRINT
# 5701 Changed db context
# 5703 Changed language
# 5704 Changed character set (Sybase)
# 6200-6299 SHOWPLAN output (Sybase)
raise DatabaseError(msg)
#====================================================================
Then I specified in hook messages that I consider not errors
returning True.
If I am wrong and there is a simpler way to solve the problem
please help me.
Alexander Stepochkin,
IT Department,
Troika Dialog, Moscow, Russia
+7 495 258-05-00 ext. 1311
_______________________________________________________
The information contained in this message may be privileged and confidential and protected from disclosure. If you are not the original intended recipient, you are hereby notified that any review, retransmission, dissemination, or other use of, or taking of any action in reliance upon, this information is prohibited. If you have received this communication in error, please notify the sender immediately by replying to this message and delete it from your computer. Thank you for your cooperation. Troika Dialog, Russia.
Please contact our IT Helpdesk at (+7495) 258 0500 Ext. 1111 or via e-mail: [email protected] if you need assistance.