summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql/zxjdbc.py
blob: b707d2d9eb92ed4cb57422f3a1a5dcb2650a405f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""Support for the PostgreSQL database via the zxjdbc JDBC connector.

JDBC Driver
-----------

The official Postgresql JDBC driver is at http://jdbc.postgresql.org/.

"""
from sqlalchemy.connectors.zxJDBC import ZxJDBCConnector
from sqlalchemy.dialects.postgresql.base import PGCompiler, PGDialect

class PostgreSQL_jdbcCompiler(PGCompiler):

    def post_process_text(self, text):
        # Don't escape '%' like PGCompiler
        return text


class PostgreSQL_jdbc(ZxJDBCConnector, PGDialect):
    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