Merge branch 'Iverian-patch-1'
commit
22ad0a1416
|
|
@ -74,6 +74,8 @@ _java_array_byte = None
|
||||||
|
|
||||||
_handle_sql_exception = None
|
_handle_sql_exception = None
|
||||||
|
|
||||||
|
old_jpype = False
|
||||||
|
|
||||||
def _handle_sql_exception_jython():
|
def _handle_sql_exception_jython():
|
||||||
from java.sql import SQLException
|
from java.sql import SQLException
|
||||||
exc_info = sys.exc_info()
|
exc_info = sys.exc_info()
|
||||||
|
|
@ -173,15 +175,17 @@ def _jdbc_connect_jpype(jclassname, url, driver_args, jars, libs):
|
||||||
# jvm_path = ('/usr/lib/jvm/java-6-openjdk'
|
# jvm_path = ('/usr/lib/jvm/java-6-openjdk'
|
||||||
# '/jre/lib/i386/client/libjvm.so')
|
# '/jre/lib/i386/client/libjvm.so')
|
||||||
jvm_path = jpype.getDefaultJVMPath()
|
jvm_path = jpype.getDefaultJVMPath()
|
||||||
jpype_ver = 0.
|
global old_jpype
|
||||||
if hasattr(jpype, '__version__'):
|
if hasattr(jpype, '__version__'):
|
||||||
try:
|
try:
|
||||||
ver_match = re.match('\d+\.\d+', jpype.__version__)
|
ver_match = re.match('\d+\.\d+', jpype.__version__)
|
||||||
if ver_match:
|
if ver_match:
|
||||||
jpype_ver = float(ver_match.group(0))
|
jpype_ver = float(ver_match.group(0))
|
||||||
|
if jpype_ver < 0.7:
|
||||||
|
old_jpype = True
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
if jpype_ver < 0.7:
|
if old_jpype:
|
||||||
jpype.startJVM(jvm_path, *args)
|
jpype.startJVM(jvm_path, *args)
|
||||||
else:
|
else:
|
||||||
jpype.startJVM(jvm_path, *args, ignoreUnrecognized=True,
|
jpype.startJVM(jvm_path, *args, ignoreUnrecognized=True,
|
||||||
|
|
@ -192,7 +196,11 @@ def _jdbc_connect_jpype(jclassname, url, driver_args, jars, libs):
|
||||||
types = jpype.java.sql.Types
|
types = jpype.java.sql.Types
|
||||||
types_map = {}
|
types_map = {}
|
||||||
for i in types.__javaclass__.getClassFields():
|
for i in types.__javaclass__.getClassFields():
|
||||||
types_map[i.getName()] = i.getStaticAttribute()
|
if old_jpype:
|
||||||
|
const = i.getStaticAttribute()
|
||||||
|
else:
|
||||||
|
const = i.__get__(i)
|
||||||
|
types_map[i.getName()] = const
|
||||||
_init_types(types_map)
|
_init_types(types_map)
|
||||||
global _java_array_byte
|
global _java_array_byte
|
||||||
if _java_array_byte is None:
|
if _java_array_byte is None:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue