summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql/zxjdbc.py
diff options
context:
space:
mode:
authorPhilip Jenvey <pjenvey@underboss.org>2011-04-23 13:10:53 -0700
committerPhilip Jenvey <pjenvey@underboss.org>2011-04-23 13:10:53 -0700
commit2a2cd333143656a76d3e2207519f2f7694065629 (patch)
treee4c8d4a1dcd0d8500496a9b451c701f09c391406 /lib/sqlalchemy/dialects/postgresql/zxjdbc.py
parent55f87348f38bc05b644905986ee85638281aa3ec (diff)
downloadsqlalchemy-2a2cd333143656a76d3e2207519f2f7694065629.tar.gz
utilize the zxjdbc PostgresqlHandler for better Decimal handling. hopefully
this won't be necessary eventually (refs http://bugs.jython.org/issue1499)
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/zxjdbc.py')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/zxjdbc.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/zxjdbc.py b/lib/sqlalchemy/dialects/postgresql/zxjdbc.py
index a9a38d234..f64b42acb 100644
--- a/lib/sqlalchemy/dialects/postgresql/zxjdbc.py
+++ b/lib/sqlalchemy/dialects/postgresql/zxjdbc.py
@@ -13,12 +13,29 @@ The official Postgresql JDBC driver is at http://jdbc.postgresql.org/.
"""
from sqlalchemy.connectors.zxJDBC import ZxJDBCConnector
-from sqlalchemy.dialects.postgresql.base import PGDialect
+from sqlalchemy.dialects.postgresql.base import PGDialect, PGExecutionContext
+
+class PGExecutionContext_zxjdbc(PGExecutionContext):
+
+ def create_cursor(self):
+ cursor = self._dbapi_connection.cursor()
+ cursor.datahandler = self.dialect.DataHandler(cursor.datahandler)
+ return cursor
+
class PGDialect_zxjdbc(ZxJDBCConnector, PGDialect):
jdbc_db_name = 'postgresql'
jdbc_driver_name = 'org.postgresql.Driver'
+ execution_ctx_cls = PGExecutionContext_zxjdbc
+
+ supports_native_decimal = True
+
+ def __init__(self, *args, **kwargs):
+ super(PGDialect_zxjdbc, self).__init__(*args, **kwargs)
+ from com.ziclix.python.sql.handler import PostgresqlDataHandler
+ self.DataHandler = PostgresqlDataHandler
+
def _get_server_version_info(self, connection):
return tuple(int(x) for x in connection.connection.dbversion.split('.'))