]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
o we don't need to escape % in text on zxjdbc
authorPhilip Jenvey <pjenvey@underboss.org>
Mon, 20 Jul 2009 05:02:32 +0000 (05:02 +0000)
committerPhilip Jenvey <pjenvey@underboss.org>
Mon, 20 Jul 2009 05:02:32 +0000 (05:02 +0000)
o don't assume ProgrammingError on zxjdbc, hopefully zxjdbc won't use plain
Error so much one day

lib/sqlalchemy/dialects/postgresql/zxjdbc.py
test/dialect/test_postgresql.py

index bdc42f1e803e8300140f71eca98ddba70db39b04..18f07f3b50af82c3455b9dc8f5e11f7dcf75ad80 100644 (file)
@@ -5,23 +5,28 @@ JDBC Driver
 
 The official Postgresql JDBC driver is at http://jdbc.postgresql.org/.
 
-
 """
-from sqlalchemy.dialects.postgresql.base import PGDialect
+from sqlalchemy.dialects.postgresql.base import PGCompiler, PGDialect
 from sqlalchemy.connectors.zxJDBC import ZxJDBCConnector
 from sqlalchemy.engine import default
 
 class PostgreSQL_jdbcExecutionContext(default.DefaultExecutionContext):
     pass
 
+class PostgreSQL_jdbcCompiler(PGCompiler):
+
+    def post_process_text(self, text):
+        # Don't escape '%' like PGCompiler
+        return text
+
 class PostgreSQL_jdbc(ZxJDBCConnector, PGDialect):
     execution_ctx_cls = PostgreSQL_jdbcExecutionContext
+    statement_compiler = PostgreSQL_jdbcCompiler
 
     jdbc_db_name = 'postgresql'
     jdbc_driver_name = "org.postgresql.Driver"
-    
 
     def _get_server_version_info(self, connection):
         return tuple(int(x) for x in connection.connection.dbversion.split('.'))
         
-dialect = PostgreSQL_jdbc
\ No newline at end of file
+dialect = PostgreSQL_jdbc
index 3d5b61054860e19685ad4bf188353e8b7f84a375..33d3eda20c583cfc45c27c672603f8df7a09ee41 100644 (file)
@@ -698,8 +698,12 @@ class MiscTest(TestBase, AssertsExecutionResults, AssertsCompiledSQL):
             eng.execute("show transaction isolation level").scalar(),
             'serializable')
         eng = create_engine(testing.db.url, isolation_level="FOO")
-        assert_raises(eng.dialect.dbapi.ProgrammingError, eng.execute,
-            "show transaction isolation level")
+
+        if testing.db.driver == 'zxjdbc':
+            exception_cls = eng.dialect.dbapi.Error
+        else:
+            exception_cls = eng.dialect.dbapi.ProgrammingError
+        assert_raises(exception_cls, eng.execute, "show transaction isolation level")
 
 
 class TimezoneTest(TestBase, AssertsExecutionResults):