提交 20d70c43 authored 作者: Thomas Mueller's avatar Thomas Mueller

New lob storage.

上级 a5e2760e
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
package org.h2.test.unit; package org.h2.test.unit;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.Date; import java.sql.Date;
import java.sql.Time; import java.sql.Time;
import java.sql.Timestamp; import java.sql.Timestamp;
...@@ -309,4 +310,8 @@ public class TestDataPage extends TestBase implements DataHandler { ...@@ -309,4 +310,8 @@ public class TestDataPage extends TestBase implements DataHandler {
return null; return null;
} }
public Connection getLobConnection() {
return null;
}
} }
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
*/ */
package org.h2.test.unit; package org.h2.test.unit;
import java.sql.Connection;
import java.util.Random; import java.util.Random;
import org.h2.store.DataHandler; import org.h2.store.DataHandler;
import org.h2.store.FileStore; import org.h2.store.FileStore;
...@@ -174,4 +175,8 @@ public class TestFile extends TestBase implements DataHandler { ...@@ -174,4 +175,8 @@ public class TestFile extends TestBase implements DataHandler {
return null; return null;
} }
public Connection getLobConnection() {
return null;
}
} }
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
*/ */
package org.h2.test.unit; package org.h2.test.unit;
import java.sql.Connection;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
...@@ -152,4 +153,8 @@ public class TestValueHashMap extends TestBase implements DataHandler { ...@@ -152,4 +153,8 @@ public class TestValueHashMap extends TestBase implements DataHandler {
return null; return null;
} }
public Connection getLobConnection() {
return null;
}
} }
...@@ -9,6 +9,7 @@ package org.h2.test.unit; ...@@ -9,6 +9,7 @@ package org.h2.test.unit;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.StringReader; import java.io.StringReader;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.IdentityHashMap; import java.util.IdentityHashMap;
...@@ -49,6 +50,7 @@ public class TestValueMemory extends TestBase implements DataHandler { ...@@ -49,6 +50,7 @@ public class TestValueMemory extends TestBase implements DataHandler {
private Random random = new Random(1); private Random random = new Random(1);
private SmallLRUCache<String, String[]> lobFileListCache = SmallLRUCache.newInstance(128); private SmallLRUCache<String, String[]> lobFileListCache = SmallLRUCache.newInstance(128);
private LobStorage lobStorage;
/** /**
* Run just this test. * Run just this test.
...@@ -137,12 +139,12 @@ public class TestValueMemory extends TestBase implements DataHandler { ...@@ -137,12 +139,12 @@ public class TestValueMemory extends TestBase implements DataHandler {
case Value.BLOB: { case Value.BLOB: {
int len = (int) Math.abs(random.nextGaussian() * 10); int len = (int) Math.abs(random.nextGaussian() * 10);
byte[] data = randomBytes(len); byte[] data = randomBytes(len);
return LobStorage.createBlob(new ByteArrayInputStream(data), len, this); return getLobStorage().createBlob(new ByteArrayInputStream(data), len);
} }
case Value.CLOB: { case Value.CLOB: {
int len = (int) Math.abs(random.nextGaussian() * 10); int len = (int) Math.abs(random.nextGaussian() * 10);
String s = randomString(len); String s = randomString(len);
return LobStorage.createClob(new StringReader(s), len, this); return getLobStorage().createClob(new StringReader(s), len);
} }
case Value.ARRAY: { case Value.ARRAY: {
int len = random.nextInt(20); int len = random.nextInt(20);
...@@ -227,6 +229,13 @@ public class TestValueMemory extends TestBase implements DataHandler { ...@@ -227,6 +229,13 @@ public class TestValueMemory extends TestBase implements DataHandler {
} }
public LobStorage getLobStorage() { public LobStorage getLobStorage() {
if (lobStorage == null) {
lobStorage = new LobStorage(this);
}
return lobStorage;
}
public Connection getLobConnection() {
return null; return null;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论