From: <pj...@us...> - 2009-07-30 03:11:42
|
Revision: 6599 http://jython.svn.sourceforge.net/jython/?rev=6599&view=rev Author: pjenvey Date: 2009-07-30 03:11:24 +0000 (Thu, 30 Jul 2009) Log Message: ----------- handle null array results fixes #1413 Modified Paths: -------------- trunk/jython/src/com/ziclix/python/sql/JDBC20DataHandler.java Modified: trunk/jython/src/com/ziclix/python/sql/JDBC20DataHandler.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/JDBC20DataHandler.java 2009-07-30 03:10:33 UTC (rev 6598) +++ trunk/jython/src/com/ziclix/python/sql/JDBC20DataHandler.java 2009-07-30 03:11:24 UTC (rev 6599) @@ -15,6 +15,7 @@ import java.io.InputStreamReader; import java.io.Reader; import java.math.BigDecimal; +import java.sql.Array; import java.sql.Blob; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -52,8 +53,9 @@ * @throws SQLException */ @SuppressWarnings("fallthrough") - public void setJDBCObject(PreparedStatement stmt, int index, PyObject object, int type) throws SQLException { - + @Override + public void setJDBCObject(PreparedStatement stmt, int index, PyObject object, int type) + throws SQLException { if (DataHandler.checkNull(stmt, index, object, type)) { return; } @@ -97,7 +99,6 @@ if (lob != null) { stmt.setBytes(index, lob); - break; } default : @@ -115,8 +116,8 @@ * @return a Python object * @throws SQLException */ + @Override public PyObject getPyObject(ResultSet set, int col, int type) throws SQLException { - PyObject obj = Py.None; switch (type) { @@ -127,7 +128,6 @@ // in JDBC 2.0, use of a scale is deprecated try { BigDecimal bd = set.getBigDecimal(col); - obj = (bd == null) ? Py.None : Py.newFloat(bd.doubleValue()); } catch (SQLException e) { obj = super.getPyObject(set, col, type); @@ -192,7 +192,8 @@ break; case Types.ARRAY: - obj = Py.java2py(set.getArray(col).getArray()); + Array array = set.getArray(col); + obj = array == null ? Py.None : Py.java2py(array.getArray()); break; default : This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |