Re: Server Message filter for _servermsg_cb

SĂ©bastien SablĂ© <[email protected]> Thu, 14 Feb 2008 11:58:14 +0100
Newsgroups gmane.comp.python.sybase
Message-ID <[email protected]>
Hi Alexander,

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

regards

--
S=E9bastien Sabl=E9


Alexander Stepochkin a =E9crit :
> 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 :
>=20
> #=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> def _servermsg_cb(ctx, conn, msg):
>     skiperr =3D False
>     hook =3D _output_hooks.get(conn)
>     if hook:
>         skiperr =3D hook(conn, msg)
>     if skiperr: return
>=20
>     mn =3D msg.msgnumber
>     if mn =3D=3D 2601: ## Attempt to insert duplicate key row in
> object with unique index
>         raise IntegrityError(msg)
>     if mn =3D=3D 2812: ## Procedure not found
>         raise StoredProcedureError(msg)
>     if not (mn in (0, 5701, 5703, 5704) or ((mn >=3D 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)
> #=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>=20
> 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.
>=20
> Alexander Stepochkin,
> IT Department,
> Troika Dialog, Moscow, Russia
> +7 495 258-05-00 ext. 1311
>=20
>=20
>=20
> _______________________________________________________
>=20
> The information contained in this message may be privileged and confide=
ntial and protected from disclosure. If you are not the original intended=
 recipient, you are hereby notified that any review, retransmission, diss=
emination, or other use of, or taking of any action in reliance upon, thi=
s information is prohibited. If you have received this communication in e=
rror, please notify the sender immediately by replying to this message an=
d delete it from your computer. Thank you for your cooperation. Troika Di=
alog, Russia.=20
> Please contact our IT Helpdesk at (+7495) 258 0500 Ext. 1111 or via e-m=
ail: [email protected] if you need assistance.
>=20
> _______________________________________________
> Python-sybase mailing list
> [email protected]
> https://www.object-craft.com.au/cgi-bin/mailman/listinfo/python-sybase