Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# postgresql/zxjdbc.py 

2# Copyright (C) 2005-2020 the SQLAlchemy authors and contributors 

3# <see AUTHORS file> 

4# 

5# This module is part of SQLAlchemy and is released under 

6# the MIT License: http://www.opensource.org/licenses/mit-license.php 

7 

8""" 

9.. dialect:: postgresql+zxjdbc 

10 :name: zxJDBC for Jython 

11 :dbapi: zxjdbc 

12 :connectstring: postgresql+zxjdbc://scott:tiger@localhost/db 

13 :driverurl: http://jdbc.postgresql.org/ 

14 

15 

16""" 

17from .base import PGDialect 

18from .base import PGExecutionContext 

19from ...connectors.zxJDBC import ZxJDBCConnector 

20 

21 

22class PGExecutionContext_zxjdbc(PGExecutionContext): 

23 def create_cursor(self): 

24 cursor = self._dbapi_connection.cursor() 

25 cursor.datahandler = self.dialect.DataHandler(cursor.datahandler) 

26 return cursor 

27 

28 

29class PGDialect_zxjdbc(ZxJDBCConnector, PGDialect): 

30 jdbc_db_name = "postgresql" 

31 jdbc_driver_name = "org.postgresql.Driver" 

32 

33 execution_ctx_cls = PGExecutionContext_zxjdbc 

34 

35 supports_native_decimal = True 

36 

37 def __init__(self, *args, **kwargs): 

38 super(PGDialect_zxjdbc, self).__init__(*args, **kwargs) 

39 from com.ziclix.python.sql.handler import PostgresqlDataHandler 

40 

41 self.DataHandler = PostgresqlDataHandler 

42 

43 def _get_server_version_info(self, connection): 

44 parts = connection.connection.dbversion.split(".") 

45 return tuple(int(x) for x in parts) 

46 

47 

48dialect = PGDialect_zxjdbc