[python-sybase] Server Message filter for _servermsg_cb

Sébastien Sablé sable at users.sourceforge.net
Thu Feb 14 21:58:14 EST 2008


Hi Alexander,

I don't see a problem in your modification, but could you provide more 
information about the error you get and the context?

regards

--
Sébastien Sablé


Alexander Stepochkin a écrit :
> 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: it_department at troika.ru if you need assistance.
> 
> _______________________________________________
> Python-sybase mailing list
> Python-sybase at www.object-craft.com.au
> https://www.object-craft.com.au/cgi-bin/mailman/listinfo/python-sybase



More information about the Python-sybase mailing list