From: <fwi...@us...> - 2009-03-30 21:40:09
|
Revision: 6128 http://jython.svn.sourceforge.net/jython/?rev=6128&view=rev Author: fwierzbicki Date: 2009-03-30 21:40:00 +0000 (Mon, 30 Mar 2009) Log Message: ----------- Fix BIGINT trouble for postgresql. Modified Paths: -------------- trunk/jython/src/com/ziclix/python/sql/DataHandler.java Modified: trunk/jython/src/com/ziclix/python/sql/DataHandler.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/DataHandler.java 2009-03-30 19:57:57 UTC (rev 6127) +++ trunk/jython/src/com/ziclix/python/sql/DataHandler.java 2009-03-30 21:40:00 UTC (rev 6128) @@ -22,6 +22,7 @@ import java.io.Reader; import java.io.StringReader; import java.lang.reflect.Constructor; +import java.math.BigInteger; import java.math.BigDecimal; import java.sql.CallableStatement; import java.sql.Date; @@ -122,7 +123,13 @@ public void setJDBCObject(PreparedStatement stmt, int index, PyObject object) throws SQLException { try { - stmt.setObject(index, object.__tojava__(Object.class)); + Object o = object.__tojava__(Object.class); + if (o instanceof BigInteger) { + //XXX: This is in here to specifically fix passing a PyLong into Postgresql. + stmt.setObject(index, o, Types.BIGINT); + } else { + stmt.setObject(index, o); + } } catch (Exception e) { SQLException cause = null, ex = new SQLException("error setting index [" + index + "]"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |