From: <pj...@us...> - 2009-07-25 21:39:35
|
Revision: 6583 http://jython.svn.sourceforge.net/jython/?rev=6583&view=rev Author: pjenvey Date: 2009-07-25 21:39:13 +0000 (Sat, 25 Jul 2009) Log Message: ----------- read LONGVARCHAR from a character stream Reader since it's destined for unicode. for better TEXT handling on mysql 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-07-25 14:38:23 UTC (rev 6582) +++ trunk/jython/src/com/ziclix/python/sql/DataHandler.java 2009-07-25 21:39:13 UTC (rev 6583) @@ -12,9 +12,7 @@ import org.python.core.PyFile; import org.python.core.PyObject; import org.python.core.PyList; -import org.python.core.util.StringUtil; -import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -239,30 +237,12 @@ case Types.CHAR: case Types.VARCHAR: String string = set.getString(col); - - obj = (string == null) ? Py.None : Py.newUnicode(string); + obj = string == null ? Py.None : Py.newUnicode(string); break; case Types.LONGVARCHAR: - InputStream longvarchar = set.getAsciiStream(col); - - if (longvarchar == null) { - obj = Py.None; - } else { - try { - longvarchar = new BufferedInputStream(longvarchar); - - byte[] bytes = DataHandler.read(longvarchar); - - if (bytes != null) { - obj = Py.newUnicode(StringUtil.fromBytes(bytes)); - } - } finally { - try { - longvarchar.close(); - } catch (Throwable t) {} - } - } + Reader reader = set.getCharacterStream(col); + obj = reader == null ? Py.None : Py.newUnicode(read(reader)); break; case Types.NUMERIC: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |