(0006026)
|
kiarash
|
08-30-12 03:23
|
|
Quercus implementation of oci_fetch_array eventually tries to retrieve all values in a string format (refer to JdbcResultResource class). in getColumnString() function, for performance purposes, data is being retrieved using getByte() method and converted to string. this will not work for CLOB values. therefore for CLOB data, getString() method should be used instead of getByte().
in addition, the code to return UnimplementedException for OCI_RETURN_LOB can be removed since the overall implementation should always follow this mode.
following fix can be applied to com.caucho.quercus.lib.db.JdbcResultResource
...
protected Value getColumnString(Env env,
ResultSet rs,
ResultSetMetaData md,
int column)
throws SQLException
{
// php/1464, php/144f, php/144g
// php/144b
// calling getString() will decode using the database encoding, so
// get bytes directly. Also, getBytes is faster for MySQL since
// getString converts from bytes to string.
byte []bytes = rs.getBytes(column);
if (bytes == null)
return NullValue.NULL;
StringValue bb = env.createUnicodeBuilder();
//enhanced for retrieving CLOB Type: CLOB values should be retrieved
//using getString() method for data to be decoded correctly --kk
if (md.getColumnType(column) == Types.CLOB)
bb.append(rs.getString(column));
else
bb.append(bytes);
return bb;
} |
|