提交 7c2d2c45 authored 作者: Thomas Mueller's avatar Thomas Mueller

LOB files are now stored in sub-directories by default for new databases.

上级 4bab319a
...@@ -732,12 +732,24 @@ public class ValueLob extends Value { ...@@ -732,12 +732,24 @@ public class ValueLob extends Value {
String[] list = FileUtils.listFiles(dir); String[] list = FileUtils.listFiles(dir);
for (int i = 0; i < list.length; i++) { for (int i = 0; i < list.length; i++) {
String name = list[i]; String name = list[i];
if (name.startsWith(prefix + "." + tableId + ".") && name.endsWith(".lob.db")) { if (name.startsWith(prefix + "." + tableId + ".") && name.endsWith(Constants.SUFFIX_LOB_FILE)) {
deleteFile(handler, name); deleteFile(handler, name);
} }
} }
} }
} }
public static boolean existsLobFile(String prefix) throws SQLException {
String dir = FileUtils.getParent(prefix);
String[] list = FileUtils.listFiles(dir);
for (int i = 0; i < list.length; i++) {
String name = list[i];
if (name.startsWith(prefix + ".") && name.endsWith(Constants.SUFFIX_LOB_FILE)) {
return true;
}
}
return false;
}
private static void removeAllForTable(DataHandler handler, String dir, int tableId) throws SQLException { private static void removeAllForTable(DataHandler handler, String dir, int tableId) throws SQLException {
String[] list = FileUtils.listFiles(dir); String[] list = FileUtils.listFiles(dir);
...@@ -746,7 +758,7 @@ public class ValueLob extends Value { ...@@ -746,7 +758,7 @@ public class ValueLob extends Value {
removeAllForTable(handler, list[i], tableId); removeAllForTable(handler, list[i], tableId);
} else { } else {
String name = list[i]; String name = list[i];
if (name.endsWith(".t" + tableId + ".lob.db")) { if (name.endsWith(".t" + tableId + Constants.SUFFIX_LOB_FILE)) {
deleteFile(handler, name); deleteFile(handler, name);
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论