提交 d801bd5c authored 作者: Thomas Mueller's avatar Thomas Mueller

Formatting / Javadocs

上级 99d6c3ee
......@@ -24,7 +24,8 @@ Change Log
<li>A thread deadlock detector (disabled by default) can help
detect and analyze Java level deadlocks.
To enable, set the system property "h2.threadDeadlockDetector" to true.
<li>Performance improvement for metadata queries that join against the COLUMNS metatable
</li>
<li>Performance improvement for metadata queries that join against the COLUMNS metadata table.
</li>
<li>MVStore: power failure could corrupt the store, if writes were re-ordered.
</li>
......
......@@ -1516,16 +1516,22 @@ public class Database implements DataHandler {
return list;
}
/**
* Get the tables with the given name, if any.
*
* @param name the table name
* @return the list
*/
public ArrayList<Table> getTableOrViewByName(String name) {
ArrayList<Table> list = New.arrayList();
for (Schema schema : schemas.values()) {
Table table = schema.getTableOrViewByName(name);
if (table != null) {
list.add(table);
}
}
return list;
}
ArrayList<Table> list = New.arrayList();
for (Schema schema : schemas.values()) {
Table table = schema.getTableOrViewByName(name);
if (table != null) {
list.add(table);
}
}
return list;
}
public ArrayList<Schema> getAllSchemas() {
initMetaTables();
......
......@@ -538,13 +538,18 @@ public class Schema extends DbObjectBase {
}
}
/**
* Get the table with the given name, if any.
*
* @param name the table name
* @return the table or null if not found
*/
public Table getTableOrViewByName(String name) {
synchronized (database) {
return tablesAndViews.get(name);
}
synchronized (database) {
return tablesAndViews.get(name);
}
}
/**
* Remove an object from this schema.
*
......
......@@ -617,13 +617,13 @@ public class MetaTable extends Table {
}
private ArrayList<Table> getTablesByName(Session session, String tableName) {
ArrayList<Table> tables = database.getTableOrViewByName(tableName);
for (Table temp : session.getLocalTempTables()) {
if (temp.getName().equals(tableName)) {
tables.add(temp);
}
}
return tables;
ArrayList<Table> tables = database.getTableOrViewByName(tableName);
for (Table temp : session.getLocalTempTables()) {
if (temp.getName().equals(tableName)) {
tables.add(temp);
}
}
return tables;
}
private boolean checkIndex(Session session, String value, Value indexFrom,
......@@ -738,13 +738,14 @@ public class MetaTable extends Table {
break;
}
case COLUMNS: {
// reduce the number of tables to scan - makes some metadata queries 10x faster
final ArrayList<Table> tablesToList;
// reduce the number of tables to scan - makes some metadata queries
// 10x faster
final ArrayList<Table> tablesToList;
if (indexFrom != null && indexTo != null && indexFrom.equals(indexTo)) {
String tableName = identifier(indexFrom.getString());
tablesToList = getTablesByName(session, tableName);
String tableName = identifier(indexFrom.getString());
tablesToList = getTablesByName(session, tableName);
} else {
tablesToList = getAllTables(session);
tablesToList = getAllTables(session);
}
for (Table table : tablesToList) {
String tableName = identifier(table.getName());
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论