Author: cito
Date: Wed Jan  2 17:51:34 2013
New Revision: 476

Log:
Cannot detect Postgres 9.0 so easily, use compile flag instead.

Modified:
   trunk/module/pgmodule.c
   trunk/module/setup.cfg
   trunk/module/setup.py

Modified: trunk/module/pgmodule.c
==============================================================================
--- trunk/module/pgmodule.c     Wed Jan  2 16:52:44 2013        (r475)
+++ trunk/module/pgmodule.c     Wed Jan  2 17:51:34 2013        (r476)
@@ -3091,7 +3091,7 @@
        return Py_None;
 }
 
-#if PG_VERSION_NUM >= 90000
+#ifdef ESCAPING_FUNCS
 
 /* escape literal */
 static char pg_escape_literal__doc__[] =
@@ -3139,7 +3139,7 @@
        return ret;
 }
 
-#endif
+#endif /* ESCAPING_FUNCS */
 
 /* escape string */
 static char pg_escape_string__doc__[] =
@@ -3316,12 +3316,12 @@
        {"parameter", (PyCFunction) pg_parameter, METH_VARARGS,
                        pg_parameter__doc__},
 
-#if PG_VERSION_NUM >= 90000
+#ifdef ESCAPING_FUNCS
        {"escape_literal", (PyCFunction) pg_escape_literal, METH_VARARGS,
                        pg_escape_literal__doc__},
        {"escape_identifier", (PyCFunction) pg_escape_identifier, METH_VARARGS,
                        pg_escape_identifier__doc__},
-#endif
+#endif /* ESCAPING_FUNCS */
        {"escape_string", (PyCFunction) pg_escape_string, METH_VARARGS,
                        pg_escape_string__doc__},
        {"escape_bytea", (PyCFunction) pg_escape_bytea, METH_VARARGS,

Modified: trunk/module/setup.cfg
==============================================================================
--- trunk/module/setup.cfg      Wed Jan  2 16:52:44 2013        (r475)
+++ trunk/module/setup.cfg      Wed Jan  2 17:51:34 2013        (r476)
@@ -5,3 +5,6 @@
 large_objects = 1
 # enable default variables use
 default_vars = 1
+# enable string escaping functions
+# (PostgreSQL version 9.0 and higher)
+escaping_funcs = 1
\ No newline at end of file

Modified: trunk/module/setup.py
==============================================================================
--- trunk/module/setup.py       Wed Jan  2 16:52:44 2013        (r475)
+++ trunk/module/setup.py       Wed Jan  2 17:51:34 2013        (r476)
@@ -90,7 +90,9 @@
         ('large-objects', None,
             "enable large object support"),
         ('default-vars', None,
-            'enable default variables use')]
+            "enable default variables use"),
+        ('escaping-funcs', None,
+            "enable string escaping functions")]
 
     boolean_options = build_ext.boolean_options + [
         'direct-access', 'large-objects', 'default-vars']
@@ -104,6 +106,7 @@
         self.direct_access = 1
         self.large_objects = 1
         self.default_vars = 1
+        self.escaping_funcs = 1
 
     def finalize_options(self):
         """Set final values for all build_pg options."""
@@ -114,6 +117,8 @@
             define_macros.append(('LARGE_OBJECTS', None))
         if self.default_vars:
             define_macros.append(('DEFAULT_VARS', None))
+        if self.escaping_funcs:
+            define_macros.append(('ESCAPING_FUNCS', None))
         if sys.platform == 'win32':
             bits = platform.architecture()[0]
             if bits == '64bit': # we need to find libpq64
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql

Reply via email to