提交 5185d722 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Try to check sizes of CLOBs

上级 8c69a427
......@@ -60,7 +60,7 @@ public class ValueLob extends Value {
}
static InputStream rangeInputStream(InputStream inputStream, long oneBasedOffset, long length, long dataSize) {
if (dataSize >= 0)
if (dataSize > 0)
rangeCheck(oneBasedOffset - 1, length, dataSize);
else
rangeCheckUnknown(oneBasedOffset - 1, length);
......@@ -71,8 +71,11 @@ public class ValueLob extends Value {
}
}
static Reader rangeReader(Reader reader, long oneBasedOffset, long length) {
rangeCheckUnknown(oneBasedOffset, length);
static Reader rangeReader(Reader reader, long oneBasedOffset, long length, long dataSize) {
if (dataSize > 0)
rangeCheck(oneBasedOffset - 1, length, dataSize);
else
rangeCheckUnknown(oneBasedOffset - 1, length);
try {
return new RangeReader(reader, oneBasedOffset - 1, length);
} catch (IOException e) {
......@@ -666,7 +669,7 @@ public class ValueLob extends Value {
@Override
public Reader getReader(long oneBasedOffset, long length) {
return rangeReader(getReader(), oneBasedOffset, length);
return rangeReader(getReader(), oneBasedOffset, length, type == Value.CLOB ? precision : -1);
}
@Override
......
......@@ -376,7 +376,7 @@ public class ValueLobDb extends Value implements Value.ValueClob,
@Override
public Reader getReader(long oneBasedOffset, long length) {
return ValueLob.rangeReader(getReader(), oneBasedOffset, length);
return ValueLob.rangeReader(getReader(), oneBasedOffset, length, type == Value.CLOB ? precision : -1);
}
@Override
......
......@@ -1103,7 +1103,7 @@ public class TestLob extends TestBase {
fail("expected -1 got: " + ch);
}
r.close();
// TODO assertThrows(ErrorCode.INVALID_VALUE_2, clob0).getCharacterStream(10001, 1);
assertThrows(ErrorCode.INVALID_VALUE_2, clob0).getCharacterStream(10001, 1);
assertThrows(ErrorCode.INVALID_VALUE_2, clob0).getCharacterStream(10002, 0);
conn0.close();
}
......
......@@ -1698,7 +1698,7 @@ public class TestResultSet extends TestBase {
Clob clob = rs.getClob(2);
try {
assertEquals("all", readString(clob.getCharacterStream(2, 3)));
// TODO assertThrows(ErrorCode.INVALID_VALUE_2, clob).getCharacterStream(6, 1);
assertThrows(ErrorCode.INVALID_VALUE_2, clob).getCharacterStream(6, 1);
assertThrows(ErrorCode.INVALID_VALUE_2, clob).getCharacterStream(7, 0);
} finally {
clob.free();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论