[BACK]Return to patch-aa CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / databases / py-sybase / patches

File: [cvs.NetBSD.org] / pkgsrc / databases / py-sybase / patches / patch-aa (download)

Revision 1.2, Tue Oct 5 20:02:10 2004 UTC (15 years, 6 months ago) by tsarna
Branch: MAIN
CVS Tags: pkgsrc-2020Q1-base, pkgsrc-2020Q1, pkgsrc-2019Q4-base, pkgsrc-2019Q4, pkgsrc-2019Q3-base, pkgsrc-2019Q3, pkgsrc-2019Q2-base, pkgsrc-2019Q2, pkgsrc-2019Q1-base, pkgsrc-2019Q1, pkgsrc-2018Q4-base, pkgsrc-2018Q4, pkgsrc-2018Q3-base, pkgsrc-2018Q3, pkgsrc-2018Q2-base, pkgsrc-2018Q2, pkgsrc-2018Q1-base, pkgsrc-2018Q1, pkgsrc-2017Q4-base, pkgsrc-2017Q4, pkgsrc-2017Q3-base, pkgsrc-2017Q3, pkgsrc-2017Q2-base, pkgsrc-2017Q2, pkgsrc-2017Q1-base, pkgsrc-2017Q1, pkgsrc-2016Q4-base, pkgsrc-2016Q4, pkgsrc-2016Q3-base, pkgsrc-2016Q3, pkgsrc-2016Q2-base, pkgsrc-2016Q2, pkgsrc-2016Q1-base, pkgsrc-2016Q1, pkgsrc-2015Q4-base, pkgsrc-2015Q4, pkgsrc-2015Q3-base, pkgsrc-2015Q3, pkgsrc-2015Q2-base, pkgsrc-2015Q2, pkgsrc-2015Q1-base, pkgsrc-2015Q1, pkgsrc-2014Q4-base, pkgsrc-2014Q4, pkgsrc-2014Q3-base, pkgsrc-2014Q3, pkgsrc-2014Q2-base, pkgsrc-2014Q2, pkgsrc-2014Q1-base, pkgsrc-2014Q1, pkgsrc-2013Q4-base, pkgsrc-2013Q4, pkgsrc-2013Q3-base, pkgsrc-2013Q3, pkgsrc-2013Q2-base, pkgsrc-2013Q2, pkgsrc-2013Q1-base, pkgsrc-2013Q1, pkgsrc-2012Q4-base, pkgsrc-2012Q4, pkgsrc-2012Q3-base, pkgsrc-2012Q3, pkgsrc-2012Q2-base, pkgsrc-2012Q2, pkgsrc-2012Q1-base, pkgsrc-2012Q1, pkgsrc-2011Q4-base, pkgsrc-2011Q4, pkgsrc-2011Q3-base, pkgsrc-2011Q3, pkgsrc-2011Q2-base, pkgsrc-2011Q2, pkgsrc-2011Q1-base, pkgsrc-2011Q1, pkgsrc-2010Q4-base, pkgsrc-2010Q4, pkgsrc-2010Q3-base, pkgsrc-2010Q3, pkgsrc-2010Q2-base, pkgsrc-2010Q2, pkgsrc-2010Q1-base, pkgsrc-2010Q1, pkgsrc-2009Q4-base, pkgsrc-2009Q4, pkgsrc-2009Q3-base, pkgsrc-2009Q3, pkgsrc-2009Q2-base, pkgsrc-2009Q2, pkgsrc-2009Q1-base, pkgsrc-2009Q1, pkgsrc-2008Q4-base, pkgsrc-2008Q4, pkgsrc-2008Q3-base, pkgsrc-2008Q3, pkgsrc-2008Q2-base, pkgsrc-2008Q2, pkgsrc-2008Q1-base, pkgsrc-2008Q1, pkgsrc-2007Q4-base, pkgsrc-2007Q4, pkgsrc-2007Q3-base, pkgsrc-2007Q3, pkgsrc-2007Q2-base, pkgsrc-2007Q2, pkgsrc-2007Q1-base, pkgsrc-2007Q1, pkgsrc-2006Q4-base, pkgsrc-2006Q4, pkgsrc-2006Q3-base, pkgsrc-2006Q3, pkgsrc-2006Q2-base, pkgsrc-2006Q2, pkgsrc-2006Q1-base, pkgsrc-2006Q1, pkgsrc-2005Q4-base, pkgsrc-2005Q4, pkgsrc-2005Q3-base, pkgsrc-2005Q3, pkgsrc-2005Q2-base, pkgsrc-2005Q2, pkgsrc-2005Q1-base, pkgsrc-2005Q1, pkgsrc-2004Q4-base, pkgsrc-2004Q4, cwrapper, cube-native-xorg-base, cube-native-xorg, HEAD
Changes since 1.1: +2 -2 lines

Fix error in patch

$NetBSD: patch-aa,v 1.2 2004/10/05 20:02:10 tsarna Exp $

Treat more informational messages as non-fatal, and add an
extension to allow an application to capture them.

--- Sybase.py.orig	2003-04-27 06:54:35.000000000 -0400
+++ Sybase.py	2004-10-05 15:01:02.000000000 -0400
@@ -129,6 +129,8 @@
 def Binary(str):
     return str
 
+_output_hooks = {}
+
 def _fmt_server(msg):
     parts = []
     for label, name in (('Msg', 'msgnumber'),
@@ -157,8 +159,17 @@
     raise DatabaseError(_fmt_client(msg))
 
 def _servermsg_cb(ctx, conn, msg):
-    if msg.msgnumber not in (5701, 5703):
-        raise DatabaseError(_fmt_server(msg))
+    mn = msg.msgnumber
+    if 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)
+        _output_hooks.get(conn, lambda c,m: None)(conn, msg)
+    else:
+        raise DatabaseError(_fmt_server(msg))
 
 def _row_bind(cmd, count = 1):
     '''Bind buffers for count rows of column data.
@@ -838,6 +849,16 @@
         finally:
             self._unlock()
 
+    def set_output_hook(self, hook):
+        if hook is None:
+            if _output_hooks.has_key(self._conn):
+                del _output_hooks[self._conn]
+        else:
+            _output_hooks[self._conn] = hook
+
+    def get_output_hook(self, hook):
+        return _output_hooks.get(self._conn)
+        
     def __del__(self):
         try:
             self.close()