mirror of https://github.com/apache/openjpa.git
OpenJPA-525: Applied Amy's patch OPENJPA-525-3-branch1.1.x.patch . Also merged revision 79066 at trunk that renamed misnamed test classes.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/branches/1.1.x@807362 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
539660ebaa
commit
dbf69ac79d
|
@ -30,6 +30,7 @@ import java.sql.Ref;
|
|||
import java.sql.SQLException;
|
||||
import java.sql.Time;
|
||||
import java.sql.Timestamp;
|
||||
import java.sql.Types;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
|
@ -666,12 +667,12 @@ public abstract class AbstractResult
|
|||
|
||||
public Object getObject(Object obj, int metaType, Object arg)
|
||||
throws SQLException {
|
||||
return getObjectInternal(translate(obj, null), metaType, arg, null);
|
||||
return getObjectInternal(obj, metaType, arg, null);
|
||||
}
|
||||
|
||||
public Object getObject(Column col, Object arg, Joins joins)
|
||||
throws SQLException {
|
||||
return getObjectInternal(translate(col, joins), col.getJavaType(),
|
||||
return getObjectInternal(col, col.getJavaType(),
|
||||
arg, joins);
|
||||
}
|
||||
|
||||
|
@ -736,15 +737,17 @@ public abstract class AbstractResult
|
|||
|
||||
public String getString(Object obj)
|
||||
throws SQLException {
|
||||
return getStringInternal(translate(obj, null), null);
|
||||
return getStringInternal(translate(obj, null), null,
|
||||
obj instanceof Column && ((Column) obj).getType() == Types.CLOB);
|
||||
}
|
||||
|
||||
public String getString(Column col, Joins joins)
|
||||
throws SQLException {
|
||||
return getStringInternal(translate(col, joins), joins);
|
||||
return getStringInternal(translate(col, joins), joins,
|
||||
col.getType() == Types.CLOB);
|
||||
}
|
||||
|
||||
protected String getStringInternal(Object obj, Joins joins)
|
||||
protected String getStringInternal(Object obj, Joins joins, boolean isClobString)
|
||||
throws SQLException {
|
||||
Object val = checkNull(getObjectInternal(obj, JavaTypes.STRING,
|
||||
null, joins));
|
||||
|
@ -810,7 +813,8 @@ public abstract class AbstractResult
|
|||
|
||||
/**
|
||||
* Translate the user-given id or column. This method is called before
|
||||
* delegating to any <code>get*Internal</code> methods. Return the
|
||||
* delegating to any <code>get*Internal</code> methods with the exception of
|
||||
* <code>getObjectInternal</code>. Return the
|
||||
* original value by default.
|
||||
*/
|
||||
protected Object translate(Object obj, Joins joins)
|
||||
|
|
|
@ -357,6 +357,9 @@ public class ResultSetResult
|
|||
if (metaTypeCode == -1 && obj instanceof Column)
|
||||
metaTypeCode = ((Column) obj).getJavaType();
|
||||
|
||||
boolean isClob = (obj instanceof Column) ? ((Column) obj).getType() == Types.CLOB : false;
|
||||
obj = translate(obj, joins);
|
||||
|
||||
Object val = null;
|
||||
switch (metaTypeCode) {
|
||||
case JavaTypes.BOOLEAN:
|
||||
|
@ -393,7 +396,7 @@ public class ResultSetResult
|
|||
val = new Short(getShortInternal(obj, joins));
|
||||
break;
|
||||
case JavaTypes.STRING:
|
||||
return getStringInternal(obj, joins);
|
||||
return getStringInternal(obj, joins, isClob);
|
||||
case JavaTypes.OBJECT:
|
||||
return _dict
|
||||
.getBlobObject(_rs, ((Number) obj).intValue(), _store);
|
||||
|
@ -462,10 +465,11 @@ public class ResultSetResult
|
|||
return _dict.getShort(_rs, ((Number) obj).intValue());
|
||||
}
|
||||
|
||||
protected String getStringInternal(Object obj, Joins joins)
|
||||
protected String getStringInternal(Object obj, Joins joins, boolean isClobString)
|
||||
throws SQLException {
|
||||
if (obj instanceof Column && ((Column) obj).getType() == Types.CLOB)
|
||||
return _dict.getClobString(_rs, findObject(obj, joins));
|
||||
if (isClobString) {
|
||||
return _dict.getClobString(_rs, ((Number) obj).intValue());
|
||||
}
|
||||
return _dict.getString(_rs, ((Number) obj).intValue());
|
||||
}
|
||||
|
||||
|
@ -489,9 +493,6 @@ public class ResultSetResult
|
|||
throws SQLException {
|
||||
if (obj instanceof Number)
|
||||
return obj;
|
||||
// getStringInternal will take care the translation
|
||||
if (obj instanceof Column && ((Column) obj).getType() == Types.CLOB)
|
||||
return obj;
|
||||
return Numbers.valueOf(findObject(obj, joins));
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import java.io.InputStream;
|
|||
* @since 1.1.0
|
||||
*/
|
||||
|
||||
public class InputStreamLobTest extends AbstractLobTest {
|
||||
public class TestInputStreamLob extends AbstractLobTest {
|
||||
|
||||
protected LobEntity newLobEntity(String s, int id) {
|
||||
InputStreamLobEntity isle = new InputStreamLobEntity();
|
|
@ -30,7 +30,7 @@ import java.io.Reader;
|
|||
* @since 1.1.0
|
||||
*/
|
||||
|
||||
public class ReaderLobTest extends AbstractLobTest {
|
||||
public class TestReaderLob extends AbstractLobTest {
|
||||
|
||||
protected LobEntity newLobEntity(String s, int id) {
|
||||
ReaderLobEntity rle = new ReaderLobEntity();
|
Loading…
Reference in New Issue